UNPKG

@bitmovin/api-sdk

Version:

Bitmovin JS/TS API SDK

88 lines (87 loc) 3.69 kB
"use strict"; 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 Acl_1 = require("../../../../models/Acl"); var BitmovinResponse_1 = require("../../../../models/BitmovinResponse"); var PaginationResponse_1 = require("../../../../models/PaginationResponse"); /** * PermissionsApi - object-oriented interface * @export * @class PermissionsApi * @extends {BaseAPI} */ var PermissionsApi = /** @class */ (function (_super) { __extends(PermissionsApi, _super); function PermissionsApi(configuration) { return _super.call(this, configuration) || this; } /** * @summary Set Group Permissions * @param {string} organizationId Id of the organization * @param {string} groupId Id of the group * @param {Acl} acl Group Permissions * @throws {BitmovinError} * @memberof PermissionsApi */ PermissionsApi.prototype.create = function (organizationId, groupId, acl) { var pathParamMap = { organization_id: organizationId, group_id: groupId }; return this.restClient.post('/account/organizations/{organization_id}/groups/{group_id}/permissions', pathParamMap, acl).then(function (response) { return (0, Mapper_1.map)(response, Acl_1.default); }); }; /** * @summary Delete Permission * @param {string} organizationId Id of the organization * @param {string} groupId Id of the group * @param {string} permissionId Id of the permission * @throws {BitmovinError} * @memberof PermissionsApi */ PermissionsApi.prototype.delete = function (organizationId, groupId, permissionId) { var pathParamMap = { organization_id: organizationId, group_id: groupId, permission_id: permissionId }; return this.restClient.delete('/account/organizations/{organization_id}/groups/{group_id}/permissions/{permission_id}', pathParamMap).then(function (response) { return (0, Mapper_1.map)(response, BitmovinResponse_1.default); }); }; /** * @summary Get Group Permissions * @param {string} organizationId Id of the organization * @param {string} groupId Id of the group * @throws {BitmovinError} * @memberof PermissionsApi */ PermissionsApi.prototype.list = function (organizationId, groupId) { var pathParamMap = { organization_id: organizationId, group_id: groupId }; return this.restClient.get('/account/organizations/{organization_id}/groups/{group_id}/permissions', pathParamMap).then(function (response) { return new PaginationResponse_1.default(response, Acl_1.default); }); }; return PermissionsApi; }(BaseAPI_1.BaseAPI)); exports.default = PermissionsApi;