/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: 5ca1b8866502 */ 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 ListPackagesGlobals = { /** * Workspace name. Platform API keys already select a workspace; other authentication methods can configure it once on the SDK client. */ workspace?: string | undefined; }; /** * Filter by package type */ export const ListPackagesType = { Cli: "cli", Cloudformation: "cloudformation", Helm: "helm", OperatorImage: "operator-image", SandboxBundle: "sandbox-bundle", Terraform: "terraform", } as const; /** * Filter by package type */ export type ListPackagesType = ClosedEnum; /** * Filter by package status */ export const ListPackagesStatus = { Pending: "pending", Building: "building", Ready: "ready", Failed: "failed", Canceled: "canceled", } as const; /** * Filter by package status */ export type ListPackagesStatus = ClosedEnum; export type ListPackagesRequest = { /** * Filter by project ID or name. */ project?: string | undefined; /** * Filter by package type */ type?: ListPackagesType | undefined; /** * Filter by package status */ status?: ListPackagesStatus | undefined; /** * Search packages by type or version */ 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 ListPackagesResponse = { /** * Items in this page */ items: Array; /** * Cursor for the next page, null if last page */ nextCursor: string | null; }; /** @internal */ export const ListPackagesType$outboundSchema: z.ZodEnum< typeof ListPackagesType > = z.enum(ListPackagesType); /** @internal */ export const ListPackagesStatus$outboundSchema: z.ZodEnum< typeof ListPackagesStatus > = z.enum(ListPackagesStatus); /** @internal */ export type ListPackagesRequest$Outbound = { project?: string | undefined; type?: string | undefined; status?: string | undefined; search?: string | undefined; limit: number; cursor?: string | undefined; }; /** @internal */ export const ListPackagesRequest$outboundSchema: z.ZodType< ListPackagesRequest$Outbound, ListPackagesRequest > = z.object({ project: z.string().optional(), type: ListPackagesType$outboundSchema.optional(), status: ListPackagesStatus$outboundSchema.optional(), search: z.string().optional(), limit: z.int().default(20), cursor: z.string().optional(), }); export function listPackagesRequestToJSON( listPackagesRequest: ListPackagesRequest, ): string { return JSON.stringify( ListPackagesRequest$outboundSchema.parse(listPackagesRequest), ); } /** @internal */ export const ListPackagesResponse$inboundSchema: z.ZodType< ListPackagesResponse, unknown > = z.object({ items: z.array(models.Package$inboundSchema), nextCursor: z.nullable(z.string()), }); export function listPackagesResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ListPackagesResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListPackagesResponse' from JSON`, ); }