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/RolesApi.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 _AddOrUpdateRoleSettingRequest = _interopRequireDefault(require("../model/AddOrUpdateRoleSettingRequest"));
var _AddRole = _interopRequireDefault(require("../model/AddRole"));
var _AddRoleAssignmentRequest = _interopRequireDefault(require("../model/AddRoleAssignmentRequest"));
var _BaseRole = _interopRequireDefault(require("../model/BaseRole"));
var _DeleteRole = _interopRequireDefault(require("../model/DeleteRole"));
var _DeleteRoleAssignment = _interopRequireDefault(require("../model/DeleteRoleAssignment"));
var _DeleteRoleAssignmentRequest = _interopRequireDefault(require("../model/DeleteRoleAssignmentRequest"));
var _GetRole = _interopRequireDefault(require("../model/GetRole"));
var _GetRoleAssignments = _interopRequireDefault(require("../model/GetRoleAssignments"));
var _GetRolePipelines = _interopRequireDefault(require("../model/GetRolePipelines"));
var _GetRoleSettings = _interopRequireDefault(require("../model/GetRoleSettings"));
var _GetRoles = _interopRequireDefault(require("../model/GetRoles"));
var _PostRoleAssignment = _interopRequireDefault(require("../model/PostRoleAssignment"));
var _PostRoleSettings = _interopRequireDefault(require("../model/PostRoleSettings"));
var _PostRoles = _interopRequireDefault(require("../model/PostRoles"));
var _PutRole = _interopRequireDefault(require("../model/PutRole"));
var _PutRolePipelinesBody = _interopRequireDefault(require("../model/PutRolePipelinesBody"));
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; }
/**
* Roles service.
* @module api/RolesApi
* @version 1.0.0
*/
var RolesApi = /*#__PURE__*/function () {
  /**
  * Constructs a new RolesApi. 
  * @alias module:api/RolesApi
  * @class
  * @param {module:ApiClient} [apiClient] Optional API client implementation to use,
  * default to {@link module:ApiClient#instance} if unspecified.
  */
  function RolesApi(apiClient) {
    (0, _classCallCheck2["default"])(this, RolesApi);
    this.apiClient = apiClient;
  }

  /**
   * Add or update role setting
   * Adds or updates the visibility setting for a role.
   * @param {Number} id The ID of the role
   * @param {Object} opts Optional parameters
   * @param {module:model/AddOrUpdateRoleSettingRequest} opts.addOrUpdateRoleSettingRequest 
   * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/PostRoleSettings} and HTTP response
   */
  (0, _createClass2["default"])(RolesApi, [{
    key: "addOrUpdateRoleSettingWithHttpInfo",
    value: function addOrUpdateRoleSettingWithHttpInfo(id, opts) {
      opts = opts || {};
      var postBody = opts['addOrUpdateRoleSettingRequest'];

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

    /**
     * Add or update role setting
     * Adds or updates the visibility setting for a role.
     * @param {Number} id The ID of the role
     * @param {Object} opts Optional parameters
     * @param {module:model/AddOrUpdateRoleSettingRequest} opts.addOrUpdateRoleSettingRequest 
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/PostRoleSettings}
     */
  }, {
    key: "addOrUpdateRoleSetting",
    value: function addOrUpdateRoleSetting(id, opts) {
      return this.addOrUpdateRoleSettingWithHttpInfo(id, opts).then(function (response_and_data) {
        return response_and_data;
      });
    }

    /**
     * Add a role
     * Adds a new role.
     * @param {Object} opts Optional parameters
     * @param {module:model/AddRole} opts.addRole 
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/PostRoles} and HTTP response
     */
  }, {
    key: "addRoleWithHttpInfo",
    value: function addRoleWithHttpInfo(opts) {
      opts = opts || {};
      var postBody = opts['addRole'];
      if (opts['name'] === undefined || opts['name'] === null) {
        throw new Error("Missing the required parameter 'name' when calling addRole");
      }
      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 = _PostRoles["default"];
      return this.apiClient.callApi('/roles', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
    }

    /**
     * Add a role
     * Adds a new role.
     * @param {Object} opts Optional parameters
     * @param {module:model/AddRole} opts.addRole 
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/PostRoles}
     */
  }, {
    key: "addRole",
    value: function addRole(opts) {
      return this.addRoleWithHttpInfo(opts).then(function (response_and_data) {
        return response_and_data;
      });
    }

    /**
     * Add role assignment
     * Assigns a user to a role.
     * @param {Number} id The ID of the role
     * @param {Object} opts Optional parameters
     * @param {module:model/AddRoleAssignmentRequest} opts.addRoleAssignmentRequest 
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/PostRoleAssignment} and HTTP response
     */
  }, {
    key: "addRoleAssignmentWithHttpInfo",
    value: function addRoleAssignmentWithHttpInfo(id, opts) {
      opts = opts || {};
      var postBody = opts['addRoleAssignmentRequest'];

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

    /**
     * Add role assignment
     * Assigns a user to a role.
     * @param {Number} id The ID of the role
     * @param {Object} opts Optional parameters
     * @param {module:model/AddRoleAssignmentRequest} opts.addRoleAssignmentRequest 
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/PostRoleAssignment}
     */
  }, {
    key: "addRoleAssignment",
    value: function addRoleAssignment(id, opts) {
      return this.addRoleAssignmentWithHttpInfo(id, opts).then(function (response_and_data) {
        return response_and_data;
      });
    }

    /**
     * Delete a role
     * Marks a role as deleted.
     * @param {Number} id The ID of the role
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/DeleteRole} and HTTP response
     */
  }, {
    key: "deleteRoleWithHttpInfo",
    value: function deleteRoleWithHttpInfo(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 deleteRole");
      }
      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 = _DeleteRole["default"];
      return this.apiClient.callApi('/roles/{id}', 'DELETE', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
    }

    /**
     * Delete a role
     * Marks a role as deleted.
     * @param {Number} id The ID of the role
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/DeleteRole}
     */
  }, {
    key: "deleteRole",
    value: function deleteRole(id) {
      return this.deleteRoleWithHttpInfo(id).then(function (response_and_data) {
        return response_and_data;
      });
    }

    /**
     * Delete a role assignment
     * Removes the assigned user from a role and adds to the default role.
     * @param {Number} id The ID of the role
     * @param {Object} opts Optional parameters
     * @param {module:model/DeleteRoleAssignmentRequest} opts.deleteRoleAssignmentRequest 
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/DeleteRoleAssignment} and HTTP response
     */
  }, {
    key: "deleteRoleAssignmentWithHttpInfo",
    value: function deleteRoleAssignmentWithHttpInfo(id, opts) {
      opts = opts || {};
      var postBody = opts['deleteRoleAssignmentRequest'];

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

    /**
     * Delete a role assignment
     * Removes the assigned user from a role and adds to the default role.
     * @param {Number} id The ID of the role
     * @param {Object} opts Optional parameters
     * @param {module:model/DeleteRoleAssignmentRequest} opts.deleteRoleAssignmentRequest 
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/DeleteRoleAssignment}
     */
  }, {
    key: "deleteRoleAssignment",
    value: function deleteRoleAssignment(id, opts) {
      return this.deleteRoleAssignmentWithHttpInfo(id, opts).then(function (response_and_data) {
        return response_and_data;
      });
    }

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

    /**
     * Get one role
     * Returns the details of a specific role.
     * @param {Number} id The ID of the role
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/GetRole}
     */
  }, {
    key: "getRole",
    value: function getRole(id) {
      return this.getRoleWithHttpInfo(id).then(function (response_and_data) {
        return response_and_data;
      });
    }

    /**
     * List role assignments
     * Returns all users assigned to a role.
     * @param {Number} id The ID of the role
     * @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: "getRoleAssignmentsWithHttpInfo",
    value: function getRoleAssignmentsWithHttpInfo(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 getRoleAssignments");
      }
      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('/roles/{id}/assignments', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
    }

    /**
     * List role assignments
     * Returns all users assigned to a role.
     * @param {Number} id The ID of the role
     * @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: "getRoleAssignments",
    value: function getRoleAssignments(id, opts) {
      return this.getRoleAssignmentsWithHttpInfo(id, opts).then(function (response_and_data) {
        return response_and_data;
      });
    }

    /**
     * List pipeline visibility for a role
     * Returns the list of either visible or hidden pipeline IDs for a specific role. For more information on pipeline visibility, please refer to the <a href=\"https://support.pipedrive.com/en/article/visibility-groups\" target=\"_blank\" rel=\"noopener noreferrer\">Visibility groups article</a>.
     * @param {Number} id The ID of the role
     * @param {Object} opts Optional parameters
     * @param {Boolean} opts.visible Whether to return the visible or hidden pipelines for the role (default to true)
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/GetRolePipelines} and HTTP response
     */
  }, {
    key: "getRolePipelinesWithHttpInfo",
    value: function getRolePipelinesWithHttpInfo(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 getRolePipelines");
      }
      var pathParams = {
        'id': id
      };
      var queryParams = {
        'visible': opts['visible'] === undefined ? opts['visible'] : opts['visible']
      };
      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 = _GetRolePipelines["default"];
      return this.apiClient.callApi('/roles/{id}/pipelines', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
    }

    /**
     * List pipeline visibility for a role
     * Returns the list of either visible or hidden pipeline IDs for a specific role. For more information on pipeline visibility, please refer to the <a href=\"https://support.pipedrive.com/en/article/visibility-groups\" target=\"_blank\" rel=\"noopener noreferrer\">Visibility groups article</a>.
     * @param {Number} id The ID of the role
     * @param {Object} opts Optional parameters
     * @param {Boolean} opts.visible Whether to return the visible or hidden pipelines for the role (default to true)
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/GetRolePipelines}
     */
  }, {
    key: "getRolePipelines",
    value: function getRolePipelines(id, opts) {
      return this.getRolePipelinesWithHttpInfo(id, opts).then(function (response_and_data) {
        return response_and_data;
      });
    }

    /**
     * List role settings
     * Returns the visibility settings of a specific role.
     * @param {Number} id The ID of the role
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/GetRoleSettings} and HTTP response
     */
  }, {
    key: "getRoleSettingsWithHttpInfo",
    value: function getRoleSettingsWithHttpInfo(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 getRoleSettings");
      }
      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('/roles/{id}/settings', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
    }

    /**
     * List role settings
     * Returns the visibility settings of a specific role.
     * @param {Number} id The ID of the role
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/GetRoleSettings}
     */
  }, {
    key: "getRoleSettings",
    value: function getRoleSettings(id) {
      return this.getRoleSettingsWithHttpInfo(id).then(function (response_and_data) {
        return response_and_data;
      });
    }

    /**
     * Get all roles
     * Returns all the roles within the company.
     * @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/GetRoles} and HTTP response
     */
  }, {
    key: "getRolesWithHttpInfo",
    value: function getRolesWithHttpInfo(opts) {
      opts = opts || {};
      var postBody = null;
      var pathParams = {};
      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 = _GetRoles["default"];
      return this.apiClient.callApi('/roles', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null);
    }

    /**
     * Get all roles
     * Returns all the roles within the company.
     * @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/GetRoles}
     */
  }, {
    key: "getRoles",
    value: function getRoles(opts) {
      return this.getRolesWithHttpInfo(opts).then(function (response_and_data) {
        return response_and_data;
      });
    }

    /**
     * Update role details
     * Updates the parent role and/or the name of a specific role.
     * @param {Number} id The ID of the role
     * @param {Object} opts Optional parameters
     * @param {module:model/BaseRole} opts.baseRole 
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/PutRole} and HTTP response
     */
  }, {
    key: "updateRoleWithHttpInfo",
    value: function updateRoleWithHttpInfo(id, opts) {
      opts = opts || {};
      var postBody = opts['baseRole'];

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

    /**
     * Update role details
     * Updates the parent role and/or the name of a specific role.
     * @param {Number} id The ID of the role
     * @param {Object} opts Optional parameters
     * @param {module:model/BaseRole} opts.baseRole 
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/PutRole}
     */
  }, {
    key: "updateRole",
    value: function updateRole(id, opts) {
      return this.updateRoleWithHttpInfo(id, opts).then(function (response_and_data) {
        return response_and_data;
      });
    }

    /**
     * Update pipeline visibility for a role
     * Updates the specified pipelines to be visible and/or hidden for a specific role. For more information on pipeline visibility, please refer to the <a href=\"https://support.pipedrive.com/en/article/visibility-groups\" target=\"_blank\" rel=\"noopener noreferrer\">Visibility groups article</a>.
     * @param {Number} id The ID of the role
     * @param {Object} opts Optional parameters
     * @param {module:model/PutRolePipelinesBody} opts.putRolePipelinesBody 
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/GetRolePipelines} and HTTP response
     */
  }, {
    key: "updateRolePipelinesWithHttpInfo",
    value: function updateRolePipelinesWithHttpInfo(id, opts) {
      opts = opts || {};
      var postBody = opts['putRolePipelinesBody'];

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

    /**
     * Update pipeline visibility for a role
     * Updates the specified pipelines to be visible and/or hidden for a specific role. For more information on pipeline visibility, please refer to the <a href=\"https://support.pipedrive.com/en/article/visibility-groups\" target=\"_blank\" rel=\"noopener noreferrer\">Visibility groups article</a>.
     * @param {Number} id The ID of the role
     * @param {Object} opts Optional parameters
     * @param {module:model/PutRolePipelinesBody} opts.putRolePipelinesBody 
     * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/GetRolePipelines}
     */
  }, {
    key: "updateRolePipelines",
    value: function updateRolePipelines(id, opts) {
      return this.updateRolePipelinesWithHttpInfo(id, opts).then(function (response_and_data) {
        return response_and_data;
      });
    }
  }]);
  return RolesApi;
}();
exports["default"] = RolesApi;