UNPKG

infusionsoft-nodejs

Version:

A NodeJS SDK automatically generated from Infusionsoft API Swagger definitions.

558 lines (454 loc) 28.9 kB
'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /** * Infusionsoft REST API * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) * * OpenAPI spec version: V1.0 * * * NOTE: This class is auto generated by the swagger code generator program. * https://github.com/swagger-api/swagger-codegen.git * Do not edit the class manually. * */ var _ApiClient = require('../ApiClient'); var _ApiClient2 = _interopRequireDefault(_ApiClient); var _ContactList = require('../model/ContactList'); var _ContactList2 = _interopRequireDefault(_ContactList); var _ContactTagList = require('../model/ContactTagList'); var _ContactTagList2 = _interopRequireDefault(_ContactTagList); var _CustomFieldMetaData = require('../model/CustomFieldMetaData'); var _CustomFieldMetaData2 = _interopRequireDefault(_CustomFieldMetaData); var _Entrylongstring = require('../model/Entrylongstring'); var _Entrylongstring2 = _interopRequireDefault(_Entrylongstring); var _Error = require('../model/Error'); var _Error2 = _interopRequireDefault(_Error); var _FullContact = require('../model/FullContact'); var _FullContact2 = _interopRequireDefault(_FullContact); var _TagId = require('../model/TagId'); var _TagId2 = _interopRequireDefault(_TagId); var _UpsertContact = require('../model/UpsertContact'); var _UpsertContact2 = _interopRequireDefault(_UpsertContact); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } /** * Contact service. * @module api/ContactApi * @version V1.0 */ var ContactApi = function () { /** * Constructs a new ContactApi. * @alias module:api/ContactApi * @class * @param {module:ApiClient} apiClient Optional API client implementation to use, * default to {@link module:ApiClient#instance} if unspecified. */ function ContactApi(apiClient) { _classCallCheck(this, ContactApi); this.apiClient = apiClient || _ApiClient2.default.instance; } /** * Callback function to receive the result of the applyTagsToContactIdUsingPOST operation. * @callback module:api/ContactApi~applyTagsToContactIdUsingPOSTCallback * @param {String} error Error message, if any. * @param {Array.<module:model/Entrylongstring>} data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Apply Tags * Apply a list of tags to a given contact record * @param {Number} contactId contactId * @param {module:model/TagId} tagIds tagIds * @param {module:api/ContactApi~applyTagsToContactIdUsingPOSTCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link Array.<module:model/Entrylongstring>} */ _createClass(ContactApi, [{ key: 'applyTagsToContactIdUsingPOST', value: function applyTagsToContactIdUsingPOST(contactId, tagIds, callback) { var postBody = tagIds; // verify the required parameter 'contactId' is set if (contactId === undefined || contactId === null) { throw new _Error2.default("Missing the required parameter 'contactId' when calling applyTagsToContactIdUsingPOST"); } // verify the required parameter 'tagIds' is set if (tagIds === undefined || tagIds === null) { throw new _Error2.default("Missing the required parameter 'tagIds' when calling applyTagsToContactIdUsingPOST"); } var pathParams = { 'contactId': contactId }; var queryParams = {}; var headerParams = {}; var formParams = {}; var authNames = []; var contentTypes = ['application/json']; var accepts = ['application/json']; var returnType = [_Entrylongstring2.default]; return this.apiClient.callApi('/contacts/{contactId}/tags', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback); } /** * Callback function to receive the result of the createContactUsingPOST operation. * @callback module:api/ContactApi~createContactUsingPOSTCallback * @param {String} error Error message, if any. * @param {module:model/FullContact} data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Create a Contact * Creates a new contact as the authenticated user. NB: Contact must contain at least one item in &#x60;email_addresses&#x60; or &#x60;phone_numbers&#x60;. NB: &#x60;country_code&#x60; is required if &#x60;region&#x60; is specified. * @param {Object} opts Optional parameters * @param {module:model/FullContact} opts.contact contact * @param {module:api/ContactApi~createContactUsingPOSTCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link module:model/FullContact} */ }, { key: 'createContactUsingPOST', value: function createContactUsingPOST(opts, callback) { opts = opts || {}; var postBody = opts['contact']; var pathParams = {}; var queryParams = {}; var headerParams = {}; var formParams = {}; var authNames = []; var contentTypes = ['application/json']; var accepts = ['application/json']; var returnType = _FullContact2.default; return this.apiClient.callApi('/contacts', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback); } /** * Callback function to receive the result of the createOrUpdateContactUsingPUT operation. * @callback module:api/ContactApi~createOrUpdateContactUsingPUTCallback * @param {String} error Error message, if any. * @param {module:model/FullContact} data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Create or Update a Contact * Creates a new contact or updates a contact as the authenticated user. NB: New Contacts must contain at least one item in &#x60;email_addresses&#x60; or &#x60;phone_numbers&#x60;. NB: &#x60;country_code&#x60; is required if &#x60;region&#x60; is specified. Existing Contacts are updated with only the values provided in the request. Accepts a &#x60;duplicate_option&#x60; which performs duplicate checking by one of the following options: &#x60;Email&#x60;, &#x60;EmailAndName&#x60;, &#x60;EmailAndNameAndCompany&#x60;, if a match is found using the option provided, the existing contact will be updated. If an existing contact was not found using the &#x60;duplicate_option&#x60; provided, a new contact record will be created * @param {Object} opts Optional parameters * @param {module:model/UpsertContact} opts.contact contact * @param {module:api/ContactApi~createOrUpdateContactUsingPUTCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link module:model/FullContact} */ }, { key: 'createOrUpdateContactUsingPUT', value: function createOrUpdateContactUsingPUT(opts, callback) { opts = opts || {}; var postBody = opts['contact']; var pathParams = {}; var queryParams = {}; var headerParams = {}; var formParams = {}; var authNames = []; var contentTypes = ['application/json']; var accepts = ['application/json']; var returnType = _FullContact2.default; return this.apiClient.callApi('/contacts', 'PUT', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback); } /** * Callback function to receive the result of the deleteContactUsingDELETE operation. * @callback module:api/ContactApi~deleteContactUsingDELETECallback * @param {String} error Error message, if any. * @param data This operation does not return a value. * @param {String} response The complete HTTP response. */ /** * Delete a Contact * Deletes the specified contact * @param {Number} contactId contactId * @param {module:api/ContactApi~deleteContactUsingDELETECallback} callback The callback function, accepting three arguments: error, data, response */ }, { key: 'deleteContactUsingDELETE', value: function deleteContactUsingDELETE(contactId, callback) { var postBody = null; // verify the required parameter 'contactId' is set if (contactId === undefined || contactId === null) { throw new _Error2.default("Missing the required parameter 'contactId' when calling deleteContactUsingDELETE"); } var pathParams = { 'contactId': contactId }; var queryParams = {}; var headerParams = {}; var formParams = {}; var authNames = []; var contentTypes = ['application/json']; var accepts = ['application/json']; var returnType = null; return this.apiClient.callApi('/contacts/{contactId}', 'DELETE', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback); } /** * Callback function to receive the result of the listAppliedTagsUsingGET operation. * @callback module:api/ContactApi~listAppliedTagsUsingGETCallback * @param {String} error Error message, if any. * @param {module:model/ContactTagList} data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * List Applied Tags * Retrieves a list of tags applied to a given contact * @param {Number} contactId contactId * @param {Object} opts Optional parameters * @param {Number} opts.limit Sets a total of items to return * @param {Number} opts.offset Sets a beginning range of items to return * @param {module:api/ContactApi~listAppliedTagsUsingGETCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link module:model/ContactTagList} */ }, { key: 'listAppliedTagsUsingGET', value: function listAppliedTagsUsingGET(contactId, opts, callback) { opts = opts || {}; var postBody = null; // verify the required parameter 'contactId' is set if (contactId === undefined || contactId === null) { throw new _Error2.default("Missing the required parameter 'contactId' when calling listAppliedTagsUsingGET"); } var pathParams = { 'contactId': contactId }; var queryParams = { 'limit': opts['limit'], 'offset': opts['offset'] }; var headerParams = {}; var formParams = {}; var authNames = []; var contentTypes = ['application/json']; var accepts = ['application/json']; var returnType = _ContactTagList2.default; return this.apiClient.callApi('/contacts/{contactId}/tags', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback); } /** * Callback function to receive the result of the listContactsUsingGET operation. * @callback module:api/ContactApi~listContactsUsingGETCallback * @param {String} error Error message, if any. * @param {module:model/ContactList} data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * List Contacts * Retrieves a list of all contacts * @param {Object} opts Optional parameters * @param {Number} opts.limit Sets a total of items to return * @param {Number} opts.offset Sets a beginning range of items to return * @param {String} opts.email Optional email address to query on * @param {String} opts.givenName Optional first name or forename to query on * @param {String} opts.familyName Optional last name or surname to query on * @param {module:model/String} opts.order Attribute to order items by * @param {module:api/ContactApi~listContactsUsingGETCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link module:model/ContactList} */ }, { key: 'listContactsUsingGET', value: function listContactsUsingGET(opts, callback) { opts = opts || {}; var postBody = null; var pathParams = {}; var queryParams = { 'limit': opts['limit'], 'offset': opts['offset'], 'email': opts['email'], 'given_name': opts['givenName'], 'family_name': opts['familyName'], 'order': opts['order'] }; var headerParams = {}; var formParams = {}; var authNames = []; var contentTypes = ['application/json']; var accepts = ['application/json']; var returnType = _ContactList2.default; return this.apiClient.callApi('/contacts', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback); } /** * Callback function to receive the result of the listCustomFieldsUsingGET operation. * @callback module:api/ContactApi~listCustomFieldsUsingGETCallback * @param {String} error Error message, if any. * @param {Array.<module:model/CustomFieldMetaData>} data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * List Contact Custom Fields * Retrieves a list of custom fields for Contacts * @param {module:api/ContactApi~listCustomFieldsUsingGETCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link Array.<module:model/CustomFieldMetaData>} */ }, { key: 'listCustomFieldsUsingGET', value: function listCustomFieldsUsingGET(callback) { var postBody = null; var pathParams = {}; var queryParams = {}; var headerParams = {}; var formParams = {}; var authNames = []; var contentTypes = ['application/json']; var accepts = ['application/json']; var returnType = [_CustomFieldMetaData2.default]; return this.apiClient.callApi('/contactCustomFields', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback); } /** * Callback function to receive the result of the loadUsingGET operation. * @callback module:api/ContactApi~loadUsingGETCallback * @param {String} error Error message, if any. * @param {module:model/FullContact} data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Retrieve a Contact * Retrieves a single contact * @param {Number} id id * @param {Object} opts Optional parameters * @param {Array.<String>} opts.optionalProperties Comma-delimited list of Contact properties to include in the response. (Some fields such as &#x60;lead_source_id&#x60;, &#x60;custom_fields&#x60;, and &#x60;job_title&#x60; aren&#39;t included, by default.) * @param {module:api/ContactApi~loadUsingGETCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link module:model/FullContact} */ }, { key: 'loadUsingGET', value: function loadUsingGET(id, opts, callback) { opts = opts || {}; var postBody = null; // verify the required parameter 'id' is set if (id === undefined || id === null) { throw new _Error2.default("Missing the required parameter 'id' when calling loadUsingGET"); } var pathParams = { 'id': id }; var queryParams = { 'optional_properties': this.apiClient.buildCollectionParam(opts['optionalProperties'], 'multi') }; var headerParams = {}; var formParams = {}; var authNames = []; var contentTypes = ['application/json']; var accepts = ['application/json']; var returnType = _FullContact2.default; return this.apiClient.callApi('/contacts/{id}', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback); } /** * Callback function to receive the result of the removeTagsFromContactUsingDELETE operation. * @callback module:api/ContactApi~removeTagsFromContactUsingDELETECallback * @param {String} error Error message, if any. * @param data This operation does not return a value. * @param {String} response The complete HTTP response. */ /** * Remove Applied Tag * Removes a tag from the given contact * @param {Number} contactId contactId * @param {Number} tagId tagId * @param {module:api/ContactApi~removeTagsFromContactUsingDELETECallback} callback The callback function, accepting three arguments: error, data, response */ }, { key: 'removeTagsFromContactUsingDELETE', value: function removeTagsFromContactUsingDELETE(contactId, tagId, callback) { var postBody = null; // verify the required parameter 'contactId' is set if (contactId === undefined || contactId === null) { throw new _Error2.default("Missing the required parameter 'contactId' when calling removeTagsFromContactUsingDELETE"); } // verify the required parameter 'tagId' is set if (tagId === undefined || tagId === null) { throw new _Error2.default("Missing the required parameter 'tagId' when calling removeTagsFromContactUsingDELETE"); } var pathParams = { 'contactId': contactId, 'tagId': tagId }; var queryParams = {}; var headerParams = {}; var formParams = {}; var authNames = []; var contentTypes = ['application/json']; var accepts = ['application/json']; var returnType = null; return this.apiClient.callApi('/contacts/{contactId}/tags/{tagId}', 'DELETE', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback); } /** * Callback function to receive the result of the removeTagsFromContactUsingDELETE1 operation. * @callback module:api/ContactApi~removeTagsFromContactUsingDELETE1Callback * @param {String} error Error message, if any. * @param data This operation does not return a value. * @param {String} response The complete HTTP response. */ /** * Remove Applied Tags * Removes a list of tags from the given contact * @param {Number} contactId contactId * @param {String} ids ids * @param {module:api/ContactApi~removeTagsFromContactUsingDELETE1Callback} callback The callback function, accepting three arguments: error, data, response */ }, { key: 'removeTagsFromContactUsingDELETE1', value: function removeTagsFromContactUsingDELETE1(contactId, ids, callback) { var postBody = null; // verify the required parameter 'contactId' is set if (contactId === undefined || contactId === null) { throw new _Error2.default("Missing the required parameter 'contactId' when calling removeTagsFromContactUsingDELETE1"); } // verify the required parameter 'ids' is set if (ids === undefined || ids === null) { throw new _Error2.default("Missing the required parameter 'ids' when calling removeTagsFromContactUsingDELETE1"); } var pathParams = { 'contactId': contactId }; var queryParams = { 'ids': ids }; var headerParams = {}; var formParams = {}; var authNames = []; var contentTypes = ['application/json']; var accepts = ['application/json']; var returnType = null; return this.apiClient.callApi('/contacts/{contactId}/tags', 'DELETE', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback); } /** * Callback function to receive the result of the updateContactUsingPATCH operation. * @callback module:api/ContactApi~updateContactUsingPATCHCallback * @param {String} error Error message, if any. * @param {module:model/FullContact} data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Update a Contact * Updates a contact with only the values provided in the request. * @param {Number} contactId contactId * @param {Object} opts Optional parameters * @param {module:model/FullContact} opts.contact contact * @param {module:api/ContactApi~updateContactUsingPATCHCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link module:model/FullContact} */ }, { key: 'updateContactUsingPATCH', value: function updateContactUsingPATCH(contactId, opts, callback) { opts = opts || {}; var postBody = opts['contact']; // verify the required parameter 'contactId' is set if (contactId === undefined || contactId === null) { throw new _Error2.default("Missing the required parameter 'contactId' when calling updateContactUsingPATCH"); } var pathParams = { 'contactId': contactId }; var queryParams = {}; var headerParams = {}; var formParams = {}; var authNames = []; var contentTypes = ['application/json']; var accepts = ['application/json']; var returnType = _FullContact2.default; return this.apiClient.callApi('/contacts/{contactId}', 'PATCH', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback); } }]); return ContactApi; }(); exports.default = ContactApi;