UNPKG

@docusign/iam-sdk

Version:

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

59 lines (54 loc) 1.68 kB
/* * 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"; export type AuthorizationCodeGrantResponse = { /** * The value of the access token. This value will be added to the Authorization header of all Docusign API calls. */ accessToken: string; /** * The type of token. For access tokens, the value of this will be Bearer. */ tokenType: string; /** * The refresh token. */ refreshToken: string; /** * The number of seconds until the access token expires. */ expiresIn: number; }; /** @internal */ export const AuthorizationCodeGrantResponse$inboundSchema: z.ZodType< AuthorizationCodeGrantResponse, z.ZodTypeDef, unknown > = z.object({ access_token: types.string(), token_type: types.string(), refresh_token: types.string(), expires_in: types.number(), }).transform((v) => { return remap$(v, { "access_token": "accessToken", "token_type": "tokenType", "refresh_token": "refreshToken", "expires_in": "expiresIn", }); }); export function authorizationCodeGrantResponseFromJSON( jsonString: string, ): SafeParseResult<AuthorizationCodeGrantResponse, SDKValidationError> { return safeParse( jsonString, (x) => AuthorizationCodeGrantResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AuthorizationCodeGrantResponse' from JSON`, ); }