@bitmovin/api-sdk
Version:
Bitmovin JS/TS API SDK
114 lines (113 loc) • 4.76 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 TenantsApi_1 = require("./tenants/TenantsApi");
var InvitationsApi_1 = require("./invitations/InvitationsApi");
var PermissionsApi_1 = require("./permissions/PermissionsApi");
var BitmovinResponse_1 = require("../../../models/BitmovinResponse");
var Group_1 = require("../../../models/Group");
var PaginationResponse_1 = require("../../../models/PaginationResponse");
var GroupListQueryParams_1 = require("./GroupListQueryParams");
/**
* GroupsApi - object-oriented interface
* @export
* @class GroupsApi
* @extends {BaseAPI}
*/
var GroupsApi = /** @class */ (function (_super) {
__extends(GroupsApi, _super);
function GroupsApi(configuration) {
var _this = _super.call(this, configuration) || this;
_this.tenants = new TenantsApi_1.default(configuration);
_this.invitations = new InvitationsApi_1.default(configuration);
_this.permissions = new PermissionsApi_1.default(configuration);
return _this;
}
/**
* @summary Add Group
* @param {string} organizationId Id of the organization
* @param {Group} group Tenant Group details
* @throws {BitmovinError}
* @memberof GroupsApi
*/
GroupsApi.prototype.create = function (organizationId, group) {
var pathParamMap = {
organization_id: organizationId
};
return this.restClient.post('/account/organizations/{organization_id}/groups', pathParamMap, group).then(function (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
*/
GroupsApi.prototype.delete = function (organizationId, groupId) {
var pathParamMap = {
organization_id: organizationId,
group_id: groupId
};
return this.restClient.delete('/account/organizations/{organization_id}/groups/{group_id}', pathParamMap).then(function (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
*/
GroupsApi.prototype.get = function (organizationId, groupId) {
var pathParamMap = {
organization_id: organizationId,
group_id: groupId
};
return this.restClient.get('/account/organizations/{organization_id}/groups/{group_id}', pathParamMap).then(function (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
*/
GroupsApi.prototype.list = function (organizationId, queryParameters) {
var pathParamMap = {
organization_id: organizationId
};
var 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(function (response) {
return new PaginationResponse_1.default(response, Group_1.default);
});
};
return GroupsApi;
}(BaseAPI_1.BaseAPI));
exports.default = GroupsApi;