UNPKG

infusionsoft-nodejs

Version:

A NodeJS SDK automatically generated from Infusionsoft API Swagger definitions.

447 lines (384 loc) 15.3 kB
/** * 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. * */ import ApiClient from "../ApiClient"; import Error from '../model/Error'; import Task from '../model/Task'; import TaskList from '../model/TaskList'; import TaskStatusList from '../model/TaskStatusList'; /** * Task service. * @module api/TaskApi * @version V1.0 */ export default class TaskApi { /** * Constructs a new TaskApi. * @alias module:api/TaskApi * @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; } /** * Callback function to receive the result of the createTaskUsingPOST operation. * @callback module:api/TaskApi~createTaskUsingPOSTCallback * @param {String} error Error message, if any. * @param {module:model/Task} data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Create a Task * Creates a new task as the authenticated user. NB: Contact must contain at least one item in the fields `title` and `due_date`. All other attributes are optional * @param {module:model/Task} task task * @param {module:api/TaskApi~createTaskUsingPOSTCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link module:model/Task} */ createTaskUsingPOST(task, callback) { let postBody = task; // verify the required parameter 'task' is set if (task === undefined || task === null) { throw new Error("Missing the required parameter 'task' when calling createTaskUsingPOST"); } let pathParams = { }; let queryParams = { }; let headerParams = { }; let formParams = { }; let authNames = []; let contentTypes = ['application/json']; let accepts = ['application/json']; let returnType = Task; return this.apiClient.callApi( '/tasks', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback ); } /** * Callback function to receive the result of the loadTaskUsingGET operation. * @callback module:api/TaskApi~loadTaskUsingGETCallback * @param {String} error Error message, if any. * @param {module:model/Task} data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Retrieve a Task * Retrieves a single task * @param {String} taskId taskId * @param {module:api/TaskApi~loadTaskUsingGETCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link module:model/Task} */ loadTaskUsingGET(taskId, callback) { let postBody = null; // verify the required parameter 'taskId' is set if (taskId === undefined || taskId === null) { throw new Error("Missing the required parameter 'taskId' when calling loadTaskUsingGET"); } let pathParams = { 'taskId': taskId }; let queryParams = { }; let headerParams = { }; let formParams = { }; let authNames = []; let contentTypes = ['application/json']; let accepts = ['application/json']; let returnType = Task; return this.apiClient.callApi( '/tasks/{taskId}', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback ); } /** * Callback function to receive the result of the removeTaskUsingDELETE operation. * @callback module:api/TaskApi~removeTaskUsingDELETECallback * @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 Task * Permanently deletes a task * @param {String} taskId taskId * @param {module:api/TaskApi~removeTaskUsingDELETECallback} callback The callback function, accepting three arguments: error, data, response */ removeTaskUsingDELETE(taskId, callback) { let postBody = null; // verify the required parameter 'taskId' is set if (taskId === undefined || taskId === null) { throw new Error("Missing the required parameter 'taskId' when calling removeTaskUsingDELETE"); } let pathParams = { 'taskId': taskId }; let queryParams = { }; let headerParams = { }; let formParams = { }; let authNames = []; let contentTypes = ['application/json']; let accepts = ['application/json']; let returnType = null; return this.apiClient.callApi( '/tasks/{taskId}', 'DELETE', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback ); } /** * Callback function to receive the result of the replaceTaskUsingPUT operation. * @callback module:api/TaskApi~replaceTaskUsingPUTCallback * @param {String} error Error message, if any. * @param {module:model/Task} data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Replace a Task * Replaces a task with the values provided in the request * @param {String} taskId taskId * @param {module:model/Task} task task * @param {module:api/TaskApi~replaceTaskUsingPUTCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link module:model/Task} */ replaceTaskUsingPUT(taskId, task, callback) { let postBody = task; // verify the required parameter 'taskId' is set if (taskId === undefined || taskId === null) { throw new Error("Missing the required parameter 'taskId' when calling replaceTaskUsingPUT"); } // verify the required parameter 'task' is set if (task === undefined || task === null) { throw new Error("Missing the required parameter 'task' when calling replaceTaskUsingPUT"); } let pathParams = { 'taskId': taskId }; let queryParams = { }; let headerParams = { }; let formParams = { }; let authNames = []; let contentTypes = ['application/json']; let accepts = ['application/json']; let returnType = Task; return this.apiClient.callApi( '/tasks/{taskId}', 'PUT', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback ); } /** * Callback function to receive the result of the searchUsingGET4 operation. * @callback module:api/TaskApi~searchUsingGET4Callback * @param {String} error Error message, if any. * @param {module:model/TaskList} data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Search Tasks * Retrieves Tasks belonging to the authenticated user using the specified search criteria * @param {Object} opts Optional parameters * @param {Number} opts.contactId Returns tasks for the provided contact id * @param {Boolean} opts.hasDueDate Returns tasks that have an 'action date' when set to true * @param {Number} opts.userId Returns tasks for the provided user id * @param {String} opts.since Date to start searching from ex. `2017-01-01T22:17:59.039Z` * @param {String} opts.until Date to search to ex. `2017-01-01T22:17:59.039Z` * @param {Boolean} opts.completed Sets completed status of items to return * @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.order Attribute to order items by * @param {module:api/TaskApi~searchUsingGET4Callback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link module:model/TaskList} */ searchUsingGET4(opts, callback) { opts = opts || {}; let postBody = null; let pathParams = { }; let queryParams = { 'contact_id': opts['contactId'], 'has_due_date': opts['hasDueDate'], 'user_id': opts['userId'], 'since': opts['since'], 'until': opts['until'], 'completed': opts['completed'], 'limit': opts['limit'], 'offset': opts['offset'], 'order': opts['order'] }; let headerParams = { }; let formParams = { }; let authNames = []; let contentTypes = ['application/json']; let accepts = ['application/json']; let returnType = TaskList; return this.apiClient.callApi( '/tasks/search', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback ); } /** * Callback function to receive the result of the syncUsingGET2 operation. * @callback module:api/TaskApi~syncUsingGET2Callback * @param {String} error Error message, if any. * @param {module:model/TaskStatusList} data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Retrieve Synced Tasks * The Sync endpoint returns a set of tasks that have been updated or created since the last result set was retrieved, minus any tasks that have been deleted. * @param {Object} opts Optional parameters * @param {String} opts.syncToken sync_token * @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/TaskApi~syncUsingGET2Callback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link module:model/TaskStatusList} */ syncUsingGET2(opts, callback) { opts = opts || {}; let postBody = null; let pathParams = { }; let queryParams = { 'sync_token': opts['syncToken'], 'limit': opts['limit'], 'offset': opts['offset'] }; let headerParams = { }; let formParams = { }; let authNames = []; let contentTypes = ['application/json']; let accepts = ['application/json']; let returnType = TaskStatusList; return this.apiClient.callApi( '/tasks/sync', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback ); } /** * Callback function to receive the result of the tasksUsingGET operation. * @callback module:api/TaskApi~tasksUsingGETCallback * @param {String} error Error message, if any. * @param {module:model/TaskList} data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * List Tasks * Retrieves a list of all tasks using the specified search criteria * @param {Object} opts Optional parameters * @param {Number} opts.contactId contact_id * @param {Boolean} opts.hasDueDate has_due_date * @param {Number} opts.userId user_id * @param {String} opts.since Date to start searching from ex. `2017-01-01T22:17:59.039Z` * @param {String} opts.until Date to search to ex. `2017-01-01T22:17:59.039Z` * @param {Boolean} opts.completed Sets completed status of items to return * @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.order Attribute to order items by * @param {module:api/TaskApi~tasksUsingGETCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link module:model/TaskList} */ tasksUsingGET(opts, callback) { opts = opts || {}; let postBody = null; let pathParams = { }; let queryParams = { 'contact_id': opts['contactId'], 'has_due_date': opts['hasDueDate'], 'user_id': opts['userId'], 'since': opts['since'], 'until': opts['until'], 'completed': opts['completed'], 'limit': opts['limit'], 'offset': opts['offset'], 'order': opts['order'] }; let headerParams = { }; let formParams = { }; let authNames = []; let contentTypes = ['application/json']; let accepts = ['application/json']; let returnType = TaskList; return this.apiClient.callApi( '/tasks', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback ); } /** * Callback function to receive the result of the updateTaskUsingPATCH operation. * @callback module:api/TaskApi~updateTaskUsingPATCHCallback * @param {String} error Error message, if any. * @param {module:model/Task} data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Update a Task * Updates a task with only the values provided in the request * @param {String} taskId taskId * @param {module:model/Task} task task * @param {module:api/TaskApi~updateTaskUsingPATCHCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link module:model/Task} */ updateTaskUsingPATCH(taskId, task, callback) { let postBody = task; // verify the required parameter 'taskId' is set if (taskId === undefined || taskId === null) { throw new Error("Missing the required parameter 'taskId' when calling updateTaskUsingPATCH"); } // verify the required parameter 'task' is set if (task === undefined || task === null) { throw new Error("Missing the required parameter 'task' when calling updateTaskUsingPATCH"); } let pathParams = { 'taskId': taskId }; let queryParams = { }; let headerParams = { }; let formParams = { }; let authNames = []; let contentTypes = ['application/json']; let accepts = ['application/json']; let returnType = Task; return this.apiClient.callApi( '/tasks/{taskId}', 'PATCH', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback ); } }