/* * 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"; export type GetClusterOrgRequest = { id: string; /** * Optional external end-user identifier forwarded by the API gateway. */ xOnBehalfOf?: string | undefined; }; export const GetClusterOrgStatus = { Active: "active", Suspended: "suspended", Deleted: "deleted", } as const; export type GetClusterOrgStatus = ClosedEnum; /** * OK */ export type GetClusterOrgResponseBody = { id: string; slug: string; name: string; logo: string | null; status: GetClusterOrgStatus; createdAt: string; memberCount?: number | undefined; apiKeyCount?: number | undefined; }; /** @internal */ export const GetClusterOrgRequest$inboundSchema: z.ZodType< GetClusterOrgRequest, z.ZodTypeDef, unknown > = z.object({ id: z.string(), "X-On-Behalf-Of": z.string().optional(), }).transform((v) => { return remap$(v, { "X-On-Behalf-Of": "xOnBehalfOf", }); }); /** @internal */ export type GetClusterOrgRequest$Outbound = { id: string; "X-On-Behalf-Of"?: string | undefined; }; /** @internal */ export const GetClusterOrgRequest$outboundSchema: z.ZodType< GetClusterOrgRequest$Outbound, z.ZodTypeDef, GetClusterOrgRequest > = z.object({ id: z.string(), xOnBehalfOf: z.string().optional(), }).transform((v) => { return remap$(v, { xOnBehalfOf: "X-On-Behalf-Of", }); }); export function getClusterOrgRequestToJSON( getClusterOrgRequest: GetClusterOrgRequest, ): string { return JSON.stringify( GetClusterOrgRequest$outboundSchema.parse(getClusterOrgRequest), ); } export function getClusterOrgRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => GetClusterOrgRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetClusterOrgRequest' from JSON`, ); } /** @internal */ export const GetClusterOrgStatus$inboundSchema: z.ZodNativeEnum< typeof GetClusterOrgStatus > = z.nativeEnum(GetClusterOrgStatus); /** @internal */ export const GetClusterOrgStatus$outboundSchema: z.ZodNativeEnum< typeof GetClusterOrgStatus > = GetClusterOrgStatus$inboundSchema; /** @internal */ export const GetClusterOrgResponseBody$inboundSchema: z.ZodType< GetClusterOrgResponseBody, z.ZodTypeDef, unknown > = z.object({ id: z.string(), slug: z.string(), name: z.string(), logo: z.nullable(z.string()), status: GetClusterOrgStatus$inboundSchema, createdAt: z.string(), memberCount: z.number().optional(), apiKeyCount: z.number().optional(), }); /** @internal */ export type GetClusterOrgResponseBody$Outbound = { id: string; slug: string; name: string; logo: string | null; status: string; createdAt: string; memberCount?: number | undefined; apiKeyCount?: number | undefined; }; /** @internal */ export const GetClusterOrgResponseBody$outboundSchema: z.ZodType< GetClusterOrgResponseBody$Outbound, z.ZodTypeDef, GetClusterOrgResponseBody > = z.object({ id: z.string(), slug: z.string(), name: z.string(), logo: z.nullable(z.string()), status: GetClusterOrgStatus$outboundSchema, createdAt: z.string(), memberCount: z.number().optional(), apiKeyCount: z.number().optional(), }); export function getClusterOrgResponseBodyToJSON( getClusterOrgResponseBody: GetClusterOrgResponseBody, ): string { return JSON.stringify( GetClusterOrgResponseBody$outboundSchema.parse(getClusterOrgResponseBody), ); } export function getClusterOrgResponseBodyFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => GetClusterOrgResponseBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetClusterOrgResponseBody' from JSON`, ); }