File: /var/www/quadcode.com/node_modules/pipedrive/dist/api/PersonsApi.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 _AddFollowerToPersonResponse = _interopRequireDefault(require("../model/AddFollowerToPersonResponse"));
var _AddPersonFollowerRequest = _interopRequireDefault(require("../model/AddPersonFollowerRequest"));
var _AddPersonPictureResponse = _interopRequireDefault(require("../model/AddPersonPictureResponse"));
var _AddPersonResponse = _interopRequireDefault(require("../model/AddPersonResponse"));
var _ChangelogResponse = _interopRequireDefault(require("../model/ChangelogResponse"));
var _DeletePersonResponse = _interopRequireDefault(require("../model/DeletePersonResponse"));
var _DeletePersonsInBulkResponse = _interopRequireDefault(require("../model/DeletePersonsInBulkResponse"));
var _FailResponse = _interopRequireDefault(require("../model/FailResponse"));
var _GetAllPersonsResponse = _interopRequireDefault(require("../model/GetAllPersonsResponse"));
var _GetPersonDetailsResponse = _interopRequireDefault(require("../model/GetPersonDetailsResponse"));
var _InlineResponse = _interopRequireDefault(require("../model/InlineResponse2002"));
var _ListActivitiesResponse = _interopRequireDefault(require("../model/ListActivitiesResponse"));
var _ListDealsResponse = _interopRequireDefault(require("../model/ListDealsResponse"));
var _ListFilesResponse = _interopRequireDefault(require("../model/ListFilesResponse"));
var _ListFollowersResponse = _interopRequireDefault(require("../model/ListFollowersResponse"));
var _ListMailMessagesResponse = _interopRequireDefault(require("../model/ListMailMessagesResponse"));
var _ListPermittedUsersResponse = _interopRequireDefault(require("../model/ListPermittedUsersResponse1"));
var _ListPersonProductsResponse = _interopRequireDefault(require("../model/ListPersonProductsResponse"));
var _MergePersonsRequest = _interopRequireDefault(require("../model/MergePersonsRequest"));
var _MergePersonsResponse = _interopRequireDefault(require("../model/MergePersonsResponse"));
var _NewPerson = _interopRequireDefault(require("../model/NewPerson"));
var _NumberBoolean = _interopRequireDefault(require("../model/NumberBoolean"));
var _PersonFlowResponse = _interopRequireDefault(require("../model/PersonFlowResponse"));
var _PersonSearchResponse = _interopRequireDefault(require("../model/PersonSearchResponse"));
var _UpdatePerson = _interopRequireDefault(require("../model/UpdatePerson"));
var _UpdatePersonResponse = _interopRequireDefault(require("../model/UpdatePersonResponse"));
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.
*
*/
/**
* Persons service.
* @module api/PersonsApi
* @version 1.0.0
*/
var PersonsApi = /*#__PURE__*/function () {
/**
* Constructs a new PersonsApi.
* @alias module:api/PersonsApi
* @class
* @param {module:ApiClient} [apiClient] Optional API client implementation to use,
* default to {@link module:ApiClient#instance} if unspecified.
*/
function PersonsApi(apiClient) {
(0, _classCallCheck2["default"])(this, PersonsApi);
this.apiClient = apiClient;
}
/**
* Add a person
* Adds a new person. Note that you can supply additional custom fields along with the request that are not described here. These custom fields are different for each Pipedrive account and can be recognized by long hashes as keys. To determine which custom fields exists, fetch the personFields and look for `key` values.<br>If a company uses the [Campaigns product](https://pipedrive.readme.io/docs/campaigns-in-pipedrive-api), then this endpoint will also accept and return the `data.marketing_status` field.
* @param {Object} opts Optional parameters
* @param {module:model/NewPerson} opts.newPerson
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/AddPersonResponse} and HTTP response
*/
(0, _createClass2["default"])(PersonsApi, [{
key: "addPersonWithHttpInfo",
value: function addPersonWithHttpInfo(opts) {
opts = opts || {};
var postBody = opts['newPerson'];
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 = _AddPersonResponse["default"];
return this.apiClient.callApi('/persons', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* Add a person
* Adds a new person. Note that you can supply additional custom fields along with the request that are not described here. These custom fields are different for each Pipedrive account and can be recognized by long hashes as keys. To determine which custom fields exists, fetch the personFields and look for `key` values.<br>If a company uses the [Campaigns product](https://pipedrive.readme.io/docs/campaigns-in-pipedrive-api), then this endpoint will also accept and return the `data.marketing_status` field.
* @param {Object} opts Optional parameters
* @param {module:model/NewPerson} opts.newPerson
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/AddPersonResponse}
*/
}, {
key: "addPerson",
value: function addPerson(opts) {
return this.addPersonWithHttpInfo(opts).then(function (response_and_data) {
return response_and_data;
});
}
/**
* Add a follower to a person
* Adds a follower to a person.
* @param {Number} id The ID of the person
* @param {Object} opts Optional parameters
* @param {module:model/AddPersonFollowerRequest} opts.addPersonFollowerRequest
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/AddFollowerToPersonResponse} and HTTP response
*/
}, {
key: "addPersonFollowerWithHttpInfo",
value: function addPersonFollowerWithHttpInfo(id, opts) {
opts = opts || {};
var postBody = opts['addPersonFollowerRequest'];
// verify the required parameter 'id' is set
if (id === undefined || id === null) {
throw new Error("Missing the required parameter 'id' when calling addPersonFollower");
}
if (opts['user_id'] === undefined || opts['user_id'] === null) {
throw new Error("Missing the required parameter 'user_id' when calling addPersonFollower");
}
var pathParams = {
'id': id
};
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 = _AddFollowerToPersonResponse["default"];
return this.apiClient.callApi('/persons/{id}/followers', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* Add a follower to a person
* Adds a follower to a person.
* @param {Number} id The ID of the person
* @param {Object} opts Optional parameters
* @param {module:model/AddPersonFollowerRequest} opts.addPersonFollowerRequest
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/AddFollowerToPersonResponse}
*/
}, {
key: "addPersonFollower",
value: function addPersonFollower(id, opts) {
return this.addPersonFollowerWithHttpInfo(id, opts).then(function (response_and_data) {
return response_and_data;
});
}
/**
* Add person picture
* Adds a picture to a person. If a picture is already set, the old picture will be replaced. Added image (or the cropping parameters supplied with the request) should have an equal width and height and should be at least 128 pixels. GIF, JPG and PNG are accepted. All added images will be resized to 128 and 512 pixel wide squares.
* @param {Number} id The ID of the person
* @param {File} file One image supplied in the multipart/form-data encoding
* @param {Object} opts Optional parameters
* @param {Number} opts.cropX X coordinate to where start cropping form (in pixels)
* @param {Number} opts.cropY Y coordinate to where start cropping form (in pixels)
* @param {Number} opts.cropWidth The width of the cropping area (in pixels)
* @param {Number} opts.cropHeight The height of the cropping area (in pixels)
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/AddPersonPictureResponse} and HTTP response
*/
}, {
key: "addPersonPictureWithHttpInfo",
value: function addPersonPictureWithHttpInfo(id, file, 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 addPersonPicture");
}
// verify the required parameter 'file' is set
if (file === undefined || file === null) {
throw new Error("Missing the required parameter 'file' when calling addPersonPicture");
}
var pathParams = {
'id': id
};
var queryParams = {};
var headerParams = {};
var formParams = {
'file': file,
'crop_x': opts['cropX'],
'crop_y': opts['cropY'],
'crop_width': opts['cropWidth'],
'crop_height': opts['cropHeight']
};
var formParamArray = ['file', 'cropX', 'cropY', 'cropWidth', 'cropHeight'];
var contentTypes = ['multipart/form-data'];
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 = _AddPersonPictureResponse["default"];
return this.apiClient.callApi('/persons/{id}/picture', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* Add person picture
* Adds a picture to a person. If a picture is already set, the old picture will be replaced. Added image (or the cropping parameters supplied with the request) should have an equal width and height and should be at least 128 pixels. GIF, JPG and PNG are accepted. All added images will be resized to 128 and 512 pixel wide squares.
* @param {Number} id The ID of the person
* @param {File} file One image supplied in the multipart/form-data encoding
* @param {Object} opts Optional parameters
* @param {Number} opts.cropX X coordinate to where start cropping form (in pixels)
* @param {Number} opts.cropY Y coordinate to where start cropping form (in pixels)
* @param {Number} opts.cropWidth The width of the cropping area (in pixels)
* @param {Number} opts.cropHeight The height of the cropping area (in pixels)
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/AddPersonPictureResponse}
*/
}, {
key: "addPersonPicture",
value: function addPersonPicture(id, file, opts) {
return this.addPersonPictureWithHttpInfo(id, file, opts).then(function (response_and_data) {
return response_and_data;
});
}
/**
* Delete a person
* Marks a person as deleted. After 30 days, the person will be permanently deleted.
* @param {Number} id The ID of the person
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/DeletePersonResponse} and HTTP response
*/
}, {
key: "deletePersonWithHttpInfo",
value: function deletePersonWithHttpInfo(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 deletePerson");
}
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 = _DeletePersonResponse["default"];
return this.apiClient.callApi('/persons/{id}', 'DELETE', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* Delete a person
* Marks a person as deleted. After 30 days, the person will be permanently deleted.
* @param {Number} id The ID of the person
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/DeletePersonResponse}
*/
}, {
key: "deletePerson",
value: function deletePerson(id) {
return this.deletePersonWithHttpInfo(id).then(function (response_and_data) {
return response_and_data;
});
}
/**
* Delete a follower from a person
* Deletes a follower from a person.
* @param {Number} id The ID of the person
* @param {Number} followerId The ID of the follower
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/DeletePersonResponse} and HTTP response
*/
}, {
key: "deletePersonFollowerWithHttpInfo",
value: function deletePersonFollowerWithHttpInfo(id, followerId) {
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 deletePersonFollower");
}
// verify the required parameter 'followerId' is set
if (followerId === undefined || followerId === null) {
throw new Error("Missing the required parameter 'followerId' when calling deletePersonFollower");
}
var pathParams = {
'id': id,
'follower_id': followerId
};
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 = _DeletePersonResponse["default"];
return this.apiClient.callApi('/persons/{id}/followers/{follower_id}', 'DELETE', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* Delete a follower from a person
* Deletes a follower from a person.
* @param {Number} id The ID of the person
* @param {Number} followerId The ID of the follower
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/DeletePersonResponse}
*/
}, {
key: "deletePersonFollower",
value: function deletePersonFollower(id, followerId) {
return this.deletePersonFollowerWithHttpInfo(id, followerId).then(function (response_and_data) {
return response_and_data;
});
}
/**
* Delete person picture
* Deletes a person’s picture.
* @param {Number} id The ID of the person
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/DeletePersonResponse} and HTTP response
*/
}, {
key: "deletePersonPictureWithHttpInfo",
value: function deletePersonPictureWithHttpInfo(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 deletePersonPicture");
}
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 = _DeletePersonResponse["default"];
return this.apiClient.callApi('/persons/{id}/picture', 'DELETE', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* Delete person picture
* Deletes a person’s picture.
* @param {Number} id The ID of the person
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/DeletePersonResponse}
*/
}, {
key: "deletePersonPicture",
value: function deletePersonPicture(id) {
return this.deletePersonPictureWithHttpInfo(id).then(function (response_and_data) {
return response_and_data;
});
}
/**
* Delete multiple persons in bulk
* Marks multiple persons as deleted. After 30 days, the persons will be permanently deleted.
* @param {String} ids The comma-separated IDs that will be deleted
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/DeletePersonsInBulkResponse} and HTTP response
*/
}, {
key: "deletePersonsWithHttpInfo",
value: function deletePersonsWithHttpInfo(ids) {
var opts = {};
var postBody = null;
// verify the required parameter 'ids' is set
if (ids === undefined || ids === null) {
throw new Error("Missing the required parameter 'ids' when calling deletePersons");
}
var pathParams = {};
var queryParams = {
'ids': ids
};
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 = _DeletePersonsInBulkResponse["default"];
return this.apiClient.callApi('/persons', 'DELETE', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* Delete multiple persons in bulk
* Marks multiple persons as deleted. After 30 days, the persons will be permanently deleted.
* @param {String} ids The comma-separated IDs that will be deleted
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/DeletePersonsInBulkResponse}
*/
}, {
key: "deletePersons",
value: function deletePersons(ids) {
return this.deletePersonsWithHttpInfo(ids).then(function (response_and_data) {
return response_and_data;
});
}
/**
* Get details of a person
* Returns the details of a person. Note that this also returns some additional fields which are not present when asking for all persons. Also note that custom fields appear as long hashes in the resulting data. These hashes can be mapped against the `key` value of personFields.<br>If a company uses the [Campaigns product](https://pipedrive.readme.io/docs/campaigns-in-pipedrive-api), then this endpoint will also return the `data.marketing_status` field.
* @param {Number} id The ID of the person
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/GetPersonDetailsResponse} and HTTP response
*/
}, {
key: "getPersonWithHttpInfo",
value: function getPersonWithHttpInfo(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 getPerson");
}
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 = _GetPersonDetailsResponse["default"];
return this.apiClient.callApi('/persons/{id}', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* Get details of a person
* Returns the details of a person. Note that this also returns some additional fields which are not present when asking for all persons. Also note that custom fields appear as long hashes in the resulting data. These hashes can be mapped against the `key` value of personFields.<br>If a company uses the [Campaigns product](https://pipedrive.readme.io/docs/campaigns-in-pipedrive-api), then this endpoint will also return the `data.marketing_status` field.
* @param {Number} id The ID of the person
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/GetPersonDetailsResponse}
*/
}, {
key: "getPerson",
value: function getPerson(id) {
return this.getPersonWithHttpInfo(id).then(function (response_and_data) {
return response_and_data;
});
}
/**
* List activities associated with a person
* Lists activities associated with a person.
* @param {Number} id The ID of the person
* @param {Object} opts Optional parameters
* @param {Number} opts.start Pagination start (default to 0)
* @param {Number} opts.limit Items shown per page
* @param {module:model/NumberBoolean} opts.done Whether the activity is done or not. 0 = Not done, 1 = Done. If omitted, returns both Done and Not done activities.
* @param {String} opts.exclude A comma-separated string of activity IDs to exclude from result
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/ListActivitiesResponse} and HTTP response
*/
}, {
key: "getPersonActivitiesWithHttpInfo",
value: function getPersonActivitiesWithHttpInfo(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 getPersonActivities");
}
var pathParams = {
'id': id
};
var queryParams = {
'start': opts['start'] === undefined ? opts['start'] : opts['start'],
'limit': opts['limit'] === undefined ? opts['limit'] : opts['limit'],
'done': opts['done'] === undefined ? opts['done'] : opts['done'],
'exclude': opts['exclude'] === undefined ? opts['exclude'] : opts['exclude']
};
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 = _ListActivitiesResponse["default"];
return this.apiClient.callApi('/persons/{id}/activities', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* List activities associated with a person
* Lists activities associated with a person.
* @param {Number} id The ID of the person
* @param {Object} opts Optional parameters
* @param {Number} opts.start Pagination start (default to 0)
* @param {Number} opts.limit Items shown per page
* @param {module:model/NumberBoolean} opts.done Whether the activity is done or not. 0 = Not done, 1 = Done. If omitted, returns both Done and Not done activities.
* @param {String} opts.exclude A comma-separated string of activity IDs to exclude from result
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/ListActivitiesResponse}
*/
}, {
key: "getPersonActivities",
value: function getPersonActivities(id, opts) {
return this.getPersonActivitiesWithHttpInfo(id, opts).then(function (response_and_data) {
return response_and_data;
});
}
/**
* List updates about person field values
* Lists updates about field values of a person.
* @param {Number} id The ID of the person
* @param {Object} opts Optional parameters
* @param {String} opts.cursor For pagination, the marker (an opaque string value) representing the first item on the next page
* @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/ChangelogResponse} and HTTP response
*/
}, {
key: "getPersonChangelogWithHttpInfo",
value: function getPersonChangelogWithHttpInfo(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 getPersonChangelog");
}
var pathParams = {
'id': id
};
var queryParams = {
'cursor': opts['cursor'] === undefined ? opts['cursor'] : opts['cursor'],
'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 = _ChangelogResponse["default"];
return this.apiClient.callApi('/persons/{id}/changelog', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* List updates about person field values
* Lists updates about field values of a person.
* @param {Number} id The ID of the person
* @param {Object} opts Optional parameters
* @param {String} opts.cursor For pagination, the marker (an opaque string value) representing the first item on the next page
* @param {Number} opts.limit Items shown per page
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/ChangelogResponse}
*/
}, {
key: "getPersonChangelog",
value: function getPersonChangelog(id, opts) {
return this.getPersonChangelogWithHttpInfo(id, opts).then(function (response_and_data) {
return response_and_data;
});
}
/**
* List deals associated with a person
* Lists deals associated with a person.
* @param {Number} id The ID of the person
* @param {Object} opts Optional parameters
* @param {Number} opts.start Pagination start (default to 0)
* @param {Number} opts.limit Items shown per page
* @param {module:model/String} opts.status Only fetch deals with a specific status. If omitted, all not deleted deals are returned. If set to deleted, deals that have been deleted up to 30 days ago will be included. (default to 'all_not_deleted')
* @param {String} opts.sort The field names and sorting mode separated by a comma (`field_name_1 ASC`, `field_name_2 DESC`). Only first-level field keys are supported (no nested keys).
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/ListDealsResponse} and HTTP response
*/
}, {
key: "getPersonDealsWithHttpInfo",
value: function getPersonDealsWithHttpInfo(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 getPersonDeals");
}
var pathParams = {
'id': id
};
var queryParams = {
'start': opts['start'] === undefined ? opts['start'] : opts['start'],
'limit': opts['limit'] === undefined ? opts['limit'] : opts['limit'],
'status': opts['status'] === undefined ? opts['status'] : opts['status'],
'sort': opts['sort'] === undefined ? opts['sort'] : opts['sort']
};
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 = _ListDealsResponse["default"];
return this.apiClient.callApi('/persons/{id}/deals', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* List deals associated with a person
* Lists deals associated with a person.
* @param {Number} id The ID of the person
* @param {Object} opts Optional parameters
* @param {Number} opts.start Pagination start (default to 0)
* @param {Number} opts.limit Items shown per page
* @param {module:model/String} opts.status Only fetch deals with a specific status. If omitted, all not deleted deals are returned. If set to deleted, deals that have been deleted up to 30 days ago will be included. (default to 'all_not_deleted')
* @param {String} opts.sort The field names and sorting mode separated by a comma (`field_name_1 ASC`, `field_name_2 DESC`). Only first-level field keys are supported (no nested keys).
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/ListDealsResponse}
*/
}, {
key: "getPersonDeals",
value: function getPersonDeals(id, opts) {
return this.getPersonDealsWithHttpInfo(id, opts).then(function (response_and_data) {
return response_and_data;
});
}
/**
* List files attached to a person
* Lists files associated with a person.
* @param {Number} id The ID of the person
* @param {Object} opts Optional parameters
* @param {Number} opts.start Pagination start (default to 0)
* @param {Number} opts.limit Items shown per page
* @param {String} opts.sort The field names and sorting mode separated by a comma (`field_name_1 ASC`, `field_name_2 DESC`). Only first-level field keys are supported (no nested keys). Supported fields: `id`, `user_id`, `deal_id`, `person_id`, `org_id`, `product_id`, `add_time`, `update_time`, `file_name`, `file_type`, `file_size`, `comment`.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/ListFilesResponse} and HTTP response
*/
}, {
key: "getPersonFilesWithHttpInfo",
value: function getPersonFilesWithHttpInfo(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 getPersonFiles");
}
var pathParams = {
'id': id
};
var queryParams = {
'start': opts['start'] === undefined ? opts['start'] : opts['start'],
'limit': opts['limit'] === undefined ? opts['limit'] : opts['limit'],
'sort': opts['sort'] === undefined ? opts['sort'] : opts['sort']
};
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 = _ListFilesResponse["default"];
return this.apiClient.callApi('/persons/{id}/files', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* List files attached to a person
* Lists files associated with a person.
* @param {Number} id The ID of the person
* @param {Object} opts Optional parameters
* @param {Number} opts.start Pagination start (default to 0)
* @param {Number} opts.limit Items shown per page
* @param {String} opts.sort The field names and sorting mode separated by a comma (`field_name_1 ASC`, `field_name_2 DESC`). Only first-level field keys are supported (no nested keys). Supported fields: `id`, `user_id`, `deal_id`, `person_id`, `org_id`, `product_id`, `add_time`, `update_time`, `file_name`, `file_type`, `file_size`, `comment`.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/ListFilesResponse}
*/
}, {
key: "getPersonFiles",
value: function getPersonFiles(id, opts) {
return this.getPersonFilesWithHttpInfo(id, opts).then(function (response_and_data) {
return response_and_data;
});
}
/**
* List followers of a person
* Lists the followers of a person.
* @param {Number} id The ID of the person
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/ListFollowersResponse} and HTTP response
*/
}, {
key: "getPersonFollowersWithHttpInfo",
value: function getPersonFollowersWithHttpInfo(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 getPersonFollowers");
}
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 = _ListFollowersResponse["default"];
return this.apiClient.callApi('/persons/{id}/followers', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* List followers of a person
* Lists the followers of a person.
* @param {Number} id The ID of the person
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/ListFollowersResponse}
*/
}, {
key: "getPersonFollowers",
value: function getPersonFollowers(id) {
return this.getPersonFollowersWithHttpInfo(id).then(function (response_and_data) {
return response_and_data;
});
}
/**
* List mail messages associated with a person
* Lists mail messages associated with a person.
* @param {Number} id The ID of the person
* @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/ListMailMessagesResponse} and HTTP response
*/
}, {
key: "getPersonMailMessagesWithHttpInfo",
value: function getPersonMailMessagesWithHttpInfo(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 getPersonMailMessages");
}
var pathParams = {
'id': id
};
var queryParams = {
'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 = _ListMailMessagesResponse["default"];
return this.apiClient.callApi('/persons/{id}/mailMessages', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* List mail messages associated with a person
* Lists mail messages associated with a person.
* @param {Number} id The ID of the person
* @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/ListMailMessagesResponse}
*/
}, {
key: "getPersonMailMessages",
value: function getPersonMailMessages(id, opts) {
return this.getPersonMailMessagesWithHttpInfo(id, opts).then(function (response_and_data) {
return response_and_data;
});
}
/**
* List products associated with a person
* Lists products associated with a person.
* @param {Number} id The ID of the person
* @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/ListPersonProductsResponse} and HTTP response
*/
}, {
key: "getPersonProductsWithHttpInfo",
value: function getPersonProductsWithHttpInfo(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 getPersonProducts");
}
var pathParams = {
'id': id
};
var queryParams = {
'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 = _ListPersonProductsResponse["default"];
return this.apiClient.callApi('/persons/{id}/products', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* List products associated with a person
* Lists products associated with a person.
* @param {Number} id The ID of the person
* @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/ListPersonProductsResponse}
*/
}, {
key: "getPersonProducts",
value: function getPersonProducts(id, opts) {
return this.getPersonProductsWithHttpInfo(id, opts).then(function (response_and_data) {
return response_and_data;
});
}
/**
* List updates about a person
* Lists updates about a person.<br>If a company uses the [Campaigns product](https://pipedrive.readme.io/docs/campaigns-in-pipedrive-api), then this endpoint's response will also include updates for the `marketing_status` field.
* @param {Number} id The ID of the person
* @param {Object} opts Optional parameters
* @param {Number} opts.start Pagination start (default to 0)
* @param {Number} opts.limit Items shown per page
* @param {String} opts.allChanges Whether to show custom field updates or not. 1 = Include custom field changes. If omitted returns changes without custom field updates.
* @param {String} opts.items A comma-separated string for filtering out item specific updates. (Possible values - call, activity, plannedActivity, change, note, deal, file, dealChange, personChange, organizationChange, follower, dealFollower, personFollower, organizationFollower, participant, comment, mailMessage, mailMessageWithAttachment, invoice, document, marketing_campaign_stat, marketing_status_change).
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/PersonFlowResponse} and HTTP response
*/
}, {
key: "getPersonUpdatesWithHttpInfo",
value: function getPersonUpdatesWithHttpInfo(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 getPersonUpdates");
}
var pathParams = {
'id': id
};
var queryParams = {
'start': opts['start'] === undefined ? opts['start'] : opts['start'],
'limit': opts['limit'] === undefined ? opts['limit'] : opts['limit'],
'all_changes': opts['all_changes'] === undefined ? opts['allChanges'] : opts['all_changes'],
'items': opts['items'] === undefined ? opts['items'] : opts['items']
};
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 = _PersonFlowResponse["default"];
return this.apiClient.callApi('/persons/{id}/flow', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* List updates about a person
* Lists updates about a person.<br>If a company uses the [Campaigns product](https://pipedrive.readme.io/docs/campaigns-in-pipedrive-api), then this endpoint's response will also include updates for the `marketing_status` field.
* @param {Number} id The ID of the person
* @param {Object} opts Optional parameters
* @param {Number} opts.start Pagination start (default to 0)
* @param {Number} opts.limit Items shown per page
* @param {String} opts.allChanges Whether to show custom field updates or not. 1 = Include custom field changes. If omitted returns changes without custom field updates.
* @param {String} opts.items A comma-separated string for filtering out item specific updates. (Possible values - call, activity, plannedActivity, change, note, deal, file, dealChange, personChange, organizationChange, follower, dealFollower, personFollower, organizationFollower, participant, comment, mailMessage, mailMessageWithAttachment, invoice, document, marketing_campaign_stat, marketing_status_change).
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/PersonFlowResponse}
*/
}, {
key: "getPersonUpdates",
value: function getPersonUpdates(id, opts) {
return this.getPersonUpdatesWithHttpInfo(id, opts).then(function (response_and_data) {
return response_and_data;
});
}
/**
* List permitted users
* List users permitted to access a person.
* @param {Number} id The ID of the person
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/ListPermittedUsersResponse1} and HTTP response
*/
}, {
key: "getPersonUsersWithHttpInfo",
value: function getPersonUsersWithHttpInfo(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 getPersonUsers");
}
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 = _ListPermittedUsersResponse["default"];
return this.apiClient.callApi('/persons/{id}/permittedUsers', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* List permitted users
* List users permitted to access a person.
* @param {Number} id The ID of the person
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/ListPermittedUsersResponse1}
*/
}, {
key: "getPersonUsers",
value: function getPersonUsers(id) {
return this.getPersonUsersWithHttpInfo(id).then(function (response_and_data) {
return response_and_data;
});
}
/**
* Get all persons
* Returns all persons.
* @param {Object} opts Optional parameters
* @param {Number} opts.userId If supplied, only persons owned by the given user will be returned. However, `filter_id` takes precedence over `user_id` when both are supplied.
* @param {Number} opts.filterId The ID of the filter to use
* @param {String} opts.firstChar If supplied, only persons whose name starts with the specified letter will be returned (case-insensitive)
* @param {Number} opts.start Pagination start (default to 0)
* @param {Number} opts.limit Items shown per page
* @param {String} opts.sort The field names and sorting mode separated by a comma (`field_name_1 ASC`, `field_name_2 DESC`). Only first-level field keys are supported (no nested keys).
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/GetAllPersonsResponse} and HTTP response
*/
}, {
key: "getPersonsWithHttpInfo",
value: function getPersonsWithHttpInfo(opts) {
opts = opts || {};
var postBody = null;
var pathParams = {};
var queryParams = {
'user_id': opts['user_id'] === undefined ? opts['userId'] : opts['user_id'],
'filter_id': opts['filter_id'] === undefined ? opts['filterId'] : opts['filter_id'],
'first_char': opts['first_char'] === undefined ? opts['firstChar'] : opts['first_char'],
'start': opts['start'] === undefined ? opts['start'] : opts['start'],
'limit': opts['limit'] === undefined ? opts['limit'] : opts['limit'],
'sort': opts['sort'] === undefined ? opts['sort'] : opts['sort']
};
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 = _GetAllPersonsResponse["default"];
return this.apiClient.callApi('/persons', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* Get all persons
* Returns all persons.
* @param {Object} opts Optional parameters
* @param {Number} opts.userId If supplied, only persons owned by the given user will be returned. However, `filter_id` takes precedence over `user_id` when both are supplied.
* @param {Number} opts.filterId The ID of the filter to use
* @param {String} opts.firstChar If supplied, only persons whose name starts with the specified letter will be returned (case-insensitive)
* @param {Number} opts.start Pagination start (default to 0)
* @param {Number} opts.limit Items shown per page
* @param {String} opts.sort The field names and sorting mode separated by a comma (`field_name_1 ASC`, `field_name_2 DESC`). Only first-level field keys are supported (no nested keys).
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/GetAllPersonsResponse}
*/
}, {
key: "getPersons",
value: function getPersons(opts) {
return this.getPersonsWithHttpInfo(opts).then(function (response_and_data) {
return response_and_data;
});
}
/**
* Get all persons (BETA)
* Returns all persons. This is a cursor-paginated endpoint that is currently in BETA. For more information, please refer to our documentation on <a href=\"https://pipedrive.readme.io/docs/core-api-concepts-pagination\" target=\"_blank\" rel=\"noopener noreferrer\">pagination</a>. Please note that only global admins (those with global permissions) can access these endpoints. Users with regular permissions will receive a 403 response. Read more about global permissions <a href=\"https://support.pipedrive.com/en/article/global-user-management\" target=\"_blank\" rel=\"noopener noreferrer\">here</a>.
* @param {Object} opts Optional parameters
* @param {String} opts.cursor For pagination, the marker (an opaque string value) representing the first item on the next page
* @param {Number} opts.limit For pagination, the limit of entries to be returned. If not provided, 100 items will be returned. Please note that a maximum value of 500 is allowed.
* @param {String} opts.since The time boundary that points to the start of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field.
* @param {String} opts.until The time boundary that points to the end of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field.
* @param {Number} opts.ownerId If supplied, only persons owned by the given user will be returned
* @param {String} opts.firstChar If supplied, only persons whose name starts with the specified letter will be returned (case-insensitive)
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/InlineResponse2002} and HTTP response
*/
}, {
key: "getPersonsCollectionWithHttpInfo",
value: function getPersonsCollectionWithHttpInfo(opts) {
opts = opts || {};
var postBody = null;
var pathParams = {};
var queryParams = {
'cursor': opts['cursor'] === undefined ? opts['cursor'] : opts['cursor'],
'limit': opts['limit'] === undefined ? opts['limit'] : opts['limit'],
'since': opts['since'] === undefined ? opts['since'] : opts['since'],
'until': opts['until'] === undefined ? opts['until'] : opts['until'],
'owner_id': opts['owner_id'] === undefined ? opts['ownerId'] : opts['owner_id'],
'first_char': opts['first_char'] === undefined ? opts['firstChar'] : opts['first_char']
};
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 = _InlineResponse["default"];
return this.apiClient.callApi('/persons/collection', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* Get all persons (BETA)
* Returns all persons. This is a cursor-paginated endpoint that is currently in BETA. For more information, please refer to our documentation on <a href=\"https://pipedrive.readme.io/docs/core-api-concepts-pagination\" target=\"_blank\" rel=\"noopener noreferrer\">pagination</a>. Please note that only global admins (those with global permissions) can access these endpoints. Users with regular permissions will receive a 403 response. Read more about global permissions <a href=\"https://support.pipedrive.com/en/article/global-user-management\" target=\"_blank\" rel=\"noopener noreferrer\">here</a>.
* @param {Object} opts Optional parameters
* @param {String} opts.cursor For pagination, the marker (an opaque string value) representing the first item on the next page
* @param {Number} opts.limit For pagination, the limit of entries to be returned. If not provided, 100 items will be returned. Please note that a maximum value of 500 is allowed.
* @param {String} opts.since The time boundary that points to the start of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field.
* @param {String} opts.until The time boundary that points to the end of the range of data. Datetime in ISO 8601 format. E.g. 2022-11-01 08:55:59. Operates on the `update_time` field.
* @param {Number} opts.ownerId If supplied, only persons owned by the given user will be returned
* @param {String} opts.firstChar If supplied, only persons whose name starts with the specified letter will be returned (case-insensitive)
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/InlineResponse2002}
*/
}, {
key: "getPersonsCollection",
value: function getPersonsCollection(opts) {
return this.getPersonsCollectionWithHttpInfo(opts).then(function (response_and_data) {
return response_and_data;
});
}
/**
* Merge two persons
* Merges a person with another person. For more information, see the tutorial for <a href=\"https://pipedrive.readme.io/docs/merging-two-persons\" target=\"_blank\" rel=\"noopener noreferrer\">merging two persons</a>.
* @param {Number} id The ID of the person
* @param {Object} opts Optional parameters
* @param {module:model/MergePersonsRequest} opts.mergePersonsRequest
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/MergePersonsResponse} and HTTP response
*/
}, {
key: "mergePersonsWithHttpInfo",
value: function mergePersonsWithHttpInfo(id, opts) {
opts = opts || {};
var postBody = opts['mergePersonsRequest'];
// verify the required parameter 'id' is set
if (id === undefined || id === null) {
throw new Error("Missing the required parameter 'id' when calling mergePersons");
}
if (opts['merge_with_id'] === undefined || opts['merge_with_id'] === null) {
throw new Error("Missing the required parameter 'merge_with_id' when calling mergePersons");
}
var pathParams = {
'id': id
};
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 = _MergePersonsResponse["default"];
return this.apiClient.callApi('/persons/{id}/merge', 'PUT', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* Merge two persons
* Merges a person with another person. For more information, see the tutorial for <a href=\"https://pipedrive.readme.io/docs/merging-two-persons\" target=\"_blank\" rel=\"noopener noreferrer\">merging two persons</a>.
* @param {Number} id The ID of the person
* @param {Object} opts Optional parameters
* @param {module:model/MergePersonsRequest} opts.mergePersonsRequest
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/MergePersonsResponse}
*/
}, {
key: "mergePersons",
value: function mergePersons(id, opts) {
return this.mergePersonsWithHttpInfo(id, opts).then(function (response_and_data) {
return response_and_data;
});
}
/**
* Search persons
* Searches all persons by name, email, phone, notes and/or custom fields. This endpoint is a wrapper of <a href=\"https://developers.pipedrive.com/docs/api/v1/ItemSearch#searchItem\">/v1/itemSearch</a> with a narrower OAuth scope. Found persons can be filtered by organization ID.
* @param {String} term The search term to look for. Minimum 2 characters (or 1 if using `exact_match`). Please note that the search term has to be URL encoded.
* @param {Object} opts Optional parameters
* @param {module:model/String} opts.fields A comma-separated string array. The fields to perform the search from. Defaults to all of them. Only the following custom field types are searchable: `address`, `varchar`, `text`, `varchar_auto`, `double`, `monetary` and `phone`. Read more about searching by custom fields <a href=\"https://support.pipedrive.com/en/article/search-finding-what-you-need#searching-by-custom-fields\" target=\"_blank\" rel=\"noopener noreferrer\">here</a>.
* @param {Boolean} opts.exactMatch When enabled, only full exact matches against the given term are returned. It is <b>not</b> case sensitive.
* @param {Number} opts.organizationId Will filter persons by the provided organization ID. The upper limit of found persons associated with the organization is 2000.
* @param {module:model/String} opts.includeFields Supports including optional fields in the results which are not provided by default
* @param {Number} opts.start Pagination start. Note that the pagination is based on main results and does not include related items when using `search_for_related_items` parameter. (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/PersonSearchResponse} and HTTP response
*/
}, {
key: "searchPersonsWithHttpInfo",
value: function searchPersonsWithHttpInfo(term, opts) {
opts = opts || {};
var postBody = null;
// verify the required parameter 'term' is set
if (term === undefined || term === null) {
throw new Error("Missing the required parameter 'term' when calling searchPersons");
}
var pathParams = {};
var queryParams = {
'term': term,
'fields': opts['fields'] === undefined ? opts['fields'] : opts['fields'],
'exact_match': opts['exact_match'] === undefined ? opts['exactMatch'] : opts['exact_match'],
'organization_id': opts['organization_id'] === undefined ? opts['organizationId'] : opts['organization_id'],
'include_fields': opts['include_fields'] === undefined ? opts['includeFields'] : opts['include_fields'],
'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 = _PersonSearchResponse["default"];
return this.apiClient.callApi('/persons/search', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* Search persons
* Searches all persons by name, email, phone, notes and/or custom fields. This endpoint is a wrapper of <a href=\"https://developers.pipedrive.com/docs/api/v1/ItemSearch#searchItem\">/v1/itemSearch</a> with a narrower OAuth scope. Found persons can be filtered by organization ID.
* @param {String} term The search term to look for. Minimum 2 characters (or 1 if using `exact_match`). Please note that the search term has to be URL encoded.
* @param {Object} opts Optional parameters
* @param {module:model/String} opts.fields A comma-separated string array. The fields to perform the search from. Defaults to all of them. Only the following custom field types are searchable: `address`, `varchar`, `text`, `varchar_auto`, `double`, `monetary` and `phone`. Read more about searching by custom fields <a href=\"https://support.pipedrive.com/en/article/search-finding-what-you-need#searching-by-custom-fields\" target=\"_blank\" rel=\"noopener noreferrer\">here</a>.
* @param {Boolean} opts.exactMatch When enabled, only full exact matches against the given term are returned. It is <b>not</b> case sensitive.
* @param {Number} opts.organizationId Will filter persons by the provided organization ID. The upper limit of found persons associated with the organization is 2000.
* @param {module:model/String} opts.includeFields Supports including optional fields in the results which are not provided by default
* @param {Number} opts.start Pagination start. Note that the pagination is based on main results and does not include related items when using `search_for_related_items` parameter. (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/PersonSearchResponse}
*/
}, {
key: "searchPersons",
value: function searchPersons(term, opts) {
return this.searchPersonsWithHttpInfo(term, opts).then(function (response_and_data) {
return response_and_data;
});
}
/**
* Update a person
* Updates the properties of a person. For more information, see the tutorial for <a href=\"https://pipedrive.readme.io/docs/updating-a-person\" target=\"_blank\" rel=\"noopener noreferrer\">updating a person</a>.<br>If a company uses the [Campaigns product](https://pipedrive.readme.io/docs/campaigns-in-pipedrive-api), then this endpoint will also accept and return the `data.marketing_status` field.
* @param {Number} id The ID of the person
* @param {Object} opts Optional parameters
* @param {module:model/UpdatePerson} opts.updatePerson
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/UpdatePersonResponse} and HTTP response
*/
}, {
key: "updatePersonWithHttpInfo",
value: function updatePersonWithHttpInfo(id, opts) {
opts = opts || {};
var postBody = opts['updatePerson'];
// verify the required parameter 'id' is set
if (id === undefined || id === null) {
throw new Error("Missing the required parameter 'id' when calling updatePerson");
}
var pathParams = {
'id': id
};
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 = _UpdatePersonResponse["default"];
return this.apiClient.callApi('/persons/{id}', 'PUT', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* Update a person
* Updates the properties of a person. For more information, see the tutorial for <a href=\"https://pipedrive.readme.io/docs/updating-a-person\" target=\"_blank\" rel=\"noopener noreferrer\">updating a person</a>.<br>If a company uses the [Campaigns product](https://pipedrive.readme.io/docs/campaigns-in-pipedrive-api), then this endpoint will also accept and return the `data.marketing_status` field.
* @param {Number} id The ID of the person
* @param {Object} opts Optional parameters
* @param {module:model/UpdatePerson} opts.updatePerson
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/UpdatePersonResponse}
*/
}, {
key: "updatePerson",
value: function updatePerson(id, opts) {
return this.updatePersonWithHttpInfo(id, opts).then(function (response_and_data) {
return response_and_data;
});
}
}]);
return PersonsApi;
}();
exports["default"] = PersonsApi;