/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { mediaArchive } from "../funcs/mediaArchive.js"; import { mediaCopy } from "../funcs/mediaCopy.js"; import { mediaDelete } from "../funcs/mediaDelete.js"; import { mediaGet } from "../funcs/mediaGet.js"; import { mediaGetStats } from "../funcs/mediaGetStats.js"; import { mediaList } from "../funcs/mediaList.js"; import { mediaMove } from "../funcs/mediaMove.js"; import { mediaPostMediasImportUrl } from "../funcs/mediaPostMediasImportUrl.js"; import { mediaPutMediasCopy } from "../funcs/mediaPutMediasCopy.js"; import { mediaRestore } from "../funcs/mediaRestore.js"; import { mediaSwap } from "../funcs/mediaSwap.js"; import { mediaTranslate } from "../funcs/mediaTranslate.js"; import { mediaUpdate } from "../funcs/mediaUpdate.js"; import { mediaUploadForm } from "../funcs/mediaUploadForm.js"; import { mediaUploadMultipart } from "../funcs/mediaUploadMultipart.js"; import { ClientSDK, RequestOptions } from "../lib/sdks.js"; import * as operations from "../models/operations/index.js"; import { unwrapAsync } from "../types/fp.js"; export class Media extends ClientSDK { /** * Upload or Import Media * * @remarks * Endpoint to upload media files from a local system or import from a web URL. * * - Use `multipart/form-data` with a `file` parameter to upload from local system * - Use `application/x-www-form-urlencoded` with a `url` parameter to import from web URL */ async uploadForm( request?: operations.PostFormRequest | undefined, options?: RequestOptions, ): Promise { return unwrapAsync(mediaUploadForm( this, request, options, )); } /** * Upload or Import Media * * @remarks * Endpoint to upload media files from a local system or import from a web URL. * * - Use `multipart/form-data` with a `file` parameter to upload from local system * - Use `application/x-www-form-urlencoded` with a `url` parameter to import from web URL */ async uploadMultipart( request?: operations.PostMultipartRequest | undefined, options?: RequestOptions, ): Promise { return unwrapAsync(mediaUploadMultipart( this, request, options, )); } /** * List Media * * @remarks * Lists the media belonging to the account. This endpoint can also be used to * do a batch fetch based off of the hashed id. * * ## Requires api token with one of the following permissions * ``` * Read all folder and media data * ``` */ async list( request?: operations.GetMediasRequest | undefined, options?: RequestOptions, ): Promise> { return unwrapAsync(mediaList( this, request, options, )); } /** * Show Media * * @remarks * Fetches a single media by its hashed id. * * ## Requires api token with one of the following permissions * ``` * Read all folder and media data * ``` */ async get( request: operations.GetMediasMediaHashedIdRequest, options?: RequestOptions, ): Promise { return unwrapAsync(mediaGet( this, request, options, )); } /** * Update Media * * @remarks * Updates the attributes on a media. * * ## Requires api token with one of the following permissions * ``` * Read, update & delete anything * ``` */ async update( request: operations.PutMediasMediaHashedIdRequest, options?: RequestOptions, ): Promise { return unwrapAsync(mediaUpdate( this, request, options, )); } /** * Delete Media * * @remarks * Deletes a media. * * ## Requires api token with one of the following permissions * ``` * Read, update & delete anything * ``` */ async delete( request: operations.DeleteMediasMediaHashedIdRequest, options?: RequestOptions, ): Promise { return unwrapAsync(mediaDelete( this, request, options, )); } /** * Copy Media * * @remarks * This endpoint copies a media and its assets to a destination folder (defaults to source media). * * ## Requires api token with one of the following permissions * ``` * Read, update & delete anything * ``` */ async copy( request: operations.PostMediasMediaHashedIdCopyRequest, options?: RequestOptions, ): Promise { return unwrapAsync(mediaCopy( this, request, options, )); } /** * Swap Media * * @remarks * Swap one media with another media. This operation queues a background job to replace the original media with the replacement media while preserving the original media's hashed ID and URLs. * * ## Requires api token with one of the following permissions * ``` * Read, update & delete anything * ``` */ async swap( request: operations.PutMediasMediaHashedIdSwapRequest, options?: RequestOptions, ): Promise { return unwrapAsync(mediaSwap( this, request, options, )); } /** * Show Media Aggregated Stats * * @remarks * Aggregated tracking statistics for a video embedded on your site. * * ## Requires api token with one of the following permissions * ``` * Read all folder and media data * ``` */ async getStats( request: operations.GetMediasMediaHashedIdStatsRequest, options?: RequestOptions, ): Promise { return unwrapAsync(mediaGetStats( this, request, options, )); } /** * Translate Media * * @remarks * Translates the transcript for a media. * * ## Requires api token with one of the following permissions * ``` * Read, update & delete anything * ``` */ async translate( request: operations.PostMediasMediaHashedIdTranslateRequest, options?: RequestOptions, ): Promise { return unwrapAsync(mediaTranslate( this, request, options, )); } /** * Import Media from URL * * @remarks * This endpoint imports a media file from a given URL. The import is processed * asynchronously and will return a background_job_status object rather than the * typical Media response object. You can poll the background job status endpoint * to check on the progress of the import. * * If no folder_id is provided, a new folder called "Untitled Folder" will be * created and the imported media will be placed there. * * The URL must be publicly accessible — Wistia's servers need to be able to fetch the file directly. * * Note: imports from certain domains (e.g. vimeo.com, wistia.com) are not permitted. * * * ## Requires api token with one of the following permissions * ``` * Read, update & delete anything * ``` * */ async postMediasImportUrl( request?: operations.PostMediasImportUrlRequest | undefined, options?: RequestOptions, ): Promise { return unwrapAsync(mediaPostMediasImportUrl( this, request, options, )); } /** * Archive Media * * @remarks * This method accepts a list of up to 100 medias to archive per request. It processes requests asynchronously and will return a background_job_status object rather than the typical Media response object. Note that webinar medias and Soapbox videos imported to Wistia before September 1, 2023 cannot be archived. * * ## Requires api token with one of the following permissions * ``` * Read, update & delete anything * ``` */ async archive( request: operations.PutMediasArchiveRequest, options?: RequestOptions, ): Promise { return unwrapAsync(mediaArchive( this, request, options, )); } /** * Move Media * * @remarks * Move one or many media to a different folder and optionally to a specific subfolder. * Max 100 media per request, and max 10 requests in 5 minutes. * Note: this is a different rate limit than applies to the rest of the api! * * If a subfolder_id is provided, media will be moved to that subfolder. The subfolder * must belong to the specified folder. * * Returns a Background Job as the move is async. * * ## Requires api token with one of the following permissions * ``` * Read, update & delete anything * ``` */ async move( request: operations.PutMediasMoveRequest, options?: RequestOptions, ): Promise { return unwrapAsync(mediaMove( this, request, options, )); } /** * Restore Media * * @remarks * Restores archived medias to your account. This method accepts a list of up to 100 medias to restore per request. It processes requests asynchronously and will return a background_job_status object rather than the typical Media response object. Your account must have access to the Archiving feature to use this method. * * ## Requires api token with one of the following permissions * ``` * Read, update & delete anything * ``` */ async restore( request: operations.PutMediasRestoreRequest, options?: RequestOptions, ): Promise { return unwrapAsync(mediaRestore( this, request, options, )); } /** * Bulk Copy Media * * @remarks * This method accepts a list of medias to copy to a destination folder. It processes requests asynchronously and will return a background_job_status object rather than the typical Media response object. * * Each media will be duplicated and the copy will be placed in the specified destination folder. The original media files will not be affected. * * ## Requires api token with one of the following permissions * ``` * Read, update & delete anything * ``` */ async putMediasCopy( request: operations.PutMediasCopyRequest, options?: RequestOptions, ): Promise { return unwrapAsync(mediaPutMediasCopy( this, request, options, )); } }