@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>
102 lines (90 loc) • 2.85 kB
text/typescript
/*
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
*/
import * as z from "zod/v3";
import { safeParse } from "../lib/schemas.js";
import { Result as SafeParseResult } from "../types/fp.js";
import { smartUnion } from "../types/smartUnion.js";
import { Pagination, Pagination$inboundSchema } from "./pagination.js";
import { SDKValidationError } from "./sdkvalidationerror.js";
import { Team, Team$inboundSchema } from "./team.js";
import { TeamLimited, TeamLimited$inboundSchema } from "./teamlimited.js";
export type GetTeamsRequest = {
/**
* Maximum number of Teams which may be returned.
*/
limit?: number | undefined;
/**
* Timestamp (in milliseconds) to only include Teams created since then.
*/
since?: number | undefined;
/**
* Timestamp (in milliseconds) to only include Teams created until then.
*/
until?: number | undefined;
};
export type GetTeamsTeams = Team | TeamLimited;
/**
* A paginated list of teams.
*/
export type GetTeamsResponseBody = {
teams: Array<Team | TeamLimited>;
/**
* This object contains information related to the pagination of the current request, including the necessary parameters to get the next or previous page of data.
*/
pagination: Pagination;
};
/** @internal */
export type GetTeamsRequest$Outbound = {
limit?: number | undefined;
since?: number | undefined;
until?: number | undefined;
};
/** @internal */
export const GetTeamsRequest$outboundSchema: z.ZodType<
GetTeamsRequest$Outbound,
z.ZodTypeDef,
GetTeamsRequest
> = z.object({
limit: z.number().optional(),
since: z.number().optional(),
until: z.number().optional(),
});
export function getTeamsRequestToJSON(
getTeamsRequest: GetTeamsRequest,
): string {
return JSON.stringify(GetTeamsRequest$outboundSchema.parse(getTeamsRequest));
}
/** @internal */
export const GetTeamsTeams$inboundSchema: z.ZodType<
GetTeamsTeams,
z.ZodTypeDef,
unknown
> = smartUnion([Team$inboundSchema, TeamLimited$inboundSchema]);
export function getTeamsTeamsFromJSON(
jsonString: string,
): SafeParseResult<GetTeamsTeams, SDKValidationError> {
return safeParse(
jsonString,
(x) => GetTeamsTeams$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'GetTeamsTeams' from JSON`,
);
}
/** @internal */
export const GetTeamsResponseBody$inboundSchema: z.ZodType<
GetTeamsResponseBody,
z.ZodTypeDef,
unknown
> = z.object({
teams: z.array(smartUnion([Team$inboundSchema, TeamLimited$inboundSchema])),
pagination: Pagination$inboundSchema,
});
export function getTeamsResponseBodyFromJSON(
jsonString: string,
): SafeParseResult<GetTeamsResponseBody, SDKValidationError> {
return safeParse(
jsonString,
(x) => GetTeamsResponseBody$inboundSchema.parse(JSON.parse(x)),
`Failed to parse 'GetTeamsResponseBody' from JSON`,
);
}