/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: 4824e3ca0725 */ import * as z from "zod/v4"; import { safeParse } from "../../lib/schemas.js"; import { ClosedEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import * as models from "../index.js"; export type ListProjectsGlobals = { /** * Workspace name. Platform API keys already select a workspace; other authentication methods can configure it once on the SDK client. */ workspace?: string | undefined; }; export const ListProjectsInclude = { DeploymentCount: "deploymentCount", LatestRelease: "latestRelease", } as const; export type ListProjectsInclude = ClosedEnum; export type ListProjectsRequest = { /** * Search projects by name */ search?: string | undefined; /** * Optional fields to include: deploymentCount, latestRelease */ include?: Array | undefined; /** * Maximum number of items to return per page */ limit?: number | undefined; /** * Cursor for pagination - omit for first page */ cursor?: string | undefined; }; /** * Paginated response */ export type ListProjectsResponse = { /** * Items in this page */ items: Array; /** * Cursor for the next page, null if last page */ nextCursor: string | null; }; /** @internal */ export const ListProjectsInclude$outboundSchema: z.ZodEnum< typeof ListProjectsInclude > = z.enum(ListProjectsInclude); /** @internal */ export type ListProjectsRequest$Outbound = { search?: string | undefined; include?: Array | undefined; limit: number; cursor?: string | undefined; }; /** @internal */ export const ListProjectsRequest$outboundSchema: z.ZodType< ListProjectsRequest$Outbound, ListProjectsRequest > = z.object({ search: z.string().optional(), include: z.array(ListProjectsInclude$outboundSchema).optional(), limit: z.int().default(20), cursor: z.string().optional(), }); export function listProjectsRequestToJSON( listProjectsRequest: ListProjectsRequest, ): string { return JSON.stringify( ListProjectsRequest$outboundSchema.parse(listProjectsRequest), ); } /** @internal */ export const ListProjectsResponse$inboundSchema: z.ZodType< ListProjectsResponse, unknown > = z.object({ items: z.array(models.ProjectListItemResponse$inboundSchema), nextCursor: z.nullable(z.string()), }); export function listProjectsResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ListProjectsResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListProjectsResponse' from JSON`, ); }