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>

220 lines (201 loc) 6.1 kB
/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; 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 { Flag, Flag$inboundSchema } from "./flag.js"; import { MarketplaceFlag, MarketplaceFlag$inboundSchema, } from "./marketplaceflag.js"; import { SDKValidationError } from "./sdkvalidationerror.js"; /** * The state of the flags to retrieve. Defaults to `active`. */ export const ListTeamFlagsV2QueryParamState = { Active: "active", Archived: "archived", } as const; /** * The state of the flags to retrieve. Defaults to `active`. */ export type ListTeamFlagsV2QueryParamState = ClosedEnum< typeof ListTeamFlagsV2QueryParamState >; /** * The kind of flags to retrieve. */ export const QueryParamKind = { Boolean: "boolean", String: "string", Number: "number", Json: "json", } as const; /** * The kind of flags to retrieve. */ export type QueryParamKind = ClosedEnum<typeof QueryParamKind>; export type ListTeamFlagsV2Request = { /** * The state of the flags to retrieve. Defaults to `active`. */ state?: ListTeamFlagsV2QueryParamState | undefined; /** * Maximum number of flags to return. */ limit?: number | undefined; /** * Pagination cursor to continue from. */ cursor?: string | undefined; /** * Search flags by their slug or description. Case-insensitive. */ search?: string | undefined; /** * The kind of flags to retrieve. */ kind?: QueryParamKind | undefined; /** * Filter flags by tag. Repeat the parameter for multiple tags (all must match). */ tags?: Array<string> | undefined; /** * Filter flags by the id of the entity that created them (a user or team id). */ createdBy?: string | undefined; /** * Filter flags by maintainer user id. Repeat the parameter for multiple maintainers (any may match). */ maintainerIds?: Array<string> | undefined; /** * Whether to include Marketplace experimentation items in the paginated response. Defaults to false. */ includeMarketplaceFlags?: boolean | 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; }; export type ListTeamFlagsV2Pagination = { next: string | null; }; export type ListTeamFlagsV2Data = | (Flag & { typeName: "flag" }) | MarketplaceFlag; export type ListTeamFlagsV2ResponseBody = { pagination: ListTeamFlagsV2Pagination; data: Array<(Flag & { typeName: "flag" }) | MarketplaceFlag>; }; /** @internal */ export const ListTeamFlagsV2QueryParamState$outboundSchema: z.ZodNativeEnum< typeof ListTeamFlagsV2QueryParamState > = z.nativeEnum(ListTeamFlagsV2QueryParamState); /** @internal */ export const QueryParamKind$outboundSchema: z.ZodNativeEnum< typeof QueryParamKind > = z.nativeEnum(QueryParamKind); /** @internal */ export type ListTeamFlagsV2Request$Outbound = { state?: string | undefined; limit: number; cursor?: string | undefined; search?: string | undefined; kind?: string | undefined; tags?: Array<string> | undefined; createdBy?: string | undefined; maintainerIds?: Array<string> | undefined; includeMarketplaceFlags?: boolean | undefined; teamId: string; slug?: string | undefined; }; /** @internal */ export const ListTeamFlagsV2Request$outboundSchema: z.ZodType< ListTeamFlagsV2Request$Outbound, z.ZodTypeDef, ListTeamFlagsV2Request > = z.object({ state: ListTeamFlagsV2QueryParamState$outboundSchema.optional(), limit: z.number().int().default(25), cursor: z.string().optional(), search: z.string().optional(), kind: QueryParamKind$outboundSchema.optional(), tags: z.array(z.string()).optional(), createdBy: z.string().optional(), maintainerIds: z.array(z.string()).optional(), includeMarketplaceFlags: z.boolean().optional(), teamId: z.string(), slug: z.string().optional(), }); export function listTeamFlagsV2RequestToJSON( listTeamFlagsV2Request: ListTeamFlagsV2Request, ): string { return JSON.stringify( ListTeamFlagsV2Request$outboundSchema.parse(listTeamFlagsV2Request), ); } /** @internal */ export const ListTeamFlagsV2Pagination$inboundSchema: z.ZodType< ListTeamFlagsV2Pagination, z.ZodTypeDef, unknown > = z.object({ next: types.nullable(types.string()), }); export function listTeamFlagsV2PaginationFromJSON( jsonString: string, ): SafeParseResult<ListTeamFlagsV2Pagination, SDKValidationError> { return safeParse( jsonString, (x) => ListTeamFlagsV2Pagination$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListTeamFlagsV2Pagination' from JSON`, ); } /** @internal */ export const ListTeamFlagsV2Data$inboundSchema: z.ZodType< ListTeamFlagsV2Data, z.ZodTypeDef, unknown > = z.union([ Flag$inboundSchema.and(z.object({ typeName: z.literal("flag") })), MarketplaceFlag$inboundSchema, ]); export function listTeamFlagsV2DataFromJSON( jsonString: string, ): SafeParseResult<ListTeamFlagsV2Data, SDKValidationError> { return safeParse( jsonString, (x) => ListTeamFlagsV2Data$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListTeamFlagsV2Data' from JSON`, ); } /** @internal */ export const ListTeamFlagsV2ResponseBody$inboundSchema: z.ZodType< ListTeamFlagsV2ResponseBody, z.ZodTypeDef, unknown > = z.object({ pagination: z.lazy(() => ListTeamFlagsV2Pagination$inboundSchema), data: z.array( z.union([ Flag$inboundSchema.and(z.object({ typeName: z.literal("flag") })), MarketplaceFlag$inboundSchema, ]), ), }); export function listTeamFlagsV2ResponseBodyFromJSON( jsonString: string, ): SafeParseResult<ListTeamFlagsV2ResponseBody, SDKValidationError> { return safeParse( jsonString, (x) => ListTeamFlagsV2ResponseBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListTeamFlagsV2ResponseBody' from JSON`, ); }