/* * 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 { FfmpegProfile, FfmpegProfile$inboundSchema, FfmpegProfile$Outbound, FfmpegProfile$outboundSchema, } from "./ffmpegprofile.js"; import { RecordingSpec, RecordingSpec$inboundSchema, RecordingSpec$Outbound, RecordingSpec$outboundSchema, } from "./recordingspec.js"; /** * The status of the recording process of this stream session. */ export enum RecordingStatus { Waiting = "waiting", Ready = "ready", Failed = "failed", Deleted = "deleted", None = "none", } export type Session = { id?: string | undefined; /** * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ kind?: string | undefined; /** * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ userId?: string | undefined; name: string; lastSeen?: number | undefined; sourceSegments?: number | undefined; transcodedSegments?: number | undefined; /** * Duration of all the source segments, sec */ sourceSegmentsDuration?: number | undefined; /** * Duration of all the transcoded segments, sec */ transcodedSegmentsDuration?: number | undefined; sourceBytes?: number | undefined; transcodedBytes?: number | undefined; /** * Rate at which sourceBytes increases (bytes/second) */ ingestRate?: number | undefined; /** * Rate at which transcodedBytes increases (bytes/second) */ outgoingRate?: number | undefined; /** * Indicates whether the stream is healthy or not. */ isHealthy?: boolean | null | undefined; /** * A string array of human-readable errors describing issues affecting the stream, if any. */ issues?: Array | null | undefined; /** * Timestamp (in milliseconds) at which stream object was created */ createdAt?: number | undefined; /** * Points to parent stream object */ parentId?: string | undefined; /** * The ID of the project */ projectId?: string | undefined; /** * Whether the stream should be recorded. Uses default settings. For more customization, create and configure an object store. * * @remarks */ record?: boolean | undefined; /** * The status of the recording process of this stream session. */ recordingStatus?: RecordingStatus | undefined; /** * URL for accessing the recording of this stream session. */ recordingUrl?: string | undefined; /** * The URL for the stream session recording packaged in an MP4. */ mp4Url?: string | undefined; /** * The playback ID to use with the Playback Info endpoint to retrieve playback URLs. */ playbackId?: string | undefined; /** * Profiles to transcode the stream into. If not specified, a default * * @remarks * set of profiles will be used with 240p, 360p, 480p and 720p * resolutions. Keep in mind that the source rendition is always kept. */ profiles?: Array | undefined; /** * Configuration for recording the stream. This can only be set if * * @remarks * `record` is true. */ recordingSpec?: RecordingSpec | undefined; }; /** @internal */ export const RecordingStatus$inboundSchema: z.ZodNativeEnum< typeof RecordingStatus > = z.nativeEnum(RecordingStatus); /** @internal */ export const RecordingStatus$outboundSchema: z.ZodNativeEnum< typeof RecordingStatus > = RecordingStatus$inboundSchema; /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace RecordingStatus$ { /** @deprecated use `RecordingStatus$inboundSchema` instead. */ export const inboundSchema = RecordingStatus$inboundSchema; /** @deprecated use `RecordingStatus$outboundSchema` instead. */ export const outboundSchema = RecordingStatus$outboundSchema; } /** @internal */ export const Session$inboundSchema: z.ZodType = z.object({ id: z.string().optional(), kind: z.string().optional(), userId: z.string().optional(), name: z.string(), lastSeen: z.number().optional(), sourceSegments: z.number().optional(), transcodedSegments: z.number().optional(), sourceSegmentsDuration: z.number().optional(), transcodedSegmentsDuration: z.number().optional(), sourceBytes: z.number().optional(), transcodedBytes: z.number().optional(), ingestRate: z.number().optional(), outgoingRate: z.number().optional(), isHealthy: z.nullable(z.boolean()).optional(), issues: z.nullable(z.array(z.string())).optional(), createdAt: z.number().optional(), parentId: z.string().optional(), projectId: z.string().optional(), record: z.boolean().optional(), recordingStatus: RecordingStatus$inboundSchema.optional(), recordingUrl: z.string().optional(), mp4Url: z.string().optional(), playbackId: z.string().optional(), profiles: z.array(FfmpegProfile$inboundSchema).optional(), recordingSpec: RecordingSpec$inboundSchema.optional(), }); /** @internal */ export type Session$Outbound = { id?: string | undefined; kind?: string | undefined; userId?: string | undefined; name: string; lastSeen?: number | undefined; sourceSegments?: number | undefined; transcodedSegments?: number | undefined; sourceSegmentsDuration?: number | undefined; transcodedSegmentsDuration?: number | undefined; sourceBytes?: number | undefined; transcodedBytes?: number | undefined; ingestRate?: number | undefined; outgoingRate?: number | undefined; isHealthy?: boolean | null | undefined; issues?: Array | null | undefined; createdAt?: number | undefined; parentId?: string | undefined; projectId?: string | undefined; record?: boolean | undefined; recordingStatus?: string | undefined; recordingUrl?: string | undefined; mp4Url?: string | undefined; playbackId?: string | undefined; profiles?: Array | undefined; recordingSpec?: RecordingSpec$Outbound | undefined; }; /** @internal */ export const Session$outboundSchema: z.ZodType< Session$Outbound, z.ZodTypeDef, Session > = z.object({ id: z.string().optional(), kind: z.string().optional(), userId: z.string().optional(), name: z.string(), lastSeen: z.number().optional(), sourceSegments: z.number().optional(), transcodedSegments: z.number().optional(), sourceSegmentsDuration: z.number().optional(), transcodedSegmentsDuration: z.number().optional(), sourceBytes: z.number().optional(), transcodedBytes: z.number().optional(), ingestRate: z.number().optional(), outgoingRate: z.number().optional(), isHealthy: z.nullable(z.boolean()).optional(), issues: z.nullable(z.array(z.string())).optional(), createdAt: z.number().optional(), parentId: z.string().optional(), projectId: z.string().optional(), record: z.boolean().optional(), recordingStatus: RecordingStatus$outboundSchema.optional(), recordingUrl: z.string().optional(), mp4Url: z.string().optional(), playbackId: z.string().optional(), profiles: z.array(FfmpegProfile$outboundSchema).optional(), recordingSpec: RecordingSpec$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 Session$ { /** @deprecated use `Session$inboundSchema` instead. */ export const inboundSchema = Session$inboundSchema; /** @deprecated use `Session$outboundSchema` instead. */ export const outboundSchema = Session$outboundSchema; /** @deprecated use `Session$Outbound` instead. */ export type Outbound = Session$Outbound; } export function sessionToJSON(session: Session): string { return JSON.stringify(Session$outboundSchema.parse(session)); } export function sessionFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Session$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Session' from JSON`, ); }