UNPKG

infusionsoft-nodejs

Version:

A NodeJS SDK automatically generated from Infusionsoft API Swagger definitions.

427 lines (364 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 Appointment from '../model/Appointment'; import AppointmentList from '../model/AppointmentList'; import AppointmentStatusList from '../model/AppointmentStatusList'; import Error from '../model/Error'; /** * Appointment service. * @module api/AppointmentApi * @version V1.0 */ export default class AppointmentApi { /** * Constructs a new AppointmentApi. * @alias module:api/AppointmentApi * @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 appointmentsUsingGET operation. * @callback module:api/AppointmentApi~appointmentsUsingGETCallback * @param {String} error Error message, if any. * @param {module:model/AppointmentList} data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * List Appointments * Retrieves all appointments for the authenticated user * @param {Object} opts Optional parameters * @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 {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/AppointmentApi~appointmentsUsingGETCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link module:model/AppointmentList} */ appointmentsUsingGET(opts, callback) { opts = opts || {}; let postBody = null; let pathParams = { }; let queryParams = { 'since': opts['since'], 'until': opts['until'], 'limit': opts['limit'], 'offset': opts['offset'] }; let headerParams = { }; let formParams = { }; let authNames = []; let contentTypes = ['application/json']; let accepts = ['application/json']; let returnType = AppointmentList; return this.apiClient.callApi( '/appointments', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback ); } /** * Callback function to receive the result of the createAppointmentUsingPOST operation. * @callback module:api/AppointmentApi~createAppointmentUsingPOSTCallback * @param {String} error Error message, if any. * @param {module:model/Appointment} data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Create an Appointment * Creates a new appointment as the authenticated user * @param {module:model/Appointment} appointment appointment * @param {module:api/AppointmentApi~createAppointmentUsingPOSTCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link module:model/Appointment} */ createAppointmentUsingPOST(appointment, callback) { let postBody = appointment; // verify the required parameter 'appointment' is set if (appointment === undefined || appointment === null) { throw new Error("Missing the required parameter 'appointment' when calling createAppointmentUsingPOST"); } let pathParams = { }; let queryParams = { }; let headerParams = { }; let formParams = { }; let authNames = []; let contentTypes = ['application/json']; let accepts = ['application/json']; let returnType = Appointment; return this.apiClient.callApi( '/appointments', 'POST', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback ); } /** * Callback function to receive the result of the loadAppointmentUsingGET operation. * @callback module:api/AppointmentApi~loadAppointmentUsingGETCallback * @param {String} error Error message, if any. * @param {module:model/Appointment} data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Retrieve an Appointment * Retrieves a specific appointment belonging to the authenticated user * @param {String} appointmentId appointmentId * @param {module:api/AppointmentApi~loadAppointmentUsingGETCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link module:model/Appointment} */ loadAppointmentUsingGET(appointmentId, callback) { let postBody = null; // verify the required parameter 'appointmentId' is set if (appointmentId === undefined || appointmentId === null) { throw new Error("Missing the required parameter 'appointmentId' when calling loadAppointmentUsingGET"); } let pathParams = { 'appointmentId': appointmentId }; let queryParams = { }; let headerParams = { }; let formParams = { }; let authNames = []; let contentTypes = ['application/json']; let accepts = ['application/json']; let returnType = Appointment; return this.apiClient.callApi( '/appointments/{appointmentId}', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback ); } /** * Callback function to receive the result of the removeAppointmentUsingDELETE operation. * @callback module:api/AppointmentApi~removeAppointmentUsingDELETECallback * @param {String} error Error message, if any. * @param data This operation does not return a value. * @param {String} response The complete HTTP response. */ /** * Delete an Appointment * Deletes the specified appointment * @param {String} appointmentId appointmentId * @param {module:api/AppointmentApi~removeAppointmentUsingDELETECallback} callback The callback function, accepting three arguments: error, data, response */ removeAppointmentUsingDELETE(appointmentId, callback) { let postBody = null; // verify the required parameter 'appointmentId' is set if (appointmentId === undefined || appointmentId === null) { throw new Error("Missing the required parameter 'appointmentId' when calling removeAppointmentUsingDELETE"); } let pathParams = { 'appointmentId': appointmentId }; let queryParams = { }; let headerParams = { }; let formParams = { }; let authNames = []; let contentTypes = ['application/json']; let accepts = ['application/json']; let returnType = null; return this.apiClient.callApi( '/appointments/{appointmentId}', 'DELETE', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback ); } /** * Callback function to receive the result of the replaceAppointmentUsingPUT operation. * @callback module:api/AppointmentApi~replaceAppointmentUsingPUTCallback * @param {String} error Error message, if any. * @param {module:model/Appointment} data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Replace an Appointment * Replaces all values of a given appointment * @param {String} appointmentId appointmentId * @param {module:model/Appointment} appointment appointment * @param {module:api/AppointmentApi~replaceAppointmentUsingPUTCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link module:model/Appointment} */ replaceAppointmentUsingPUT(appointmentId, appointment, callback) { let postBody = appointment; // verify the required parameter 'appointmentId' is set if (appointmentId === undefined || appointmentId === null) { throw new Error("Missing the required parameter 'appointmentId' when calling replaceAppointmentUsingPUT"); } // verify the required parameter 'appointment' is set if (appointment === undefined || appointment === null) { throw new Error("Missing the required parameter 'appointment' when calling replaceAppointmentUsingPUT"); } let pathParams = { 'appointmentId': appointmentId }; let queryParams = { }; let headerParams = { }; let formParams = { }; let authNames = []; let contentTypes = ['application/json']; let accepts = ['application/json']; let returnType = Appointment; return this.apiClient.callApi( '/appointments/{appointmentId}', 'PUT', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback ); } /** * Callback function to receive the result of the searchUsingGET operation. * @callback module:api/AppointmentApi~searchUsingGETCallback * @param {String} error Error message, if any. * @param {module:model/AppointmentList} data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Search Appointments * Retrieves all appointments belonging to the authenticated user for the specified date range * @param {Object} opts Optional parameters * @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 {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/AppointmentApi~searchUsingGETCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link module:model/AppointmentList} */ searchUsingGET(opts, callback) { opts = opts || {}; let postBody = null; let pathParams = { }; let queryParams = { 'since': opts['since'], 'until': opts['until'], 'limit': opts['limit'], 'offset': opts['offset'] }; let headerParams = { }; let formParams = { }; let authNames = []; let contentTypes = ['application/json']; let accepts = ['application/json']; let returnType = AppointmentList; return this.apiClient.callApi( '/appointments/search', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback ); } /** * Callback function to receive the result of the syncUsingGET operation. * @callback module:api/AppointmentApi~syncUsingGETCallback * @param {String} error Error message, if any. * @param {module:model/AppointmentStatusList} data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Retrieve Synced Appointments * The Sync endpoint returns a set of appointments that have been updated or created since the last result set was retrieved, minus any appointments 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/AppointmentApi~syncUsingGETCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link module:model/AppointmentStatusList} */ syncUsingGET(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 = AppointmentStatusList; return this.apiClient.callApi( '/appointments/sync', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback ); } /** * Callback function to receive the result of the updateAppointmentUsingPATCH operation. * @callback module:api/AppointmentApi~updateAppointmentUsingPATCHCallback * @param {String} error Error message, if any. * @param {module:model/Appointment} data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Update an Appointment * Updates the provided values of a given appointment * @param {String} appointmentId appointmentId * @param {module:model/Appointment} appointment appointment * @param {module:api/AppointmentApi~updateAppointmentUsingPATCHCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link module:model/Appointment} */ updateAppointmentUsingPATCH(appointmentId, appointment, callback) { let postBody = appointment; // verify the required parameter 'appointmentId' is set if (appointmentId === undefined || appointmentId === null) { throw new Error("Missing the required parameter 'appointmentId' when calling updateAppointmentUsingPATCH"); } // verify the required parameter 'appointment' is set if (appointment === undefined || appointment === null) { throw new Error("Missing the required parameter 'appointment' when calling updateAppointmentUsingPATCH"); } let pathParams = { 'appointmentId': appointmentId }; let queryParams = { }; let headerParams = { }; let formParams = { }; let authNames = []; let contentTypes = ['application/json']; let accepts = ['application/json']; let returnType = Appointment; return this.apiClient.callApi( '/appointments/{appointmentId}', 'PATCH', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback ); } }