/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v4-mini"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdk-validation-error.js"; import * as models from "../index.js"; export type ListProjectsRequest = { page?: number | undefined; pageSize?: number | undefined; }; /** * Projects retrieved successfully */ export type ListProjectsResponseBody = { /** * The items on this page. */ data: Array; /** * Where this page is in the full list. */ pagination: models.Pagination; }; export type ListProjectsResponse = { result: ListProjectsResponseBody; }; /** @internal */ export type ListProjectsRequest$Outbound = { page: number; pageSize: number; }; /** @internal */ export const ListProjectsRequest$outboundSchema: z.ZodMiniType< ListProjectsRequest$Outbound, ListProjectsRequest > = z.object({ page: z._default(z.int(), 1), pageSize: z._default(z.int(), 20), }); export function listProjectsRequestToJSON( listProjectsRequest: ListProjectsRequest, ): string { return JSON.stringify( ListProjectsRequest$outboundSchema.parse(listProjectsRequest), ); } /** @internal */ export const ListProjectsResponseBody$inboundSchema: z.ZodMiniType< ListProjectsResponseBody, unknown > = z.object({ data: z.array(models.Project$inboundSchema), pagination: models.Pagination$inboundSchema, }); export function listProjectsResponseBodyFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ListProjectsResponseBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListProjectsResponseBody' from JSON`, ); } /** @internal */ export const ListProjectsResponse$inboundSchema: z.ZodMiniType< ListProjectsResponse, unknown > = z.pipe( z.object({ Result: z.lazy(() => ListProjectsResponseBody$inboundSchema), }), z.transform((v) => { return remap$(v, { "Result": "result", }); }), ); export function listProjectsResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ListProjectsResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListProjectsResponse' from JSON`, ); }