@docusign/iam-sdk
Version:
Developer-friendly & type-safe Typescript SDK specifically catered to leverage *@docusign/iam-sdk* API.
143 lines (129 loc) • 4.03 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 {
BulkJobConstraints,
BulkJobConstraints$inboundSchema,
} from "./bulkjobconstraints.js";
/**
* Key value pairs of variable names and descriptions, explaining how they are to be used
*/
export type TemplateVariables = {};
/**
* Key value pairs of header names and example values
*/
export type Headers = {};
/**
* Key value pairs of error response codes and explanations of those codes
*/
export type ErrorStatusCodes = {};
export type BulkJobActionTemplate = {
/**
* HTTP method used for this template
*/
method?: string | undefined;
/**
* Whether this action is required
*/
required?: boolean | undefined;
description?: string | undefined;
/**
* Key value pairs of variable names and descriptions, explaining how they are to be used
*/
templateVariables?: TemplateVariables | undefined;
/**
* Key value pairs of header names and example values
*/
headers?: Headers | undefined;
/**
* Describes the limits of a bulk job, or an action associated with a bulk job
*/
constraints?: BulkJobConstraints | undefined;
successStatusCode?: number | undefined;
/**
* Key value pairs of error response codes and explanations of those codes
*/
errorStatusCodes?: ErrorStatusCodes | undefined;
};
/** @internal */
export const TemplateVariables$inboundSchema: z.ZodType<
TemplateVariables,
z.ZodTypeDef,
unknown
> = z.object({});
export function templateVariablesFromJSON(
jsonString: string,
): SafeParseResult<TemplateVariables, SDKValidationError> {
return safeParse(
jsonString,
(x) => TemplateVariables$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'TemplateVariables' from JSON`,
);
}
/** @internal */
export const Headers$inboundSchema: z.ZodType<Headers, z.ZodTypeDef, unknown> =
z.object({});
export function headersFromJSON(
jsonString: string,
): SafeParseResult<Headers, SDKValidationError> {
return safeParse(
jsonString,
(x) => Headers$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'Headers' from JSON`,
);
}
/** @internal */
export const ErrorStatusCodes$inboundSchema: z.ZodType<
ErrorStatusCodes,
z.ZodTypeDef,
unknown
> = z.object({});
export function errorStatusCodesFromJSON(
jsonString: string,
): SafeParseResult<ErrorStatusCodes, SDKValidationError> {
return safeParse(
jsonString,
(x) => ErrorStatusCodes$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'ErrorStatusCodes' from JSON`,
);
}
/** @internal */
export const BulkJobActionTemplate$inboundSchema: z.ZodType<
BulkJobActionTemplate,
z.ZodTypeDef,
unknown
> = z.object({
method: types.optional(types.string()),
required: types.optional(types.boolean()),
description: types.optional(types.string()),
template_variables: types.optional(
z.lazy(() => TemplateVariables$inboundSchema),
),
headers: types.optional(z.lazy(() => Headers$inboundSchema)),
constraints: types.optional(BulkJobConstraints$inboundSchema),
success_status_code: types.optional(types.number()),
error_status_codes: types.optional(
z.lazy(() => ErrorStatusCodes$inboundSchema),
),
}).transform((v) => {
return remap$(v, {
"template_variables": "templateVariables",
"success_status_code": "successStatusCode",
"error_status_codes": "errorStatusCodes",
});
});
export function bulkJobActionTemplateFromJSON(
jsonString: string,
): SafeParseResult<BulkJobActionTemplate, SDKValidationError> {
return safeParse(
jsonString,
(x) => BulkJobActionTemplate$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'BulkJobActionTemplate' from JSON`,
);
}