/* * 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"; /** * Inline multistream target object. Will automatically * * @remarks * create the target resource to be used by the created * stream. */ export type TargetSpec = { name?: string | undefined; /** * Livepeer-compatible multistream target URL (RTMP(S) or SRT) */ url: string; }; export type Target = { /** * Name of transcoding profile that should be sent. Use * * @remarks * "source" for pushing source stream data */ profile: string; /** * If true, the stream audio will be muted and only silent * * @remarks * video will be pushed to the target. */ videoOnly?: boolean | undefined; /** * ID of multistream target object where to push this stream */ id?: string | undefined; /** * Inline multistream target object. Will automatically * * @remarks * create the target resource to be used by the created * stream. */ spec?: TargetSpec | undefined; }; /** @internal */ export const TargetSpec$inboundSchema: z.ZodType< TargetSpec, z.ZodTypeDef, unknown > = z.object({ name: z.string().optional(), url: z.string(), }); /** @internal */ export type TargetSpec$Outbound = { name?: string | undefined; url: string; }; /** @internal */ export const TargetSpec$outboundSchema: z.ZodType< TargetSpec$Outbound, z.ZodTypeDef, TargetSpec > = z.object({ name: z.string().optional(), url: z.string(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace TargetSpec$ { /** @deprecated use `TargetSpec$inboundSchema` instead. */ export const inboundSchema = TargetSpec$inboundSchema; /** @deprecated use `TargetSpec$outboundSchema` instead. */ export const outboundSchema = TargetSpec$outboundSchema; /** @deprecated use `TargetSpec$Outbound` instead. */ export type Outbound = TargetSpec$Outbound; } export function targetSpecToJSON(targetSpec: TargetSpec): string { return JSON.stringify(TargetSpec$outboundSchema.parse(targetSpec)); } export function targetSpecFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => TargetSpec$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'TargetSpec' from JSON`, ); } /** @internal */ export const Target$inboundSchema: z.ZodType = z .object({ profile: z.string(), videoOnly: z.boolean().default(false), id: z.string().optional(), spec: z.lazy(() => TargetSpec$inboundSchema).optional(), }); /** @internal */ export type Target$Outbound = { profile: string; videoOnly: boolean; id?: string | undefined; spec?: TargetSpec$Outbound | undefined; }; /** @internal */ export const Target$outboundSchema: z.ZodType< Target$Outbound, z.ZodTypeDef, Target > = z.object({ profile: z.string(), videoOnly: z.boolean().default(false), id: z.string().optional(), spec: z.lazy(() => TargetSpec$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 Target$ { /** @deprecated use `Target$inboundSchema` instead. */ export const inboundSchema = Target$inboundSchema; /** @deprecated use `Target$outboundSchema` instead. */ export const outboundSchema = Target$outboundSchema; /** @deprecated use `Target$Outbound` instead. */ export type Outbound = Target$Outbound; } export function targetToJSON(target: Target): string { return JSON.stringify(Target$outboundSchema.parse(target)); } export function targetFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => Target$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Target' from JSON`, ); }