/* * 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 PostMediasMediaHashedIdLocalizationsRequestBody = { /** * The language to localize the media to as a 3-character IETF language code. */ outputLanguage: string; /** * Whether to automatically enable the localization. */ autoEnable?: boolean | undefined; }; export type PostMediasMediaHashedIdLocalizationsRequest = { /** * The hashed ID of the media to create a localization for. */ mediaHashedId: string; requestBody?: PostMediasMediaHashedIdLocalizationsRequestBody | undefined; }; /** * The media that the localization is associated with. */ export type PostMediasMediaHashedIdLocalizationsSourceMedia = { /** * A unique alphanumeric identifier for this media. */ hashedId: string; /** * The name of the media. */ name: string; /** * The duration of the media in seconds. */ duration: number; /** * The date when the media was created. */ createdAt: Date; /** * The date when the media was last updated. */ updatedAt: Date; }; /** * The transcript for the localization. Selectively serialized in some endpoints. See properties for endpoint. */ export type PostMediasMediaHashedIdLocalizationsTranscript = { /** * A unique alphanumeric identifier for this transcript. */ hashedId: string; /** * The name of the language in English. */ languageName: string; /** * The name of the language in the language of the localization. */ nativeLanguageName: string; /** * The text of the transcript. */ text: string; /** * The date when the transcript was created. */ createdAt: Date; /** * The date when the transcript was last updated. */ updatedAt: Date; }; /** * A localization is a translation of a media into another language. * * @remarks */ export type PostMediasMediaHashedIdLocalizationsResponse = { /** * A unique alphanumeric identifier for this localization. */ hashedId: string; /** * A 3-character language code as specified by IETF. */ languageCode: string; /** * A 2-character language code as specified by ISO-639–2. */ iso6392LanguageCode: string; /** * The name of the language in English. */ languageName: string; /** * The name of the language in the language of the localization. */ nativeLanguageName: string; /** * The date when the localization was created. */ createdAt: Date; /** * The date when the localization was last updated. */ updatedAt: Date; /** * The date when the localization was ordered. */ orderedAt: Date | null; /** * The date when the localization was enabled. */ enabledAt: Date | null; /** * Whether or not the localization is enabled. */ enabled: boolean; /** * The media that the localization is associated with. */ sourceMedia: PostMediasMediaHashedIdLocalizationsSourceMedia; /** * The transcript for the localization. Selectively serialized in some endpoints. See properties for endpoint. */ transcript?: | PostMediasMediaHashedIdLocalizationsTranscript | null | undefined; /** * Whether or not the dubbing will be automatically enabled when completed. */ autoEnableDubbing: boolean; /** * The expected number of minutes that will be billed for the dubbing. */ expectedBilledMinutes?: number | null | undefined; /** * The expected price per minute that will be billed for the dubbing. */ expectedBilledPricePerMinute?: number | null | undefined; /** * The expected total price that will be billed for the dubbing. */ expectedBilledPrice?: number | null | undefined; /** * The date when the dubbing was billed. */ billedAt?: Date | null | undefined; }; /** @internal */ export type PostMediasMediaHashedIdLocalizationsRequestBody$Outbound = { output_language: string; auto_enable: boolean; }; /** @internal */ export const PostMediasMediaHashedIdLocalizationsRequestBody$outboundSchema: z.ZodType< PostMediasMediaHashedIdLocalizationsRequestBody$Outbound, z.ZodTypeDef, PostMediasMediaHashedIdLocalizationsRequestBody > = z.object({ outputLanguage: z.string(), autoEnable: z.boolean().default(true), }).transform((v) => { return remap$(v, { outputLanguage: "output_language", autoEnable: "auto_enable", }); }); export function postMediasMediaHashedIdLocalizationsRequestBodyToJSON( postMediasMediaHashedIdLocalizationsRequestBody: PostMediasMediaHashedIdLocalizationsRequestBody, ): string { return JSON.stringify( PostMediasMediaHashedIdLocalizationsRequestBody$outboundSchema.parse( postMediasMediaHashedIdLocalizationsRequestBody, ), ); } /** @internal */ export type PostMediasMediaHashedIdLocalizationsRequest$Outbound = { mediaHashedId: string; RequestBody?: | PostMediasMediaHashedIdLocalizationsRequestBody$Outbound | undefined; }; /** @internal */ export const PostMediasMediaHashedIdLocalizationsRequest$outboundSchema: z.ZodType< PostMediasMediaHashedIdLocalizationsRequest$Outbound, z.ZodTypeDef, PostMediasMediaHashedIdLocalizationsRequest > = z.object({ mediaHashedId: z.string(), requestBody: z.lazy(() => PostMediasMediaHashedIdLocalizationsRequestBody$outboundSchema ).optional(), }).transform((v) => { return remap$(v, { requestBody: "RequestBody", }); }); export function postMediasMediaHashedIdLocalizationsRequestToJSON( postMediasMediaHashedIdLocalizationsRequest: PostMediasMediaHashedIdLocalizationsRequest, ): string { return JSON.stringify( PostMediasMediaHashedIdLocalizationsRequest$outboundSchema.parse( postMediasMediaHashedIdLocalizationsRequest, ), ); } /** @internal */ export const PostMediasMediaHashedIdLocalizationsSourceMedia$inboundSchema: z.ZodType< PostMediasMediaHashedIdLocalizationsSourceMedia, z.ZodTypeDef, unknown > = z.object({ hashed_id: z.string(), name: z.string(), duration: z.number(), created_at: z.string().datetime({ offset: true }).transform(v => new Date(v) ), updated_at: z.string().datetime({ offset: true }).transform(v => new Date(v) ), }).transform((v) => { return remap$(v, { "hashed_id": "hashedId", "created_at": "createdAt", "updated_at": "updatedAt", }); }); export function postMediasMediaHashedIdLocalizationsSourceMediaFromJSON( jsonString: string, ): SafeParseResult< PostMediasMediaHashedIdLocalizationsSourceMedia, SDKValidationError > { return safeParse( jsonString, (x) => PostMediasMediaHashedIdLocalizationsSourceMedia$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'PostMediasMediaHashedIdLocalizationsSourceMedia' from JSON`, ); } /** @internal */ export const PostMediasMediaHashedIdLocalizationsTranscript$inboundSchema: z.ZodType< PostMediasMediaHashedIdLocalizationsTranscript, z.ZodTypeDef, unknown > = z.object({ hashed_id: z.string(), language_name: z.string(), native_language_name: z.string(), text: z.string(), created_at: z.string().datetime({ offset: true }).transform(v => new Date(v) ), updated_at: z.string().datetime({ offset: true }).transform(v => new Date(v) ), }).transform((v) => { return remap$(v, { "hashed_id": "hashedId", "language_name": "languageName", "native_language_name": "nativeLanguageName", "created_at": "createdAt", "updated_at": "updatedAt", }); }); export function postMediasMediaHashedIdLocalizationsTranscriptFromJSON( jsonString: string, ): SafeParseResult< PostMediasMediaHashedIdLocalizationsTranscript, SDKValidationError > { return safeParse( jsonString, (x) => PostMediasMediaHashedIdLocalizationsTranscript$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'PostMediasMediaHashedIdLocalizationsTranscript' from JSON`, ); } /** @internal */ export const PostMediasMediaHashedIdLocalizationsResponse$inboundSchema: z.ZodType< PostMediasMediaHashedIdLocalizationsResponse, z.ZodTypeDef, unknown > = z.object({ hashed_id: z.string(), language_code: z.string(), iso639_2_language_code: z.string(), language_name: z.string(), native_language_name: z.string(), created_at: z.string().datetime({ offset: true }).transform(v => new Date(v) ), updated_at: z.string().datetime({ offset: true }).transform(v => new Date(v) ), ordered_at: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ), enabled_at: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ), enabled: z.boolean(), source_media: z.lazy(() => PostMediasMediaHashedIdLocalizationsSourceMedia$inboundSchema ), transcript: z.nullable( z.lazy(() => PostMediasMediaHashedIdLocalizationsTranscript$inboundSchema ), ).optional(), auto_enable_dubbing: z.boolean(), expected_billed_minutes: z.nullable(z.number()).optional(), expected_billed_price_per_minute: z.nullable(z.number()).optional(), expected_billed_price: z.nullable(z.number()).optional(), billed_at: z.nullable( z.string().datetime({ offset: true }).transform(v => new Date(v)), ).optional(), }).transform((v) => { return remap$(v, { "hashed_id": "hashedId", "language_code": "languageCode", "iso639_2_language_code": "iso6392LanguageCode", "language_name": "languageName", "native_language_name": "nativeLanguageName", "created_at": "createdAt", "updated_at": "updatedAt", "ordered_at": "orderedAt", "enabled_at": "enabledAt", "source_media": "sourceMedia", "auto_enable_dubbing": "autoEnableDubbing", "expected_billed_minutes": "expectedBilledMinutes", "expected_billed_price_per_minute": "expectedBilledPricePerMinute", "expected_billed_price": "expectedBilledPrice", "billed_at": "billedAt", }); }); export function postMediasMediaHashedIdLocalizationsResponseFromJSON( jsonString: string, ): SafeParseResult< PostMediasMediaHashedIdLocalizationsResponse, SDKValidationError > { return safeParse( jsonString, (x) => PostMediasMediaHashedIdLocalizationsResponse$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'PostMediasMediaHashedIdLocalizationsResponse' from JSON`, ); }