UNPKG

infusionsoft-nodejs

Version:

A NodeJS SDK automatically generated from Infusionsoft API Swagger definitions.

413 lines (338 loc) 23 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 _Appointment = require('../model/Appointment'); var _Appointment2 = _interopRequireDefault(_Appointment); var _AppointmentList = require('../model/AppointmentList'); var _AppointmentList2 = _interopRequireDefault(_AppointmentList); var _AppointmentStatusList = require('../model/AppointmentStatusList'); var _AppointmentStatusList2 = _interopRequireDefault(_AppointmentStatusList); var _Error = require('../model/Error'); var _Error2 = _interopRequireDefault(_Error); 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"); } } /** * Appointment service. * @module api/AppointmentApi * @version V1.0 */ var AppointmentApi = function () { /** * 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. */ function AppointmentApi(apiClient) { _classCallCheck(this, AppointmentApi); this.apiClient = apiClient || _ApiClient2.default.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. &#x60;2017-01-01T22:17:59.039Z&#x60; * @param {String} opts.until Date to search to ex. &#x60;2017-01-01T22:17:59.039Z&#x60; * @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} */ _createClass(AppointmentApi, [{ key: 'appointmentsUsingGET', value: function appointmentsUsingGET(opts, callback) { opts = opts || {}; var postBody = null; var pathParams = {}; var queryParams = { 'since': opts['since'], 'until': opts['until'], 'limit': opts['limit'], 'offset': opts['offset'] }; var headerParams = {}; var formParams = {}; var authNames = []; var contentTypes = ['application/json']; var accepts = ['application/json']; var returnType = _AppointmentList2.default; 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} */ }, { key: 'createAppointmentUsingPOST', value: function createAppointmentUsingPOST(appointment, callback) { var postBody = appointment; // verify the required parameter 'appointment' is set if (appointment === undefined || appointment === null) { throw new _Error2.default("Missing the required parameter 'appointment' when calling createAppointmentUsingPOST"); } var pathParams = {}; var queryParams = {}; var headerParams = {}; var formParams = {}; var authNames = []; var contentTypes = ['application/json']; var accepts = ['application/json']; var returnType = _Appointment2.default; 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} */ }, { key: 'loadAppointmentUsingGET', value: function loadAppointmentUsingGET(appointmentId, callback) { var postBody = null; // verify the required parameter 'appointmentId' is set if (appointmentId === undefined || appointmentId === null) { throw new _Error2.default("Missing the required parameter 'appointmentId' when calling loadAppointmentUsingGET"); } var pathParams = { 'appointmentId': appointmentId }; var queryParams = {}; var headerParams = {}; var formParams = {}; var authNames = []; var contentTypes = ['application/json']; var accepts = ['application/json']; var returnType = _Appointment2.default; 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 */ }, { key: 'removeAppointmentUsingDELETE', value: function removeAppointmentUsingDELETE(appointmentId, callback) { var postBody = null; // verify the required parameter 'appointmentId' is set if (appointmentId === undefined || appointmentId === null) { throw new _Error2.default("Missing the required parameter 'appointmentId' when calling removeAppointmentUsingDELETE"); } var pathParams = { 'appointmentId': appointmentId }; var queryParams = {}; var headerParams = {}; var formParams = {}; var authNames = []; var contentTypes = ['application/json']; var accepts = ['application/json']; var 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} */ }, { key: 'replaceAppointmentUsingPUT', value: function replaceAppointmentUsingPUT(appointmentId, appointment, callback) { var postBody = appointment; // verify the required parameter 'appointmentId' is set if (appointmentId === undefined || appointmentId === null) { throw new _Error2.default("Missing the required parameter 'appointmentId' when calling replaceAppointmentUsingPUT"); } // verify the required parameter 'appointment' is set if (appointment === undefined || appointment === null) { throw new _Error2.default("Missing the required parameter 'appointment' when calling replaceAppointmentUsingPUT"); } var pathParams = { 'appointmentId': appointmentId }; var queryParams = {}; var headerParams = {}; var formParams = {}; var authNames = []; var contentTypes = ['application/json']; var accepts = ['application/json']; var returnType = _Appointment2.default; 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. &#x60;2017-01-01T22:17:59.039Z&#x60; * @param {String} opts.until Date to search to ex. &#x60;2017-01-01T22:17:59.039Z&#x60; * @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} */ }, { key: 'searchUsingGET', value: function searchUsingGET(opts, callback) { opts = opts || {}; var postBody = null; var pathParams = {}; var queryParams = { 'since': opts['since'], 'until': opts['until'], 'limit': opts['limit'], 'offset': opts['offset'] }; var headerParams = {}; var formParams = {}; var authNames = []; var contentTypes = ['application/json']; var accepts = ['application/json']; var returnType = _AppointmentList2.default; 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} */ }, { key: 'syncUsingGET', value: function syncUsingGET(opts, callback) { opts = opts || {}; var postBody = null; var pathParams = {}; var queryParams = { 'sync_token': opts['syncToken'], 'limit': opts['limit'], 'offset': opts['offset'] }; var headerParams = {}; var formParams = {}; var authNames = []; var contentTypes = ['application/json']; var accepts = ['application/json']; var returnType = _AppointmentStatusList2.default; 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} */ }, { key: 'updateAppointmentUsingPATCH', value: function updateAppointmentUsingPATCH(appointmentId, appointment, callback) { var postBody = appointment; // verify the required parameter 'appointmentId' is set if (appointmentId === undefined || appointmentId === null) { throw new _Error2.default("Missing the required parameter 'appointmentId' when calling updateAppointmentUsingPATCH"); } // verify the required parameter 'appointment' is set if (appointment === undefined || appointment === null) { throw new _Error2.default("Missing the required parameter 'appointment' when calling updateAppointmentUsingPATCH"); } var pathParams = { 'appointmentId': appointmentId }; var queryParams = {}; var headerParams = {}; var formParams = {}; var authNames = []; var contentTypes = ['application/json']; var accepts = ['application/json']; var returnType = _Appointment2.default; return this.apiClient.callApi('/appointments/{appointmentId}', 'PATCH', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback); } }]); return AppointmentApi; }(); exports.default = AppointmentApi;