/* * 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 GetMediasMediaHashedIdLocalizationsLocalizationHashedIdRequest = { /** * The hashed ID of the localization's media. */ mediaHashedId: string; /** * The hashed ID of the localization. */ localizationHashedId: string; /** * Whether to include the transcript in the response. */ includeTranscript?: boolean | undefined; }; /** * The media that the localization is associated with. */ export type GetMediasMediaHashedIdLocalizationsLocalizationHashedIdSourceMedia = { /** * 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 GetMediasMediaHashedIdLocalizationsLocalizationHashedIdTranscript = { /** * 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 GetMediasMediaHashedIdLocalizationsLocalizationHashedIdResponse = { /** * 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: GetMediasMediaHashedIdLocalizationsLocalizationHashedIdSourceMedia; /** * The transcript for the localization. Selectively serialized in some endpoints. See properties for endpoint. */ transcript?: | GetMediasMediaHashedIdLocalizationsLocalizationHashedIdTranscript | null | undefined; }; /** @internal */ export type GetMediasMediaHashedIdLocalizationsLocalizationHashedIdRequest$Outbound = { mediaHashedId: string; localizationHashedId: string; include_transcript: boolean; }; /** @internal */ export const GetMediasMediaHashedIdLocalizationsLocalizationHashedIdRequest$outboundSchema: z.ZodType< GetMediasMediaHashedIdLocalizationsLocalizationHashedIdRequest$Outbound, z.ZodTypeDef, GetMediasMediaHashedIdLocalizationsLocalizationHashedIdRequest > = z.object({ mediaHashedId: z.string(), localizationHashedId: z.string(), includeTranscript: z.boolean().default(false), }).transform((v) => { return remap$(v, { includeTranscript: "include_transcript", }); }); export function getMediasMediaHashedIdLocalizationsLocalizationHashedIdRequestToJSON( getMediasMediaHashedIdLocalizationsLocalizationHashedIdRequest: GetMediasMediaHashedIdLocalizationsLocalizationHashedIdRequest, ): string { return JSON.stringify( GetMediasMediaHashedIdLocalizationsLocalizationHashedIdRequest$outboundSchema .parse(getMediasMediaHashedIdLocalizationsLocalizationHashedIdRequest), ); } /** @internal */ export const GetMediasMediaHashedIdLocalizationsLocalizationHashedIdSourceMedia$inboundSchema: z.ZodType< GetMediasMediaHashedIdLocalizationsLocalizationHashedIdSourceMedia, 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 getMediasMediaHashedIdLocalizationsLocalizationHashedIdSourceMediaFromJSON( jsonString: string, ): SafeParseResult< GetMediasMediaHashedIdLocalizationsLocalizationHashedIdSourceMedia, SDKValidationError > { return safeParse( jsonString, (x) => GetMediasMediaHashedIdLocalizationsLocalizationHashedIdSourceMedia$inboundSchema .parse(JSON.parse(x)), `Failed to parse 'GetMediasMediaHashedIdLocalizationsLocalizationHashedIdSourceMedia' from JSON`, ); } /** @internal */ export const GetMediasMediaHashedIdLocalizationsLocalizationHashedIdTranscript$inboundSchema: z.ZodType< GetMediasMediaHashedIdLocalizationsLocalizationHashedIdTranscript, 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 getMediasMediaHashedIdLocalizationsLocalizationHashedIdTranscriptFromJSON( jsonString: string, ): SafeParseResult< GetMediasMediaHashedIdLocalizationsLocalizationHashedIdTranscript, SDKValidationError > { return safeParse( jsonString, (x) => GetMediasMediaHashedIdLocalizationsLocalizationHashedIdTranscript$inboundSchema .parse(JSON.parse(x)), `Failed to parse 'GetMediasMediaHashedIdLocalizationsLocalizationHashedIdTranscript' from JSON`, ); } /** @internal */ export const GetMediasMediaHashedIdLocalizationsLocalizationHashedIdResponse$inboundSchema: z.ZodType< GetMediasMediaHashedIdLocalizationsLocalizationHashedIdResponse, 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(() => GetMediasMediaHashedIdLocalizationsLocalizationHashedIdSourceMedia$inboundSchema ), transcript: z.nullable( z.lazy(() => GetMediasMediaHashedIdLocalizationsLocalizationHashedIdTranscript$inboundSchema ), ).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", }); }); export function getMediasMediaHashedIdLocalizationsLocalizationHashedIdResponseFromJSON( jsonString: string, ): SafeParseResult< GetMediasMediaHashedIdLocalizationsLocalizationHashedIdResponse, SDKValidationError > { return safeParse( jsonString, (x) => GetMediasMediaHashedIdLocalizationsLocalizationHashedIdResponse$inboundSchema .parse(JSON.parse(x)), `Failed to parse 'GetMediasMediaHashedIdLocalizationsLocalizationHashedIdResponse' from JSON`, ); }