@docusign/iam-sdk
Version:
Developer-friendly & type-safe Typescript SDK specifically catered to leverage *@docusign/iam-sdk* API.
104 lines (95 loc) • 2.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";
import {
ResourceMetadata,
ResourceMetadata$inboundSchema,
ResourceMetadata$Outbound,
ResourceMetadata$outboundSchema,
} from "./resourcemetadata.js";
export type Workflow = {
id?: string | null | undefined;
/**
* A user-provided name for this workflow
*/
name?: string | undefined;
accountId?: string | null | undefined;
/**
* 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: z.nullable(z.string().default("00000000-0000-0000-0000-000000000000")),
name: z.string().optional(),
account_id: z.nullable(
z.string().default("00000000-0000-0000-0000-000000000000"),
),
status: z.string().optional(),
metadata: ResourceMetadata$inboundSchema.optional(),
}).transform((v) => {
return remap$(v, {
"account_id": "accountId",
});
});
/** @internal */
export type Workflow$Outbound = {
id: string | null;
name?: string | undefined;
account_id: string | null;
status?: string | undefined;
metadata?: ResourceMetadata$Outbound | undefined;
};
/** @internal */
export const Workflow$outboundSchema: z.ZodType<
Workflow$Outbound,
z.ZodTypeDef,
Workflow
> = z.object({
id: z.nullable(z.string().default("00000000-0000-0000-0000-000000000000")),
name: z.string().optional(),
accountId: z.nullable(
z.string().default("00000000-0000-0000-0000-000000000000"),
),
status: z.string().optional(),
metadata: ResourceMetadata$outboundSchema.optional(),
}).transform((v) => {
return remap$(v, {
accountId: "account_id",
});
});
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export namespace Workflow$ {
/** @deprecated use `Workflow$inboundSchema` instead. */
export const inboundSchema = Workflow$inboundSchema;
/** @deprecated use `Workflow$outboundSchema` instead. */
export const outboundSchema = Workflow$outboundSchema;
/** @deprecated use `Workflow$Outbound` instead. */
export type Outbound = Workflow$Outbound;
}
export function workflowToJSON(workflow: Workflow): string {
return JSON.stringify(Workflow$outboundSchema.parse(workflow));
}
export function workflowFromJSON(
jsonString: string,
): SafeParseResult<Workflow, SDKValidationError> {
return safeParse(
jsonString,
(x) => Workflow$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'Workflow' from JSON`,
);
}