File: /var/www/fintechfuel/node_modules/pipedrive/dist/api/MailboxApi.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 _MailMessage = _interopRequireDefault(require("../model/MailMessage"));
var _MailThread = _interopRequireDefault(require("../model/MailThread"));
var _MailThreadDelete = _interopRequireDefault(require("../model/MailThreadDelete"));
var _MailThreadMessages = _interopRequireDefault(require("../model/MailThreadMessages"));
var _MailThreadOne = _interopRequireDefault(require("../model/MailThreadOne"));
var _MailThreadPut = _interopRequireDefault(require("../model/MailThreadPut"));
var _NumberBoolean = _interopRequireDefault(require("../model/NumberBoolean"));
var _NumberBooleanDefault = _interopRequireDefault(require("../model/NumberBooleanDefault0"));
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; }
/**
* Mailbox service.
* @module api/MailboxApi
* @version 1.0.0
*/
var MailboxApi = /*#__PURE__*/function () {
/**
* Constructs a new MailboxApi.
* @alias module:api/MailboxApi
* @class
* @param {module:ApiClient} [apiClient] Optional API client implementation to use,
* default to {@link module:ApiClient#instance} if unspecified.
*/
function MailboxApi(apiClient) {
(0, _classCallCheck2["default"])(this, MailboxApi);
this.apiClient = apiClient;
}
/**
* Delete mail thread
* Marks a mail thread as deleted.
* @param {Number} id The ID of the mail thread
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/MailThreadDelete} and HTTP response
*/
(0, _createClass2["default"])(MailboxApi, [{
key: "deleteMailThreadWithHttpInfo",
value: function deleteMailThreadWithHttpInfo(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 deleteMailThread");
}
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 = _MailThreadDelete["default"];
return this.apiClient.callApi('/mailbox/mailThreads/{id}', 'DELETE', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* Delete mail thread
* Marks a mail thread as deleted.
* @param {Number} id The ID of the mail thread
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/MailThreadDelete}
*/
}, {
key: "deleteMailThread",
value: function deleteMailThread(id) {
return this.deleteMailThreadWithHttpInfo(id).then(function (response_and_data) {
return response_and_data;
});
}
/**
* Get one mail message
* Returns data about a specific mail message.
* @param {Number} id The ID of the mail message to fetch
* @param {Object} opts Optional parameters
* @param {module:model/NumberBooleanDefault0} opts.includeBody Whether to include the full message body or not. `0` = Don't include, `1` = Include
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/MailMessage} and HTTP response
*/
}, {
key: "getMailMessageWithHttpInfo",
value: function getMailMessageWithHttpInfo(id, opts) {
opts = 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 getMailMessage");
}
var pathParams = {
'id': id
};
var queryParams = {
'include_body': opts['include_body'] === undefined ? opts['includeBody'] : opts['include_body']
};
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 = _MailMessage["default"];
return this.apiClient.callApi('/mailbox/mailMessages/{id}', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* Get one mail message
* Returns data about a specific mail message.
* @param {Number} id The ID of the mail message to fetch
* @param {Object} opts Optional parameters
* @param {module:model/NumberBooleanDefault0} opts.includeBody Whether to include the full message body or not. `0` = Don't include, `1` = Include
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/MailMessage}
*/
}, {
key: "getMailMessage",
value: function getMailMessage(id, opts) {
return this.getMailMessageWithHttpInfo(id, opts).then(function (response_and_data) {
return response_and_data;
});
}
/**
* Get one mail thread
* Returns a specific mail thread.
* @param {Number} id The ID of the mail thread
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/MailThreadOne} and HTTP response
*/
}, {
key: "getMailThreadWithHttpInfo",
value: function getMailThreadWithHttpInfo(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 getMailThread");
}
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 = _MailThreadOne["default"];
return this.apiClient.callApi('/mailbox/mailThreads/{id}', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* Get one mail thread
* Returns a specific mail thread.
* @param {Number} id The ID of the mail thread
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/MailThreadOne}
*/
}, {
key: "getMailThread",
value: function getMailThread(id) {
return this.getMailThreadWithHttpInfo(id).then(function (response_and_data) {
return response_and_data;
});
}
/**
* Get all mail messages of mail thread
* Returns all the mail messages inside a specified mail thread.
* @param {Number} id The ID of the mail thread
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/MailThreadMessages} and HTTP response
*/
}, {
key: "getMailThreadMessagesWithHttpInfo",
value: function getMailThreadMessagesWithHttpInfo(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 getMailThreadMessages");
}
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 = _MailThreadMessages["default"];
return this.apiClient.callApi('/mailbox/mailThreads/{id}/mailMessages', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* Get all mail messages of mail thread
* Returns all the mail messages inside a specified mail thread.
* @param {Number} id The ID of the mail thread
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/MailThreadMessages}
*/
}, {
key: "getMailThreadMessages",
value: function getMailThreadMessages(id) {
return this.getMailThreadMessagesWithHttpInfo(id).then(function (response_and_data) {
return response_and_data;
});
}
/**
* Get mail threads
* Returns mail threads in a specified folder ordered by the most recent message within.
* @param {module:model/String} folder The type of folder to fetch
* @param {Object} opts Optional parameters
* @param {Number} opts.start Pagination start (default to 0)
* @param {Number} opts.limit Items shown per page
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/MailThread} and HTTP response
*/
}, {
key: "getMailThreadsWithHttpInfo",
value: function getMailThreadsWithHttpInfo(folder, opts) {
opts = opts || {};
var postBody = null;
// verify the required parameter 'folder' is set
if (folder === undefined || folder === null) {
throw new Error("Missing the required parameter 'folder' when calling getMailThreads");
}
var pathParams = {};
var queryParams = {
'folder': folder,
'start': opts['start'] === undefined ? opts['start'] : opts['start'],
'limit': opts['limit'] === undefined ? opts['limit'] : opts['limit']
};
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 = _MailThread["default"];
return this.apiClient.callApi('/mailbox/mailThreads', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* Get mail threads
* Returns mail threads in a specified folder ordered by the most recent message within.
* @param {module:model/String} folder The type of folder to fetch
* @param {Object} opts Optional parameters
* @param {Number} opts.start Pagination start (default to 0)
* @param {Number} opts.limit Items shown per page
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/MailThread}
*/
}, {
key: "getMailThreads",
value: function getMailThreads(folder, opts) {
return this.getMailThreadsWithHttpInfo(folder, opts).then(function (response_and_data) {
return response_and_data;
});
}
/**
* Update mail thread details
* Updates the properties of a mail thread.
* @param {Number} id The ID of the mail thread
* @param {Object} opts Optional parameters
* @param {Number} opts.dealId The ID of the deal this thread is associated with
* @param {String} opts.leadId The ID of the lead this thread is associated with
* @param {module:model/NumberBoolean} opts.sharedFlag Whether this thread is shared with other users in your company
* @param {module:model/NumberBoolean} opts.readFlag Whether this thread is read or unread
* @param {module:model/NumberBoolean} opts.archivedFlag Whether this thread is archived or not. You can only archive threads that belong to Inbox folder. Archived threads will disappear from Inbox.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/MailThreadPut} and HTTP response
*/
}, {
key: "updateMailThreadDetailsWithHttpInfo",
value: function updateMailThreadDetailsWithHttpInfo(id, opts) {
opts = 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 updateMailThreadDetails");
}
var pathParams = {
'id': id
};
var queryParams = {};
var headerParams = {};
var formParams = {
'deal_id': opts['dealId'],
'lead_id': opts['leadId'],
'shared_flag': opts['sharedFlag'],
'read_flag': opts['readFlag'],
'archived_flag': opts['archivedFlag']
};
var formParamArray = ['dealId', 'leadId', 'sharedFlag', 'readFlag', 'archivedFlag'];
var contentTypes = ['application/x-www-form-urlencoded'];
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 = _MailThreadPut["default"];
return this.apiClient.callApi('/mailbox/mailThreads/{id}', 'PUT', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* Update mail thread details
* Updates the properties of a mail thread.
* @param {Number} id The ID of the mail thread
* @param {Object} opts Optional parameters
* @param {Number} opts.dealId The ID of the deal this thread is associated with
* @param {String} opts.leadId The ID of the lead this thread is associated with
* @param {module:model/NumberBoolean} opts.sharedFlag Whether this thread is shared with other users in your company
* @param {module:model/NumberBoolean} opts.readFlag Whether this thread is read or unread
* @param {module:model/NumberBoolean} opts.archivedFlag Whether this thread is archived or not. You can only archive threads that belong to Inbox folder. Archived threads will disappear from Inbox.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/MailThreadPut}
*/
}, {
key: "updateMailThreadDetails",
value: function updateMailThreadDetails(id, opts) {
return this.updateMailThreadDetailsWithHttpInfo(id, opts).then(function (response_and_data) {
return response_and_data;
});
}
}]);
return MailboxApi;
}();
exports["default"] = MailboxApi;