/* * 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 TerminateServiceRequest = { id: string; /** * Optional external end-user identifier forwarded by the API gateway. */ xOnBehalfOf?: string | undefined; }; export type TerminateServiceResponse = | components.ComputeService | components.ComputeErrorEnvelope; /** @internal */ export const TerminateServiceRequest$inboundSchema: z.ZodType< TerminateServiceRequest, 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 TerminateServiceRequest$Outbound = { id: string; "X-On-Behalf-Of"?: string | undefined; }; /** @internal */ export const TerminateServiceRequest$outboundSchema: z.ZodType< TerminateServiceRequest$Outbound, z.ZodTypeDef, TerminateServiceRequest > = z.object({ id: z.string(), xOnBehalfOf: z.string().optional(), }).transform((v) => { return remap$(v, { xOnBehalfOf: "X-On-Behalf-Of", }); }); export function terminateServiceRequestToJSON( terminateServiceRequest: TerminateServiceRequest, ): string { return JSON.stringify( TerminateServiceRequest$outboundSchema.parse(terminateServiceRequest), ); } export function terminateServiceRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => TerminateServiceRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'TerminateServiceRequest' from JSON`, ); } /** @internal */ export const TerminateServiceResponse$inboundSchema: z.ZodType< TerminateServiceResponse, z.ZodTypeDef, unknown > = z.union([ components.ComputeService$inboundSchema, components.ComputeErrorEnvelope$inboundSchema, ]); /** @internal */ export type TerminateServiceResponse$Outbound = | components.ComputeService$Outbound | components.ComputeErrorEnvelope$Outbound; /** @internal */ export const TerminateServiceResponse$outboundSchema: z.ZodType< TerminateServiceResponse$Outbound, z.ZodTypeDef, TerminateServiceResponse > = z.union([ components.ComputeService$outboundSchema, components.ComputeErrorEnvelope$outboundSchema, ]); export function terminateServiceResponseToJSON( terminateServiceResponse: TerminateServiceResponse, ): string { return JSON.stringify( TerminateServiceResponse$outboundSchema.parse(terminateServiceResponse), ); } export function terminateServiceResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => TerminateServiceResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'TerminateServiceResponse' from JSON`, ); }