/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. * @generated-id: ef2c1e01bd6c */ 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 { GitMetadata, GitMetadata$inboundSchema } from "./gitmetadata.js"; import { SetupFingerprintInfo, SetupFingerprintInfo$inboundSchema, } from "./setupfingerprintinfo.js"; export type ReleaseListItemResponseStack = { aws?: any | null | undefined; gcp?: any | null | undefined; azure?: any | null | undefined; kubernetes?: any | null | undefined; machines?: any | null | undefined; local?: any | null | undefined; test?: any | null | undefined; }; /** * Project info, included when ?include=project is used */ export type ReleaseListItemResponseProject = { /** * Project ID */ id: string; /** * Project name */ name: string; }; /** * Rollout stats, included when ?include=rollout is used */ export type Rollout = { /** * Deployments that finished updating to this release (excludes initial provisions) */ updatedCount: number; /** * Deployments currently targeting this release but not yet running it */ pendingCount: number; /** * Average time from release creation until a deployment finished updating, in milliseconds */ avgDurationMs: number | null; }; /** * Platform user who created the release, included when ?include=createdBy is used */ export type CreatedBy = { /** * User ID */ id: string; /** * User's display name */ name: string; /** * User's email address */ email: string; /** * User's avatar image URL */ image: string | null; }; export type ReleaseListItemResponse = { /** * Unique identifier for the release. */ id: string; projectId: string; version: string; gitMetadata?: GitMetadata | null | undefined; createdAt: Date; stack?: ReleaseListItemResponseStack | null | undefined; setupFingerprints: { [k: string]: SetupFingerprintInfo }; rootDirectory?: string | null | undefined; /** * ID of the platform user who created the release, if known */ createdByUserId?: string | null | undefined; workspaceId: string; /** * Channels for which this release is currently selected */ currentChannels: Array; /** * Validated canonical provider URL for the exact commit */ commitUrl: string | null; /** * Project info, included when ?include=project is used */ project?: ReleaseListItemResponseProject | null | undefined; /** * Rollout stats, included when ?include=rollout is used */ rollout?: Rollout | null | undefined; /** * Platform user who created the release, included when ?include=createdBy is used */ createdBy?: CreatedBy | null | undefined; }; /** @internal */ export const ReleaseListItemResponseStack$inboundSchema: z.ZodType< ReleaseListItemResponseStack, unknown > = z.object({ aws: z.nullable(z.any()).optional(), gcp: z.nullable(z.any()).optional(), azure: z.nullable(z.any()).optional(), kubernetes: z.nullable(z.any()).optional(), machines: z.nullable(z.any()).optional(), local: z.nullable(z.any()).optional(), test: z.nullable(z.any()).optional(), }); export function releaseListItemResponseStackFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ReleaseListItemResponseStack$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ReleaseListItemResponseStack' from JSON`, ); } /** @internal */ export const ReleaseListItemResponseProject$inboundSchema: z.ZodType< ReleaseListItemResponseProject, unknown > = z.object({ id: z.string(), name: z.string(), }); export function releaseListItemResponseProjectFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ReleaseListItemResponseProject$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ReleaseListItemResponseProject' from JSON`, ); } /** @internal */ export const Rollout$inboundSchema: z.ZodType = z.object({ updatedCount: z.int(), pendingCount: z.int(), avgDurationMs: z.nullable(z.number()), }); export function rolloutFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Rollout$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Rollout' from JSON`, ); } /** @internal */ export const CreatedBy$inboundSchema: z.ZodType = z.object({ id: z.string(), name: z.string(), email: z.string(), image: z.nullable(z.string()), }); export function createdByFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CreatedBy$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreatedBy' from JSON`, ); } /** @internal */ export const ReleaseListItemResponse$inboundSchema: z.ZodType< ReleaseListItemResponse, unknown > = z.object({ id: z.string(), projectId: z.string(), version: z.string(), gitMetadata: z.nullable(GitMetadata$inboundSchema).optional(), createdAt: z.iso.datetime({ offset: true }).transform(v => new Date(v)), stack: z.nullable(z.lazy(() => ReleaseListItemResponseStack$inboundSchema)) .optional(), setupFingerprints: z.record(z.string(), SetupFingerprintInfo$inboundSchema), rootDirectory: z.nullable(z.string()).optional(), createdByUserId: z.nullable(z.string()).optional(), workspaceId: z.string(), currentChannels: z.array(z.string()), commitUrl: z.nullable(z.string()), project: z.nullable( z.lazy(() => ReleaseListItemResponseProject$inboundSchema), ).optional(), rollout: z.nullable(z.lazy(() => Rollout$inboundSchema)).optional(), createdBy: z.nullable(z.lazy(() => CreatedBy$inboundSchema)).optional(), }); export function releaseListItemResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ReleaseListItemResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ReleaseListItemResponse' from JSON`, ); }