@bitmovin/api-sdk
Version:
Bitmovin JS/TS API SDK
95 lines (94 loc) • 4.08 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 SubOrganizationsApi_1 = require("./subOrganizations/SubOrganizationsApi");
var TenantsApi_1 = require("./tenants/TenantsApi");
var InvitationsApi_1 = require("./invitations/InvitationsApi");
var GroupsApi_1 = require("./groups/GroupsApi");
var Organization_1 = require("../../models/Organization");
var PaginationResponse_1 = require("../../models/PaginationResponse");
/**
* OrganizationsApi - object-oriented interface
* @export
* @class OrganizationsApi
* @extends {BaseAPI}
*/
var OrganizationsApi = /** @class */ (function (_super) {
__extends(OrganizationsApi, _super);
function OrganizationsApi(configuration) {
var _this = _super.call(this, configuration) || this;
_this.subOrganizations = new SubOrganizationsApi_1.default(configuration);
_this.tenants = new TenantsApi_1.default(configuration);
_this.invitations = new InvitationsApi_1.default(configuration);
_this.groups = new GroupsApi_1.default(configuration);
return _this;
}
/**
* @summary Add Organization
* @param {Organization} organization Organization Details
* @throws {BitmovinError}
* @memberof OrganizationsApi
*/
OrganizationsApi.prototype.create = function (organization) {
return this.restClient.post('/account/organizations', {}, organization).then(function (response) {
return (0, Mapper_1.map)(response, Organization_1.default);
});
};
/**
* @summary Organization Details
* @param {string} organizationId ID of the organization
* @throws {BitmovinError}
* @memberof OrganizationsApi
*/
OrganizationsApi.prototype.get = function (organizationId) {
var pathParamMap = {
organization_id: organizationId
};
return this.restClient.get('/account/organizations/{organization_id}', pathParamMap).then(function (response) {
return (0, Mapper_1.map)(response, Organization_1.default);
});
};
/**
* @summary List Organizations
* @throws {BitmovinError}
* @memberof OrganizationsApi
*/
OrganizationsApi.prototype.list = function () {
return this.restClient.get('/account/organizations', {}).then(function (response) {
return new PaginationResponse_1.default(response, Organization_1.default);
});
};
/**
* @summary Update Organization
* @param {string} organizationId ID of the organization
* @param {UpdateOrganizationRequest} updateOrganizationRequest Organization Details fields to be updated
* @throws {BitmovinError}
* @memberof OrganizationsApi
*/
OrganizationsApi.prototype.update = function (organizationId, updateOrganizationRequest) {
var pathParamMap = {
organization_id: organizationId
};
return this.restClient.put('/account/organizations/{organization_id}', pathParamMap, updateOrganizationRequest).then(function (response) {
return (0, Mapper_1.map)(response, Organization_1.default);
});
};
return OrganizationsApi;
}(BaseAPI_1.BaseAPI));
exports.default = OrganizationsApi;