/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import * as components from "../components/index.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type GetPlaybackInfoRequest = { /** * The playback ID from the asset or livestream, e.g. `eaw4nk06ts2d0mzb`. */ id: string; }; export type GetPlaybackInfoResponse = { /** * HTTP response content type for this operation */ contentType: string; /** * HTTP response status code for this operation */ statusCode: number; /** * Raw HTTP response; suitable for custom response parsing */ rawResponse: Response; /** * Successful response */ playbackInfo?: components.PlaybackInfo | undefined; /** * Playback not found */ error?: components.ErrorT | undefined; }; /** @internal */ export const GetPlaybackInfoRequest$inboundSchema: z.ZodType< GetPlaybackInfoRequest, z.ZodTypeDef, unknown > = z.object({ id: z.string(), }); /** @internal */ export type GetPlaybackInfoRequest$Outbound = { id: string; }; /** @internal */ export const GetPlaybackInfoRequest$outboundSchema: z.ZodType< GetPlaybackInfoRequest$Outbound, z.ZodTypeDef, GetPlaybackInfoRequest > = z.object({ id: 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 GetPlaybackInfoRequest$ { /** @deprecated use `GetPlaybackInfoRequest$inboundSchema` instead. */ export const inboundSchema = GetPlaybackInfoRequest$inboundSchema; /** @deprecated use `GetPlaybackInfoRequest$outboundSchema` instead. */ export const outboundSchema = GetPlaybackInfoRequest$outboundSchema; /** @deprecated use `GetPlaybackInfoRequest$Outbound` instead. */ export type Outbound = GetPlaybackInfoRequest$Outbound; } export function getPlaybackInfoRequestToJSON( getPlaybackInfoRequest: GetPlaybackInfoRequest, ): string { return JSON.stringify( GetPlaybackInfoRequest$outboundSchema.parse(getPlaybackInfoRequest), ); } export function getPlaybackInfoRequestFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => GetPlaybackInfoRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetPlaybackInfoRequest' from JSON`, ); } /** @internal */ export const GetPlaybackInfoResponse$inboundSchema: z.ZodType< GetPlaybackInfoResponse, z.ZodTypeDef, unknown > = z.object({ ContentType: z.string(), StatusCode: z.number().int(), RawResponse: z.instanceof(Response), "playback-info": components.PlaybackInfo$inboundSchema.optional(), error: components.ErrorT$inboundSchema.optional(), }).transform((v) => { return remap$(v, { "ContentType": "contentType", "StatusCode": "statusCode", "RawResponse": "rawResponse", "playback-info": "playbackInfo", }); }); /** @internal */ export type GetPlaybackInfoResponse$Outbound = { ContentType: string; StatusCode: number; RawResponse: never; "playback-info"?: components.PlaybackInfo$Outbound | undefined; error?: components.ErrorT$Outbound | undefined; }; /** @internal */ export const GetPlaybackInfoResponse$outboundSchema: z.ZodType< GetPlaybackInfoResponse$Outbound, z.ZodTypeDef, GetPlaybackInfoResponse > = z.object({ contentType: z.string(), statusCode: z.number().int(), rawResponse: z.instanceof(Response).transform(() => { throw new Error("Response cannot be serialized"); }), playbackInfo: components.PlaybackInfo$outboundSchema.optional(), error: components.ErrorT$outboundSchema.optional(), }).transform((v) => { return remap$(v, { contentType: "ContentType", statusCode: "StatusCode", rawResponse: "RawResponse", playbackInfo: "playback-info", }); }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace GetPlaybackInfoResponse$ { /** @deprecated use `GetPlaybackInfoResponse$inboundSchema` instead. */ export const inboundSchema = GetPlaybackInfoResponse$inboundSchema; /** @deprecated use `GetPlaybackInfoResponse$outboundSchema` instead. */ export const outboundSchema = GetPlaybackInfoResponse$outboundSchema; /** @deprecated use `GetPlaybackInfoResponse$Outbound` instead. */ export type Outbound = GetPlaybackInfoResponse$Outbound; } export function getPlaybackInfoResponseToJSON( getPlaybackInfoResponse: GetPlaybackInfoResponse, ): string { return JSON.stringify( GetPlaybackInfoResponse$outboundSchema.parse(getPlaybackInfoResponse), ); } export function getPlaybackInfoResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => GetPlaybackInfoResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetPlaybackInfoResponse' from JSON`, ); }