/* * 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 { InputCreatorId, InputCreatorId$inboundSchema, InputCreatorId$Outbound, InputCreatorId$outboundSchema, } from "./inputcreatorid.js"; import { PlaybackPolicy, PlaybackPolicy$inboundSchema, PlaybackPolicy$Outbound, PlaybackPolicy$outboundSchema, } from "./playbackpolicy.js"; import { Spec, Spec$inboundSchema, Spec$Outbound, Spec$outboundSchema, } from "./spec.js"; import { TranscodeProfile, TranscodeProfile$inboundSchema, TranscodeProfile$Outbound, TranscodeProfile$outboundSchema, } from "./transcodeprofile.js"; export type NewAssetPayload1 = { spec?: Spec | null | undefined; }; /** * Set to true to make default export to IPFS. To customize the * * @remarks * pinned files, specify an object with a spec field. False or null * means to unpin from IPFS, but it's unsupported right now. */ export type NewAssetPayloadIpfs = NewAssetPayload1 | boolean; export type NewAssetPayloadStorage = { /** * Set to true to make default export to IPFS. To customize the * * @remarks * pinned files, specify an object with a spec field. False or null * means to unpin from IPFS, but it's unsupported right now. */ ipfs?: NewAssetPayload1 | boolean | null | undefined; }; export type NewAssetPayloadEncryption = { /** * Encryption key used to encrypt the asset. Only writable in the upload asset endpoints and cannot be retrieved back. */ encryptedKey: string; }; export type NewAssetPayload = { /** * The name of the asset. This is not necessarily the filename - it can be a custom name or title. * * @remarks */ name: string; /** * Whether to generate MP4s for the asset. */ staticMp4?: boolean | undefined; /** * Whether the playback policy for an asset or stream is public or signed */ playbackPolicy?: PlaybackPolicy | null | undefined; creatorId?: InputCreatorId | undefined; storage?: NewAssetPayloadStorage | undefined; encryption?: NewAssetPayloadEncryption | undefined; /** * Decides if the output video should include C2PA signature */ c2pa?: boolean | undefined; profiles?: Array | null | undefined; /** * How many seconds the duration of each output segment should be */ targetSegmentSizeSecs?: number | undefined; }; /** @internal */ export const NewAssetPayload1$inboundSchema: z.ZodType< NewAssetPayload1, z.ZodTypeDef, unknown > = z.object({ spec: z.nullable(Spec$inboundSchema).optional(), }); /** @internal */ export type NewAssetPayload1$Outbound = { spec?: Spec$Outbound | null | undefined; }; /** @internal */ export const NewAssetPayload1$outboundSchema: z.ZodType< NewAssetPayload1$Outbound, z.ZodTypeDef, NewAssetPayload1 > = z.object({ spec: z.nullable(Spec$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 NewAssetPayload1$ { /** @deprecated use `NewAssetPayload1$inboundSchema` instead. */ export const inboundSchema = NewAssetPayload1$inboundSchema; /** @deprecated use `NewAssetPayload1$outboundSchema` instead. */ export const outboundSchema = NewAssetPayload1$outboundSchema; /** @deprecated use `NewAssetPayload1$Outbound` instead. */ export type Outbound = NewAssetPayload1$Outbound; } export function newAssetPayload1ToJSON( newAssetPayload1: NewAssetPayload1, ): string { return JSON.stringify( NewAssetPayload1$outboundSchema.parse(newAssetPayload1), ); } export function newAssetPayload1FromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => NewAssetPayload1$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'NewAssetPayload1' from JSON`, ); } /** @internal */ export const NewAssetPayloadIpfs$inboundSchema: z.ZodType< NewAssetPayloadIpfs, z.ZodTypeDef, unknown > = z.union([z.lazy(() => NewAssetPayload1$inboundSchema), z.boolean()]); /** @internal */ export type NewAssetPayloadIpfs$Outbound = NewAssetPayload1$Outbound | boolean; /** @internal */ export const NewAssetPayloadIpfs$outboundSchema: z.ZodType< NewAssetPayloadIpfs$Outbound, z.ZodTypeDef, NewAssetPayloadIpfs > = z.union([z.lazy(() => NewAssetPayload1$outboundSchema), z.boolean()]); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace NewAssetPayloadIpfs$ { /** @deprecated use `NewAssetPayloadIpfs$inboundSchema` instead. */ export const inboundSchema = NewAssetPayloadIpfs$inboundSchema; /** @deprecated use `NewAssetPayloadIpfs$outboundSchema` instead. */ export const outboundSchema = NewAssetPayloadIpfs$outboundSchema; /** @deprecated use `NewAssetPayloadIpfs$Outbound` instead. */ export type Outbound = NewAssetPayloadIpfs$Outbound; } export function newAssetPayloadIpfsToJSON( newAssetPayloadIpfs: NewAssetPayloadIpfs, ): string { return JSON.stringify( NewAssetPayloadIpfs$outboundSchema.parse(newAssetPayloadIpfs), ); } export function newAssetPayloadIpfsFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => NewAssetPayloadIpfs$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'NewAssetPayloadIpfs' from JSON`, ); } /** @internal */ export const NewAssetPayloadStorage$inboundSchema: z.ZodType< NewAssetPayloadStorage, z.ZodTypeDef, unknown > = z.object({ ipfs: z.nullable( z.union([z.lazy(() => NewAssetPayload1$inboundSchema), z.boolean()]), ).optional(), }); /** @internal */ export type NewAssetPayloadStorage$Outbound = { ipfs?: NewAssetPayload1$Outbound | boolean | null | undefined; }; /** @internal */ export const NewAssetPayloadStorage$outboundSchema: z.ZodType< NewAssetPayloadStorage$Outbound, z.ZodTypeDef, NewAssetPayloadStorage > = z.object({ ipfs: z.nullable( z.union([z.lazy(() => NewAssetPayload1$outboundSchema), z.boolean()]), ).optional(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace NewAssetPayloadStorage$ { /** @deprecated use `NewAssetPayloadStorage$inboundSchema` instead. */ export const inboundSchema = NewAssetPayloadStorage$inboundSchema; /** @deprecated use `NewAssetPayloadStorage$outboundSchema` instead. */ export const outboundSchema = NewAssetPayloadStorage$outboundSchema; /** @deprecated use `NewAssetPayloadStorage$Outbound` instead. */ export type Outbound = NewAssetPayloadStorage$Outbound; } export function newAssetPayloadStorageToJSON( newAssetPayloadStorage: NewAssetPayloadStorage, ): string { return JSON.stringify( NewAssetPayloadStorage$outboundSchema.parse(newAssetPayloadStorage), ); } export function newAssetPayloadStorageFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => NewAssetPayloadStorage$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'NewAssetPayloadStorage' from JSON`, ); } /** @internal */ export const NewAssetPayloadEncryption$inboundSchema: z.ZodType< NewAssetPayloadEncryption, z.ZodTypeDef, unknown > = z.object({ encryptedKey: z.string(), }); /** @internal */ export type NewAssetPayloadEncryption$Outbound = { encryptedKey: string; }; /** @internal */ export const NewAssetPayloadEncryption$outboundSchema: z.ZodType< NewAssetPayloadEncryption$Outbound, z.ZodTypeDef, NewAssetPayloadEncryption > = z.object({ encryptedKey: 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 NewAssetPayloadEncryption$ { /** @deprecated use `NewAssetPayloadEncryption$inboundSchema` instead. */ export const inboundSchema = NewAssetPayloadEncryption$inboundSchema; /** @deprecated use `NewAssetPayloadEncryption$outboundSchema` instead. */ export const outboundSchema = NewAssetPayloadEncryption$outboundSchema; /** @deprecated use `NewAssetPayloadEncryption$Outbound` instead. */ export type Outbound = NewAssetPayloadEncryption$Outbound; } export function newAssetPayloadEncryptionToJSON( newAssetPayloadEncryption: NewAssetPayloadEncryption, ): string { return JSON.stringify( NewAssetPayloadEncryption$outboundSchema.parse(newAssetPayloadEncryption), ); } export function newAssetPayloadEncryptionFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => NewAssetPayloadEncryption$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'NewAssetPayloadEncryption' from JSON`, ); } /** @internal */ export const NewAssetPayload$inboundSchema: z.ZodType< NewAssetPayload, z.ZodTypeDef, unknown > = z.object({ name: z.string(), staticMp4: z.boolean().optional(), playbackPolicy: z.nullable(PlaybackPolicy$inboundSchema).optional(), creatorId: InputCreatorId$inboundSchema.optional(), storage: z.lazy(() => NewAssetPayloadStorage$inboundSchema).optional(), encryption: z.lazy(() => NewAssetPayloadEncryption$inboundSchema).optional(), c2pa: z.boolean().optional(), profiles: z.nullable(z.array(TranscodeProfile$inboundSchema)).optional(), targetSegmentSizeSecs: z.number().optional(), }); /** @internal */ export type NewAssetPayload$Outbound = { name: string; staticMp4?: boolean | undefined; playbackPolicy?: PlaybackPolicy$Outbound | null | undefined; creatorId?: InputCreatorId$Outbound | undefined; storage?: NewAssetPayloadStorage$Outbound | undefined; encryption?: NewAssetPayloadEncryption$Outbound | undefined; c2pa?: boolean | undefined; profiles?: Array | null | undefined; targetSegmentSizeSecs?: number | undefined; }; /** @internal */ export const NewAssetPayload$outboundSchema: z.ZodType< NewAssetPayload$Outbound, z.ZodTypeDef, NewAssetPayload > = z.object({ name: z.string(), staticMp4: z.boolean().optional(), playbackPolicy: z.nullable(PlaybackPolicy$outboundSchema).optional(), creatorId: InputCreatorId$outboundSchema.optional(), storage: z.lazy(() => NewAssetPayloadStorage$outboundSchema).optional(), encryption: z.lazy(() => NewAssetPayloadEncryption$outboundSchema).optional(), c2pa: z.boolean().optional(), profiles: z.nullable(z.array(TranscodeProfile$outboundSchema)).optional(), targetSegmentSizeSecs: z.number().optional(), }); /** * @internal * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module. */ export namespace NewAssetPayload$ { /** @deprecated use `NewAssetPayload$inboundSchema` instead. */ export const inboundSchema = NewAssetPayload$inboundSchema; /** @deprecated use `NewAssetPayload$outboundSchema` instead. */ export const outboundSchema = NewAssetPayload$outboundSchema; /** @deprecated use `NewAssetPayload$Outbound` instead. */ export type Outbound = NewAssetPayload$Outbound; } export function newAssetPayloadToJSON( newAssetPayload: NewAssetPayload, ): string { return JSON.stringify(NewAssetPayload$outboundSchema.parse(newAssetPayload)); } export function newAssetPayloadFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => NewAssetPayload$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'NewAssetPayload' from JSON`, ); }