text: /**
   * 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.
   *
   */
  
  
  import ApiClient from "../ApiClient";
  import BulkDeleteResponse from '../model/BulkDeleteResponse';
  import DeleteResponse from '../model/DeleteResponse';
  import FieldCreateRequest from '../model/FieldCreateRequest';
  import FieldResponse from '../model/FieldResponse';
  import FieldUpdateRequest from '../model/FieldUpdateRequest';
  import FieldsResponse from '../model/FieldsResponse';
  
  /**
  * PersonFields service.
  * @module api/PersonFieldsApi
  * @version 1.0.0
  */
  export default class PersonFieldsApi {
  
      /**
      * Constructs a new PersonFieldsApi. 
      * @alias module:api/PersonFieldsApi
      * @class
      * @param {module:ApiClient} [apiClient] Optional API client implementation to use,
      * default to {@link module:ApiClient#instance} if unspecified.
      */
      constructor(apiClient) {
          this.apiClient = apiClient || ApiClient.instance;
      }
  
  
  
      /**
       * Add a new person field
       * Adds a new person field. For more information on adding a new custom field, see <a href=\"https://pipedrive.readme.io/docs/adding-a-new-custom-field\" target=\"_blank\" rel=\"noopener noreferrer\">this tutorial</a>.
       * @param {Object} opts Optional parameters
       * @param {module:model/FieldCreateRequest} opts.fieldCreateRequest 
       * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/FieldResponse} and HTTP response
       */
      addPersonFieldWithHttpInfo(opts) {
        opts = opts || {};
        let postBody = opts['fieldCreateRequest'];
  
        let pathParams = {
        };
        let queryParams = {
        };
        let headerParams = {
        };
        let formParams = {
        };
  
        let formParamArray = [
        ];
  
        let contentTypes = ['application/json', ];
        const isURLEncoded = contentTypes.includes('application/x-www-form-urlencoded');
        const isJSON = contentTypes.includes('application/json');
  
        if (isJSON) {
          postBody = { ...postBody, ...opts };
        } else if (isURLEncoded) {
          for (let key in opts) {
            if (opts.hasOwnProperty(key) && !formParamArray.includes(key)) {
              formParams[key] = opts[key];
            }
          }
        }
  
        let authNames = ['api_key', 'oauth2', ];
        let accepts = ['application/json', ];
        let returnType = FieldResponse;
        return this.apiClient.callApi(
          '/personFields', 'POST',
          pathParams, queryParams, headerParams, formParams, postBody,
          authNames, contentTypes, accepts, returnType, null
        );
      }
  
      /**
       * Add a new person field
       * Adds a new person field. For more information on adding a new custom field, see <a href=\"https://pipedrive.readme.io/docs/adding-a-new-custom-field\" target=\"_blank\" rel=\"noopener noreferrer\">this tutorial</a>.
       * @param {Object} opts Optional parameters
       * @param {module:model/FieldCreateRequest} opts.fieldCreateRequest 
       * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/FieldResponse}
       */
      addPersonField(opts) {
        return this.addPersonFieldWithHttpInfo(opts)
          .then(function(response_and_data) {
            return response_and_data;
          });
      }
  
  
      /**
       * Delete a person field
       * Marks a field as deleted. For more information on how to delete a custom field, see <a href=\"https://pipedrive.readme.io/docs/deleting-a-custom-field\" target=\"_blank\" rel=\"noopener noreferrer\">this tutorial</a>.
       * @param {Number} id ID of the field
       * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/DeleteResponse} and HTTP response
       */
      deletePersonFieldWithHttpInfo(id) {
        const opts = {}
        let postBody = null;
        // verify the required parameter 'id' is set
        if (id === undefined || id === null) {
          throw new Error("Missing the required parameter 'id' when calling deletePersonField");
        }
  
        let pathParams = {
          'id': id,
        };
        let queryParams = {
        };
        let headerParams = {
        };
        let formParams = {
        };
  
        let formParamArray = [
        ];
  
        let contentTypes = [];
        const isURLEncoded = contentTypes.includes('application/x-www-form-urlencoded');
        const isJSON = contentTypes.includes('application/json');
  
        if (isJSON) {
          postBody = { ...postBody, ...opts };
        } else if (isURLEncoded) {
          for (let key in opts) {
            if (opts.hasOwnProperty(key) && !formParamArray.includes(key)) {
              formParams[key] = opts[key];
            }
          }
        }
  
        let authNames = ['api_key', 'oauth2', ];
        let accepts = ['application/json', ];
        let returnType = DeleteResponse;
        return this.apiClient.callApi(
          '/personFields/{id}', 'DELETE',
          pathParams, queryParams, headerParams, formParams, postBody,
          authNames, contentTypes, accepts, returnType, null
        );
      }
  
      /**
       * Delete a person field
       * Marks a field as deleted. For more information on how to delete a custom field, see <a href=\"https://pipedrive.readme.io/docs/deleting-a-custom-field\" target=\"_blank\" rel=\"noopener noreferrer\">this tutorial</a>.
       * @param {Number} id ID of the field
       * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/DeleteResponse}
       */
      deletePersonField(id) {
        return this.deletePersonFieldWithHttpInfo(id)
          .then(function(response_and_data) {
            return response_and_data;
          });
      }
  
  
      /**
       * Delete multiple person fields in bulk
       * Marks multiple fields as deleted.
       * @param {String} ids Comma-separated field IDs to delete
       * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/BulkDeleteResponse} and HTTP response
       */
      deletePersonFieldsWithHttpInfo(ids) {
        const opts = {}
        let postBody = null;
        // verify the required parameter 'ids' is set
        if (ids === undefined || ids === null) {
          throw new Error("Missing the required parameter 'ids' when calling deletePersonFields");
        }
  
        let pathParams = {
        };
        let queryParams = {
          'ids': ids,
        };
        let headerParams = {
        };
        let formParams = {
        };
  
        let formParamArray = [
        ];
  
        let contentTypes = [];
        const isURLEncoded = contentTypes.includes('application/x-www-form-urlencoded');
        const isJSON = contentTypes.includes('application/json');
  
        if (isJSON) {
          postBody = { ...postBody, ...opts };
        } else if (isURLEncoded) {
          for (let key in opts) {
            if (opts.hasOwnProperty(key) && !formParamArray.includes(key)) {
              formParams[key] = opts[key];
            }
          }
        }
  
        let authNames = ['api_key', 'oauth2', ];
        let accepts = ['application/json', ];
        let returnType = BulkDeleteResponse;
        return this.apiClient.callApi(
          '/personFields', 'DELETE',
          pathParams, queryParams, headerParams, formParams, postBody,
          authNames, contentTypes, accepts, returnType, null
        );
      }
  
      /**
       * Delete multiple person fields in bulk
       * Marks multiple fields as deleted.
       * @param {String} ids Comma-separated field IDs to delete
       * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/BulkDeleteResponse}
       */
      deletePersonFields(ids) {
        return this.deletePersonFieldsWithHttpInfo(ids)
          .then(function(response_and_data) {
            return response_and_data;
          });
      }
  
  
      /**
       * Get one person field
       * Returns data about a specific person field.
       * @param {Number} id ID of the field
       * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/FieldResponse} and HTTP response
       */
      getPersonFieldWithHttpInfo(id) {
        const opts = {}
        let postBody = null;
        // verify the required parameter 'id' is set
        if (id === undefined || id === null) {
          throw new Error("Missing the required parameter 'id' when calling getPersonField");
        }
  
        let pathParams = {
          'id': id,
        };
        let queryParams = {
        };
        let headerParams = {
        };
        let formParams = {
        };
  
        let formParamArray = [
        ];
  
        let contentTypes = [];
        const isURLEncoded = contentTypes.includes('application/x-www-form-urlencoded');
        const isJSON = contentTypes.includes('application/json');
  
        if (isJSON) {
          postBody = { ...postBody, ...opts };
        } else if (isURLEncoded) {
          for (let key in opts) {
            if (opts.hasOwnProperty(key) && !formParamArray.includes(key)) {
              formParams[key] = opts[key];
            }
          }
        }
  
        let authNames = ['api_key', 'oauth2', ];
        let accepts = ['application/json', ];
        let returnType = FieldResponse;
        return this.apiClient.callApi(
          '/personFields/{id}', 'GET',
          pathParams, queryParams, headerParams, formParams, postBody,
          authNames, contentTypes, accepts, returnType, null
        );
      }
  
      /**
       * Get one person field
       * Returns data about a specific person field.
       * @param {Number} id ID of the field
       * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/FieldResponse}
       */
      getPersonField(id) {
        return this.getPersonFieldWithHttpInfo(id)
          .then(function(response_and_data) {
            return response_and_data;
          });
      }
  
  
      /**
       * Get all person fields
       * Returns data about all person fields
       * @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/FieldsResponse} and HTTP response
       */
      getPersonFieldsWithHttpInfo(opts) {
        opts = opts || {};
        let postBody = null;
  
        let pathParams = {
        };
        let queryParams = {
          'start': opts['start'],
          'limit': opts['limit'],
        };
        let headerParams = {
        };
        let formParams = {
        };
  
        let formParamArray = [
        ];
  
        let contentTypes = [];
        const isURLEncoded = contentTypes.includes('application/x-www-form-urlencoded');
        const isJSON = contentTypes.includes('application/json');
  
        if (isJSON) {
          postBody = { ...postBody, ...opts };
        } else if (isURLEncoded) {
          for (let key in opts) {
            if (opts.hasOwnProperty(key) && !formParamArray.includes(key)) {
              formParams[key] = opts[key];
            }
          }
        }
  
        let authNames = ['api_key', 'oauth2', ];
        let accepts = ['application/json', ];
        let returnType = FieldsResponse;
        return this.apiClient.callApi(
          '/personFields', 'GET',
          pathParams, queryParams, headerParams, formParams, postBody,
          authNames, contentTypes, accepts, returnType, null
        );
      }
  
      /**
       * Get all person fields
       * Returns data about all person fields
       * @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/FieldsResponse}
       */
      getPersonFields(opts) {
        return this.getPersonFieldsWithHttpInfo(opts)
          .then(function(response_and_data) {
            return response_and_data;
          });
      }
  
  
      /**
       * Update a person field
       * Updates a person field. See an example of updating custom fields’ values in <a href=\" https://pipedrive.readme.io/docs/updating-custom-field-value \" target=\"_blank\" rel=\"noopener noreferrer\">this tutorial</a>.
       * @param {Number} id ID of the field
       * @param {Object} opts Optional parameters
       * @param {module:model/FieldUpdateRequest} opts.fieldUpdateRequest 
       * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with an object containing data of type {@link module:model/FieldResponse} and HTTP response
       */
      updatePersonFieldWithHttpInfo(id, opts) {
        opts = opts || {};
        let postBody = opts['fieldUpdateRequest'];
        // verify the required parameter 'id' is set
        if (id === undefined || id === null) {
          throw new Error("Missing the required parameter 'id' when calling updatePersonField");
        }
  
        let pathParams = {
          'id': id,
        };
        let queryParams = {
        };
        let headerParams = {
        };
        let formParams = {
        };
  
        let formParamArray = [
        ];
  
        let contentTypes = ['application/json', ];
        const isURLEncoded = contentTypes.includes('application/x-www-form-urlencoded');
        const isJSON = contentTypes.includes('application/json');
  
        if (isJSON) {
          postBody = { ...postBody, ...opts };
        } else if (isURLEncoded) {
          for (let key in opts) {
            if (opts.hasOwnProperty(key) && !formParamArray.includes(key)) {
              formParams[key] = opts[key];
            }
          }
        }
  
        let authNames = ['api_key', 'oauth2', ];
        let accepts = ['application/json', ];
        let returnType = FieldResponse;
        return this.apiClient.callApi(
          '/personFields/{id}', 'PUT',
          pathParams, queryParams, headerParams, formParams, postBody,
          authNames, contentTypes, accepts, returnType, null
        );
      }
  
      /**
       * Update a person field
       * Updates a person field. See an example of updating custom fields’ values in <a href=\" https://pipedrive.readme.io/docs/updating-custom-field-value \" target=\"_blank\" rel=\"noopener noreferrer\">this tutorial</a>.
       * @param {Number} id ID of the field
       * @param {Object} opts Optional parameters
       * @param {module:model/FieldUpdateRequest} opts.fieldUpdateRequest 
       * @return {Promise} a {@link https://www.promisejs.org/|Promise}, with data of type {@link module:model/FieldResponse}
       */
      updatePersonField(id, opts) {
        return this.updatePersonFieldWithHttpInfo(id, opts)
          .then(function(response_and_data) {
            return response_and_data;
          });
      }
  
  
  }
  