@bitmovin/api-sdk
Version:
Bitmovin JS/TS API SDK
79 lines (78 loc) • 2.88 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const BaseAPI_1 = require("../../../common/BaseAPI");
const Mapper_1 = require("../../../common/Mapper");
const RegionsApi_1 = require("./regions/RegionsApi");
const GceAccount_1 = require("../../../models/GceAccount");
const PaginationResponse_1 = require("../../../models/PaginationResponse");
const GceAccountListQueryParams_1 = require("./GceAccountListQueryParams");
/**
* GceApi - object-oriented interface
* @export
* @class GceApi
* @extends {BaseAPI}
*/
class GceApi extends BaseAPI_1.BaseAPI {
constructor(configuration) {
super(configuration);
this.regions = new RegionsApi_1.default(configuration);
}
/**
* @summary Add GCE Account
* @param {GceAccount} gceAccount The GCE Account to be added
* @throws {BitmovinError}
* @memberof GceApi
*/
create(gceAccount) {
return this.restClient.post('/encoding/infrastructure/gce', {}, gceAccount).then((response) => {
return (0, Mapper_1.map)(response, GceAccount_1.default);
});
}
/**
* @summary Delete GCE Account
* @param {string} infrastructureId Id of the GCE account
* @throws {BitmovinError}
* @memberof GceApi
*/
delete(infrastructureId) {
const pathParamMap = {
infrastructure_id: infrastructureId
};
return this.restClient.delete('/encoding/infrastructure/gce/{infrastructure_id}', pathParamMap).then((response) => {
return (0, Mapper_1.map)(response, GceAccount_1.default);
});
}
/**
* @summary GCE Account Details
* @param {string} infrastructureId Id of the GCE account
* @throws {BitmovinError}
* @memberof GceApi
*/
get(infrastructureId) {
const pathParamMap = {
infrastructure_id: infrastructureId
};
return this.restClient.get('/encoding/infrastructure/gce/{infrastructure_id}', pathParamMap).then((response) => {
return (0, Mapper_1.map)(response, GceAccount_1.default);
});
}
/**
* @summary List GCE Accounts
* @param {*} [queryParameters] query parameters for filtering, sorting and pagination
* @throws {BitmovinError}
* @memberof GceApi
*/
list(queryParameters) {
let queryParams = {};
if (typeof queryParameters === 'function') {
queryParams = queryParameters(new GceAccountListQueryParams_1.GceAccountListQueryParamsBuilder()).buildQueryParams();
}
else if (queryParameters) {
queryParams = queryParameters;
}
return this.restClient.get('/encoding/infrastructure/gce', {}, queryParams).then((response) => {
return new PaginationResponse_1.default(response, GceAccount_1.default);
});
}
}
exports.default = GceApi;