@dolbyio/dolbyio-rest-apis-client
Version:
Node.JS wrapper for the Dolby.io REST APIs
65 lines (64 loc) • 1.73 kB
TypeScript
/// <reference types="node" />
/// <reference types="node" />
import coreHttp from 'http';
export interface RequestOptions {
hostname: string;
path: string;
params?: NodeJS.Dict<string>;
headers: coreHttp.OutgoingHttpHeaders;
body?: string;
}
/**
* Sends a GET request.
*
* @param options Request options.
*
* @returns A JSON payload object through a {@link Promise}.
*/
export declare const sendGet: (options: RequestOptions) => Promise<any>;
/**
* Sends a POST request.
*
* @param options Request options.
*
* @returns A JSON payload object through a {@link Promise}.
*/
export declare const sendPost: (options: RequestOptions) => Promise<any>;
/**
* Sends a PUT request.
*
* @param options Request options.
*
* @returns A JSON payload object through a {@link Promise}.
*/
export declare const sendPut: (options: RequestOptions) => Promise<any>;
/**
* Sends a DELETE request.
*
* @param options Request options.
*
* @returns A JSON payload object through a {@link Promise}.
*/
export declare const sendDelete: (options: RequestOptions) => Promise<any>;
/**
* Sends a PATCH request.
*
* @param options Request options.
*
* @returns A JSON payload object through a {@link Promise}.
*/
export declare const sendPatch: (options: RequestOptions) => Promise<any>;
/**
* Download a file.
*
* @param filepath Where to save the file.
* @param options Request options.
*/
export declare const download: (filepath: string, options: RequestOptions) => Promise<void>;
/**
* Upload a file.
*
* @param filepath The local path of the file to upload.
* @param uploadUrl Where to upload the file to.
*/
export declare const upload: (filepath: string, uploadUrl: string) => Promise<void>;