@dolbyio/dolbyio-rest-apis-client
Version:
Node.JS wrapper for the Dolby OptiView REST APIs
124 lines (123 loc) • 6.51 kB
TypeScript
import { CreateAssetClipRequest, ListMediaAssetsQueryParams, AssetResponseData, UploadCredentials, RegisterMediaAssetRequest, UpdateMediaAssetRequest } from './types/asset';
/**
* ## Creates Media Asset
*
* Create a live clip from an ongoing live stream. You must provide the stream name and start time, and once processing is complete the media asset of the type clip will be available for retrieval.
*
* If a stop time is not specified, the time the request was received will be used. The clip duration must be a minimum of ten (10) seconds and cannot exceed eight (8) hours.
*
* There are a few cases where more than one clip will be generated from a single request.
* 1. A stream went offline during the time range will generate separate clips for the period before and after the restart.
* 1. A stream that is configured for multi-source when a simulcastId is not given in the request to select a single layer.
* 1. A stream that is configured for multi-bitrate contribution or redundant fallback ingest and a sourceId is not given in the request to specify which to use. In that scenario, sources will be ranked based on the following criteria and the highest ranked source is selected for clipping:
* * priority
* * quality
* * start time
*
* By using an `Idempotency-Key` header in your requests, you can avoid generating more than one identical clip should the same request be received more than once.
* To avoid unnecessary charges, it is recommended you use a common identifier for live clip requests based on a common source stream and time range.
* For background on the usage of this header, please refer to the {@link https://datatracker.ietf.org/doc/draft-ietf-httpapi-idempotency-key-header/ | IETF Draft}.
*
* @see {@link https://optiview.dolby.com/docs/millicast/api/media-assets-create-media-asset/}
*
* @param apiSecret The API Secret used to authenticate this request.
* @param clipRequest The request body for creating a new media asset.
* @param idempotencyKey Optional, The unique identifier for this request to prevent duplicate submissions.
*/
export declare const create: (apiSecret: string, clipRequest: CreateAssetClipRequest, idempotencyKey?: string) => Promise<AssetResponseData>;
/**
* ## Lists Media Assets
*
* List media assets, excluding those that have been deleted. A media asset can be:
* 1. A `"recording"` that is from the full duration of the stream
* 1. A `"clip"` which is generated from {@link create | Create Media Asset}
* 1. A `"timeline"` which is a series of segments that is buffered in a cache and available for clipping. A `"timeline"` is capped at a 12 hour duration or whenever the stream is re-started.
* 1. Of type `storageValidation`, which is a record reflecting the outcome of triggering Validate Third Party Storage Setup
*
* @see {@link https://optiview.dolby.com/docs/millicast/api/media-assets-list-media-assets/}
*
* @param apiSecret The API Secret used to authenticate this request.
* @param params Query parameters for filtering the list of media assets.
*
* @returns A {@link !Promise Promise} whose fulfillment handler receives an array of {@link AssetResponseData} objects.
*/
export declare const list: (apiSecret: string, params: ListMediaAssetsQueryParams) => Promise<AssetResponseData[]>;
/**
* ## Delete Media Assets
*
* Deletes multiple media assets from storage.
*
* @remarks Only media assets with status Complete or Error can be deleted.
*
* @see {@link https://optiview.dolby.com/docs/millicast/api/media-assets-delete-media-assets/}
*
* @param apiSecret The API Secret used to authenticate this request.
* @param assetIds The list of asset IDs to delete.
*
* @returns A {@link !Promise Promise} whose fulfillment handler receives an array of asset deletion tasks that failed.
*/
export declare const deleteAssets: (apiSecret: string, assetIds: string[]) => Promise<{
id?: string;
error?: string;
}[] | null>;
/**
* ## Read Media Asset
*
* Gets media asset specified by id. Includes temporary download link if the media asset is complete.
*
* @see {@link https://optiview.dolby.com/docs/millicast/api/media-assets-read-media-asset/}
*
* @param apiSecret The API Secret used to authenticate this request.
* @param assetId The ID of the media asset to read.
*
* @returns A {@link !Promise Promise} whose fulfillment handler receives an {@link AssetResponseData} object.
*/
export declare const read: (apiSecret: string, assetId: string) => Promise<AssetResponseData>;
/**
* ## Delete All Media Assets
*
* Deletes all media assets of a specified type from storage.
*
* @see {@link https://optiview.dolby.com/docs/millicast/api/media-assets-delete-media-assets-2/}
*
* @param apiSecret The API Secret used to authenticate this request.
* @param mediaAssetType Asset type to delete.
*
* @returns A {@link !Promise Promise} whose fulfillment handler receives an array of asset deletion tasks that failed.
*/
export declare const deleteAllAssets: (apiSecret: string, mediaAssetType: "recording" | "clip" | "storageValidation" | "timeline") => Promise<{
id?: string;
error?: string;
}[] | null>;
/**
* ## Generate Upload Credentials
*
* Generate AWS access credentials for uploading media to a specified S3 location.
*
* @see {@link https://optiview.dolby.com/docs/millicast/api/media-assets-get-upload-credentials/}
*
* @param apiSecret The API Secret used to authenticate this request.
*/
export declare const generateUploadCredentials: (apiSecret: string) => Promise<UploadCredentials>;
/**
* ## Registers Media Asset
*
* Register media asset upon completion of content upload.
*
* @see {@link https://optiview.dolby.com/docs/millicast/api/media-assets-register-media-asset/}
*
* @param apiSecret The API Secret used to authenticate this request.
* @param registrationRequest The request body for creating a new media asset.
*/
export declare const registerMediaAsset: (apiSecret: string, registrationRequest: RegisterMediaAssetRequest) => Promise<AssetResponseData>;
/**
* ## Updates Media Asset
*
* Update media asset settings.
*
* @see {@link https://optiview.dolby.com/docs/millicast/api/media-assets-update-media-asset/}
*
* @param apiSecret The API Secret used to authenticate this request.
* @param updateRequest The request body for creating a new media asset.
*/
export declare const updateMediaAsset: (apiSecret: string, updateRequest: UpdateMediaAssetRequest) => Promise<AssetResponseData>;