/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; 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 CreateRoomResponse = { /** * HTTP response content type for this operation */ contentType: string; /** * HTTP response status code for this operation */ statusCode: number; /** * Raw HTTP response; suitable for custom response parsing */ rawResponse: Response; /** * Success */ createRoomResponse?: components.CreateRoomResponse | undefined; /** * Error */ error?: components.ErrorT | undefined; }; /** @internal */ export const CreateRoomResponse$inboundSchema: z.ZodType< CreateRoomResponse, z.ZodTypeDef, unknown > = z.object({ ContentType: z.string(), StatusCode: z.number().int(), RawResponse: z.instanceof(Response), "create-room-response": components.CreateRoomResponse$inboundSchema .optional(), error: components.ErrorT$inboundSchema.optional(), }).transform((v) => { return remap$(v, { "ContentType": "contentType", "StatusCode": "statusCode", "RawResponse": "rawResponse", "create-room-response": "createRoomResponse", }); }); /** @internal */ export type CreateRoomResponse$Outbound = { ContentType: string; StatusCode: number; RawResponse: never; "create-room-response"?: components.CreateRoomResponse$Outbound | undefined; error?: components.ErrorT$Outbound | undefined; }; /** @internal */ export const CreateRoomResponse$outboundSchema: z.ZodType< CreateRoomResponse$Outbound, z.ZodTypeDef, CreateRoomResponse > = z.object({ contentType: z.string(), statusCode: z.number().int(), rawResponse: z.instanceof(Response).transform(() => { throw new Error("Response cannot be serialized"); }), createRoomResponse: components.CreateRoomResponse$outboundSchema.optional(), error: components.ErrorT$outboundSchema.optional(), }).transform((v) => { return remap$(v, { contentType: "ContentType", statusCode: "StatusCode", rawResponse: "RawResponse", createRoomResponse: "create-room-response", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace CreateRoomResponse$ { /** @deprecated use `CreateRoomResponse$inboundSchema` instead. */ export const inboundSchema = CreateRoomResponse$inboundSchema; /** @deprecated use `CreateRoomResponse$outboundSchema` instead. */ export const outboundSchema = CreateRoomResponse$outboundSchema; /** @deprecated use `CreateRoomResponse$Outbound` instead. */ export type Outbound = CreateRoomResponse$Outbound; } export function createRoomResponseToJSON( createRoomResponse: CreateRoomResponse, ): string { return JSON.stringify( CreateRoomResponse$outboundSchema.parse(createRoomResponse), ); } export function createRoomResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => CreateRoomResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateRoomResponse' from JSON`, ); }