HEX
Server: nginx/1.18.0
System: Linux test-ipsremont 5.4.0-214-generic #234-Ubuntu SMP Fri Mar 14 23:50:27 UTC 2025 x86_64
User: ips (1000)
PHP: 8.0.30
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/fintechfuel/node_modules/pipedrive/dist/api/UsersApi.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 _AddUserRequest = _interopRequireDefault(require("../model/AddUserRequest"));
var _FailResponse = _interopRequireDefault(require("../model/FailResponse"));
var _GetRoleAssignments = _interopRequireDefault(require("../model/GetRoleAssignments"));
var _GetRoleSettings = _interopRequireDefault(require("../model/GetRoleSettings"));
var _NumberBooleanDefault = _interopRequireDefault(require("../model/NumberBooleanDefault0"));
var _Unauthorized = _interopRequireDefault(require("../model/Unauthorized"));
var _UpdateUserRequest = _interopRequireDefault(require("../model/UpdateUserRequest"));
var _User = _interopRequireDefault(require("../model/User"));
var _UserIDs = _interopRequireDefault(require("../model/UserIDs"));
var _UserMe = _interopRequireDefault(require("../model/UserMe"));
var _UserPermissions = _interopRequireDefault(require("../model/UserPermissions"));
var _Users = _interopRequireDefault(require("../model/Users"));
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; }
/**
* Users service.
* @module api/UsersApi
* @version 1.0.0
*/
var UsersApi = /*#__PURE__*/function () {
  /**
  * Constructs a new UsersApi. 
  * @alias module:api/UsersApi
  * @class
  * @param {module:ApiClient} [apiClient] Optional API client implementation to use,
  * default to {@link module:ApiClient#instance} if unspecified.
  */
  function UsersApi(apiClient) {
    (0, _classCallCheck2["default"])(this, UsersApi);
    this.apiClient = apiClient;
  }

  /**
   * Add a new user
   * Adds a new user to the company, returns the ID upon success.
   * @param {Object} opts Optional parameters
   * @param {module:model/AddUserRequest} opts.addUserRequest 
   * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/User} and HTTP response
   */
  (0, _createClass2["default"])(UsersApi, [{
    key: "addUserWithHttpInfo",
    value: function addUserWithHttpInfo(opts) {
      opts = opts || {};
      var postBody = opts['addUserRequest'];
      if (opts['email'] === undefined || opts['email'] === null) {
        throw new Error("Missing the required parameter 'email' when calling addUser");
      }
      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 = _User["default"];
      return this.apiClient.callApi('/users', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
    }

    /**
     * Add a new user
     * Adds a new user to the company, returns the ID upon success.
     * @param {Object} opts Optional parameters
     * @param {module:model/AddUserRequest} opts.addUserRequest 
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/User}
     */
  }, {
    key: "addUser",
    value: function addUser(opts) {
      return this.addUserWithHttpInfo(opts).then(function (response_and_data) {
        return response_and_data;
      });
    }

    /**
     * Find users by name
     * Finds users by their name.
     * @param {String} term The search term to look for
     * @param {Object} opts Optional parameters
     * @param {module:model/NumberBooleanDefault0} opts.searchByEmail When enabled, the term will only be matched against email addresses of users. Default: `false`
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Users} and HTTP response
     */
  }, {
    key: "findUsersByNameWithHttpInfo",
    value: function findUsersByNameWithHttpInfo(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 findUsersByName");
      }
      var pathParams = {};
      var queryParams = {
        'term': term,
        'search_by_email': opts['search_by_email'] === undefined ? opts['searchByEmail'] : opts['search_by_email']
      };
      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 = _Users["default"];
      return this.apiClient.callApi('/users/find', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
    }

    /**
     * Find users by name
     * Finds users by their name.
     * @param {String} term The search term to look for
     * @param {Object} opts Optional parameters
     * @param {module:model/NumberBooleanDefault0} opts.searchByEmail When enabled, the term will only be matched against email addresses of users. Default: `false`
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Users}
     */
  }, {
    key: "findUsersByName",
    value: function findUsersByName(term, opts) {
      return this.findUsersByNameWithHttpInfo(term, opts).then(function (response_and_data) {
        return response_and_data;
      });
    }

    /**
     * Get current user data
     * Returns data about an authorized user within the company with bound company data: company ID, company name, and domain. Note that the `locale` property means 'Date/number format' in the Pipedrive account settings, not the chosen language.
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/UserMe} and HTTP response
     */
  }, {
    key: "getCurrentUserWithHttpInfo",
    value: function getCurrentUserWithHttpInfo() {
      var opts = {};
      var postBody = null;
      var pathParams = {};
      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 = _UserMe["default"];
      return this.apiClient.callApi('/users/me', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
    }

    /**
     * Get current user data
     * Returns data about an authorized user within the company with bound company data: company ID, company name, and domain. Note that the `locale` property means 'Date/number format' in the Pipedrive account settings, not the chosen language.
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/UserMe}
     */
  }, {
    key: "getCurrentUser",
    value: function getCurrentUser() {
      return this.getCurrentUserWithHttpInfo().then(function (response_and_data) {
        return response_and_data;
      });
    }

    /**
     * Get one user
     * Returns data about a specific user within the company.
     * @param {Number} id The ID of the user
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/User} and HTTP response
     */
  }, {
    key: "getUserWithHttpInfo",
    value: function getUserWithHttpInfo(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 getUser");
      }
      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 = _User["default"];
      return this.apiClient.callApi('/users/{id}', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
    }

    /**
     * Get one user
     * Returns data about a specific user within the company.
     * @param {Number} id The ID of the user
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/User}
     */
  }, {
    key: "getUser",
    value: function getUser(id) {
      return this.getUserWithHttpInfo(id).then(function (response_and_data) {
        return response_and_data;
      });
    }

    /**
     * List followers of a user
     * Lists the followers of a specific user.
     * @param {Number} id The ID of the user
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/UserIDs} and HTTP response
     */
  }, {
    key: "getUserFollowersWithHttpInfo",
    value: function getUserFollowersWithHttpInfo(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 getUserFollowers");
      }
      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 = _UserIDs["default"];
      return this.apiClient.callApi('/users/{id}/followers', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
    }

    /**
     * List followers of a user
     * Lists the followers of a specific user.
     * @param {Number} id The ID of the user
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/UserIDs}
     */
  }, {
    key: "getUserFollowers",
    value: function getUserFollowers(id) {
      return this.getUserFollowersWithHttpInfo(id).then(function (response_and_data) {
        return response_and_data;
      });
    }

    /**
     * List user permissions
     * Lists aggregated permissions over all assigned permission sets for a user.
     * @param {Number} id The ID of the user
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/UserPermissions} and HTTP response
     */
  }, {
    key: "getUserPermissionsWithHttpInfo",
    value: function getUserPermissionsWithHttpInfo(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 getUserPermissions");
      }
      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 = _UserPermissions["default"];
      return this.apiClient.callApi('/users/{id}/permissions', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
    }

    /**
     * List user permissions
     * Lists aggregated permissions over all assigned permission sets for a user.
     * @param {Number} id The ID of the user
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/UserPermissions}
     */
  }, {
    key: "getUserPermissions",
    value: function getUserPermissions(id) {
      return this.getUserPermissionsWithHttpInfo(id).then(function (response_and_data) {
        return response_and_data;
      });
    }

    /**
     * List role assignments
     * Lists role assignments for a user.
     * @param {Number} id The ID of the user
     * @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/GetRoleAssignments} and HTTP response
     */
  }, {
    key: "getUserRoleAssignmentsWithHttpInfo",
    value: function getUserRoleAssignmentsWithHttpInfo(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 getUserRoleAssignments");
      }
      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 = _GetRoleAssignments["default"];
      return this.apiClient.callApi('/users/{id}/roleAssignments', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
    }

    /**
     * List role assignments
     * Lists role assignments for a user.
     * @param {Number} id The ID of the user
     * @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/GetRoleAssignments}
     */
  }, {
    key: "getUserRoleAssignments",
    value: function getUserRoleAssignments(id, opts) {
      return this.getUserRoleAssignmentsWithHttpInfo(id, opts).then(function (response_and_data) {
        return response_and_data;
      });
    }

    /**
     * List user role settings
     * Lists the settings of user's assigned role.
     * @param {Number} id The ID of the user
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/GetRoleSettings} and HTTP response
     */
  }, {
    key: "getUserRoleSettingsWithHttpInfo",
    value: function getUserRoleSettingsWithHttpInfo(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 getUserRoleSettings");
      }
      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 = _GetRoleSettings["default"];
      return this.apiClient.callApi('/users/{id}/roleSettings', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
    }

    /**
     * List user role settings
     * Lists the settings of user's assigned role.
     * @param {Number} id The ID of the user
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/GetRoleSettings}
     */
  }, {
    key: "getUserRoleSettings",
    value: function getUserRoleSettings(id) {
      return this.getUserRoleSettingsWithHttpInfo(id).then(function (response_and_data) {
        return response_and_data;
      });
    }

    /**
     * Get all users
     * Returns data about all users within the company.
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/Users} and HTTP response
     */
  }, {
    key: "getUsersWithHttpInfo",
    value: function getUsersWithHttpInfo() {
      var opts = {};
      var postBody = null;
      var pathParams = {};
      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 = _Users["default"];
      return this.apiClient.callApi('/users', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
    }

    /**
     * Get all users
     * Returns data about all users within the company.
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/Users}
     */
  }, {
    key: "getUsers",
    value: function getUsers() {
      return this.getUsersWithHttpInfo().then(function (response_and_data) {
        return response_and_data;
      });
    }

    /**
     * Update user details
     * Updates the properties of a user. Currently, only `active_flag` can be updated.
     * @param {Number} id The ID of the user
     * @param {Object} opts Optional parameters
     * @param {module:model/UpdateUserRequest} opts.updateUserRequest 
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/User} and HTTP response
     */
  }, {
    key: "updateUserWithHttpInfo",
    value: function updateUserWithHttpInfo(id, opts) {
      opts = opts || {};
      var postBody = opts['updateUserRequest'];

      // verify the required parameter 'id' is set
      if (id === undefined || id === null) {
        throw new Error("Missing the required parameter 'id' when calling updateUser");
      }
      if (opts['active_flag'] === undefined || opts['active_flag'] === null) {
        throw new Error("Missing the required parameter 'active_flag' when calling updateUser");
      }
      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 = _User["default"];
      return this.apiClient.callApi('/users/{id}', 'PUT', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
    }

    /**
     * Update user details
     * Updates the properties of a user. Currently, only `active_flag` can be updated.
     * @param {Number} id The ID of the user
     * @param {Object} opts Optional parameters
     * @param {module:model/UpdateUserRequest} opts.updateUserRequest 
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/User}
     */
  }, {
    key: "updateUser",
    value: function updateUser(id, opts) {
      return this.updateUserWithHttpInfo(id, opts).then(function (response_and_data) {
        return response_and_data;
      });
    }
  }]);
  return UsersApi;
}();
exports["default"] = UsersApi;