UNPKG

@docusign/iam-sdk

Version:

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

66 lines 2.57 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 * as types from "../../types/primitives.js"; export const GetTokenFromRefreshTokenServerList = [ /** * For the developer environment, the URI is https://account-d.docusign.com/oauth/token */ "https://account-d.docusign.com", /** * For the production environment, the URI is https://account.docusign.com/oauth/token */ "https://account.docusign.com", ]; /** * The grant type. This value must be set to "refresh_token". */ export const GetTokenFromRefreshTokenGrantType = { RefreshToken: "refresh_token", }; /** @internal */ export const GetTokenFromRefreshTokenSecurity$outboundSchema = z.object({ clientId: z.string().optional(), secretKey: z.string().optional(), }); export function getTokenFromRefreshTokenSecurityToJSON(getTokenFromRefreshTokenSecurity) { return JSON.stringify(GetTokenFromRefreshTokenSecurity$outboundSchema.parse(getTokenFromRefreshTokenSecurity)); } /** @internal */ export const GetTokenFromRefreshTokenGrantType$outboundSchema = z.nativeEnum(GetTokenFromRefreshTokenGrantType); /** @internal */ export const AuthorizationCodeGrant$outboundSchema = z.object({ grantType: GetTokenFromRefreshTokenGrantType$outboundSchema.default("refresh_token"), refreshToken: z.string(), clientId: z.string().optional(), }).transform((v) => { return remap$(v, { grantType: "grant_type", refreshToken: "refresh_token", clientId: "client_id", }); }); export function authorizationCodeGrantToJSON(authorizationCodeGrant) { return JSON.stringify(AuthorizationCodeGrant$outboundSchema.parse(authorizationCodeGrant)); } /** @internal */ export const GetTokenFromRefreshTokenResponse$inboundSchema = 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 getTokenFromRefreshTokenResponseFromJSON(jsonString) { return safeParse(jsonString, (x) => GetTokenFromRefreshTokenResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetTokenFromRefreshTokenResponse' from JSON`); } //# sourceMappingURL=gettokenfromrefreshtoken.js.map