UNPKG

@docusign/iam-sdk

Version:

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

162 lines (145 loc) 5.45 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 { ClosedEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export const Flow = { Confidential: "confidential", } as const; export type Flow = ClosedEnum<typeof Flow>; /** * The grant type. This value must be set to "authorization_code". */ export const ConfidentialAuthCodeGrantRequestBodyGrantType = { AuthorizationCode: "authorization_code", } as const; /** * The grant type. This value must be set to "authorization_code". */ export type ConfidentialAuthCodeGrantRequestBodyGrantType = ClosedEnum< typeof ConfidentialAuthCodeGrantRequestBodyGrantType >; /** * The request body for the confidential authorization code grant type. */ export type ConfidentialAuthCodeGrantRequestBody = { flow?: "confidential" | undefined; /** * The grant type. This value must be set to "authorization_code". */ grantType?: ConfidentialAuthCodeGrantRequestBodyGrantType | undefined; /** * The authorization code supplied to the callback. */ code: string; }; /** @internal */ export const Flow$inboundSchema: z.ZodNativeEnum<typeof Flow> = z.nativeEnum( Flow, ); /** @internal */ export const Flow$outboundSchema: z.ZodNativeEnum<typeof Flow> = Flow$inboundSchema; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace Flow$ { /** @deprecated use `Flow$inboundSchema` instead. */ export const inboundSchema = Flow$inboundSchema; /** @deprecated use `Flow$outboundSchema` instead. */ export const outboundSchema = Flow$outboundSchema; } /** @internal */ export const ConfidentialAuthCodeGrantRequestBodyGrantType$inboundSchema: z.ZodNativeEnum<typeof ConfidentialAuthCodeGrantRequestBodyGrantType> = z .nativeEnum(ConfidentialAuthCodeGrantRequestBodyGrantType); /** @internal */ export const ConfidentialAuthCodeGrantRequestBodyGrantType$outboundSchema: z.ZodNativeEnum<typeof ConfidentialAuthCodeGrantRequestBodyGrantType> = ConfidentialAuthCodeGrantRequestBodyGrantType$inboundSchema; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace ConfidentialAuthCodeGrantRequestBodyGrantType$ { /** @deprecated use `ConfidentialAuthCodeGrantRequestBodyGrantType$inboundSchema` instead. */ export const inboundSchema = ConfidentialAuthCodeGrantRequestBodyGrantType$inboundSchema; /** @deprecated use `ConfidentialAuthCodeGrantRequestBodyGrantType$outboundSchema` instead. */ export const outboundSchema = ConfidentialAuthCodeGrantRequestBodyGrantType$outboundSchema; } /** @internal */ export const ConfidentialAuthCodeGrantRequestBody$inboundSchema: z.ZodType< ConfidentialAuthCodeGrantRequestBody, z.ZodTypeDef, unknown > = z.object({ flow: z.literal("confidential").optional(), grant_type: ConfidentialAuthCodeGrantRequestBodyGrantType$inboundSchema .default("authorization_code"), code: z.string(), }).transform((v) => { return remap$(v, { "grant_type": "grantType", }); }); /** @internal */ export type ConfidentialAuthCodeGrantRequestBody$Outbound = { flow: "confidential"; grant_type: string; code: string; }; /** @internal */ export const ConfidentialAuthCodeGrantRequestBody$outboundSchema: z.ZodType< ConfidentialAuthCodeGrantRequestBody$Outbound, z.ZodTypeDef, ConfidentialAuthCodeGrantRequestBody > = z.object({ flow: z.literal("confidential").default("confidential"), grantType: ConfidentialAuthCodeGrantRequestBodyGrantType$outboundSchema .default("authorization_code"), code: z.string(), }).transform((v) => { return remap$(v, { grantType: "grant_type", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace ConfidentialAuthCodeGrantRequestBody$ { /** @deprecated use `ConfidentialAuthCodeGrantRequestBody$inboundSchema` instead. */ export const inboundSchema = ConfidentialAuthCodeGrantRequestBody$inboundSchema; /** @deprecated use `ConfidentialAuthCodeGrantRequestBody$outboundSchema` instead. */ export const outboundSchema = ConfidentialAuthCodeGrantRequestBody$outboundSchema; /** @deprecated use `ConfidentialAuthCodeGrantRequestBody$Outbound` instead. */ export type Outbound = ConfidentialAuthCodeGrantRequestBody$Outbound; } export function confidentialAuthCodeGrantRequestBodyToJSON( confidentialAuthCodeGrantRequestBody: ConfidentialAuthCodeGrantRequestBody, ): string { return JSON.stringify( ConfidentialAuthCodeGrantRequestBody$outboundSchema.parse( confidentialAuthCodeGrantRequestBody, ), ); } export function confidentialAuthCodeGrantRequestBodyFromJSON( jsonString: string, ): SafeParseResult<ConfidentialAuthCodeGrantRequestBody, SDKValidationError> { return safeParse( jsonString, (x) => ConfidentialAuthCodeGrantRequestBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ConfidentialAuthCodeGrantRequestBody' from JSON`, ); }