/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v4-mini"; import { safeParse } from "../lib/schemas.js"; import * as openEnums from "../types/enums.js"; import { OpenEnum } from "../types/enums.js"; import { Result as SafeParseResult } from "../types/fp.js"; import * as types from "../types/primitives.js"; import { SDKValidationError } from "./errors/sdk-validation-error.js"; import { SourceAudioDetails, SourceAudioDetails$inboundSchema, } from "./source-audio-details.js"; import { SourceVideoDetails, SourceVideoDetails$inboundSchema, } from "./source-video-details.js"; import { StreamAudioDetails, StreamAudioDetails$inboundSchema, } from "./stream-audio-details.js"; import { StreamVideoDetails, StreamVideoDetails$inboundSchema, } from "./stream-video-details.js"; import { SubtitleInfo, SubtitleInfo$inboundSchema } from "./subtitle-info.js"; import { TranscodeInfo, TranscodeInfo$inboundSchema, } from "./transcode-info.js"; export const StreamMediaType = { Movie: "movie", Episode: "episode", Track: "track", Live: "live", Photo: "photo", Unknown: "unknown", } as const; export type StreamMediaType = OpenEnum; export const StreamState = { Playing: "playing", Paused: "paused", Stopped: "stopped", } as const; export type StreamState = OpenEnum; export const StreamVideoDecision = { Directplay: "directplay", Copy: "copy", Transcode: "transcode", } as const; export type StreamVideoDecision = OpenEnum; export const StreamAudioDecision = { Directplay: "directplay", Copy: "copy", Transcode: "transcode", } as const; export type StreamAudioDecision = OpenEnum; export type Stream = { id: string; serverId: string; serverName: string; username: string; userThumb: string | null; userAvatarUrl: string | null; mediaTitle: string; mediaType: StreamMediaType; /** * Show name (episodes only) */ showTitle: string | null; seasonNumber: number | null; episodeNumber: number | null; year: number | null; /** * Artist name (music tracks only) */ artistName: string | null; /** * Album name (music tracks only) */ albumName: string | null; /** * Track number (music tracks only) */ trackNumber: number | null; /** * Disc number (music tracks only) */ discNumber: number | null; /** * Poster path */ thumbPath: string | null; /** * Proxied poster URL */ posterUrl: string | null; /** * Total media length */ durationMs: number | null; state: StreamState; progressMs: number; startedAt: Date; isTranscode: boolean | null; videoDecision: StreamVideoDecision | null; audioDecision: StreamAudioDecision | null; /** * Bitrate in kbps */ bitrate: number | null; sourceVideoCodec: string | null; sourceAudioCodec: string | null; sourceAudioChannels: number | null; sourceVideoWidth: number | null; sourceVideoHeight: number | null; sourceVideoDetails: SourceVideoDetails | null; sourceAudioDetails: SourceAudioDetails | null; streamVideoCodec: string | null; streamAudioCodec: string | null; streamVideoDetails: StreamVideoDetails | null; streamAudioDetails: StreamAudioDetails | null; transcodeInfo: TranscodeInfo | null; subtitleInfo: SubtitleInfo | null; /** * 4K, 1080p, 720p, etc. */ resolution: string | null; sourceVideoCodecDisplay: string | null; sourceAudioCodecDisplay: string | null; audioChannelsDisplay: string | null; streamVideoCodecDisplay: string | null; streamAudioCodecDisplay: string | null; device: string | null; player: string | null; product: string | null; platform: string | null; }; /** @internal */ export const StreamMediaType$inboundSchema: z.ZodMiniType< StreamMediaType, unknown > = openEnums.inboundSchema(StreamMediaType); /** @internal */ export const StreamState$inboundSchema: z.ZodMiniType = openEnums.inboundSchema(StreamState); /** @internal */ export const StreamVideoDecision$inboundSchema: z.ZodMiniType< StreamVideoDecision, unknown > = openEnums.inboundSchema(StreamVideoDecision); /** @internal */ export const StreamAudioDecision$inboundSchema: z.ZodMiniType< StreamAudioDecision, unknown > = openEnums.inboundSchema(StreamAudioDecision); /** @internal */ export const Stream$inboundSchema: z.ZodMiniType = z.object({ id: types.string(), serverId: types.string(), serverName: types.string(), username: types.string(), userThumb: types.nullable(types.string()), userAvatarUrl: types.nullable(types.string()), mediaTitle: types.string(), mediaType: StreamMediaType$inboundSchema, showTitle: types.nullable(types.string()), seasonNumber: types.nullable(types.number()), episodeNumber: types.nullable(types.number()), year: types.nullable(types.number()), artistName: types.nullable(types.string()), albumName: types.nullable(types.string()), trackNumber: types.nullable(types.number()), discNumber: types.nullable(types.number()), thumbPath: types.nullable(types.string()), posterUrl: types.nullable(types.string()), durationMs: types.nullable(types.number()), state: StreamState$inboundSchema, progressMs: types.number(), startedAt: types.date(), isTranscode: types.nullable(types.boolean()), videoDecision: types.nullable(StreamVideoDecision$inboundSchema), audioDecision: types.nullable(StreamAudioDecision$inboundSchema), bitrate: types.nullable(types.number()), sourceVideoCodec: types.nullable(types.string()), sourceAudioCodec: types.nullable(types.string()), sourceAudioChannels: types.nullable(types.number()), sourceVideoWidth: types.nullable(types.number()), sourceVideoHeight: types.nullable(types.number()), sourceVideoDetails: types.nullable(SourceVideoDetails$inboundSchema), sourceAudioDetails: types.nullable(SourceAudioDetails$inboundSchema), streamVideoCodec: types.nullable(types.string()), streamAudioCodec: types.nullable(types.string()), streamVideoDetails: types.nullable(StreamVideoDetails$inboundSchema), streamAudioDetails: types.nullable(StreamAudioDetails$inboundSchema), transcodeInfo: types.nullable(TranscodeInfo$inboundSchema), subtitleInfo: types.nullable(SubtitleInfo$inboundSchema), resolution: types.nullable(types.string()), sourceVideoCodecDisplay: types.nullable(types.string()), sourceAudioCodecDisplay: types.nullable(types.string()), audioChannelsDisplay: types.nullable(types.string()), streamVideoCodecDisplay: types.nullable(types.string()), streamAudioCodecDisplay: types.nullable(types.string()), device: types.nullable(types.string()), player: types.nullable(types.string()), product: types.nullable(types.string()), platform: types.nullable(types.string()), }); export function streamFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Stream$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Stream' from JSON`, ); }