/* * 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 ListClusterOrgsRequest = { /** * Optional external end-user identifier forwarded by the API gateway. */ xOnBehalfOf?: string | undefined; }; export const ListClusterOrgsStatus = { Active: "active", Suspended: "suspended", Deleted: "deleted", } as const; export type ListClusterOrgsStatus = ClosedEnum; export type Organizations = { id: string; slug: string; name: string; logo: string | null; status: ListClusterOrgsStatus; createdAt: string; memberCount?: number | undefined; apiKeyCount?: number | undefined; }; /** * OK */ export type ListClusterOrgsResponseBody = { organizations: Array; }; /** @internal */ export const ListClusterOrgsRequest$inboundSchema: z.ZodType< ListClusterOrgsRequest, z.ZodTypeDef, unknown > = z.object({ "X-On-Behalf-Of": z.string().optional(), }).transform((v) => { return remap$(v, { "X-On-Behalf-Of": "xOnBehalfOf", }); }); /** @internal */ export type ListClusterOrgsRequest$Outbound = { "X-On-Behalf-Of"?: string | undefined; }; /** @internal */ export const ListClusterOrgsRequest$outboundSchema: z.ZodType< ListClusterOrgsRequest$Outbound, z.ZodTypeDef, ListClusterOrgsRequest > = z.object({ xOnBehalfOf: z.string().optional(), }).transform((v) => { return remap$(v, { xOnBehalfOf: "X-On-Behalf-Of", }); }); export function listClusterOrgsRequestToJSON( listClusterOrgsRequest: ListClusterOrgsRequest, ): string { return JSON.stringify( ListClusterOrgsRequest$outboundSchema.parse(listClusterOrgsRequest), ); } export function listClusterOrgsRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ListClusterOrgsRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListClusterOrgsRequest' from JSON`, ); } /** @internal */ export const ListClusterOrgsStatus$inboundSchema: z.ZodNativeEnum< typeof ListClusterOrgsStatus > = z.nativeEnum(ListClusterOrgsStatus); /** @internal */ export const ListClusterOrgsStatus$outboundSchema: z.ZodNativeEnum< typeof ListClusterOrgsStatus > = ListClusterOrgsStatus$inboundSchema; /** @internal */ export const Organizations$inboundSchema: z.ZodType< Organizations, z.ZodTypeDef, unknown > = z.object({ id: z.string(), slug: z.string(), name: z.string(), logo: z.nullable(z.string()), status: ListClusterOrgsStatus$inboundSchema, createdAt: z.string(), memberCount: z.number().optional(), apiKeyCount: z.number().optional(), }); /** @internal */ export type Organizations$Outbound = { id: string; slug: string; name: string; logo: string | null; status: string; createdAt: string; memberCount?: number | undefined; apiKeyCount?: number | undefined; }; /** @internal */ export const Organizations$outboundSchema: z.ZodType< Organizations$Outbound, z.ZodTypeDef, Organizations > = z.object({ id: z.string(), slug: z.string(), name: z.string(), logo: z.nullable(z.string()), status: ListClusterOrgsStatus$outboundSchema, createdAt: z.string(), memberCount: z.number().optional(), apiKeyCount: z.number().optional(), }); export function organizationsToJSON(organizations: Organizations): string { return JSON.stringify(Organizations$outboundSchema.parse(organizations)); } export function organizationsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Organizations$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Organizations' from JSON`, ); } /** @internal */ export const ListClusterOrgsResponseBody$inboundSchema: z.ZodType< ListClusterOrgsResponseBody, z.ZodTypeDef, unknown > = z.object({ organizations: z.array(z.lazy(() => Organizations$inboundSchema)), }); /** @internal */ export type ListClusterOrgsResponseBody$Outbound = { organizations: Array; }; /** @internal */ export const ListClusterOrgsResponseBody$outboundSchema: z.ZodType< ListClusterOrgsResponseBody$Outbound, z.ZodTypeDef, ListClusterOrgsResponseBody > = z.object({ organizations: z.array(z.lazy(() => Organizations$outboundSchema)), }); export function listClusterOrgsResponseBodyToJSON( listClusterOrgsResponseBody: ListClusterOrgsResponseBody, ): string { return JSON.stringify( ListClusterOrgsResponseBody$outboundSchema.parse( listClusterOrgsResponseBody, ), ); } export function listClusterOrgsResponseBodyFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ListClusterOrgsResponseBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListClusterOrgsResponseBody' from JSON`, ); }