UNPKG

holly-sdk

Version:
40 lines (30 loc) 1.73 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.AppInstallationsAPI = undefined; var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); var _got = require("got"); var _got2 = _interopRequireDefault(_got); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var AppInstallationsAPI = exports.AppInstallationsAPI = function () { function AppInstallationsAPI(app) { _classCallCheck(this, AppInstallationsAPI); this.app = app; } _createClass(AppInstallationsAPI, [{ key: "updateAppInstallation", value: function updateAppInstallation(appInstallation) { return (0, _got2.default)(this.app.api.url + "/app_installations/" + this.app.manifest.name, { method: "PUT", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ app_installation: appInstallation }), json: true }).then(function (res) { return res.body.app_installation; }); } }]); return AppInstallationsAPI; }();