/* * 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 { Result as SafeParseResult } from "../../types/fp.js"; import * as components from "../components/index.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type GetComputeTenantRequest = { orgId: string; /** * Optional external end-user identifier forwarded by the API gateway. */ xOnBehalfOf?: string | undefined; }; export type GetComputeTenantResponse = | components.ComputeTenant | components.ComputeErrorEnvelope; /** @internal */ export const GetComputeTenantRequest$inboundSchema: z.ZodType< GetComputeTenantRequest, z.ZodTypeDef, unknown > = z.object({ org_id: z.string(), "X-On-Behalf-Of": z.string().optional(), }).transform((v) => { return remap$(v, { "org_id": "orgId", "X-On-Behalf-Of": "xOnBehalfOf", }); }); /** @internal */ export type GetComputeTenantRequest$Outbound = { org_id: string; "X-On-Behalf-Of"?: string | undefined; }; /** @internal */ export const GetComputeTenantRequest$outboundSchema: z.ZodType< GetComputeTenantRequest$Outbound, z.ZodTypeDef, GetComputeTenantRequest > = z.object({ orgId: z.string(), xOnBehalfOf: z.string().optional(), }).transform((v) => { return remap$(v, { orgId: "org_id", xOnBehalfOf: "X-On-Behalf-Of", }); }); export function getComputeTenantRequestToJSON( getComputeTenantRequest: GetComputeTenantRequest, ): string { return JSON.stringify( GetComputeTenantRequest$outboundSchema.parse(getComputeTenantRequest), ); } export function getComputeTenantRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => GetComputeTenantRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetComputeTenantRequest' from JSON`, ); } /** @internal */ export const GetComputeTenantResponse$inboundSchema: z.ZodType< GetComputeTenantResponse, z.ZodTypeDef, unknown > = z.union([ components.ComputeTenant$inboundSchema, components.ComputeErrorEnvelope$inboundSchema, ]); /** @internal */ export type GetComputeTenantResponse$Outbound = | components.ComputeTenant$Outbound | components.ComputeErrorEnvelope$Outbound; /** @internal */ export const GetComputeTenantResponse$outboundSchema: z.ZodType< GetComputeTenantResponse$Outbound, z.ZodTypeDef, GetComputeTenantResponse > = z.union([ components.ComputeTenant$outboundSchema, components.ComputeErrorEnvelope$outboundSchema, ]); export function getComputeTenantResponseToJSON( getComputeTenantResponse: GetComputeTenantResponse, ): string { return JSON.stringify( GetComputeTenantResponse$outboundSchema.parse(getComputeTenantResponse), ); } export function getComputeTenantResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => GetComputeTenantResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetComputeTenantResponse' from JSON`, ); }