/* * 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 * as errors from "../errors/index.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type GenAudioToTextResponse = { /** * 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; /** * Successful Response */ textResponse?: components.TextResponse | undefined; /** * Error */ studioApiError?: errors.StudioApiError | undefined; }; /** @internal */ export const GenAudioToTextResponse$inboundSchema: z.ZodType< GenAudioToTextResponse, z.ZodTypeDef, unknown > = z.object({ ContentType: z.string(), StatusCode: z.number().int(), RawResponse: z.instanceof(Response), TextResponse: components.TextResponse$inboundSchema.optional(), "studio-api-error": errors.StudioApiError$inboundSchema.optional(), }).transform((v) => { return remap$(v, { "ContentType": "contentType", "StatusCode": "statusCode", "RawResponse": "rawResponse", "TextResponse": "textResponse", "studio-api-error": "studioApiError", }); }); /** @internal */ export type GenAudioToTextResponse$Outbound = { ContentType: string; StatusCode: number; RawResponse: never; TextResponse?: components.TextResponse$Outbound | undefined; "studio-api-error"?: errors.StudioApiError$Outbound | undefined; }; /** @internal */ export const GenAudioToTextResponse$outboundSchema: z.ZodType< GenAudioToTextResponse$Outbound, z.ZodTypeDef, GenAudioToTextResponse > = z.object({ contentType: z.string(), statusCode: z.number().int(), rawResponse: z.instanceof(Response).transform(() => { throw new Error("Response cannot be serialized"); }), textResponse: components.TextResponse$outboundSchema.optional(), studioApiError: errors.StudioApiError$outboundSchema.optional(), }).transform((v) => { return remap$(v, { contentType: "ContentType", statusCode: "StatusCode", rawResponse: "RawResponse", textResponse: "TextResponse", studioApiError: "studio-api-error", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace GenAudioToTextResponse$ { /** @deprecated use `GenAudioToTextResponse$inboundSchema` instead. */ export const inboundSchema = GenAudioToTextResponse$inboundSchema; /** @deprecated use `GenAudioToTextResponse$outboundSchema` instead. */ export const outboundSchema = GenAudioToTextResponse$outboundSchema; /** @deprecated use `GenAudioToTextResponse$Outbound` instead. */ export type Outbound = GenAudioToTextResponse$Outbound; } export function genAudioToTextResponseToJSON( genAudioToTextResponse: GenAudioToTextResponse, ): string { return JSON.stringify( GenAudioToTextResponse$outboundSchema.parse(genAudioToTextResponse), ); } export function genAudioToTextResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => GenAudioToTextResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GenAudioToTextResponse' from JSON`, ); }