/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import * as z from "zod/v3"; import { remap as remap$ } from "../../lib/primitives.js"; import { safeParse } from "../../lib/schemas.js"; import { ClosedEnum } from "../../types/enums.js"; import { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; export type PutMediasMediaHashedIdSwapRequestBody = { /** * The hashed ID of the media that will replace the original media. Must be the same media type as the original. */ replacementMediaId: string; }; export type PutMediasMediaHashedIdSwapRequest = { /** * The hashed ID of the media to be replaced. */ mediaHashedId: string; requestBody?: PutMediasMediaHashedIdSwapRequestBody | undefined; }; /** * A string representing what type of media this is. */ export const PutMediasMediaHashedIdSwapType = { Video: "Video", Audio: "Audio", Image: "Image", PdfDocument: "PdfDocument", MicrosoftOfficeDocument: "MicrosoftOfficeDocument", Swf: "Swf", UnknownType: "UnknownType", } as const; /** * A string representing what type of media this is. */ export type PutMediasMediaHashedIdSwapType = ClosedEnum< typeof PutMediasMediaHashedIdSwapType >; /** * Post upload processing status. - `queued`: the file is waiting in the queue to be processed. - `processing`: the file is actively being processed. - `ready`: the file has been fully processed and is ready for embedding and viewing. - `failed`: the file was unable to be processed (usually a format or size error). * * @remarks */ export const PutMediasMediaHashedIdSwapStatus = { Queued: "queued", Processing: "processing", Ready: "ready", Failed: "failed", } as const; /** * Post upload processing status. - `queued`: the file is waiting in the queue to be processed. - `processing`: the file is actively being processed. - `ready`: the file has been fully processed and is ready for embedding and viewing. - `failed`: the file was unable to be processed (usually a format or size error). * * @remarks */ export type PutMediasMediaHashedIdSwapStatus = ClosedEnum< typeof PutMediasMediaHashedIdSwapStatus >; export type PutMediasMediaHashedIdSwapThumbnail = { url?: string | undefined; width?: number | undefined; height?: number | undefined; }; /** * A media generally represents a video or an audio which can be embedded into your website. * * @remarks * * CDN-backed medias are accessible using this url structure: https://fast.wistia.com/embed/medias/{hashed_id}.m3u8. * For more information, see https://docs.wistia.com/docs/asset-urls#getting-hls-assets. */ export type PutMediasMediaHashedIdSwapMedia = { /** * A unique numeric identifier for the media within the system. */ id?: number | undefined; /** * The display name of the media. */ name?: string | undefined; /** * A string representing what type of media this is. */ type?: PutMediasMediaHashedIdSwapType | undefined; /** * Whether or not the media is archived, either true or false. */ archived?: boolean | undefined; /** * The date when the media was originally uploaded. */ created?: Date | undefined; /** * The date when the media was last changed. */ updated?: Date | undefined; /** * Specifies the length (in seconds) for audio and video files. Specifies number of pages in the document. Omitted for other types of media. */ duration?: number | null | undefined; /** * DEPRECATED: If you want to programmatically embed videos, follow the construct an embed code guide. * * @remarks * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ embedCode?: string | undefined; /** * A unique alphanumeric identifier for this media. */ hashedId?: string | undefined; /** * A description for the media which usually appears near the top of the sidebar on the media's page. */ description?: string | undefined; /** * A floating point value between 0 and 1 that indicates the progress of the processing for this file. */ progress?: number | undefined; /** * Post upload processing status. - `queued`: the file is waiting in the queue to be processed. - `processing`: the file is actively being processed. - `ready`: the file has been fully processed and is ready for embedding and viewing. - `failed`: the file was unable to be processed (usually a format or size error). * * @remarks */ status?: PutMediasMediaHashedIdSwapStatus | undefined; /** * The title of the section in which the media appears. This attribute is omitted if the media is not in a section (default). */ section?: string | null | undefined; thumbnail?: PutMediasMediaHashedIdSwapThumbnail | undefined; }; /** * The status of the background job that's been queued for the request. */ export const PutMediasMediaHashedIdSwapBackgroundJobStatusStatus = { Queued: "queued", Started: "started", Finished: "finished", Failed: "failed", } as const; /** * The status of the background job that's been queued for the request. */ export type PutMediasMediaHashedIdSwapBackgroundJobStatusStatus = ClosedEnum< typeof PutMediasMediaHashedIdSwapBackgroundJobStatusStatus >; /** * A background job keeps track of the progress of an asynchronous task, e.g * * @remarks * bulk archiving media, translating media, etc. */ export type PutMediasMediaHashedIdSwapBackgroundJobStatus = { /** * The ID of the background job that's been queued for the request. */ id: number; /** * The status of the background job that's been queued for the request. */ status: PutMediasMediaHashedIdSwapBackgroundJobStatusStatus; }; /** * Successfully queued background job for media swap. */ export type PutMediasMediaHashedIdSwapResponse = { message?: string | undefined; /** * A media generally represents a video or an audio which can be embedded into your website. * * @remarks * * CDN-backed medias are accessible using this url structure: https://fast.wistia.com/embed/medias/{hashed_id}.m3u8. * For more information, see https://docs.wistia.com/docs/asset-urls#getting-hls-assets. */ media?: PutMediasMediaHashedIdSwapMedia | undefined; /** * A background job keeps track of the progress of an asynchronous task, e.g * * @remarks * bulk archiving media, translating media, etc. */ backgroundJobStatus?: | PutMediasMediaHashedIdSwapBackgroundJobStatus | undefined; }; /** @internal */ export type PutMediasMediaHashedIdSwapRequestBody$Outbound = { replacement_media_id: string; }; /** @internal */ export const PutMediasMediaHashedIdSwapRequestBody$outboundSchema: z.ZodType< PutMediasMediaHashedIdSwapRequestBody$Outbound, z.ZodTypeDef, PutMediasMediaHashedIdSwapRequestBody > = z.object({ replacementMediaId: z.string(), }).transform((v) => { return remap$(v, { replacementMediaId: "replacement_media_id", }); }); export function putMediasMediaHashedIdSwapRequestBodyToJSON( putMediasMediaHashedIdSwapRequestBody: PutMediasMediaHashedIdSwapRequestBody, ): string { return JSON.stringify( PutMediasMediaHashedIdSwapRequestBody$outboundSchema.parse( putMediasMediaHashedIdSwapRequestBody, ), ); } /** @internal */ export type PutMediasMediaHashedIdSwapRequest$Outbound = { mediaHashedId: string; RequestBody?: PutMediasMediaHashedIdSwapRequestBody$Outbound | undefined; }; /** @internal */ export const PutMediasMediaHashedIdSwapRequest$outboundSchema: z.ZodType< PutMediasMediaHashedIdSwapRequest$Outbound, z.ZodTypeDef, PutMediasMediaHashedIdSwapRequest > = z.object({ mediaHashedId: z.string(), requestBody: z.lazy(() => PutMediasMediaHashedIdSwapRequestBody$outboundSchema ).optional(), }).transform((v) => { return remap$(v, { requestBody: "RequestBody", }); }); export function putMediasMediaHashedIdSwapRequestToJSON( putMediasMediaHashedIdSwapRequest: PutMediasMediaHashedIdSwapRequest, ): string { return JSON.stringify( PutMediasMediaHashedIdSwapRequest$outboundSchema.parse( putMediasMediaHashedIdSwapRequest, ), ); } /** @internal */ export const PutMediasMediaHashedIdSwapType$inboundSchema: z.ZodNativeEnum< typeof PutMediasMediaHashedIdSwapType > = z.nativeEnum(PutMediasMediaHashedIdSwapType); /** @internal */ export const PutMediasMediaHashedIdSwapStatus$inboundSchema: z.ZodNativeEnum< typeof PutMediasMediaHashedIdSwapStatus > = z.nativeEnum(PutMediasMediaHashedIdSwapStatus); /** @internal */ export const PutMediasMediaHashedIdSwapThumbnail$inboundSchema: z.ZodType< PutMediasMediaHashedIdSwapThumbnail, z.ZodTypeDef, unknown > = z.object({ url: z.string().optional(), width: z.number().int().optional(), height: z.number().int().optional(), }); export function putMediasMediaHashedIdSwapThumbnailFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PutMediasMediaHashedIdSwapThumbnail$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PutMediasMediaHashedIdSwapThumbnail' from JSON`, ); } /** @internal */ export const PutMediasMediaHashedIdSwapMedia$inboundSchema: z.ZodType< PutMediasMediaHashedIdSwapMedia, z.ZodTypeDef, unknown > = z.object({ id: z.number().int().optional(), name: z.string().optional(), type: PutMediasMediaHashedIdSwapType$inboundSchema.optional(), archived: z.boolean().optional(), created: z.string().datetime({ offset: true }).transform(v => new Date(v)) .optional(), updated: z.string().datetime({ offset: true }).transform(v => new Date(v)) .optional(), duration: z.nullable(z.number()).optional(), embedCode: z.string().optional(), hashed_id: z.string().optional(), description: z.string().optional(), progress: z.number().optional(), status: PutMediasMediaHashedIdSwapStatus$inboundSchema.optional(), section: z.nullable(z.string()).optional(), thumbnail: z.lazy(() => PutMediasMediaHashedIdSwapThumbnail$inboundSchema) .optional(), }).transform((v) => { return remap$(v, { "hashed_id": "hashedId", }); }); export function putMediasMediaHashedIdSwapMediaFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PutMediasMediaHashedIdSwapMedia$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PutMediasMediaHashedIdSwapMedia' from JSON`, ); } /** @internal */ export const PutMediasMediaHashedIdSwapBackgroundJobStatusStatus$inboundSchema: z.ZodNativeEnum = z.nativeEnum(PutMediasMediaHashedIdSwapBackgroundJobStatusStatus); /** @internal */ export const PutMediasMediaHashedIdSwapBackgroundJobStatus$inboundSchema: z.ZodType< PutMediasMediaHashedIdSwapBackgroundJobStatus, z.ZodTypeDef, unknown > = z.object({ id: z.number().int(), status: PutMediasMediaHashedIdSwapBackgroundJobStatusStatus$inboundSchema, }); export function putMediasMediaHashedIdSwapBackgroundJobStatusFromJSON( jsonString: string, ): SafeParseResult< PutMediasMediaHashedIdSwapBackgroundJobStatus, SDKValidationError > { return safeParse( jsonString, (x) => PutMediasMediaHashedIdSwapBackgroundJobStatus$inboundSchema.parse( JSON.parse(x), ), `Failed to parse 'PutMediasMediaHashedIdSwapBackgroundJobStatus' from JSON`, ); } /** @internal */ export const PutMediasMediaHashedIdSwapResponse$inboundSchema: z.ZodType< PutMediasMediaHashedIdSwapResponse, z.ZodTypeDef, unknown > = z.object({ message: z.string().optional(), media: z.lazy(() => PutMediasMediaHashedIdSwapMedia$inboundSchema).optional(), background_job_status: z.lazy(() => PutMediasMediaHashedIdSwapBackgroundJobStatus$inboundSchema ).optional(), }).transform((v) => { return remap$(v, { "background_job_status": "backgroundJobStatus", }); }); export function putMediasMediaHashedIdSwapResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PutMediasMediaHashedIdSwapResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PutMediasMediaHashedIdSwapResponse' from JSON`, ); }