UNPKG

box-node-sdk

Version:

Official SDK for Box Plaform APIs

113 lines 6.2 kB
"use strict"; var __rest = (this && this.__rest) || function (s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; } return t; }; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; var url_path_1 = __importDefault(require("../util/url-path")); /** */ var IntegrationMappingsManager = /** @class */ (function () { /** * @param {BoxClient} client The Box API Client that is responsible for making calls to the API */ function IntegrationMappingsManager(client) { this.client = client; } /** * List Slack integration mappings * * Lists [Slack integration mappings](https://support.box.com/hc/en-us/articles/4415585987859-Box-as-the-Content-Layer-for-Slack) in a users' enterprise. * * You need Admin or Co-Admin role to * use this endpoint. * @param {object} [options] Options for the request * @param {string} [options.marker] Defines the position marker at which to begin returning results. This is used when paginating using marker-based pagination. This requires `usemarker` to be set to `true`. * @param {number} [options.limit] The maximum number of items to return per page. * @param {"channel"} [options.partner_item_type] Mapped item type, for which the mapping should be returned * @param {string} [options.partner_item_id] ID of the mapped item, for which the mapping should be returned * @param {string} [options.box_item_id] Box item ID, for which the mappings should be returned * @param {"folder"} [options.box_item_type] Box item type, for which the mappings should be returned * @param {boolean} [options.is_manually_created] Whether the mapping has been manually created * @param {Function} [callback] Passed the result if successful, error otherwise * @returns {Promise<schemas.IntegrationMappings>} A promise resolving to the result or rejecting with an error */ IntegrationMappingsManager.prototype.getSlackIntegrationMappings = function (options, callback) { var queryParams = __rest(options, []), apiPath = (0, url_path_1.default)('integration_mappings', 'slack'), params = { qs: queryParams, }; return this.client.wrapWithDefaultHandler(this.client.get)(apiPath, params, callback); }; /** * Create Slack integration mapping * * Creates a [Slack integration mapping](https://support.box.com/hc/en-us/articles/4415585987859-Box-as-the-Content-Layer-for-Slack) * by mapping a Slack channel to a Box item. * * You need Admin or Co-Admin role to * use this endpoint. * @param {schemas.IntegrationMappingSlackCreateRequest} body * @param {object} [options] Options for the request * @param {Function} [callback] Passed the result if successful, error otherwise * @returns {Promise<schemas.IntegrationMapping>} A promise resolving to the result or rejecting with an error */ IntegrationMappingsManager.prototype.createSlackIntegrationMapping = function (body, options, callback) { var queryParams = __rest(options, []), apiPath = (0, url_path_1.default)('integration_mappings', 'slack'), params = { qs: queryParams, body: body, }; return this.client.wrapWithDefaultHandler(this.client.post)(apiPath, params, callback); }; /** * Update Slack integration mapping * * Updates a [Slack integration mapping](https://support.box.com/hc/en-us/articles/4415585987859-Box-as-the-Content-Layer-for-Slack). * Supports updating the Box folder ID and options. * * You need Admin or Co-Admin role to * use this endpoint. * @param {object} body * @param {object} options Options for the request * @param {string} options.integration_mapping_id An ID of an integration mapping * @param {Function} [callback] Passed the result if successful, error otherwise * @returns {Promise<schemas.IntegrationMapping>} A promise resolving to the result or rejecting with an error */ IntegrationMappingsManager.prototype.updateSlackIntegrationMapping = function (body, options, callback) { var integrationMappingId = options.integration_mapping_id, queryParams = __rest(options, ["integration_mapping_id"]), apiPath = (0, url_path_1.default)('integration_mappings', 'slack', integrationMappingId), params = { qs: queryParams, body: body, }; return this.client.wrapWithDefaultHandler(this.client.put)(apiPath, params, callback); }; /** * Delete Slack integration mapping * * Deletes a [Slack integration mapping](https://support.box.com/hc/en-us/articles/4415585987859-Box-as-the-Content-Layer-for-Slack). * * * You need Admin or Co-Admin role to * use this endpoint. * @param {object} options Options for the request * @param {string} options.integration_mapping_id An ID of an integration mapping * @param {Function} [callback] Passed the result if successful, error otherwise * @returns {Promise<void>} A promise resolving to the result or rejecting with an error */ IntegrationMappingsManager.prototype.deleteSlackIntegrationMappingById = function (options, callback) { var integrationMappingId = options.integration_mapping_id, queryParams = __rest(options, ["integration_mapping_id"]), apiPath = (0, url_path_1.default)('integration_mappings', 'slack', integrationMappingId), params = { qs: queryParams, }; return this.client.wrapWithDefaultHandler(this.client.del)(apiPath, params, callback); }; return IntegrationMappingsManager; }()); module.exports = IntegrationMappingsManager; //# sourceMappingURL=integration-mappings.js.map