@bitmovin/api-sdk
Version:
Bitmovin JS/TS API SDK
96 lines (95 loc) • 3.72 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const BaseAPI_1 = require("../../../common/BaseAPI");
const Mapper_1 = require("../../../common/Mapper");
const TenantsApi_1 = require("./tenants/TenantsApi");
const InvitationsApi_1 = require("./invitations/InvitationsApi");
const PermissionsApi_1 = require("./permissions/PermissionsApi");
const BitmovinResponse_1 = require("../../../models/BitmovinResponse");
const Group_1 = require("../../../models/Group");
const PaginationResponse_1 = require("../../../models/PaginationResponse");
const GroupListQueryParams_1 = require("./GroupListQueryParams");
/**
* GroupsApi - object-oriented interface
* @export
* @class GroupsApi
* @extends {BaseAPI}
*/
class GroupsApi extends BaseAPI_1.BaseAPI {
constructor(configuration) {
super(configuration);
this.tenants = new TenantsApi_1.default(configuration);
this.invitations = new InvitationsApi_1.default(configuration);
this.permissions = new PermissionsApi_1.default(configuration);
}
/**
* @summary Add Group
* @param {string} organizationId Id of the organization
* @param {Group} group Tenant Group details
* @throws {BitmovinError}
* @memberof GroupsApi
*/
create(organizationId, group) {
const pathParamMap = {
organization_id: organizationId
};
return this.restClient.post('/account/organizations/{organization_id}/groups', pathParamMap, group).then((response) => {
return (0, Mapper_1.map)(response, Group_1.default);
});
}
/**
* @summary Delete Group
* @param {string} organizationId Id of the organization
* @param {string} groupId Id of the group
* @throws {BitmovinError}
* @memberof GroupsApi
*/
delete(organizationId, groupId) {
const pathParamMap = {
organization_id: organizationId,
group_id: groupId
};
return this.restClient.delete('/account/organizations/{organization_id}/groups/{group_id}', pathParamMap).then((response) => {
return (0, Mapper_1.map)(response, BitmovinResponse_1.default);
});
}
/**
* @summary Group Details
* @param {string} organizationId Id of the organization
* @param {string} groupId Id of the group.
* @throws {BitmovinError}
* @memberof GroupsApi
*/
get(organizationId, groupId) {
const pathParamMap = {
organization_id: organizationId,
group_id: groupId
};
return this.restClient.get('/account/organizations/{organization_id}/groups/{group_id}', pathParamMap).then((response) => {
return (0, Mapper_1.map)(response, Group_1.default);
});
}
/**
* @summary List Groups
* @param {string} organizationId Id of the organization
* @param {*} [queryParameters] query parameters for filtering, sorting and pagination
* @throws {BitmovinError}
* @memberof GroupsApi
*/
list(organizationId, queryParameters) {
const pathParamMap = {
organization_id: organizationId
};
let queryParams = {};
if (typeof queryParameters === 'function') {
queryParams = queryParameters(new GroupListQueryParams_1.GroupListQueryParamsBuilder()).buildQueryParams();
}
else if (queryParameters) {
queryParams = queryParameters;
}
return this.restClient.get('/account/organizations/{organization_id}/groups', pathParamMap, queryParams).then((response) => {
return new PaginationResponse_1.default(response, Group_1.default);
});
}
}
exports.default = GroupsApi;