/* * 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 "../errors/sdkvalidationerror.js"; import { Attestation, Attestation$inboundSchema, Attestation$Outbound, Attestation$outboundSchema, } from "./attestation.js"; import { PlaybackPolicy, PlaybackPolicy$inboundSchema, PlaybackPolicy$Outbound, PlaybackPolicy$outboundSchema, } from "./playbackpolicy.js"; export enum PlaybackInfoType { Live = "live", Vod = "vod", Recording = "recording", } export enum Live { Zero = 0, One = 1, } /** * Human Readable Name */ export enum Hrn { HlsTs = "HLS (TS)", Mp4 = "MP4", WebRTCH264 = "WebRTC (H264)", FlvH264 = "FLV (H264)", ThumbnailJPEG = "Thumbnail (JPEG)", ThumbnailPNG = "Thumbnail (PNG)", Thumbnails = "Thumbnails", } export enum PlaybackInfoSchemasType { Html5ApplicationVndAppleMpegurl = "html5/application/vnd.apple.mpegurl", Html5VideoMp4 = "html5/video/mp4", Html5VideoH264 = "html5/video/h264", VideoXFlv = "video/x-flv", ImageJpeg = "image/jpeg", ImagePng = "image/png", TextVtt = "text/vtt", } export type PlaybackInfoSource = { /** * Human Readable Name */ hrn: Hrn; type: PlaybackInfoSchemasType; url: string; size?: number | undefined; width?: number | undefined; height?: number | undefined; bitrate?: number | undefined; }; export enum PlaybackInfoHrn { HlsTs = "HLS (TS)", } export enum PlaybackInfoSchemasMetaType { Html5ApplicationVndAppleMpegurl = "html5/application/vnd.apple.mpegurl", } export type DvrPlayback = { hrn?: PlaybackInfoHrn | undefined; type?: PlaybackInfoSchemasMetaType | undefined; url?: string | undefined; error?: string | undefined; }; export type Meta = { live?: Live | undefined; /** * Whether the playback policy for an asset or stream is public or signed */ playbackPolicy?: PlaybackPolicy | null | undefined; source: Array; dvrPlayback?: Array | undefined; attestation?: Attestation | undefined; }; export type PlaybackInfo = { type: PlaybackInfoType; meta: Meta; }; /** @internal */ export const PlaybackInfoType$inboundSchema: z.ZodNativeEnum< typeof PlaybackInfoType > = z.nativeEnum(PlaybackInfoType); /** @internal */ export const PlaybackInfoType$outboundSchema: z.ZodNativeEnum< typeof PlaybackInfoType > = PlaybackInfoType$inboundSchema; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace PlaybackInfoType$ { /** @deprecated use `PlaybackInfoType$inboundSchema` instead. */ export const inboundSchema = PlaybackInfoType$inboundSchema; /** @deprecated use `PlaybackInfoType$outboundSchema` instead. */ export const outboundSchema = PlaybackInfoType$outboundSchema; } /** @internal */ export const Live$inboundSchema: z.ZodNativeEnum = z.nativeEnum( Live, ); /** @internal */ export const Live$outboundSchema: z.ZodNativeEnum = Live$inboundSchema; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace Live$ { /** @deprecated use `Live$inboundSchema` instead. */ export const inboundSchema = Live$inboundSchema; /** @deprecated use `Live$outboundSchema` instead. */ export const outboundSchema = Live$outboundSchema; } /** @internal */ export const Hrn$inboundSchema: z.ZodNativeEnum = z.nativeEnum(Hrn); /** @internal */ export const Hrn$outboundSchema: z.ZodNativeEnum = Hrn$inboundSchema; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace Hrn$ { /** @deprecated use `Hrn$inboundSchema` instead. */ export const inboundSchema = Hrn$inboundSchema; /** @deprecated use `Hrn$outboundSchema` instead. */ export const outboundSchema = Hrn$outboundSchema; } /** @internal */ export const PlaybackInfoSchemasType$inboundSchema: z.ZodNativeEnum< typeof PlaybackInfoSchemasType > = z.nativeEnum(PlaybackInfoSchemasType); /** @internal */ export const PlaybackInfoSchemasType$outboundSchema: z.ZodNativeEnum< typeof PlaybackInfoSchemasType > = PlaybackInfoSchemasType$inboundSchema; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace PlaybackInfoSchemasType$ { /** @deprecated use `PlaybackInfoSchemasType$inboundSchema` instead. */ export const inboundSchema = PlaybackInfoSchemasType$inboundSchema; /** @deprecated use `PlaybackInfoSchemasType$outboundSchema` instead. */ export const outboundSchema = PlaybackInfoSchemasType$outboundSchema; } /** @internal */ export const PlaybackInfoSource$inboundSchema: z.ZodType< PlaybackInfoSource, z.ZodTypeDef, unknown > = z.object({ hrn: Hrn$inboundSchema, type: PlaybackInfoSchemasType$inboundSchema, url: z.string(), size: z.number().optional(), width: z.number().optional(), height: z.number().optional(), bitrate: z.number().optional(), }); /** @internal */ export type PlaybackInfoSource$Outbound = { hrn: string; type: string; url: string; size?: number | undefined; width?: number | undefined; height?: number | undefined; bitrate?: number | undefined; }; /** @internal */ export const PlaybackInfoSource$outboundSchema: z.ZodType< PlaybackInfoSource$Outbound, z.ZodTypeDef, PlaybackInfoSource > = z.object({ hrn: Hrn$outboundSchema, type: PlaybackInfoSchemasType$outboundSchema, url: z.string(), size: z.number().optional(), width: z.number().optional(), height: z.number().optional(), bitrate: z.number().optional(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace PlaybackInfoSource$ { /** @deprecated use `PlaybackInfoSource$inboundSchema` instead. */ export const inboundSchema = PlaybackInfoSource$inboundSchema; /** @deprecated use `PlaybackInfoSource$outboundSchema` instead. */ export const outboundSchema = PlaybackInfoSource$outboundSchema; /** @deprecated use `PlaybackInfoSource$Outbound` instead. */ export type Outbound = PlaybackInfoSource$Outbound; } export function playbackInfoSourceToJSON( playbackInfoSource: PlaybackInfoSource, ): string { return JSON.stringify( PlaybackInfoSource$outboundSchema.parse(playbackInfoSource), ); } export function playbackInfoSourceFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PlaybackInfoSource$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PlaybackInfoSource' from JSON`, ); } /** @internal */ export const PlaybackInfoHrn$inboundSchema: z.ZodNativeEnum< typeof PlaybackInfoHrn > = z.nativeEnum(PlaybackInfoHrn); /** @internal */ export const PlaybackInfoHrn$outboundSchema: z.ZodNativeEnum< typeof PlaybackInfoHrn > = PlaybackInfoHrn$inboundSchema; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace PlaybackInfoHrn$ { /** @deprecated use `PlaybackInfoHrn$inboundSchema` instead. */ export const inboundSchema = PlaybackInfoHrn$inboundSchema; /** @deprecated use `PlaybackInfoHrn$outboundSchema` instead. */ export const outboundSchema = PlaybackInfoHrn$outboundSchema; } /** @internal */ export const PlaybackInfoSchemasMetaType$inboundSchema: z.ZodNativeEnum< typeof PlaybackInfoSchemasMetaType > = z.nativeEnum(PlaybackInfoSchemasMetaType); /** @internal */ export const PlaybackInfoSchemasMetaType$outboundSchema: z.ZodNativeEnum< typeof PlaybackInfoSchemasMetaType > = PlaybackInfoSchemasMetaType$inboundSchema; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace PlaybackInfoSchemasMetaType$ { /** @deprecated use `PlaybackInfoSchemasMetaType$inboundSchema` instead. */ export const inboundSchema = PlaybackInfoSchemasMetaType$inboundSchema; /** @deprecated use `PlaybackInfoSchemasMetaType$outboundSchema` instead. */ export const outboundSchema = PlaybackInfoSchemasMetaType$outboundSchema; } /** @internal */ export const DvrPlayback$inboundSchema: z.ZodType< DvrPlayback, z.ZodTypeDef, unknown > = z.object({ hrn: PlaybackInfoHrn$inboundSchema.optional(), type: PlaybackInfoSchemasMetaType$inboundSchema.optional(), url: z.string().optional(), error: z.string().optional(), }); /** @internal */ export type DvrPlayback$Outbound = { hrn?: string | undefined; type?: string | undefined; url?: string | undefined; error?: string | undefined; }; /** @internal */ export const DvrPlayback$outboundSchema: z.ZodType< DvrPlayback$Outbound, z.ZodTypeDef, DvrPlayback > = z.object({ hrn: PlaybackInfoHrn$outboundSchema.optional(), type: PlaybackInfoSchemasMetaType$outboundSchema.optional(), url: z.string().optional(), error: z.string().optional(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace DvrPlayback$ { /** @deprecated use `DvrPlayback$inboundSchema` instead. */ export const inboundSchema = DvrPlayback$inboundSchema; /** @deprecated use `DvrPlayback$outboundSchema` instead. */ export const outboundSchema = DvrPlayback$outboundSchema; /** @deprecated use `DvrPlayback$Outbound` instead. */ export type Outbound = DvrPlayback$Outbound; } export function dvrPlaybackToJSON(dvrPlayback: DvrPlayback): string { return JSON.stringify(DvrPlayback$outboundSchema.parse(dvrPlayback)); } export function dvrPlaybackFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => DvrPlayback$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'DvrPlayback' from JSON`, ); } /** @internal */ export const Meta$inboundSchema: z.ZodType = z .object({ live: Live$inboundSchema.optional(), playbackPolicy: z.nullable(PlaybackPolicy$inboundSchema).optional(), source: z.array(z.lazy(() => PlaybackInfoSource$inboundSchema)), dvrPlayback: z.array(z.lazy(() => DvrPlayback$inboundSchema)).optional(), attestation: Attestation$inboundSchema.optional(), }); /** @internal */ export type Meta$Outbound = { live?: number | undefined; playbackPolicy?: PlaybackPolicy$Outbound | null | undefined; source: Array; dvrPlayback?: Array | undefined; attestation?: Attestation$Outbound | undefined; }; /** @internal */ export const Meta$outboundSchema: z.ZodType = z.object({ live: Live$outboundSchema.optional(), playbackPolicy: z.nullable(PlaybackPolicy$outboundSchema).optional(), source: z.array(z.lazy(() => PlaybackInfoSource$outboundSchema)), dvrPlayback: z.array(z.lazy(() => DvrPlayback$outboundSchema)).optional(), attestation: Attestation$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 Meta$ { /** @deprecated use `Meta$inboundSchema` instead. */ export const inboundSchema = Meta$inboundSchema; /** @deprecated use `Meta$outboundSchema` instead. */ export const outboundSchema = Meta$outboundSchema; /** @deprecated use `Meta$Outbound` instead. */ export type Outbound = Meta$Outbound; } export function metaToJSON(meta: Meta): string { return JSON.stringify(Meta$outboundSchema.parse(meta)); } export function metaFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Meta$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Meta' from JSON`, ); } /** @internal */ export const PlaybackInfo$inboundSchema: z.ZodType< PlaybackInfo, z.ZodTypeDef, unknown > = z.object({ type: PlaybackInfoType$inboundSchema, meta: z.lazy(() => Meta$inboundSchema), }); /** @internal */ export type PlaybackInfo$Outbound = { type: string; meta: Meta$Outbound; }; /** @internal */ export const PlaybackInfo$outboundSchema: z.ZodType< PlaybackInfo$Outbound, z.ZodTypeDef, PlaybackInfo > = z.object({ type: PlaybackInfoType$outboundSchema, meta: z.lazy(() => Meta$outboundSchema), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace PlaybackInfo$ { /** @deprecated use `PlaybackInfo$inboundSchema` instead. */ export const inboundSchema = PlaybackInfo$inboundSchema; /** @deprecated use `PlaybackInfo$outboundSchema` instead. */ export const outboundSchema = PlaybackInfo$outboundSchema; /** @deprecated use `PlaybackInfo$Outbound` instead. */ export type Outbound = PlaybackInfo$Outbound; } export function playbackInfoToJSON(playbackInfo: PlaybackInfo): string { return JSON.stringify(PlaybackInfo$outboundSchema.parse(playbackInfo)); } export function playbackInfoFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PlaybackInfo$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PlaybackInfo' from JSON`, ); }