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>

136 lines (121 loc) 3.76 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 { ClosedEnum } from "../types/enums.js"; import { Result as SafeParseResult } from "../types/fp.js"; import * as types from "../types/primitives.js"; import { SDKValidationError } from "./sdkvalidationerror.js"; export type RotateInstallationCredentialRequestBody = { clientSecret: string; clientId?: string | undefined; }; export type RotateInstallationCredentialRequest = { integrationConfigurationId: string; requestBody?: RotateInstallationCredentialRequestBody | undefined; }; export const TokenType = { Oauth2Token: "oauth2-token", } as const; export type TokenType = ClosedEnum<typeof TokenType>; export type RotateInstallationCredentialResponseBody = { scope: string; expiresIn: number; accessToken: string; tokenType: TokenType; }; /** @internal */ export type RotateInstallationCredentialRequestBody$Outbound = { client_secret: string; client_id?: string | undefined; }; /** @internal */ export const RotateInstallationCredentialRequestBody$outboundSchema: z.ZodType< RotateInstallationCredentialRequestBody$Outbound, z.ZodTypeDef, RotateInstallationCredentialRequestBody > = z.object({ clientSecret: z.string(), clientId: z.string().optional(), }).transform((v) => { return remap$(v, { clientSecret: "client_secret", clientId: "client_id", }); }); export function rotateInstallationCredentialRequestBodyToJSON( rotateInstallationCredentialRequestBody: RotateInstallationCredentialRequestBody, ): string { return JSON.stringify( RotateInstallationCredentialRequestBody$outboundSchema.parse( rotateInstallationCredentialRequestBody, ), ); } /** @internal */ export type RotateInstallationCredentialRequest$Outbound = { integrationConfigurationId: string; RequestBody?: RotateInstallationCredentialRequestBody$Outbound | undefined; }; /** @internal */ export const RotateInstallationCredentialRequest$outboundSchema: z.ZodType< RotateInstallationCredentialRequest$Outbound, z.ZodTypeDef, RotateInstallationCredentialRequest > = z.object({ integrationConfigurationId: z.string(), requestBody: z.lazy(() => RotateInstallationCredentialRequestBody$outboundSchema ).optional(), }).transform((v) => { return remap$(v, { requestBody: "RequestBody", }); }); export function rotateInstallationCredentialRequestToJSON( rotateInstallationCredentialRequest: RotateInstallationCredentialRequest, ): string { return JSON.stringify( RotateInstallationCredentialRequest$outboundSchema.parse( rotateInstallationCredentialRequest, ), ); } /** @internal */ export const TokenType$inboundSchema: z.ZodNativeEnum<typeof TokenType> = z .nativeEnum(TokenType); /** @internal */ export const RotateInstallationCredentialResponseBody$inboundSchema: z.ZodType< RotateInstallationCredentialResponseBody, z.ZodTypeDef, unknown > = z.object({ scope: types.string(), expires_in: types.number(), access_token: types.string(), token_type: TokenType$inboundSchema, }).transform((v) => { return remap$(v, { "expires_in": "expiresIn", "access_token": "accessToken", "token_type": "tokenType", }); }); export function rotateInstallationCredentialResponseBodyFromJSON( jsonString: string, ): SafeParseResult< RotateInstallationCredentialResponseBody, SDKValidationError > { return safeParse( jsonString, (x) => RotateInstallationCredentialResponseBody$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'RotateInstallationCredentialResponseBody' from JSON`, ); }