/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { remap as remap$ } from "../../lib/primitives.js"; 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 { ApiKeyDto, ApiKeyDto$inboundSchema } from "./apikeydto.js"; /** * Type of the environment */ export const EnvironmentResponseDtoType = { Dev: "dev", Prod: "prod", } as const; /** * Type of the environment */ export type EnvironmentResponseDtoType = ClosedEnum< typeof EnvironmentResponseDtoType >; export type EnvironmentResponseDto = { /** * Unique identifier of the environment */ id: string; /** * Name of the environment */ name: string; /** * Organization ID associated with the environment */ organizationId: string; /** * Unique identifier for the environment */ identifier: string; /** * Type of the environment */ type?: EnvironmentResponseDtoType | null | undefined; /** * List of API keys associated with the environment */ apiKeys?: Array | undefined; /** * Parent environment ID */ parentId?: string | undefined; /** * URL-friendly slug for the environment */ slug?: string | undefined; }; /** @internal */ export const EnvironmentResponseDtoType$inboundSchema: z.ZodNativeEnum< typeof EnvironmentResponseDtoType > = z.nativeEnum(EnvironmentResponseDtoType); /** @internal */ export const EnvironmentResponseDto$inboundSchema: z.ZodType< EnvironmentResponseDto, z.ZodTypeDef, unknown > = z.object({ _id: z.string(), name: z.string(), _organizationId: z.string(), identifier: z.string(), type: z.nullable(EnvironmentResponseDtoType$inboundSchema).optional(), apiKeys: z.array(ApiKeyDto$inboundSchema).optional(), _parentId: z.string().optional(), slug: z.string().optional(), }).transform((v) => { return remap$(v, { "_id": "id", "_organizationId": "organizationId", "_parentId": "parentId", }); }); export function environmentResponseDtoFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => EnvironmentResponseDto$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'EnvironmentResponseDto' from JSON`, ); }