/* * 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"; export type ClipPayload = { /** * The playback ID of the stream or stream recording to clip. Asset playback IDs are not supported yet. */ playbackId: string; /** * The start timestamp of the clip in Unix milliseconds. _See the ClipTrigger in the UI Kit for an example of how this is calculated (for HLS, it uses `Program Date-Time` tags, and for WebRTC, it uses the latency from server to client at stream startup)._ */ startTime: number; /** * The end timestamp of the clip in Unix milliseconds. _See the ClipTrigger in the UI Kit for an example of how this is calculated (for HLS, it uses `Program Date-Time` tags, and for WebRTC, it uses the latency from server to client at stream startup)._ */ endTime?: number | undefined; /** * The optional friendly name of the clip to create. */ name?: string | undefined; /** * The optional session ID of the stream to clip. This can be used to clip _recordings_ - if it is not specified, it will clip the ongoing livestream. */ sessionId?: string | undefined; }; /** @internal */ export const ClipPayload$inboundSchema: z.ZodType< ClipPayload, z.ZodTypeDef, unknown > = z.object({ playbackId: z.string(), startTime: z.number(), endTime: z.number().optional(), name: z.string().optional(), sessionId: z.string().optional(), }); /** @internal */ export type ClipPayload$Outbound = { playbackId: string; startTime: number; endTime?: number | undefined; name?: string | undefined; sessionId?: string | undefined; }; /** @internal */ export const ClipPayload$outboundSchema: z.ZodType< ClipPayload$Outbound, z.ZodTypeDef, ClipPayload > = z.object({ playbackId: z.string(), startTime: z.number(), endTime: z.number().optional(), name: z.string().optional(), sessionId: 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 ClipPayload$ { /** @deprecated use `ClipPayload$inboundSchema` instead. */ export const inboundSchema = ClipPayload$inboundSchema; /** @deprecated use `ClipPayload$outboundSchema` instead. */ export const outboundSchema = ClipPayload$outboundSchema; /** @deprecated use `ClipPayload$Outbound` instead. */ export type Outbound = ClipPayload$Outbound; } export function clipPayloadToJSON(clipPayload: ClipPayload): string { return JSON.stringify(ClipPayload$outboundSchema.parse(clipPayload)); } export function clipPayloadFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => ClipPayload$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ClipPayload' from JSON`, ); }