HEX
Server: nginx/1.18.0
System: Linux test-ipsremont 5.4.0-214-generic #234-Ubuntu SMP Fri Mar 14 23:50:27 UTC 2025 x86_64
User: ips (1000)
PHP: 8.0.30
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/quadcode.com/node_modules/pipedrive/dist/api/ChannelsApi.js
"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports["default"] = void 0;
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
var _ApiClient = _interopRequireDefault(require("../ApiClient"));
var _ChannelObject = _interopRequireDefault(require("../model/ChannelObject"));
var _ChannelObjectResponse = _interopRequireDefault(require("../model/ChannelObjectResponse"));
var _DeleteChannelSuccess = _interopRequireDefault(require("../model/DeleteChannelSuccess"));
var _DeleteConversationSuccess = _interopRequireDefault(require("../model/DeleteConversationSuccess"));
var _InlineResponse = _interopRequireDefault(require("../model/InlineResponse200"));
var _InlineResponse2 = _interopRequireDefault(require("../model/InlineResponse400"));
var _InlineResponse3 = _interopRequireDefault(require("../model/InlineResponse4001"));
var _InlineResponse4 = _interopRequireDefault(require("../model/InlineResponse403"));
var _InlineResponse5 = _interopRequireDefault(require("../model/InlineResponse4031"));
var _InlineResponse6 = _interopRequireDefault(require("../model/InlineResponse404"));
var _MessageObject = _interopRequireDefault(require("../model/MessageObject"));
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } /**
 * Pipedrive API v1
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: 1.0.0
 * 
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 *
 */
