@docusign/iam-sdk
Version:
Developer-friendly & type-safe Typescript SDK specifically catered to leverage *@docusign/iam-sdk* API.
148 lines (139 loc) • 4.96 kB
text/typescript
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
import * as z from "zod";
import { remap as remap$ } from "../../lib/primitives.js";
import { safeParse } from "../../lib/schemas.js";
import { Result as SafeParseResult } from "../../types/fp.js";
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
/**
* Control information and metadata for the response.
*/
export type TriggerWorkflowSuccess = {
instanceId?: string | null | undefined;
/**
* A fully-qualified URL that can be used to access or interact with this
*
* @remarks
* workflow instance while it is running. This URL may provide access to
* additional details, actions, or logs related to the workflow execution.
*/
instanceUrl?: string | undefined;
/**
* The maximum number of items that can be returned in a single page.
*/
pageLimit?: number | null | undefined;
/**
* The continuation token used to retrieve a page in a paginated response.
*/
pageTokenNext?: string | null | undefined;
/**
* Unique identifier for the request, useful for tracking and debugging.
*/
requestId?: string | null | undefined;
/**
* The timestamp indicating when the response was generated.
*/
responseTimestamp?: Date | null | undefined;
/**
* The duration of time, in milliseconds, that the server took to process and respond
*
* @remarks
* to the request. This is measured from the time the server received the request
* until the time the response was sent.
*/
responseDurationMs?: number | null | undefined;
};
/** @internal */
export const TriggerWorkflowSuccess$inboundSchema: z.ZodType<
TriggerWorkflowSuccess,
z.ZodTypeDef,
unknown
> = z.object({
instance_id: z.nullable(
z.string().default("00000000-0000-0000-0000-000000000000"),
),
instance_url: z.string().optional(),
page_limit: z.nullable(z.number().int()).optional(),
page_token_next: z.nullable(z.string()).optional(),
request_id: z.nullable(z.string()).optional(),
response_timestamp: z.nullable(
z.string().datetime({ offset: true }).transform(v => new Date(v)),
).optional(),
response_duration_ms: z.nullable(z.number().int()).optional(),
}).transform((v) => {
return remap$(v, {
"instance_id": "instanceId",
"instance_url": "instanceUrl",
"page_limit": "pageLimit",
"page_token_next": "pageTokenNext",
"request_id": "requestId",
"response_timestamp": "responseTimestamp",
"response_duration_ms": "responseDurationMs",
});
});
/** @internal */
export type TriggerWorkflowSuccess$Outbound = {
instance_id: string | null;
instance_url?: string | undefined;
page_limit?: number | null | undefined;
page_token_next?: string | null | undefined;
request_id?: string | null | undefined;
response_timestamp?: string | null | undefined;
response_duration_ms?: number | null | undefined;
};
/** @internal */
export const TriggerWorkflowSuccess$outboundSchema: z.ZodType<
TriggerWorkflowSuccess$Outbound,
z.ZodTypeDef,
TriggerWorkflowSuccess
> = z.object({
instanceId: z.nullable(
z.string().default("00000000-0000-0000-0000-000000000000"),
),
instanceUrl: z.string().optional(),
pageLimit: z.nullable(z.number().int()).optional(),
pageTokenNext: z.nullable(z.string()).optional(),
requestId: z.nullable(z.string()).optional(),
responseTimestamp: z.nullable(z.date().transform(v => v.toISOString()))
.optional(),
responseDurationMs: z.nullable(z.number().int()).optional(),
}).transform((v) => {
return remap$(v, {
instanceId: "instance_id",
instanceUrl: "instance_url",
pageLimit: "page_limit",
pageTokenNext: "page_token_next",
requestId: "request_id",
responseTimestamp: "response_timestamp",
responseDurationMs: "response_duration_ms",
});
});
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace TriggerWorkflowSuccess$ {
/** @deprecated use `TriggerWorkflowSuccess$inboundSchema` instead. */
export const inboundSchema = TriggerWorkflowSuccess$inboundSchema;
/** @deprecated use `TriggerWorkflowSuccess$outboundSchema` instead. */
export const outboundSchema = TriggerWorkflowSuccess$outboundSchema;
/** @deprecated use `TriggerWorkflowSuccess$Outbound` instead. */
export type Outbound = TriggerWorkflowSuccess$Outbound;
}
export function triggerWorkflowSuccessToJSON(
triggerWorkflowSuccess: TriggerWorkflowSuccess,
): string {
return JSON.stringify(
TriggerWorkflowSuccess$outboundSchema.parse(triggerWorkflowSuccess),
);
}
export function triggerWorkflowSuccessFromJSON(
jsonString: string,
): SafeParseResult<TriggerWorkflowSuccess, SDKValidationError> {
return safeParse(
jsonString,
(x) => TriggerWorkflowSuccess$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'TriggerWorkflowSuccess' from JSON`,
);
}