@bitmovin/api-sdk
Version:
Bitmovin JS/TS API SDK
115 lines (114 loc) • 4.83 kB
JavaScript
;
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var BaseAPI_1 = require("../../../../common/BaseAPI");
var Mapper_1 = require("../../../../common/Mapper");
var BitmovinResponse_1 = require("../../../../models/BitmovinResponse");
var Tenant_1 = require("../../../../models/Tenant");
var PaginationResponse_1 = require("../../../../models/PaginationResponse");
var TenantListQueryParams_1 = require("./TenantListQueryParams");
/**
* TenantsApi - object-oriented interface
* @export
* @class TenantsApi
* @extends {BaseAPI}
*/
var TenantsApi = /** @class */ (function (_super) {
__extends(TenantsApi, _super);
function TenantsApi(configuration) {
return _super.call(this, configuration) || this;
}
/**
* @summary Add Tenant to Group
* @param {string} organizationId Id of the organization
* @param {string} groupId Id of the group
* @param {Tenant} tenant Tenant details
* @throws {BitmovinError}
* @memberof TenantsApi
*/
TenantsApi.prototype.create = function (organizationId, groupId, tenant) {
var pathParamMap = {
organization_id: organizationId,
group_id: groupId
};
return this.restClient.post('/account/organizations/{organization_id}/groups/{group_id}/tenants', pathParamMap, tenant).then(function (response) {
return (0, Mapper_1.map)(response, Tenant_1.default);
});
};
/**
* @summary Delete Tenant
* @param {string} organizationId Id of the organization
* @param {string} groupId Id of the group
* @param {string} tenantId Id of the tenant.
* @throws {BitmovinError}
* @memberof TenantsApi
*/
TenantsApi.prototype.delete = function (organizationId, groupId, tenantId) {
var pathParamMap = {
organization_id: organizationId,
group_id: groupId,
tenant_id: tenantId
};
return this.restClient.delete('/account/organizations/{organization_id}/groups/{group_id}/tenants/{tenant_id}', pathParamMap).then(function (response) {
return (0, Mapper_1.map)(response, BitmovinResponse_1.default);
});
};
/**
* @summary Tenant Details
* @param {string} organizationId Id of the organization
* @param {string} groupId Id of the group
* @param {string} tenantId Id of the tenant.
* @throws {BitmovinError}
* @memberof TenantsApi
*/
TenantsApi.prototype.get = function (organizationId, groupId, tenantId) {
var pathParamMap = {
organization_id: organizationId,
group_id: groupId,
tenant_id: tenantId
};
return this.restClient.get('/account/organizations/{organization_id}/groups/{group_id}/tenants/{tenant_id}', pathParamMap).then(function (response) {
return (0, Mapper_1.map)(response, Tenant_1.default);
});
};
/**
* @summary List Tenants
* @param {string} organizationId Id of the organization
* @param {string} groupId Id of the group
* @param {*} [queryParameters] query parameters for filtering, sorting and pagination
* @throws {BitmovinError}
* @memberof TenantsApi
*/
TenantsApi.prototype.list = function (organizationId, groupId, queryParameters) {
var pathParamMap = {
organization_id: organizationId,
group_id: groupId
};
var queryParams = {};
if (typeof queryParameters === 'function') {
queryParams = queryParameters(new TenantListQueryParams_1.TenantListQueryParamsBuilder()).buildQueryParams();
}
else if (queryParameters) {
queryParams = queryParameters;
}
return this.restClient.get('/account/organizations/{organization_id}/groups/{group_id}/tenants', pathParamMap, queryParams).then(function (response) {
return new PaginationResponse_1.default(response, Tenant_1.default);
});
};
return TenantsApi;
}(BaseAPI_1.BaseAPI));
exports.default = TenantsApi;