@docusign/iam-sdk
Version:
Developer-friendly & type-safe Typescript SDK specifically catered to leverage *@docusign/iam-sdk* API.
62 lines (57 loc) • 1.66 kB
text/typescript
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
import * as z from "zod/v3";
import { remap as remap$ } from "../../lib/primitives.js";
import { safeParse } from "../../lib/schemas.js";
import { Result as SafeParseResult } from "../../types/fp.js";
import * as types from "../../types/primitives.js";
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
import {
ResourceMetadata,
ResourceMetadata$inboundSchema,
} from "./resourcemetadata.js";
export type Workflow = {
/**
* A unique ID for this workflow
*/
id: string;
/**
* A user-provided name for this workflow
*/
name?: string | undefined;
/**
* A unique ID for the account associated with the workflow
*/
accountId: string;
/**
* Indicates the readiness and deployment status of a workflow
*/
status?: string | undefined;
metadata?: ResourceMetadata | undefined;
};
/** @internal */
export const Workflow$inboundSchema: z.ZodType<
Workflow,
z.ZodTypeDef,
unknown
> = z.object({
id: types.string().default("00000000-0000-0000-0000-000000000000"),
name: types.optional(types.string()),
account_id: types.string().default("00000000-0000-0000-0000-000000000000"),
status: types.optional(types.string()),
metadata: types.optional(ResourceMetadata$inboundSchema),
}).transform((v) => {
return remap$(v, {
"account_id": "accountId",
});
});
export function workflowFromJSON(
jsonString: string,
): SafeParseResult<Workflow, SDKValidationError> {
return safeParse(
jsonString,
(x) => Workflow$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'Workflow' from JSON`,
);
}