UNPKG

backendless-console-sdk

Version:

Backendless Console SDK for Node.js and browser

134 lines (128 loc) 7.37 kB
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); var _typeof = require("@babel/runtime/helpers/typeof"); Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = void 0; var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck")); var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass")); var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits")); var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn")); var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf")); var _urls = _interopRequireWildcard(require("./urls")); var _baseService = _interopRequireDefault(require("./base/base-service")); function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); } function _createSuper(t) { var r = _isNativeReflectConstruct(); return function () { var e, o = (0, _getPrototypeOf2["default"])(t); if (r) { var s = (0, _getPrototypeOf2["default"])(this).constructor; e = Reflect.construct(o, arguments, s); } else e = o.apply(this, arguments); return (0, _possibleConstructorReturn2["default"])(this, e); }; } function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); } /* eslint-disable max-len */ var DevTeam = /*#__PURE__*/function (_BaseService) { (0, _inherits2["default"])(DevTeam, _BaseService); var _super = _createSuper(DevTeam); function DevTeam(req) { var _this; (0, _classCallCheck2["default"])(this, DevTeam); _this = _super.call(this, req); _this.serviceName = 'devTeam'; return _this; } /** * @aiToolName Get Developers * @category Development Team * @description Retrieve list of developers for an application * @paramDef {"type":"string","name":"appId","label":"Application ID","description":"The identifier of the application","required":true} * @sampleResult [{"id":"D7ED38DB-2CD5-4E2D-BBCE-131F7D40254C","name":"Sergey Androsov","email":"androsov.srg@gmail.com"}] */ (0, _createClass2["default"])(DevTeam, [{ key: "getDevelopers", value: function getDevelopers(appId) { return this.req.get((0, _urls.devTeam)(appId)); } }, { key: "updateDevPermissions", value: function updateDevPermissions(appId, devId, permissions) { return this.req.put("".concat((0, _urls.devTeam)(appId, devId), "/permissions"), permissions); } }, { key: "updateDevPermissionGroups", value: function updateDevPermissionGroups(appId, devId, groups) { return this.req.put("".concat((0, _urls.devTeam)(appId, devId), "/permission/groups"), groups); } /** * @typedef {Object} inviteDeveloper__email * @paramDef {"type":"string","label":"Email Address","name":"email","required":true,"description":"The email address of the developer to invite to the team"} */ /** * @aiToolName Invite Developer * @category Development Team * @description Send an invitation to a developer to join the application team * @paramDef {"type":"string","name":"appId","label":"Application ID","description":"The identifier of the application","required":true} * @paramDef {"type":"inviteDeveloper__email","name":"email","label":"Email Object","description":"Object containing the email address of the developer to invite","required":true} * @sampleResult {"id":"ABC123-DEF456-GHI789","name":"Invited","email":"developer@example.com","lastLogin":null,"registrationDate":1672531200000,"system":false,"permissionGroups":[{"groupName":"Data Service","permissions":[{"id":"40","operation":"Create/Rename/Delete tables","access":"DENY","visible":true}],"visible":true}],"notifications":[{"type":"PERCENT_80","group":"Limits","enabled":false}]} */ }, { key: "inviteDeveloper", value: function inviteDeveloper(appId, email) { return this.req.post((0, _urls.devTeam)(appId), email); } /** * @aiToolName Remove Developer * @category Development Team * @description Remove a developer from the application team * @paramDef {"type":"string","name":"appId","label":"Application ID","description":"The identifier of the application","required":true} * @paramDef {"type":"string","name":"devId","label":"Developer ID","description":"The identifier of the developer to remove","required":true} * @sampleResult "" */ }, { key: "removeDeveloper", value: function removeDeveloper(appId, devId) { return this.req["delete"]("".concat((0, _urls.devTeam)(appId, devId))); } }, { key: "updateNotificationSettings", value: function updateNotificationSettings(appId, settings) { return this.req.put("".concat(_urls["default"].appConsole(appId), "/notifications/limits"), settings); } }, { key: "transferOwnership", value: function transferOwnership(appId, developerId) { return this.req.put("".concat(_urls["default"].appConsole(appId), "/devteam/owner"), { developerId: developerId }); } }, { key: "loadOwnershipTransferProposals", value: function loadOwnershipTransferProposals() { return this.req.get('/console/devteam/application-owner-change/pending-received-proposal'); } }, { key: "confirmOwnershipChange", value: function confirmOwnershipChange(appId, data) { return this.req.put("".concat(_urls["default"].appConsole(appId), "/devteam/owner-confirm"), data); } }, { key: "loadSentOwnershipTransfer", value: function loadSentOwnershipTransfer(appId) { return this.req.get("".concat(_urls["default"].appConsole(appId), "/devteam/application-owner-change/pending-sent-proposal")); } }, { key: "cancelSentOwnershipTransfer", value: function cancelSentOwnershipTransfer(appId) { return this.req["delete"]("".concat(_urls["default"].appConsole(appId), "/devteam/application-owner-change/pending-sent-proposal")); } /** * @aiToolName Generate Developer Signature * @category Development Team * @description Generate a signature for the current developer * @sampleResult "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.sampleSignatureHashExample" */ }, { key: "generateDeveloperSignature", value: function generateDeveloperSignature() { return this.req.get("".concat(_urls["default"].console(), "/developer/signature")); } }]); return DevTeam; }(_baseService["default"]); var _default = exports["default"] = function _default(req) { return DevTeam.create(req); };