@docusign/iam-sdk
Version:
Developer-friendly & type-safe Typescript SDK specifically catered to leverage *@docusign/iam-sdk* API.
67 lines (61 loc) • 1.76 kB
text/typescript
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
import * as z from "zod/v3";
import { safeParse } from "../../lib/schemas.js";
import { Result as SafeParseResult } from "../../types/fp.js";
import * as types from "../../types/primitives.js";
import { smartUnion } from "../../types/smartUnion.js";
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
/**
* A key-value pair where the key is the `field_name` defined in the `trigger_input_schema` of the workflow definition,
*
* @remarks
* and the value is the actual input data. Supported types include string, number, boolean, object, or array.
*/
export type TriggerInputs =
| string
| number
| boolean
| { [k: string]: any }
| Array<any>;
/** @internal */
export const TriggerInputs$inboundSchema: z.ZodType<
TriggerInputs,
z.ZodTypeDef,
unknown
> = smartUnion([
types.string(),
types.number(),
types.boolean(),
z.record(z.any()),
z.array(z.any()),
]);
/** @internal */
export type TriggerInputs$Outbound = string | number | boolean | {
[k: string]: any;
} | Array<any>;
/** @internal */
export const TriggerInputs$outboundSchema: z.ZodType<
TriggerInputs$Outbound,
z.ZodTypeDef,
TriggerInputs
> = smartUnion([
z.string(),
z.number(),
z.boolean(),
z.record(z.any()),
z.array(z.any()),
]);
export function triggerInputsToJSON(triggerInputs: TriggerInputs): string {
return JSON.stringify(TriggerInputs$outboundSchema.parse(triggerInputs));
}
export function triggerInputsFromJSON(
jsonString: string,
): SafeParseResult<TriggerInputs, SDKValidationError> {
return safeParse(
jsonString,
(x) => TriggerInputs$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'TriggerInputs' from JSON`,
);
}