/* * 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 { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type RefreshTokenAuthentication = { /** * A new access token that can be used for subsequent authenticated requests */ accessToken: string; /** * The literal string 'Bearer' */ tokenType: string; /** * The TTL of this token. After this amount of time, you must hit the refresh token endpoint to continue making authenticated requests. */ expiresIn: number; /** * Datetime for when the new access token is created. */ createdAt: number; /** * A token that must be passed to the refresh token endpoint to get a new authenticated token. */ refreshToken?: string | undefined; /** * All of the scopes for which the access token provides access. */ scope?: string | undefined; }; /** @internal */ export const RefreshTokenAuthentication$inboundSchema: z.ZodType< RefreshTokenAuthentication, z.ZodTypeDef, unknown > = z.object({ access_token: z.string(), token_type: z.string().default("Bearer"), expires_in: z.number().default(7200), created_at: z.number(), refresh_token: z.string().optional(), scope: z.string().optional(), }).transform((v) => { return remap$(v, { "access_token": "accessToken", "token_type": "tokenType", "expires_in": "expiresIn", "created_at": "createdAt", "refresh_token": "refreshToken", }); }); export function refreshTokenAuthenticationFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => RefreshTokenAuthentication$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'RefreshTokenAuthentication' from JSON`, ); }