/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: f8f053f836b3 */ 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"; export type ListDeploymentGroupsGlobals = { /** * 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 ListDeploymentGroupsInclude = { Project: "project", } as const; export type ListDeploymentGroupsInclude = ClosedEnum< typeof ListDeploymentGroupsInclude >; export type ListDeploymentGroupsRequest = { /** * Filter by project ID or name. */ project?: string | undefined; /** * Search deployment groups by name */ search?: string | undefined; /** * Optional fields to include: 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; }; /** * Project info, included when ?include=project is used */ export type ListDeploymentGroupsProject = { /** * Project ID */ id: string; /** * Project name */ name: string; }; export type ListDeploymentGroupsItem = { /** * Unique identifier for the deployment group. */ id: string; /** * Deployment group name. */ name: string; /** * Case-sensitive, URL- and header-safe identifier from the integrating application. */ externalId: string | null; /** * Unique identifier for the project. */ projectId: string; /** * Unique identifier for the workspace. */ workspaceId: string; /** * Maximum number of deployments allowed in this deployment group */ maxDeployments: number; createdAt: Date; /** * Project info, included when ?include=project is used */ project?: ListDeploymentGroupsProject | null | undefined; }; /** * Paginated response */ export type ListDeploymentGroupsResponse = { /** * Items in this page */ items: Array; /** * Cursor for the next page, null if last page */ nextCursor: string | null; }; /** @internal */ export const ListDeploymentGroupsInclude$outboundSchema: z.ZodEnum< typeof ListDeploymentGroupsInclude > = z.enum(ListDeploymentGroupsInclude); /** @internal */ export type ListDeploymentGroupsRequest$Outbound = { project?: string | undefined; search?: string | undefined; include?: Array | undefined; limit: number; cursor?: string | undefined; }; /** @internal */ export const ListDeploymentGroupsRequest$outboundSchema: z.ZodType< ListDeploymentGroupsRequest$Outbound, ListDeploymentGroupsRequest > = z.object({ project: z.string().optional(), search: z.string().optional(), include: z.array(ListDeploymentGroupsInclude$outboundSchema).optional(), limit: z.int().default(20), cursor: z.string().optional(), }); export function listDeploymentGroupsRequestToJSON( listDeploymentGroupsRequest: ListDeploymentGroupsRequest, ): string { return JSON.stringify( ListDeploymentGroupsRequest$outboundSchema.parse( listDeploymentGroupsRequest, ), ); } /** @internal */ export const ListDeploymentGroupsProject$inboundSchema: z.ZodType< ListDeploymentGroupsProject, unknown > = z.object({ id: z.string(), name: z.string(), }); export function listDeploymentGroupsProjectFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ListDeploymentGroupsProject$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListDeploymentGroupsProject' from JSON`, ); } /** @internal */ export const ListDeploymentGroupsItem$inboundSchema: z.ZodType< ListDeploymentGroupsItem, unknown > = z.object({ id: z.string(), name: z.string(), externalId: z.nullable(z.string()), projectId: z.string(), workspaceId: z.string(), maxDeployments: z.int().default(100), createdAt: z.iso.datetime({ offset: true }).transform(v => new Date(v)), project: z.nullable(z.lazy(() => ListDeploymentGroupsProject$inboundSchema)) .optional(), }); export function listDeploymentGroupsItemFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ListDeploymentGroupsItem$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListDeploymentGroupsItem' from JSON`, ); } /** @internal */ export const ListDeploymentGroupsResponse$inboundSchema: z.ZodType< ListDeploymentGroupsResponse, unknown > = z.object({ items: z.array(z.lazy(() => ListDeploymentGroupsItem$inboundSchema)), nextCursor: z.nullable(z.string()), }); export function listDeploymentGroupsResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ListDeploymentGroupsResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListDeploymentGroupsResponse' from JSON`, ); }