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>

160 lines (143 loc) 3.98 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 { Result as SafeParseResult } from "../types/fp.js"; import * as types from "../types/primitives.js"; import { SDKValidationError } from "./sdkvalidationerror.js"; /** * An object describing the reason why the team is being deleted. */ export type DeleteTeamReasons = { /** * Idenitifier slug of the reason why the team is being deleted. */ slug: string; /** * Description of the reason why the team is being deleted. */ description: string; }; export type DeleteTeamRequestBody = { /** * Optional array of objects that describe the reason why the team is being deleted. */ reasons?: Array<DeleteTeamReasons> | undefined; }; export type DeleteTeamRequest = { /** * Id of the team to be set as the new default team */ newDefaultTeamId?: string | undefined; /** * The Team identifier to perform the request on behalf of. */ teamId: string; /** * The Team slug to perform the request on behalf of. */ slug?: string | undefined; requestBody: DeleteTeamRequestBody; }; /** * The Team was successfully deleted */ export type DeleteTeamResponseBody = { /** * The ID of the deleted Team */ id: string; /** * Signifies whether the default team update has failed, when newDefaultTeamId is provided in request query. */ newDefaultTeamIdError?: boolean | undefined; }; /** @internal */ export type DeleteTeamReasons$Outbound = { slug: string; description: string; }; /** @internal */ export const DeleteTeamReasons$outboundSchema: z.ZodType< DeleteTeamReasons$Outbound, z.ZodTypeDef, DeleteTeamReasons > = z.object({ slug: z.string(), description: z.string(), }); export function deleteTeamReasonsToJSON( deleteTeamReasons: DeleteTeamReasons, ): string { return JSON.stringify( DeleteTeamReasons$outboundSchema.parse(deleteTeamReasons), ); } /** @internal */ export type DeleteTeamRequestBody$Outbound = { reasons?: Array<DeleteTeamReasons$Outbound> | undefined; }; /** @internal */ export const DeleteTeamRequestBody$outboundSchema: z.ZodType< DeleteTeamRequestBody$Outbound, z.ZodTypeDef, DeleteTeamRequestBody > = z.object({ reasons: z.array(z.lazy(() => DeleteTeamReasons$outboundSchema)).optional(), }); export function deleteTeamRequestBodyToJSON( deleteTeamRequestBody: DeleteTeamRequestBody, ): string { return JSON.stringify( DeleteTeamRequestBody$outboundSchema.parse(deleteTeamRequestBody), ); } /** @internal */ export type DeleteTeamRequest$Outbound = { newDefaultTeamId?: string | undefined; teamId: string; slug?: string | undefined; RequestBody: DeleteTeamRequestBody$Outbound; }; /** @internal */ export const DeleteTeamRequest$outboundSchema: z.ZodType< DeleteTeamRequest$Outbound, z.ZodTypeDef, DeleteTeamRequest > = z.object({ newDefaultTeamId: z.string().optional(), teamId: z.string(), slug: z.string().optional(), requestBody: z.lazy(() => DeleteTeamRequestBody$outboundSchema), }).transform((v) => { return remap$(v, { requestBody: "RequestBody", }); }); export function deleteTeamRequestToJSON( deleteTeamRequest: DeleteTeamRequest, ): string { return JSON.stringify( DeleteTeamRequest$outboundSchema.parse(deleteTeamRequest), ); } /** @internal */ export const DeleteTeamResponseBody$inboundSchema: z.ZodType< DeleteTeamResponseBody, z.ZodTypeDef, unknown > = z.object({ id: types.string(), newDefaultTeamIdError: types.optional(types.boolean()), }); export function deleteTeamResponseBodyFromJSON( jsonString: string, ): SafeParseResult<DeleteTeamResponseBody, SDKValidationError> { return safeParse( jsonString, (x) => DeleteTeamResponseBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'DeleteTeamResponseBody' from JSON`, ); }