/* * 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 { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type V3TokenResponse = { /** * The access token used to authenticate API calls. */ accessToken: string; /** * The lifetime of the token in seconds. */ expiresIn: number; /** * The lifetime of the refresh token in seconds. Not currently supported. */ refreshExpiresIn?: number | undefined; /** * The token used to refresh the expiration time. Not currently supported. */ refreshToken?: string | undefined; /** * The type of token. */ tokenType: string; }; /** @internal */ export const V3TokenResponse$inboundSchema: z.ZodType< V3TokenResponse, z.ZodTypeDef, unknown > = z.object({ access_token: z.string(), expires_in: z.number().int(), refresh_expires_in: z.number().int().optional(), refresh_token: z.string().optional(), token_type: z.string(), }).transform((v) => { return remap$(v, { "access_token": "accessToken", "expires_in": "expiresIn", "refresh_expires_in": "refreshExpiresIn", "refresh_token": "refreshToken", "token_type": "tokenType", }); }); /** @internal */ export type V3TokenResponse$Outbound = { access_token: string; expires_in: number; refresh_expires_in?: number | undefined; refresh_token?: string | undefined; token_type: string; }; /** @internal */ export const V3TokenResponse$outboundSchema: z.ZodType< V3TokenResponse$Outbound, z.ZodTypeDef, V3TokenResponse > = z.object({ accessToken: z.string(), expiresIn: z.number().int(), refreshExpiresIn: z.number().int().optional(), refreshToken: z.string().optional(), tokenType: z.string(), }).transform((v) => { return remap$(v, { accessToken: "access_token", expiresIn: "expires_in", refreshExpiresIn: "refresh_expires_in", refreshToken: "refresh_token", tokenType: "token_type", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace V3TokenResponse$ { /** @deprecated use `V3TokenResponse$inboundSchema` instead. */ export const inboundSchema = V3TokenResponse$inboundSchema; /** @deprecated use `V3TokenResponse$outboundSchema` instead. */ export const outboundSchema = V3TokenResponse$outboundSchema; /** @deprecated use `V3TokenResponse$Outbound` instead. */ export type Outbound = V3TokenResponse$Outbound; } export function v3TokenResponseToJSON( v3TokenResponse: V3TokenResponse, ): string { return JSON.stringify(V3TokenResponse$outboundSchema.parse(v3TokenResponse)); } export function v3TokenResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => V3TokenResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'V3TokenResponse' from JSON`, ); }