@docusign/iam-sdk
Version:
Developer-friendly & type-safe Typescript SDK specifically catered to leverage *@docusign/iam-sdk* API.
53 lines (48 loc) • 1.45 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";
export type JWTGrantResponse = {
/**
* 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 number of seconds until the access token expires.
*/
expiresIn: number;
};
/** @internal */
export const JWTGrantResponse$inboundSchema: z.ZodType<
JWTGrantResponse,
z.ZodTypeDef,
unknown
> = z.object({
access_token: types.string(),
token_type: types.string(),
expires_in: types.number(),
}).transform((v) => {
return remap$(v, {
"access_token": "accessToken",
"token_type": "tokenType",
"expires_in": "expiresIn",
});
});
export function jwtGrantResponseFromJSON(
jsonString: string,
): SafeParseResult<JWTGrantResponse, SDKValidationError> {
return safeParse(
jsonString,
(x) => JWTGrantResponse$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'JWTGrantResponse' from JSON`,
);
}