/* * 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 PutMediasMediaHashedIdRequestBody = { /** * The media’s new name. */ name?: string | undefined; /** * The Wistia hashed ID of an image that will replace the still that’s displayed before the player starts playing. * * @remarks */ newStillMediaId?: string | undefined; /** * A new description for this media. Accepts plain text or markdown. */ description?: string | undefined; /** * An array of tag names to apply to the media. Note that this will replace any existing tags! */ tags?: Array | undefined; }; export type PutMediasMediaHashedIdRequest = { /** * The hashed ID of the media. */ mediaHashedId: string; requestBody?: PutMediasMediaHashedIdRequestBody | undefined; }; /** * A string representing what type of media this is. */ export const PutMediasMediaHashedIdType = { 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 PutMediasMediaHashedIdType = ClosedEnum< typeof PutMediasMediaHashedIdType >; /** * 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 PutMediasMediaHashedIdStatus = { 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 PutMediasMediaHashedIdStatus = ClosedEnum< typeof PutMediasMediaHashedIdStatus >; export type PutMediasMediaHashedIdThumbnail = { url?: string | undefined; width?: number | undefined; height?: number | undefined; }; export type PutMediasMediaHashedIdTag = { /** * The display name of the tag. */ name?: 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. */ export type PutMediasMediaHashedIdResponse = { /** * 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?: PutMediasMediaHashedIdType | 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?: PutMediasMediaHashedIdStatus | 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?: PutMediasMediaHashedIdThumbnail | undefined; /** * Tags associated with this media. */ tags?: Array | undefined; }; /** @internal */ export type PutMediasMediaHashedIdRequestBody$Outbound = { name?: string | undefined; new_still_media_id?: string | undefined; description?: string | undefined; tags?: Array | undefined; }; /** @internal */ export const PutMediasMediaHashedIdRequestBody$outboundSchema: z.ZodType< PutMediasMediaHashedIdRequestBody$Outbound, z.ZodTypeDef, PutMediasMediaHashedIdRequestBody > = z.object({ name: z.string().optional(), newStillMediaId: z.string().optional(), description: z.string().optional(), tags: z.array(z.string()).optional(), }).transform((v) => { return remap$(v, { newStillMediaId: "new_still_media_id", }); }); export function putMediasMediaHashedIdRequestBodyToJSON( putMediasMediaHashedIdRequestBody: PutMediasMediaHashedIdRequestBody, ): string { return JSON.stringify( PutMediasMediaHashedIdRequestBody$outboundSchema.parse( putMediasMediaHashedIdRequestBody, ), ); } /** @internal */ export type PutMediasMediaHashedIdRequest$Outbound = { mediaHashedId: string; RequestBody?: PutMediasMediaHashedIdRequestBody$Outbound | undefined; }; /** @internal */ export const PutMediasMediaHashedIdRequest$outboundSchema: z.ZodType< PutMediasMediaHashedIdRequest$Outbound, z.ZodTypeDef, PutMediasMediaHashedIdRequest > = z.object({ mediaHashedId: z.string(), requestBody: z.lazy(() => PutMediasMediaHashedIdRequestBody$outboundSchema) .optional(), }).transform((v) => { return remap$(v, { requestBody: "RequestBody", }); }); export function putMediasMediaHashedIdRequestToJSON( putMediasMediaHashedIdRequest: PutMediasMediaHashedIdRequest, ): string { return JSON.stringify( PutMediasMediaHashedIdRequest$outboundSchema.parse( putMediasMediaHashedIdRequest, ), ); } /** @internal */ export const PutMediasMediaHashedIdType$inboundSchema: z.ZodNativeEnum< typeof PutMediasMediaHashedIdType > = z.nativeEnum(PutMediasMediaHashedIdType); /** @internal */ export const PutMediasMediaHashedIdStatus$inboundSchema: z.ZodNativeEnum< typeof PutMediasMediaHashedIdStatus > = z.nativeEnum(PutMediasMediaHashedIdStatus); /** @internal */ export const PutMediasMediaHashedIdThumbnail$inboundSchema: z.ZodType< PutMediasMediaHashedIdThumbnail, z.ZodTypeDef, unknown > = z.object({ url: z.string().optional(), width: z.number().int().optional(), height: z.number().int().optional(), }); export function putMediasMediaHashedIdThumbnailFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PutMediasMediaHashedIdThumbnail$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PutMediasMediaHashedIdThumbnail' from JSON`, ); } /** @internal */ export const PutMediasMediaHashedIdTag$inboundSchema: z.ZodType< PutMediasMediaHashedIdTag, z.ZodTypeDef, unknown > = z.object({ name: z.string().optional(), }); export function putMediasMediaHashedIdTagFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PutMediasMediaHashedIdTag$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PutMediasMediaHashedIdTag' from JSON`, ); } /** @internal */ export const PutMediasMediaHashedIdResponse$inboundSchema: z.ZodType< PutMediasMediaHashedIdResponse, z.ZodTypeDef, unknown > = z.object({ id: z.number().int().optional(), name: z.string().optional(), type: PutMediasMediaHashedIdType$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: PutMediasMediaHashedIdStatus$inboundSchema.optional(), section: z.nullable(z.string()).optional(), thumbnail: z.lazy(() => PutMediasMediaHashedIdThumbnail$inboundSchema) .optional(), tags: z.array(z.lazy(() => PutMediasMediaHashedIdTag$inboundSchema)) .optional(), }).transform((v) => { return remap$(v, { "hashed_id": "hashedId", }); }); export function putMediasMediaHashedIdResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PutMediasMediaHashedIdResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PutMediasMediaHashedIdResponse' from JSON`, ); }