@dolbyio/dolbyio-rest-apis-client
Version:
Node.JS wrapper for the Dolby.io REST APIs
60 lines (59 loc) • 3.55 kB
TypeScript
import { JwtToken } from './types/jwtToken';
/**
* Gets an upload URL.
*
* To use the Dolby provided temporary storage is a two step process.
*
* You start by declaring a dlb:// url that you can reference in any other Media API calls. The response will provide a url where you can put your media. This allows you to use the dlb:// url as a short-cut for a temporary storage location.
*
* You'll be returned a pre-signed url you can use to PUT and upload your media file. The temporary storage should allow you to read and write to the dlb:// locations for a period of at least 24 hours before it is removed.
*
* @link https://docs.dolby.io/media-apis/reference/media-input
*
* @param accessToken Access token to use for authentication.
* @param dlbUrl The `url` should be in the form `dlb://object-key` where the object-key can be any alpha-numeric string. The object-key is unique to your account API Key so there is no risk of collision with other users.
*
* @returns The upload URL through a {@link Promise}.
*/
export declare const getUploadUrl: (accessToken: JwtToken, dlbUrl: string) => Promise<string | null>;
/**
* Gets the download URL.
*
* You can download media you previously uploaded with /media/input or media that was generated through another Dolby Media API.
*
* The temporary storage should allow you to read and write to the dlb:// locations for a period of at least 24 hours before it is removed.
*
* @link https://docs.dolby.io/media-apis/reference/media-output-post
*
* @param accessToken Access token to use for authentication.
* @param dlbUrl The `url` should be in the form `dlb://object-key` where the object-key can be any alpha-numeric string. The object-key is unique to your account API Key so there is no risk of collision with other users.
*
* @returns The download URL through a {@link Promise}.
*/
export declare const getDownloadUrl: (accessToken: JwtToken, dlbUrl: string) => Promise<string | null>;
/**
* Upload a media file to the Dolby.io temporary storage.
*
* The temporary storage should allow you to read and write to the dlb:// locations for a period of at least 24 hours before it is removed.
*
* @link https://docs.dolby.io/media-apis/reference/media-input-post
*
* @param accessToken Access token to use for authentication.
* @param dlbUrl The `url` should be in the form `dlb://object-key` where the object-key can be any alpha-numeric string. The object-key is unique to your account API Key so there is no risk of collision with other users.
* @param filePath Local path of the file you want to upload.
*/
export declare const uploadFile: (accessToken: JwtToken, dlbUrl: string, filePath: string) => Promise<void>;
/**
* Download a media file.
*
* You can download media you previously uploaded with /media/input or media that was generated through another Dolby Media API.
*
* The temporary storage should allow you to read and write to the dlb:// locations for a period of at least 24 hours before it is removed.
*
* @link https://docs.dolby.io/media-apis/reference/media-output-get
*
* @param accessToken Access token to use for authentication.
* @param dlbUrl The `url` should be in the form `dlb://object-key` where the object-key can be any alpha-numeric string. The object-key is unique to your account API Key so there is no risk of collision with other users.
* @param filePath Local file path where to download the file to.
*/
export declare const downloadFile: (accessToken: JwtToken, dlbUrl: string, filePath: string) => Promise<void>;