/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: 12faf0246e66 */ import * as z from "zod/v4"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import * as models from "../index.js"; export type ListWorkspacesGlobals = { /** * Workspace name. Platform API keys already select a workspace; other authentication methods can configure it once on the SDK client. */ workspace?: string | undefined; }; export type ListWorkspacesRequest = { /** * Search workspaces by name */ search?: string | 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 ListWorkspacesResponse = { /** * Items in this page */ items: Array; /** * Cursor for the next page, null if last page */ nextCursor: string | null; }; /** @internal */ export type ListWorkspacesRequest$Outbound = { search?: string | undefined; limit: number; cursor?: string | undefined; }; /** @internal */ export const ListWorkspacesRequest$outboundSchema: z.ZodType< ListWorkspacesRequest$Outbound, ListWorkspacesRequest > = z.object({ search: z.string().optional(), limit: z.int().default(20), cursor: z.string().optional(), }); export function listWorkspacesRequestToJSON( listWorkspacesRequest: ListWorkspacesRequest, ): string { return JSON.stringify( ListWorkspacesRequest$outboundSchema.parse(listWorkspacesRequest), ); } /** @internal */ export const ListWorkspacesResponse$inboundSchema: z.ZodType< ListWorkspacesResponse, unknown > = z.object({ items: z.array(models.Workspace$inboundSchema), nextCursor: z.nullable(z.string()), }); export function listWorkspacesResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ListWorkspacesResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListWorkspacesResponse' from JSON`, ); }