@docusign/iam-sdk
Version:
Developer-friendly & type-safe Typescript SDK specifically catered to leverage *@docusign/iam-sdk* API.
151 lines • 7.04 kB
JavaScript
/*
* 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";
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$inboundSchema = z.object({
clientId: z.string().optional(),
secretKey: z.string().optional(),
});
/** @internal */
export const GetTokenFromRefreshTokenSecurity$outboundSchema = z.object({
clientId: z.string().optional(),
secretKey: z.string().optional(),
});
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export var GetTokenFromRefreshTokenSecurity$;
(function (GetTokenFromRefreshTokenSecurity$) {
/** @deprecated use `GetTokenFromRefreshTokenSecurity$inboundSchema` instead. */
GetTokenFromRefreshTokenSecurity$.inboundSchema = GetTokenFromRefreshTokenSecurity$inboundSchema;
/** @deprecated use `GetTokenFromRefreshTokenSecurity$outboundSchema` instead. */
GetTokenFromRefreshTokenSecurity$.outboundSchema = GetTokenFromRefreshTokenSecurity$outboundSchema;
})(GetTokenFromRefreshTokenSecurity$ || (GetTokenFromRefreshTokenSecurity$ = {}));
export function getTokenFromRefreshTokenSecurityToJSON(getTokenFromRefreshTokenSecurity) {
return JSON.stringify(GetTokenFromRefreshTokenSecurity$outboundSchema.parse(getTokenFromRefreshTokenSecurity));
}
export function getTokenFromRefreshTokenSecurityFromJSON(jsonString) {
return safeParse(jsonString, (x) => GetTokenFromRefreshTokenSecurity$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetTokenFromRefreshTokenSecurity' from JSON`);
}
/** @internal */
export const GetTokenFromRefreshTokenGrantType$inboundSchema = z.nativeEnum(GetTokenFromRefreshTokenGrantType);
/** @internal */
export const GetTokenFromRefreshTokenGrantType$outboundSchema = GetTokenFromRefreshTokenGrantType$inboundSchema;
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export var GetTokenFromRefreshTokenGrantType$;
(function (GetTokenFromRefreshTokenGrantType$) {
/** @deprecated use `GetTokenFromRefreshTokenGrantType$inboundSchema` instead. */
GetTokenFromRefreshTokenGrantType$.inboundSchema = GetTokenFromRefreshTokenGrantType$inboundSchema;
/** @deprecated use `GetTokenFromRefreshTokenGrantType$outboundSchema` instead. */
GetTokenFromRefreshTokenGrantType$.outboundSchema = GetTokenFromRefreshTokenGrantType$outboundSchema;
})(GetTokenFromRefreshTokenGrantType$ || (GetTokenFromRefreshTokenGrantType$ = {}));
/** @internal */
export const AuthorizationCodeGrant$inboundSchema = z.object({
grant_type: GetTokenFromRefreshTokenGrantType$inboundSchema.default("refresh_token"),
refresh_token: z.string(),
client_id: z.string().optional(),
}).transform((v) => {
return remap$(v, {
"grant_type": "grantType",
"refresh_token": "refreshToken",
"client_id": "clientId",
});
});
/** @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",
});
});
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export var AuthorizationCodeGrant$;
(function (AuthorizationCodeGrant$) {
/** @deprecated use `AuthorizationCodeGrant$inboundSchema` instead. */
AuthorizationCodeGrant$.inboundSchema = AuthorizationCodeGrant$inboundSchema;
/** @deprecated use `AuthorizationCodeGrant$outboundSchema` instead. */
AuthorizationCodeGrant$.outboundSchema = AuthorizationCodeGrant$outboundSchema;
})(AuthorizationCodeGrant$ || (AuthorizationCodeGrant$ = {}));
export function authorizationCodeGrantToJSON(authorizationCodeGrant) {
return JSON.stringify(AuthorizationCodeGrant$outboundSchema.parse(authorizationCodeGrant));
}
export function authorizationCodeGrantFromJSON(jsonString) {
return safeParse(jsonString, (x) => AuthorizationCodeGrant$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AuthorizationCodeGrant' from JSON`);
}
/** @internal */
export const GetTokenFromRefreshTokenResponse$inboundSchema = z.object({
access_token: z.string(),
token_type: z.string(),
refresh_token: z.string(),
expires_in: z.number().int(),
}).transform((v) => {
return remap$(v, {
"access_token": "accessToken",
"token_type": "tokenType",
"refresh_token": "refreshToken",
"expires_in": "expiresIn",
});
});
/** @internal */
export const GetTokenFromRefreshTokenResponse$outboundSchema = z.object({
accessToken: z.string(),
tokenType: z.string(),
refreshToken: z.string(),
expiresIn: z.number().int(),
}).transform((v) => {
return remap$(v, {
accessToken: "access_token",
tokenType: "token_type",
refreshToken: "refresh_token",
expiresIn: "expires_in",
});
});
/**
* @internal
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
*/
export var GetTokenFromRefreshTokenResponse$;
(function (GetTokenFromRefreshTokenResponse$) {
/** @deprecated use `GetTokenFromRefreshTokenResponse$inboundSchema` instead. */
GetTokenFromRefreshTokenResponse$.inboundSchema = GetTokenFromRefreshTokenResponse$inboundSchema;
/** @deprecated use `GetTokenFromRefreshTokenResponse$outboundSchema` instead. */
GetTokenFromRefreshTokenResponse$.outboundSchema = GetTokenFromRefreshTokenResponse$outboundSchema;
})(GetTokenFromRefreshTokenResponse$ || (GetTokenFromRefreshTokenResponse$ = {}));
export function getTokenFromRefreshTokenResponseToJSON(getTokenFromRefreshTokenResponse) {
return JSON.stringify(GetTokenFromRefreshTokenResponse$outboundSchema.parse(getTokenFromRefreshTokenResponse));
}
export function getTokenFromRefreshTokenResponseFromJSON(jsonString) {
return safeParse(jsonString, (x) => GetTokenFromRefreshTokenResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetTokenFromRefreshTokenResponse' from JSON`);
}
//# sourceMappingURL=gettokenfromrefreshtoken.js.map