File: /var/www/quadcode.com/node_modules/pipedrive/dist/api/OrganizationsApi.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 _AddOrganizationFollowerRequest = _interopRequireDefault(require("../model/AddOrganizationFollowerRequest"));
var _AllOrganizationsGetResponse = _interopRequireDefault(require("../model/AllOrganizationsGetResponse"));
var _ChangelogResponse = _interopRequireDefault(require("../model/ChangelogResponse"));
var _FailResponse = _interopRequireDefault(require("../model/FailResponse"));
var _InlineResponse = _interopRequireDefault(require("../model/InlineResponse2001"));
var _ListActivitiesResponse = _interopRequireDefault(require("../model/ListActivitiesResponse"));
var _ListDealsResponse = _interopRequireDefault(require("../model/ListDealsResponse"));
var _ListFilesResponse = _interopRequireDefault(require("../model/ListFilesResponse"));
var _ListMailMessagesResponse = _interopRequireDefault(require("../model/ListMailMessagesResponse"));
var _ListPermittedUsersResponse = _interopRequireDefault(require("../model/ListPermittedUsersResponse1"));
var _ListPersonsResponse = _interopRequireDefault(require("../model/ListPersonsResponse"));
var _MergeOrganizationsRequest = _interopRequireDefault(require("../model/MergeOrganizationsRequest"));
var _NewOrganization = _interopRequireDefault(require("../model/NewOrganization"));
var _NumberBoolean = _interopRequireDefault(require("../model/NumberBoolean"));
var _OrganizationDeleteResponse = _interopRequireDefault(require("../model/OrganizationDeleteResponse"));
var _OrganizationDetailsGetResponse = _interopRequireDefault(require("../model/OrganizationDetailsGetResponse"));
var _OrganizationFlowResponse = _interopRequireDefault(require("../model/OrganizationFlowResponse"));
var _OrganizationFollowerDeleteResponse = _interopRequireDefault(require("../model/OrganizationFollowerDeleteResponse"));
var _OrganizationFollowerPostResponse = _interopRequireDefault(require("../model/OrganizationFollowerPostResponse"));
var _OrganizationFollowersListResponse = _interopRequireDefault(require("../model/OrganizationFollowersListResponse"));
var _OrganizationPostResponse = _interopRequireDefault(require("../model/OrganizationPostResponse"));
var _OrganizationSearchResponse = _interopRequireDefault(require("../model/OrganizationSearchResponse"));
var _OrganizationUpdateResponse = _interopRequireDefault(require("../model/OrganizationUpdateResponse"));
var _OrganizationsDeleteResponse = _interopRequireDefault(require("../model/OrganizationsDeleteResponse"));
var _OrganizationsMergeResponse = _interopRequireDefault(require("../model/OrganizationsMergeResponse"));
var _UpdateOrganization = _interopRequireDefault(require("../model/UpdateOrganization"));
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.
*
*/
/**
* Organizations service.
* @module api/OrganizationsApi
* @version 1.0.0
*/
var OrganizationsApi = /*#__PURE__*/function () {
/**
* Constructs a new OrganizationsApi.
* @alias module:api/OrganizationsApi
* @class
* @param {module:ApiClient} [apiClient] Optional API client implementation to use,
* default to {@link module:ApiClient#instance} if unspecified.
*/
function OrganizationsApi(apiClient) {
(0, _classCallCheck2["default"])(this, OrganizationsApi);
this.apiClient = apiClient;
}
/**
* Add an organization
* Adds a new organization. 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 organizationFields and look for `key` values. For more information, see the tutorial for <a href=\"https://pipedrive.readme.io/docs/adding-an-organization\" target=\"_blank\" rel=\"noopener noreferrer\">adding an organization</a>.
* @param {Object} opts Optional parameters
* @param {module:model/NewOrganization} opts.newOrganization
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/OrganizationPostResponse} and HTTP response
*/
(0, _createClass2["default"])(OrganizationsApi, [{
key: "addOrganizationWithHttpInfo",
value: function addOrganizationWithHttpInfo(opts) {
opts = opts || {};
var postBody = opts['newOrganization'];
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 = _OrganizationPostResponse["default"];
return this.apiClient.callApi('/organizations', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* Add an organization
* Adds a new organization. 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 organizationFields and look for `key` values. For more information, see the tutorial for <a href=\"https://pipedrive.readme.io/docs/adding-an-organization\" target=\"_blank\" rel=\"noopener noreferrer\">adding an organization</a>.
* @param {Object} opts Optional parameters
* @param {module:model/NewOrganization} opts.newOrganization
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/OrganizationPostResponse}
*/
}, {
key: "addOrganization",
value: function addOrganization(opts) {
return this.addOrganizationWithHttpInfo(opts).then(function (response_and_data) {
return response_and_data;
});
}
/**
* Add a follower to an organization
* Adds a follower to an organization.
* @param {Number} id The ID of the organization
* @param {Object} opts Optional parameters
* @param {module:model/AddOrganizationFollowerRequest} opts.addOrganizationFollowerRequest
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/OrganizationFollowerPostResponse} and HTTP response
*/
}, {
key: "addOrganizationFollowerWithHttpInfo",
value: function addOrganizationFollowerWithHttpInfo(id, opts) {
opts = opts || {};
var postBody = opts['addOrganizationFollowerRequest'];
// verify the required parameter 'id' is set
if (id === undefined || id === null) {
throw new Error("Missing the required parameter 'id' when calling addOrganizationFollower");
}
if (opts['user_id'] === undefined || opts['user_id'] === null) {
throw new Error("Missing the required parameter 'user_id' when calling addOrganizationFollower");
}
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 = _OrganizationFollowerPostResponse["default"];
return this.apiClient.callApi('/organizations/{id}/followers', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* Add a follower to an organization
* Adds a follower to an organization.
* @param {Number} id The ID of the organization
* @param {Object} opts Optional parameters
* @param {module:model/AddOrganizationFollowerRequest} opts.addOrganizationFollowerRequest
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/OrganizationFollowerPostResponse}
*/
}, {
key: "addOrganizationFollower",
value: function addOrganizationFollower(id, opts) {
return this.addOrganizationFollowerWithHttpInfo(id, opts).then(function (response_and_data) {
return response_and_data;
});
}
/**
* Delete an organization
* Marks an organization as deleted. After 30 days, the organization will be permanently deleted.
* @param {Number} id The ID of the organization
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/OrganizationDeleteResponse} and HTTP response
*/
}, {
key: "deleteOrganizationWithHttpInfo",
value: function deleteOrganizationWithHttpInfo(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 deleteOrganization");
}
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 = _OrganizationDeleteResponse["default"];
return this.apiClient.callApi('/organizations/{id}', 'DELETE', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* Delete an organization
* Marks an organization as deleted. After 30 days, the organization will be permanently deleted.
* @param {Number} id The ID of the organization
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/OrganizationDeleteResponse}
*/
}, {
key: "deleteOrganization",
value: function deleteOrganization(id) {
return this.deleteOrganizationWithHttpInfo(id).then(function (response_and_data) {
return response_and_data;
});
}
/**
* Delete a follower from an organization
* Deletes a follower from an organization. You can retrieve the `follower_id` from the <a href=\"https://developers.pipedrive.com/docs/api/v1/Organizations#getOrganizationFollowers\">List followers of an organization</a> endpoint.
* @param {Number} id The ID of the organization
* @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/OrganizationFollowerDeleteResponse} and HTTP response
*/
}, {
key: "deleteOrganizationFollowerWithHttpInfo",
value: function deleteOrganizationFollowerWithHttpInfo(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 deleteOrganizationFollower");
}
// verify the required parameter 'followerId' is set
if (followerId === undefined || followerId === null) {
throw new Error("Missing the required parameter 'followerId' when calling deleteOrganizationFollower");
}
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 = _OrganizationFollowerDeleteResponse["default"];
return this.apiClient.callApi('/organizations/{id}/followers/{follower_id}', 'DELETE', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* Delete a follower from an organization
* Deletes a follower from an organization. You can retrieve the `follower_id` from the <a href=\"https://developers.pipedrive.com/docs/api/v1/Organizations#getOrganizationFollowers\">List followers of an organization</a> endpoint.
* @param {Number} id The ID of the organization
* @param {Number} followerId The ID of the follower
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/OrganizationFollowerDeleteResponse}
*/
}, {
key: "deleteOrganizationFollower",
value: function deleteOrganizationFollower(id, followerId) {
return this.deleteOrganizationFollowerWithHttpInfo(id, followerId).then(function (response_and_data) {
return response_and_data;
});
}
/**
* Delete multiple organizations in bulk
* Marks multiple organizations as deleted. After 30 days, the organizations 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/OrganizationsDeleteResponse} and HTTP response
*/
}, {
key: "deleteOrganizationsWithHttpInfo",
value: function deleteOrganizationsWithHttpInfo(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 deleteOrganizations");
}
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 = _OrganizationsDeleteResponse["default"];
return this.apiClient.callApi('/organizations', 'DELETE', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* Delete multiple organizations in bulk
* Marks multiple organizations as deleted. After 30 days, the organizations 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/OrganizationsDeleteResponse}
*/
}, {
key: "deleteOrganizations",
value: function deleteOrganizations(ids) {
return this.deleteOrganizationsWithHttpInfo(ids).then(function (response_and_data) {
return response_and_data;
});
}
/**
* Get details of an organization
* Returns the details of an organization. Note that this also returns some additional fields which are not present when asking for all organizations. Also note that custom fields appear as long hashes in the resulting data. These hashes can be mapped against the `key` value of organizationFields.
* @param {Number} id The ID of the organization
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/OrganizationDetailsGetResponse} and HTTP response
*/
}, {
key: "getOrganizationWithHttpInfo",
value: function getOrganizationWithHttpInfo(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 getOrganization");
}
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 = _OrganizationDetailsGetResponse["default"];
return this.apiClient.callApi('/organizations/{id}', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* Get details of an organization
* Returns the details of an organization. Note that this also returns some additional fields which are not present when asking for all organizations. Also note that custom fields appear as long hashes in the resulting data. These hashes can be mapped against the `key` value of organizationFields.
* @param {Number} id The ID of the organization
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/OrganizationDetailsGetResponse}
*/
}, {
key: "getOrganization",
value: function getOrganization(id) {
return this.getOrganizationWithHttpInfo(id).then(function (response_and_data) {
return response_and_data;
});
}
/**
* List activities associated with an organization
* Lists activities associated with an organization.
* @param {Number} id The ID of the organization
* @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: "getOrganizationActivitiesWithHttpInfo",
value: function getOrganizationActivitiesWithHttpInfo(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 getOrganizationActivities");
}
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('/organizations/{id}/activities', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* List activities associated with an organization
* Lists activities associated with an organization.
* @param {Number} id The ID of the organization
* @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: "getOrganizationActivities",
value: function getOrganizationActivities(id, opts) {
return this.getOrganizationActivitiesWithHttpInfo(id, opts).then(function (response_and_data) {
return response_and_data;
});
}
/**
* List updates about organization field values
* Lists updates about field values of an organization.
* @param {Number} id The ID of the organization
* @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: "getOrganizationChangelogWithHttpInfo",
value: function getOrganizationChangelogWithHttpInfo(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 getOrganizationChangelog");
}
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('/organizations/{id}/changelog', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* List updates about organization field values
* Lists updates about field values of an organization.
* @param {Number} id The ID of the organization
* @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: "getOrganizationChangelog",
value: function getOrganizationChangelog(id, opts) {
return this.getOrganizationChangelogWithHttpInfo(id, opts).then(function (response_and_data) {
return response_and_data;
});
}
/**
* List deals associated with an organization
* Lists deals associated with an organization.
* @param {Number} id The ID of the organization
* @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).
* @param {module:model/NumberBoolean} opts.onlyPrimaryAssociation If set, only deals that are directly associated to the organization are fetched. If not set (default), all deals are fetched that are either directly or indirectly related to the organization. Indirect relations include relations through custom, organization-type fields and through persons of the given organization.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/ListDealsResponse} and HTTP response
*/
}, {
key: "getOrganizationDealsWithHttpInfo",
value: function getOrganizationDealsWithHttpInfo(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 getOrganizationDeals");
}
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'],
'only_primary_association': opts['only_primary_association'] === undefined ? opts['onlyPrimaryAssociation'] : opts['only_primary_association']
};
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('/organizations/{id}/deals', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* List deals associated with an organization
* Lists deals associated with an organization.
* @param {Number} id The ID of the organization
* @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).
* @param {module:model/NumberBoolean} opts.onlyPrimaryAssociation If set, only deals that are directly associated to the organization are fetched. If not set (default), all deals are fetched that are either directly or indirectly related to the organization. Indirect relations include relations through custom, organization-type fields and through persons of the given organization.
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/ListDealsResponse}
*/
}, {
key: "getOrganizationDeals",
value: function getOrganizationDeals(id, opts) {
return this.getOrganizationDealsWithHttpInfo(id, opts).then(function (response_and_data) {
return response_and_data;
});
}
/**
* List files attached to an organization
* Lists files associated with an organization.
* @param {Number} id The ID of the organization
* @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: "getOrganizationFilesWithHttpInfo",
value: function getOrganizationFilesWithHttpInfo(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 getOrganizationFiles");
}
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('/organizations/{id}/files', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* List files attached to an organization
* Lists files associated with an organization.
* @param {Number} id The ID of the organization
* @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: "getOrganizationFiles",
value: function getOrganizationFiles(id, opts) {
return this.getOrganizationFilesWithHttpInfo(id, opts).then(function (response_and_data) {
return response_and_data;
});
}
/**
* List followers of an organization
* Lists the followers of an organization.
* @param {Number} id The ID of the organization
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/OrganizationFollowersListResponse} and HTTP response
*/
}, {
key: "getOrganizationFollowersWithHttpInfo",
value: function getOrganizationFollowersWithHttpInfo(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 getOrganizationFollowers");
}
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 = _OrganizationFollowersListResponse["default"];
return this.apiClient.callApi('/organizations/{id}/followers', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* List followers of an organization
* Lists the followers of an organization.
* @param {Number} id The ID of the organization
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/OrganizationFollowersListResponse}
*/
}, {
key: "getOrganizationFollowers",
value: function getOrganizationFollowers(id) {
return this.getOrganizationFollowersWithHttpInfo(id).then(function (response_and_data) {
return response_and_data;
});
}
/**
* List mail messages associated with an organization
* Lists mail messages associated with an organization.
* @param {Number} id The ID of the organization
* @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: "getOrganizationMailMessagesWithHttpInfo",
value: function getOrganizationMailMessagesWithHttpInfo(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 getOrganizationMailMessages");
}
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('/organizations/{id}/mailMessages', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* List mail messages associated with an organization
* Lists mail messages associated with an organization.
* @param {Number} id The ID of the organization
* @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: "getOrganizationMailMessages",
value: function getOrganizationMailMessages(id, opts) {
return this.getOrganizationMailMessagesWithHttpInfo(id, opts).then(function (response_and_data) {
return response_and_data;
});
}
/**
* List persons of an organization
* Lists persons associated with an organization.<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 organization
* @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/ListPersonsResponse} and HTTP response
*/
}, {
key: "getOrganizationPersonsWithHttpInfo",
value: function getOrganizationPersonsWithHttpInfo(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 getOrganizationPersons");
}
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 = _ListPersonsResponse["default"];
return this.apiClient.callApi('/organizations/{id}/persons', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* List persons of an organization
* Lists persons associated with an organization.<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 organization
* @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/ListPersonsResponse}
*/
}, {
key: "getOrganizationPersons",
value: function getOrganizationPersons(id, opts) {
return this.getOrganizationPersonsWithHttpInfo(id, opts).then(function (response_and_data) {
return response_and_data;
});
}
/**
* List updates about an organization
* Lists updates about an organization.
* @param {Number} id The ID of the organization
* @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 - activity, plannedActivity, note, file, change, deal, follower, participant, mailMessage, mailMessageWithAttachment, invoice, activityFile, document).
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/OrganizationFlowResponse} and HTTP response
*/
}, {
key: "getOrganizationUpdatesWithHttpInfo",
value: function getOrganizationUpdatesWithHttpInfo(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 getOrganizationUpdates");
}
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 = _OrganizationFlowResponse["default"];
return this.apiClient.callApi('/organizations/{id}/flow', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* List updates about an organization
* Lists updates about an organization.
* @param {Number} id The ID of the organization
* @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 - activity, plannedActivity, note, file, change, deal, follower, participant, mailMessage, mailMessageWithAttachment, invoice, activityFile, document).
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/OrganizationFlowResponse}
*/
}, {
key: "getOrganizationUpdates",
value: function getOrganizationUpdates(id, opts) {
return this.getOrganizationUpdatesWithHttpInfo(id, opts).then(function (response_and_data) {
return response_and_data;
});
}
/**
* List permitted users
* List users permitted to access an organization.
* @param {Number} id The ID of the organization
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/ListPermittedUsersResponse1} and HTTP response
*/
}, {
key: "getOrganizationUsersWithHttpInfo",
value: function getOrganizationUsersWithHttpInfo(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 getOrganizationUsers");
}
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('/organizations/{id}/permittedUsers', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* List permitted users
* List users permitted to access an organization.
* @param {Number} id The ID of the organization
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/ListPermittedUsersResponse1}
*/
}, {
key: "getOrganizationUsers",
value: function getOrganizationUsers(id) {
return this.getOrganizationUsersWithHttpInfo(id).then(function (response_and_data) {
return response_and_data;
});
}
/**
* Get all organizations
* Returns all organizations.
* @param {Object} opts Optional parameters
* @param {Number} opts.userId If supplied, only organizations 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 organizations 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/AllOrganizationsGetResponse} and HTTP response
*/
}, {
key: "getOrganizationsWithHttpInfo",
value: function getOrganizationsWithHttpInfo(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 = _AllOrganizationsGetResponse["default"];
return this.apiClient.callApi('/organizations', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* Get all organizations
* Returns all organizations.
* @param {Object} opts Optional parameters
* @param {Number} opts.userId If supplied, only organizations 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 organizations 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/AllOrganizationsGetResponse}
*/
}, {
key: "getOrganizations",
value: function getOrganizations(opts) {
return this.getOrganizationsWithHttpInfo(opts).then(function (response_and_data) {
return response_and_data;
});
}
/**
* Get all organizations (BETA)
* Returns all organizations. 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 organizations owned by the given user will be returned
* @param {String} opts.firstChar If supplied, only organizations 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/InlineResponse2001} and HTTP response
*/
}, {
key: "getOrganizationsCollectionWithHttpInfo",
value: function getOrganizationsCollectionWithHttpInfo(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('/organizations/collection', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* Get all organizations (BETA)
* Returns all organizations. 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 organizations owned by the given user will be returned
* @param {String} opts.firstChar If supplied, only organizations 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/InlineResponse2001}
*/
}, {
key: "getOrganizationsCollection",
value: function getOrganizationsCollection(opts) {
return this.getOrganizationsCollectionWithHttpInfo(opts).then(function (response_and_data) {
return response_and_data;
});
}
/**
* Merge two organizations
* Merges an organization with another organization. For more information, see the tutorial for <a href=\"https://pipedrive.readme.io/docs/merging-two-organizations\" target=\"_blank\" rel=\"noopener noreferrer\">merging two organizations</a>.
* @param {Number} id The ID of the organization
* @param {Object} opts Optional parameters
* @param {module:model/MergeOrganizationsRequest} opts.mergeOrganizationsRequest
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/OrganizationsMergeResponse} and HTTP response
*/
}, {
key: "mergeOrganizationsWithHttpInfo",
value: function mergeOrganizationsWithHttpInfo(id, opts) {
opts = opts || {};
var postBody = opts['mergeOrganizationsRequest'];
// verify the required parameter 'id' is set
if (id === undefined || id === null) {
throw new Error("Missing the required parameter 'id' when calling mergeOrganizations");
}
if (opts['merge_with_id'] === undefined || opts['merge_with_id'] === null) {
throw new Error("Missing the required parameter 'merge_with_id' when calling mergeOrganizations");
}
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 = _OrganizationsMergeResponse["default"];
return this.apiClient.callApi('/organizations/{id}/merge', 'PUT', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* Merge two organizations
* Merges an organization with another organization. For more information, see the tutorial for <a href=\"https://pipedrive.readme.io/docs/merging-two-organizations\" target=\"_blank\" rel=\"noopener noreferrer\">merging two organizations</a>.
* @param {Number} id The ID of the organization
* @param {Object} opts Optional parameters
* @param {module:model/MergeOrganizationsRequest} opts.mergeOrganizationsRequest
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/OrganizationsMergeResponse}
*/
}, {
key: "mergeOrganizations",
value: function mergeOrganizations(id, opts) {
return this.mergeOrganizationsWithHttpInfo(id, opts).then(function (response_and_data) {
return response_and_data;
});
}
/**
* Search organizations
* Searches all organizations by name, address, 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.
* @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.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/OrganizationSearchResponse} and HTTP response
*/
}, {
key: "searchOrganizationWithHttpInfo",
value: function searchOrganizationWithHttpInfo(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 searchOrganization");
}
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'],
'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 = _OrganizationSearchResponse["default"];
return this.apiClient.callApi('/organizations/search', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* Search organizations
* Searches all organizations by name, address, 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.
* @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.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/OrganizationSearchResponse}
*/
}, {
key: "searchOrganization",
value: function searchOrganization(term, opts) {
return this.searchOrganizationWithHttpInfo(term, opts).then(function (response_and_data) {
return response_and_data;
});
}
/**
* Update an organization
* Updates the properties of an organization.
* @param {Number} id The ID of the organization
* @param {Object} opts Optional parameters
* @param {module:model/UpdateOrganization} opts.updateOrganization
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/OrganizationUpdateResponse} and HTTP response
*/
}, {
key: "updateOrganizationWithHttpInfo",
value: function updateOrganizationWithHttpInfo(id, opts) {
opts = opts || {};
var postBody = opts['updateOrganization'];
// verify the required parameter 'id' is set
if (id === undefined || id === null) {
throw new Error("Missing the required parameter 'id' when calling updateOrganization");
}
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 = _OrganizationUpdateResponse["default"];
return this.apiClient.callApi('/organizations/{id}', 'PUT', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
}
/**
* Update an organization
* Updates the properties of an organization.
* @param {Number} id The ID of the organization
* @param {Object} opts Optional parameters
* @param {module:model/UpdateOrganization} opts.updateOrganization
* @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/OrganizationUpdateResponse}
*/
}, {
key: "updateOrganization",
value: function updateOrganization(id, opts) {
return this.updateOrganizationWithHttpInfo(id, opts).then(function (response_and_data) {
return response_and_data;
});
}
}]);
return OrganizationsApi;
}();
exports["default"] = OrganizationsApi;