UNPKG

@docusign/iam-sdk

Version:

Developer-friendly & type-safe Typescript SDK specifically catered to leverage *@docusign/iam-sdk* API.

111 lines (102 loc) 3.6 kB
/* * 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 { TriggerInputs, TriggerInputs$inboundSchema, TriggerInputs$Outbound, TriggerInputs$outboundSchema, } from "./triggerinputs.js"; /** * The input information needed to trigger a new instance of a Maestro workflow. * * @remarks * This request body contains the metadata to describe the instance being created, * along with the input data required to trigger the workflow. * * - `instance_name` provides a user-defined name for the workflow instance. * - `trigger_inputs` contains the key-value pairs corresponding to the inputs required by the workflow, as described in the `trigger_input_schema` from the workflow definition. */ export type TriggerWorkflow = { /** * A descriptive name for the specific instance of the workflow being triggered. * * @remarks * This is typically used for identification and tracking purposes. * Example: "User Registration Workflow Instance" */ instanceName: string; /** * Key-value pairs representing the input data required to trigger the workflow. * * @remarks * The keys correspond to the `field_name` values defined in the `trigger_input_schema` of the workflow definition. * The values should match the specified `field_data_type` (e.g., string, number, boolean). * Example: {"name": "John Doe", "email": "johndoe@example.com"} */ triggerInputs: { [k: string]: TriggerInputs }; }; /** @internal */ export const TriggerWorkflow$inboundSchema: z.ZodType< TriggerWorkflow, z.ZodTypeDef, unknown > = z.object({ instance_name: z.string(), trigger_inputs: z.record(TriggerInputs$inboundSchema), }).transform((v) => { return remap$(v, { "instance_name": "instanceName", "trigger_inputs": "triggerInputs", }); }); /** @internal */ export type TriggerWorkflow$Outbound = { instance_name: string; trigger_inputs: { [k: string]: TriggerInputs$Outbound }; }; /** @internal */ export const TriggerWorkflow$outboundSchema: z.ZodType< TriggerWorkflow$Outbound, z.ZodTypeDef, TriggerWorkflow > = z.object({ instanceName: z.string(), triggerInputs: z.record(TriggerInputs$outboundSchema), }).transform((v) => { return remap$(v, { instanceName: "instance_name", triggerInputs: "trigger_inputs", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace TriggerWorkflow$ { /** @deprecated use `TriggerWorkflow$inboundSchema` instead. */ export const inboundSchema = TriggerWorkflow$inboundSchema; /** @deprecated use `TriggerWorkflow$outboundSchema` instead. */ export const outboundSchema = TriggerWorkflow$outboundSchema; /** @deprecated use `TriggerWorkflow$Outbound` instead. */ export type Outbound = TriggerWorkflow$Outbound; } export function triggerWorkflowToJSON( triggerWorkflow: TriggerWorkflow, ): string { return JSON.stringify(TriggerWorkflow$outboundSchema.parse(triggerWorkflow)); } export function triggerWorkflowFromJSON( jsonString: string, ): SafeParseResult<TriggerWorkflow, SDKValidationError> { return safeParse( jsonString, (x) => TriggerWorkflow$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'TriggerWorkflow' from JSON`, ); }