/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: d62962a61d21 */ 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 ListCommandsGlobals = { /** * 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 command state */ export const State = { PendingUpload: "PENDING_UPLOAD", Pending: "PENDING", Dispatched: "DISPATCHED", Succeeded: "SUCCEEDED", Failed: "FAILED", Expired: "EXPIRED", } as const; /** * Filter by command state */ export type State = ClosedEnum; export const ListCommandsInclude = { Deployment: "deployment", Project: "project", } as const; export type ListCommandsInclude = ClosedEnum; export type ListCommandsRequest = { /** * Filter by project ID or name. */ project?: string | undefined; /** * Filter by deployment ID */ deploymentId?: string | undefined; /** * Filter by command state */ state?: State | undefined; /** * Filter by command name */ name?: string | undefined; /** * Search commands by name */ search?: string | undefined; /** * Filter commands created after this date (ISO 8601) */ createdAfter?: Date | null | undefined; /** * Filter commands created before this date (ISO 8601) */ createdBefore?: Date | null | undefined; /** * Optional fields to include: deployment, project */ 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 ListCommandsResponse = { /** * Items in this page */ items: Array; /** * Cursor for the next page, null if last page */ nextCursor: string | null; }; /** @internal */ export const State$outboundSchema: z.ZodEnum = z.enum(State); /** @internal */ export const ListCommandsInclude$outboundSchema: z.ZodEnum< typeof ListCommandsInclude > = z.enum(ListCommandsInclude); /** @internal */ export type ListCommandsRequest$Outbound = { project?: string | undefined; deploymentId?: string | undefined; state?: string | undefined; name?: string | undefined; search?: string | undefined; createdAfter?: string | null | undefined; createdBefore?: string | null | undefined; include?: Array | undefined; limit: number; cursor?: string | undefined; }; /** @internal */ export const ListCommandsRequest$outboundSchema: z.ZodType< ListCommandsRequest$Outbound, ListCommandsRequest > = z.object({ project: z.string().optional(), deploymentId: z.string().optional(), state: State$outboundSchema.optional(), name: z.string().optional(), search: z.string().optional(), createdAfter: z.nullable(z.date().transform(v => v.toISOString())).optional(), createdBefore: z.nullable(z.date().transform(v => v.toISOString())) .optional(), include: z.array(ListCommandsInclude$outboundSchema).optional(), limit: z.int().default(20), cursor: z.string().optional(), }); export function listCommandsRequestToJSON( listCommandsRequest: ListCommandsRequest, ): string { return JSON.stringify( ListCommandsRequest$outboundSchema.parse(listCommandsRequest), ); } /** @internal */ export const ListCommandsResponse$inboundSchema: z.ZodType< ListCommandsResponse, unknown > = z.object({ items: z.array(models.CommandListItemResponse$inboundSchema), nextCursor: z.nullable(z.string()), }); export function listCommandsResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ListCommandsResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListCommandsResponse' from JSON`, ); }