UNPKG

@vercel/sdk

Version:

<p align="center"> <a href="https://vercel.com"> <img src="https://assets.vercel.com/image/upload/v1588805858/repositories/vercel/logo.png" height="96"> <h3 align="center">Vercel</h3> </a> <p align="center">Develop. Preview. Ship.</p> </p>

99 lines 4.01 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"; import { smartUnion } from "../types/smartUnion.js"; /** @internal */ export const ExchangeSsoTokenRequestBody2$outboundSchema = z.object({ refreshToken: z.string(), clientId: z.string(), clientSecret: z.string(), grantType: z.literal("refresh_token"), }).transform((v) => { return remap$(v, { refreshToken: "refresh_token", clientId: "client_id", clientSecret: "client_secret", grantType: "grant_type", }); }); export function exchangeSsoTokenRequestBody2ToJSON(exchangeSsoTokenRequestBody2) { return JSON.stringify(ExchangeSsoTokenRequestBody2$outboundSchema.parse(exchangeSsoTokenRequestBody2)); } /** @internal */ export const ExchangeSsoTokenRequestBody1$outboundSchema = z.object({ code: z.string(), state: z.string().optional(), clientId: z.string(), clientSecret: z.string(), redirectUri: z.string().optional(), grantType: z.literal("authorization_code"), }).transform((v) => { return remap$(v, { clientId: "client_id", clientSecret: "client_secret", redirectUri: "redirect_uri", grantType: "grant_type", }); }); export function exchangeSsoTokenRequestBody1ToJSON(exchangeSsoTokenRequestBody1) { return JSON.stringify(ExchangeSsoTokenRequestBody1$outboundSchema.parse(exchangeSsoTokenRequestBody1)); } /** @internal */ export const ExchangeSsoTokenRequestBody$outboundSchema = z.union([ z.lazy(() => ExchangeSsoTokenRequestBody1$outboundSchema), z.lazy(() => ExchangeSsoTokenRequestBody2$outboundSchema), ]); export function exchangeSsoTokenRequestBodyToJSON(exchangeSsoTokenRequestBody) { return JSON.stringify(ExchangeSsoTokenRequestBody$outboundSchema.parse(exchangeSsoTokenRequestBody)); } /** @internal */ export const ExchangeSsoTokenResponseBody2$inboundSchema = z.object({ id_token: types.string(), token_type: types.string(), access_token: types.string(), refresh_token: types.string(), expires_in: types.number(), }).transform((v) => { return remap$(v, { "id_token": "idToken", "token_type": "tokenType", "access_token": "accessToken", "refresh_token": "refreshToken", "expires_in": "expiresIn", }); }); export function exchangeSsoTokenResponseBody2FromJSON(jsonString) { return safeParse(jsonString, (x) => ExchangeSsoTokenResponseBody2$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ExchangeSsoTokenResponseBody2' from JSON`); } /** @internal */ export const ExchangeSsoTokenResponseBody1$inboundSchema = z.object({ id_token: types.string(), token_type: types.nullable(types.string()), expires_in: types.optional(types.number()), access_token: types.nullable(types.string()), refresh_token: types.optional(types.string()), }).transform((v) => { return remap$(v, { "id_token": "idToken", "token_type": "tokenType", "expires_in": "expiresIn", "access_token": "accessToken", "refresh_token": "refreshToken", }); }); export function exchangeSsoTokenResponseBody1FromJSON(jsonString) { return safeParse(jsonString, (x) => ExchangeSsoTokenResponseBody1$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ExchangeSsoTokenResponseBody1' from JSON`); } /** @internal */ export const ExchangeSsoTokenResponseBody$inboundSchema = smartUnion([ z.lazy(() => ExchangeSsoTokenResponseBody2$inboundSchema), z.lazy(() => ExchangeSsoTokenResponseBody1$inboundSchema), ]); export function exchangeSsoTokenResponseBodyFromJSON(jsonString) { return safeParse(jsonString, (x) => ExchangeSsoTokenResponseBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ExchangeSsoTokenResponseBody' from JSON`); } //# sourceMappingURL=exchangessotokenop.js.map