/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: b256c6348ad9 */ 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 ListReleasesGlobals = { /** * 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 AllChannels = { True: "true", False: "false", } as const; export type AllChannels = ClosedEnum; export const ListReleasesInclude = { Project: "project", Rollout: "rollout", CreatedBy: "createdBy", } as const; export type ListReleasesInclude = ClosedEnum; export type ListReleasesRequest = { /** * Filter by project ID or name. */ project?: string | null | undefined; /** * Filter to releases promoted to this channel. Defaults to production. */ channel?: string | null | undefined; allChannels?: AllChannels | undefined; /** * Optional fields to include: project, rollout */ include?: Array | undefined; /** * Search releases by commit message, branch, SHA, or release ID */ search?: string | null | undefined; /** * Filter by git branch (commitRef) */ branch?: string | null | undefined; /** * Filter by commit author login or name */ author?: string | null | undefined; /** * Filter releases created after this date (ISO 8601) */ createdAfter?: Date | null | undefined; /** * Filter releases created before this date (ISO 8601) */ createdBefore?: Date | null | 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 ListReleasesResponse = { /** * Items in this page */ items: Array; /** * Cursor for the next page, null if last page */ nextCursor: string | null; }; /** @internal */ export const AllChannels$outboundSchema: z.ZodEnum = z.enum( AllChannels, ); /** @internal */ export const ListReleasesInclude$outboundSchema: z.ZodEnum< typeof ListReleasesInclude > = z.enum(ListReleasesInclude); /** @internal */ export type ListReleasesRequest$Outbound = { project?: string | null | undefined; channel?: string | null | undefined; allChannels: string; include?: Array | undefined; search?: string | null | undefined; branch?: string | null | undefined; author?: string | null | undefined; createdAfter?: string | null | undefined; createdBefore?: string | null | undefined; limit: number; cursor?: string | undefined; }; /** @internal */ export const ListReleasesRequest$outboundSchema: z.ZodType< ListReleasesRequest$Outbound, ListReleasesRequest > = z.object({ project: z.nullable(z.string()).optional(), channel: z.nullable(z.string()).optional(), allChannels: AllChannels$outboundSchema.default("false"), include: z.array(ListReleasesInclude$outboundSchema).optional(), search: z.nullable(z.string()).optional(), branch: z.nullable(z.string()).optional(), author: z.nullable(z.string()).optional(), createdAfter: z.nullable(z.date().transform(v => v.toISOString())).optional(), createdBefore: z.nullable(z.date().transform(v => v.toISOString())) .optional(), limit: z.int().default(20), cursor: z.string().optional(), }); export function listReleasesRequestToJSON( listReleasesRequest: ListReleasesRequest, ): string { return JSON.stringify( ListReleasesRequest$outboundSchema.parse(listReleasesRequest), ); } /** @internal */ export const ListReleasesResponse$inboundSchema: z.ZodType< ListReleasesResponse, unknown > = z.object({ items: z.array(models.ReleaseListItemResponse$inboundSchema), nextCursor: z.nullable(z.string()), }); export function listReleasesResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ListReleasesResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListReleasesResponse' from JSON`, ); }