/**
* Channels service.
* @module api/ChannelsApi
* @version 1.0.0
*/
var ChannelsApi = /*#__PURE__*/function () {
  /**
  * Constructs a new ChannelsApi. 
  * @alias module:api/ChannelsApi
  * @class
  * @param {module:ApiClient} [apiClient] Optional API client implementation to use,
  * default to {@link module:ApiClient#instance} if unspecified.
  */
  function ChannelsApi(apiClient) {
    (0, _classCallCheck2["default"])(this, ChannelsApi);
    this.apiClient = apiClient;
  }

  /**
   * Add a channel
   * Adds a new messaging channel, only admins are able to register new channels. It will use the getConversations endpoint to fetch conversations, participants and messages afterward. To use the endpoint, you need to have **Messengers integration** OAuth scope enabled and the Messaging manifest ready for the [Messaging app extension](https://pipedrive.readme.io/docs/messaging-app-extension).
   * @param {Object} opts Optional parameters
   * @param {module:model/ChannelObject} opts.channelObject 
   * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/ChannelObjectResponse} and HTTP response
   */
  (0, _createClass2["default"])(ChannelsApi, [{
    key: "addChannelWithHttpInfo",
    value: function addChannelWithHttpInfo(opts) {
      opts = opts || {};
      var postBody = opts['channelObject'];
      if (opts['name'] === undefined || opts['name'] === null) {
        throw new Error("Missing the required parameter 'name' when calling addChannel");
      }
      if (opts['provider_channel_id'] === undefined || opts['provider_channel_id'] === null) {
        throw new Error("Missing the required parameter 'provider_channel_id' when calling addChannel");
      }
      var pathParams = {};
      var queryParams = {};
      var headerParams = {};
      var formParams = {};
      var formParamArray = [];
      var contentTypes = ['application/json'];
      var isURLEncoded = contentTypes.includes('application/x-www-form-urlencoded');
      var isJSON = contentTypes.includes('application/json');
      if (isJSON) {
        postBody = _objectSpread(_objectSpread({}, postBody), opts);
      } else if (isURLEncoded) {
        for (var key in opts) {
          if (opts.hasOwnProperty(key) && !formParamArray.includes(key)) {
            formParams[key] = opts[key];
          }
        }
      }
      var authNames = ['api_key', 'oauth2'];
      var accepts = ['application/json'];
      var returnType = _ChannelObjectResponse["default"];
      return this.apiClient.callApi('/channels', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
    }

    /**
     * Add a channel
     * Adds a new messaging channel, only admins are able to register new channels. It will use the getConversations endpoint to fetch conversations, participants and messages afterward. To use the endpoint, you need to have **Messengers integration** OAuth scope enabled and the Messaging manifest ready for the [Messaging app extension](https://pipedrive.readme.io/docs/messaging-app-extension).
     * @param {Object} opts Optional parameters
     * @param {module:model/ChannelObject} opts.channelObject 
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/ChannelObjectResponse}
     */
  }, {
    key: "addChannel",
    value: function addChannel(opts) {
      return this.addChannelWithHttpInfo(opts).then(function (response_and_data) {
        return response_and_data;
      });
    }

    /**
     * Delete a channel
     * Deletes an existing messenger’s channel and all related entities (conversations and messages). To use the endpoint, you need to have **Messengers integration** OAuth scope enabled and the Messaging manifest ready for the [Messaging app extension](https://pipedrive.readme.io/docs/messaging-app-extension).
     * @param {String} id The ID of the channel provided by the integration
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/DeleteChannelSuccess} and HTTP response
     */
  }, {
    key: "deleteChannelWithHttpInfo",
    value: function deleteChannelWithHttpInfo(id) {
      var opts = {};
      var postBody = null;

      // verify the required parameter 'id' is set
      if (id === undefined || id === null) {
        throw new Error("Missing the required parameter 'id' when calling deleteChannel");
      }
      var pathParams = {
        'id': id
      };
      var queryParams = {};
      var headerParams = {};
      var formParams = {};
      var formParamArray = [];
      var contentTypes = [];
      var isURLEncoded = contentTypes.includes('application/x-www-form-urlencoded');
      var isJSON = contentTypes.includes('application/json');
      if (isJSON) {
        postBody = _objectSpread(_objectSpread({}, postBody), opts);
      } else if (isURLEncoded) {
        for (var key in opts) {
          if (opts.hasOwnProperty(key) && !formParamArray.includes(key)) {
            formParams[key] = opts[key];
          }
        }
      }
      var authNames = ['api_key', 'oauth2'];
      var accepts = ['application/json'];
      var returnType = _DeleteChannelSuccess["default"];
      return this.apiClient.callApi('/channels/{id}', 'DELETE', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
    }

    /**
     * Delete a channel
     * Deletes an existing messenger’s channel and all related entities (conversations and messages). To use the endpoint, you need to have **Messengers integration** OAuth scope enabled and the Messaging manifest ready for the [Messaging app extension](https://pipedrive.readme.io/docs/messaging-app-extension).
     * @param {String} id The ID of the channel provided by the integration
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/DeleteChannelSuccess}
     */
  }, {
    key: "deleteChannel",
    value: function deleteChannel(id) {
      return this.deleteChannelWithHttpInfo(id).then(function (response_and_data) {
        return response_and_data;
      });
    }

    /**
     * Delete a conversation
     * Deletes an existing conversation. To use the endpoint, you need to have **Messengers integration** OAuth scope enabled and the Messaging manifest ready for the [Messaging app extension](https://pipedrive.readme.io/docs/messaging-app-extension).
     * @param {String} channelId The ID of the channel provided by the integration
     * @param {String} conversationId The ID of the conversation provided by the integration
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/DeleteConversationSuccess} and HTTP response
     */
  }, {
    key: "deleteConversationWithHttpInfo",
    value: function deleteConversationWithHttpInfo(channelId, conversationId) {
      var opts = {};
      var postBody = null;

      // verify the required parameter 'channelId' is set
      if (channelId === undefined || channelId === null) {
        throw new Error("Missing the required parameter 'channelId' when calling deleteConversation");
      }

      // verify the required parameter 'conversationId' is set
      if (conversationId === undefined || conversationId === null) {
        throw new Error("Missing the required parameter 'conversationId' when calling deleteConversation");
      }
      var pathParams = {
        'channel-id': channelId,
        'conversation-id': conversationId
      };
      var queryParams = {};
      var headerParams = {};
      var formParams = {};
      var formParamArray = [];
      var contentTypes = [];
      var isURLEncoded = contentTypes.includes('application/x-www-form-urlencoded');
      var isJSON = contentTypes.includes('application/json');
      if (isJSON) {
        postBody = _objectSpread(_objectSpread({}, postBody), opts);
      } else if (isURLEncoded) {
        for (var key in opts) {
          if (opts.hasOwnProperty(key) && !formParamArray.includes(key)) {
            formParams[key] = opts[key];
          }
        }
      }
      var authNames = ['api_key', 'oauth2'];
      var accepts = ['application/json'];
      var returnType = _DeleteConversationSuccess["default"];
      return this.apiClient.callApi('/channels/{channel-id}/conversations/{conversation-id}', 'DELETE', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
    }

    /**
     * Delete a conversation
     * Deletes an existing conversation. To use the endpoint, you need to have **Messengers integration** OAuth scope enabled and the Messaging manifest ready for the [Messaging app extension](https://pipedrive.readme.io/docs/messaging-app-extension).
     * @param {String} channelId The ID of the channel provided by the integration
     * @param {String} conversationId The ID of the conversation provided by the integration
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/DeleteConversationSuccess}
     */
  }, {
    key: "deleteConversation",
    value: function deleteConversation(channelId, conversationId) {
      return this.deleteConversationWithHttpInfo(channelId, conversationId).then(function (response_and_data) {
        return response_and_data;
      });
    }

    /**
     * Receives an incoming message
     * Adds a message to a conversation. To use the endpoint, you need to have **Messengers integration** OAuth scope enabled and the Messaging manifest ready for the [Messaging app extension](https://pipedrive.readme.io/docs/messaging-app-extension).
     * @param {Object} opts Optional parameters
     * @param {module:model/MessageObject} opts.messageObject 
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/InlineResponse200} and HTTP response
     */
  }, {
    key: "receiveMessageWithHttpInfo",
    value: function receiveMessageWithHttpInfo(opts) {
      opts = opts || {};
      var postBody = opts['messageObject'];
      if (opts['id'] === undefined || opts['id'] === null) {
        throw new Error("Missing the required parameter 'id' when calling receiveMessage");
      }
      if (opts['channel_id'] === undefined || opts['channel_id'] === null) {
        throw new Error("Missing the required parameter 'channel_id' when calling receiveMessage");
      }
      if (opts['sender_id'] === undefined || opts['sender_id'] === null) {
        throw new Error("Missing the required parameter 'sender_id' when calling receiveMessage");
      }
      if (opts['conversation_id'] === undefined || opts['conversation_id'] === null) {
        throw new Error("Missing the required parameter 'conversation_id' when calling receiveMessage");
      }
      if (opts['message'] === undefined || opts['message'] === null) {
        throw new Error("Missing the required parameter 'message' when calling receiveMessage");
      }
      if (opts['status'] === undefined || opts['status'] === null) {
        throw new Error("Missing the required parameter 'status' when calling receiveMessage");
      }
      if (opts['created_at'] === undefined || opts['created_at'] === null) {
        throw new Error("Missing the required parameter 'created_at' when calling receiveMessage");
      }
      var pathParams = {};
      var queryParams = {};
      var headerParams = {};
      var formParams = {};
      var formParamArray = [];
      var contentTypes = ['application/json'];
      var isURLEncoded = contentTypes.includes('application/x-www-form-urlencoded');
      var isJSON = contentTypes.includes('application/json');
      if (isJSON) {
        postBody = _objectSpread(_objectSpread({}, postBody), opts);
      } else if (isURLEncoded) {
        for (var key in opts) {
          if (opts.hasOwnProperty(key) && !formParamArray.includes(key)) {
            formParams[key] = opts[key];
          }
        }
      }
      var authNames = ['api_key', 'oauth2'];
      var accepts = ['application/json'];
      var returnType = _InlineResponse["default"];
      return this.apiClient.callApi('/channels/messages/receive', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
    }

    /**
     * Receives an incoming message
     * Adds a message to a conversation. To use the endpoint, you need to have **Messengers integration** OAuth scope enabled and the Messaging manifest ready for the [Messaging app extension](https://pipedrive.readme.io/docs/messaging-app-extension).
     * @param {Object} opts Optional parameters
     * @param {module:model/MessageObject} opts.messageObject 
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/InlineResponse200}
     */
  }, {
    key: "receiveMessage",
    value: function receiveMessage(opts) {
      return this.receiveMessageWithHttpInfo(opts).then(function (response_and_data) {
        return response_and_data;
      });
    }
  }]);
  return ChannelsApi;
}();
exports["default"] = ChannelsApi;