/* * 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 { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type WordTimestamp = { startTime: number; endTime: number; word: string; probability: number; }; /** @internal */ export const WordTimestamp$inboundSchema: z.ZodType< WordTimestamp, z.ZodTypeDef, unknown > = z.object({ start_time: z.number(), end_time: z.number(), word: z.string(), probability: z.number(), }).transform((v) => { return remap$(v, { "start_time": "startTime", "end_time": "endTime", }); }); /** @internal */ export type WordTimestamp$Outbound = { start_time: number; end_time: number; word: string; probability: number; }; /** @internal */ export const WordTimestamp$outboundSchema: z.ZodType< WordTimestamp$Outbound, z.ZodTypeDef, WordTimestamp > = z.object({ startTime: z.number(), endTime: z.number(), word: z.string(), probability: z.number(), }).transform((v) => { return remap$(v, { startTime: "start_time", endTime: "end_time", }); }); export function wordTimestampToJSON(wordTimestamp: WordTimestamp): string { return JSON.stringify(WordTimestamp$outboundSchema.parse(wordTimestamp)); } export function wordTimestampFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => WordTimestamp$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'WordTimestamp' from JSON`, ); }