/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; import { safeParse } from "../lib/schemas.js"; import { Result as SafeParseResult } from "../types/fp.js"; import { SDKValidationError } from "./sdkvalidationerror.js"; import { TranscriptionSegment, TranscriptionSegment$inboundSchema, TranscriptionSegment$Outbound, TranscriptionSegment$outboundSchema, } from "./transcriptionsegment.js"; import { TranscriptionWord, TranscriptionWord$inboundSchema, TranscriptionWord$Outbound, TranscriptionWord$outboundSchema, } from "./transcriptionword.js"; export type TranscriptionVerboseResponse = { /** * The task which was performed. Either `transcribe` or `translate`. */ task?: string | undefined; /** * The language of the transcribed/translated text. */ language: string; /** * The duration of the transcribed/translated audio, in seconds. */ duration: number; /** * The transcribed/translated text. */ text: string; /** * Extracted words and their corresponding timestamps. */ words?: Array | null | undefined; /** * Segments of the transcribed/translated text and their corresponding details. */ segments?: Array | null | undefined; }; /** @internal */ export const TranscriptionVerboseResponse$inboundSchema: z.ZodType< TranscriptionVerboseResponse, z.ZodTypeDef, unknown > = z.object({ task: z.string().default("transcribe"), language: z.string(), duration: z.number(), text: z.string(), words: z.nullable(z.array(TranscriptionWord$inboundSchema)).optional(), segments: z.nullable(z.array(TranscriptionSegment$inboundSchema)).optional(), }); /** @internal */ export type TranscriptionVerboseResponse$Outbound = { task: string; language: string; duration: number; text: string; words?: Array | null | undefined; segments?: Array | null | undefined; }; /** @internal */ export const TranscriptionVerboseResponse$outboundSchema: z.ZodType< TranscriptionVerboseResponse$Outbound, z.ZodTypeDef, TranscriptionVerboseResponse > = z.object({ task: z.string().default("transcribe"), language: z.string(), duration: z.number(), text: z.string(), words: z.nullable(z.array(TranscriptionWord$outboundSchema)).optional(), segments: z.nullable(z.array(TranscriptionSegment$outboundSchema)).optional(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace TranscriptionVerboseResponse$ { /** @deprecated use `TranscriptionVerboseResponse$inboundSchema` instead. */ export const inboundSchema = TranscriptionVerboseResponse$inboundSchema; /** @deprecated use `TranscriptionVerboseResponse$outboundSchema` instead. */ export const outboundSchema = TranscriptionVerboseResponse$outboundSchema; /** @deprecated use `TranscriptionVerboseResponse$Outbound` instead. */ export type Outbound = TranscriptionVerboseResponse$Outbound; } export function transcriptionVerboseResponseToJSON( transcriptionVerboseResponse: TranscriptionVerboseResponse, ): string { return JSON.stringify( TranscriptionVerboseResponse$outboundSchema.parse( transcriptionVerboseResponse, ), ); } export function transcriptionVerboseResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => TranscriptionVerboseResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'TranscriptionVerboseResponse' from JSON`, ); }