@bitmovin/api-sdk
Version:
Bitmovin JS/TS API SDK
98 lines (97 loc) • 3.81 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 Tenant_1 = require("../../../../models/Tenant");
const PaginationResponse_1 = require("../../../../models/PaginationResponse");
const TenantListQueryParams_1 = require("./TenantListQueryParams");
/**
* TenantsApi - object-oriented interface
* @export
* @class TenantsApi
* @extends {BaseAPI}
*/
class TenantsApi extends BaseAPI_1.BaseAPI {
constructor(configuration) {
super(configuration);
}
/**
* @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
*/
create(organizationId, groupId, tenant) {
const pathParamMap = {
organization_id: organizationId,
group_id: groupId
};
return this.restClient.post('/account/organizations/{organization_id}/groups/{group_id}/tenants', pathParamMap, tenant).then((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
*/
delete(organizationId, groupId, tenantId) {
const 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((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
*/
get(organizationId, groupId, tenantId) {
const 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((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
*/
list(organizationId, groupId, queryParameters) {
const pathParamMap = {
organization_id: organizationId,
group_id: groupId
};
let 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((response) => {
return new PaginationResponse_1.default(response, Tenant_1.default);
});
}
}
exports.default = TenantsApi;