/* * 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 { SDKValidationError } from "./errors/sdkvalidationerror.js"; export type GetUsageResponseV1Data = { /** * The date of the API usage in YYYY-MM-DD format. */ date: string; /** * The unique identifier for the voice used in the API call. */ voiceId: string; /** * The name of the voice used in the API call. */ name?: string | undefined; /** * The style of the voice used in the API call. */ style?: string | undefined; /** * The language of the voice used in the API call. */ language?: string | undefined; /** * The total duration (in minutes) of API usage for the specified voice and date. */ totalMinutesUsed: number; /** * The model name used for text-to-speech. */ model?: string | undefined; /** * The URL to the thumbnail image for the voice. */ thumbnailUrl?: string | undefined; }; /** @internal */ export const GetUsageResponseV1Data$inboundSchema: z.ZodType< GetUsageResponseV1Data, z.ZodTypeDef, unknown > = z.object({ date: z.string(), voice_id: z.string(), name: z.string().optional(), style: z.string().optional(), language: z.string().optional(), total_minutes_used: z.number(), model: z.string().optional(), thumbnail_url: z.string().optional(), }).transform((v) => { return remap$(v, { "voice_id": "voiceId", "total_minutes_used": "totalMinutesUsed", "thumbnail_url": "thumbnailUrl", }); }); /** @internal */ export type GetUsageResponseV1Data$Outbound = { date: string; voice_id: string; name?: string | undefined; style?: string | undefined; language?: string | undefined; total_minutes_used: number; model?: string | undefined; thumbnail_url?: string | undefined; }; /** @internal */ export const GetUsageResponseV1Data$outboundSchema: z.ZodType< GetUsageResponseV1Data$Outbound, z.ZodTypeDef, GetUsageResponseV1Data > = z.object({ date: z.string(), voiceId: z.string(), name: z.string().optional(), style: z.string().optional(), language: z.string().optional(), totalMinutesUsed: z.number(), model: z.string().optional(), thumbnailUrl: z.string().optional(), }).transform((v) => { return remap$(v, { voiceId: "voice_id", totalMinutesUsed: "total_minutes_used", thumbnailUrl: "thumbnail_url", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace GetUsageResponseV1Data$ { /** @deprecated use `GetUsageResponseV1Data$inboundSchema` instead. */ export const inboundSchema = GetUsageResponseV1Data$inboundSchema; /** @deprecated use `GetUsageResponseV1Data$outboundSchema` instead. */ export const outboundSchema = GetUsageResponseV1Data$outboundSchema; /** @deprecated use `GetUsageResponseV1Data$Outbound` instead. */ export type Outbound = GetUsageResponseV1Data$Outbound; } export function getUsageResponseV1DataToJSON( getUsageResponseV1Data: GetUsageResponseV1Data, ): string { return JSON.stringify( GetUsageResponseV1Data$outboundSchema.parse(getUsageResponseV1Data), ); } export function getUsageResponseV1DataFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => GetUsageResponseV1Data$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetUsageResponseV1Data' from JSON`, ); }