/* * 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 { Result as SafeParseResult } from "../../types/fp.js"; import { SDKValidationError } from "../errors/sdkvalidationerror.js"; import * as models from "../index.js"; export const PostFormServerList = [ "https://upload.wistia.com", ] as const; export type PostFormRequest = { /** * The hashed id of the project to upload media into. */ projectId?: string | undefined; /** * A display name to use for the media in Wistia. */ name?: string | undefined; /** * A description to use for the media in Wistia. */ description?: string | undefined; /** * A Wistia contact id. */ contactId?: number | undefined; /** * A 64 character hex string. This parameter can be found on your API access page OR can be the token you received from authenticating via Oauth2. Note this approach is legacy and discouraged. We recommend using Bearer Token authentication. * * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible. */ accessToken?: string | undefined; /** * The publicly accessible web location of the media file to import. */ url: string; /** * Inform the encoding service that this upload can be considered lower priority than others. This is especially useful for platform customers doing bulk uploads or migrations. Setting this to "false" has no effect. */ lowPriority?: boolean | undefined; }; export type PostFormError = { code?: string | undefined; detail?: string | undefined; }; /** * Response after successfully uploading or importing media */ export type PostFormResponse = { /** * 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?: string | 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. */ duration?: number | undefined; /** * A unique alphanumeric identifier for this media. */ hashedId?: string | undefined; /** * A floating point value between 0 and 1 that indicates the progress of the processing for this file. */ progress?: number | undefined; thumbnail?: models.Thumbnail | undefined; }; /** @internal */ export type PostFormRequest$Outbound = { project_id?: string | undefined; name?: string | undefined; description?: string | undefined; contact_id?: number | undefined; access_token?: string | undefined; url: string; low_priority?: boolean | undefined; }; /** @internal */ export const PostFormRequest$outboundSchema: z.ZodType< PostFormRequest$Outbound, z.ZodTypeDef, PostFormRequest > = z.object({ projectId: z.string().optional(), name: z.string().optional(), description: z.string().optional(), contactId: z.number().int().optional(), accessToken: z.string().optional(), url: z.string(), lowPriority: z.boolean().optional(), }).transform((v) => { return remap$(v, { projectId: "project_id", contactId: "contact_id", accessToken: "access_token", lowPriority: "low_priority", }); }); export function postFormRequestToJSON( postFormRequest: PostFormRequest, ): string { return JSON.stringify(PostFormRequest$outboundSchema.parse(postFormRequest)); } /** @internal */ export const PostFormError$inboundSchema: z.ZodType< PostFormError, z.ZodTypeDef, unknown > = z.object({ code: z.string().optional(), detail: z.string().optional(), }); export function postFormErrorFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PostFormError$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PostFormError' from JSON`, ); } /** @internal */ export const PostFormResponse$inboundSchema: z.ZodType< PostFormResponse, z.ZodTypeDef, unknown > = z.object({ id: z.number().int().optional(), name: z.string().optional(), type: z.string().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.number().optional(), hashed_id: z.string().optional(), progress: z.number().optional(), thumbnail: models.Thumbnail$inboundSchema.optional(), }).transform((v) => { return remap$(v, { "hashed_id": "hashedId", }); }); export function postFormResponseFromJSON( jsonString: string, ): SafeParseResult { return safeParse( jsonString, (x) => PostFormResponse$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PostFormResponse' from JSON`, ); }