@bitmovin/api-sdk
Version:
Bitmovin JS/TS API SDK
106 lines (105 loc) • 3.88 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const BaseAPI_1 = require("../../common/BaseAPI");
const Mapper_1 = require("../../common/Mapper");
const BitmovinResponse_1 = require("../../models/BitmovinResponse");
const WatchFolder_1 = require("../../models/WatchFolder");
const PaginationResponse_1 = require("../../models/PaginationResponse");
const WatchFolderListQueryParams_1 = require("./WatchFolderListQueryParams");
/**
* WatchFoldersApi - object-oriented interface
* @export
* @class WatchFoldersApi
* @extends {BaseAPI}
*/
class WatchFoldersApi extends BaseAPI_1.BaseAPI {
constructor(configuration) {
super(configuration);
}
/**
* @summary Create Watch Folder
* @param {WatchFolder} watchFolder The Watch Folder to be created
* @throws {BitmovinError}
* @memberof WatchFoldersApi
*/
create(watchFolder) {
return this.restClient.post('/encoding/watch-folders', {}, watchFolder).then((response) => {
return (0, Mapper_1.map)(response, WatchFolder_1.default);
});
}
/**
* @summary Delete Watch Folder
* @param {string} watchFolderId Id of the Watch Folder
* @throws {BitmovinError}
* @memberof WatchFoldersApi
*/
delete(watchFolderId) {
const pathParamMap = {
watch_folder_id: watchFolderId
};
return this.restClient.delete('/encoding/watch-folders/{watch_folder_id}', pathParamMap).then((response) => {
return (0, Mapper_1.map)(response, BitmovinResponse_1.default);
});
}
/**
* @summary Watch Folder details
* @param {string} watchFolderId Id of the Watch Folder
* @throws {BitmovinError}
* @memberof WatchFoldersApi
*/
get(watchFolderId) {
const pathParamMap = {
watch_folder_id: watchFolderId
};
return this.restClient.get('/encoding/watch-folders/{watch_folder_id}', pathParamMap).then((response) => {
return (0, Mapper_1.map)(response, WatchFolder_1.default);
});
}
/**
* @summary List all Watch Folders
* @param {*} [queryParameters] query parameters for filtering, sorting and pagination
* @throws {BitmovinError}
* @memberof WatchFoldersApi
*/
list(queryParameters) {
let queryParams = {};
if (typeof queryParameters === 'function') {
queryParams = queryParameters(new WatchFolderListQueryParams_1.WatchFolderListQueryParamsBuilder()).buildQueryParams();
}
else if (queryParameters) {
queryParams = queryParameters;
}
return this.restClient.get('/encoding/watch-folders', {}, queryParams).then((response) => {
return new PaginationResponse_1.default(response, WatchFolder_1.default);
});
}
/**
* @summary Start Watch Folder
* @param {string} watchFolderId Id of the Watch Folder
* @throws {BitmovinError}
* @memberof WatchFoldersApi
*/
start(watchFolderId) {
const pathParamMap = {
watch_folder_id: watchFolderId
};
return this.restClient.post('/encoding/watch-folders/{watch_folder_id}/start', pathParamMap).then((response) => {
return (0, Mapper_1.map)(response, BitmovinResponse_1.default);
});
}
/**
* @summary Stop Watch Folder
* @param {string} watchFolderId Id of the Watch Folder
* @throws {BitmovinError}
* @memberof WatchFoldersApi
*/
stop(watchFolderId) {
const pathParamMap = {
watch_folder_id: watchFolderId
};
return this.restClient.post('/encoding/watch-folders/{watch_folder_id}/stop', pathParamMap).then((response) => {
return (0, Mapper_1.map)(response, BitmovinResponse_1.default);
});
}
}
exports.default = WatchFoldersApi;