UNPKG

infusionsoft-nodejs

Version:

A NodeJS SDK automatically generated from Infusionsoft API Swagger definitions.

307 lines (252 loc) 18.3 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 _Error = require('../model/Error'); var _Error2 = _interopRequireDefault(_Error); var _Order = require('../model/Order'); var _Order2 = _interopRequireDefault(_Order); var _OrderList = require('../model/OrderList'); var _OrderList2 = _interopRequireDefault(_OrderList); var _Transaction = require('../model/Transaction'); var _Transaction2 = _interopRequireDefault(_Transaction); var _TransactionList = require('../model/TransactionList'); var _TransactionList2 = _interopRequireDefault(_TransactionList); 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"); } } /** * ECommerce service. * @module api/ECommerceApi * @version V1.0 */ var ECommerceApi = function () { /** * Constructs a new ECommerceApi. * @alias module:api/ECommerceApi * @class * @param {module:ApiClient} apiClient Optional API client implementation to use, * default to {@link module:ApiClient#instance} if unspecified. */ function ECommerceApi(apiClient) { _classCallCheck(this, ECommerceApi); this.apiClient = apiClient || _ApiClient2.default.instance; } /** * Callback function to receive the result of the loadOrderUsingGET operation. * @callback module:api/ECommerceApi~loadOrderUsingGETCallback * @param {String} error Error message, if any. * @param {module:model/Order} data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Retrieve an Order * Retrieves a single order * @param {Number} orderId orderId * @param {module:api/ECommerceApi~loadOrderUsingGETCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link module:model/Order} */ _createClass(ECommerceApi, [{ key: 'loadOrderUsingGET', value: function loadOrderUsingGET(orderId, callback) { var postBody = null; // verify the required parameter 'orderId' is set if (orderId === undefined || orderId === null) { throw new _Error2.default("Missing the required parameter 'orderId' when calling loadOrderUsingGET"); } var pathParams = { 'orderId': orderId }; var queryParams = {}; var headerParams = {}; var formParams = {}; var authNames = []; var contentTypes = ['application/json']; var accepts = ['application/json']; var returnType = _Order2.default; return this.apiClient.callApi('/orders/{orderId}', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback); } /** * Callback function to receive the result of the searchUsingGET1 operation. * @callback module:api/ECommerceApi~searchUsingGET1Callback * @param {String} error Error message, if any. * @param {module:model/OrderList} data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * List Orders * Retrieves a list of all orders using the specified search criteria * @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 {Boolean} opts.paid Sets paid status of items to return * @param {String} opts.order Attribute to order items by * @param {Number} opts.contactId Returns orders for the provided contact id * @param {Number} opts.productId Returns orders containing the provided product id * @param {module:api/ECommerceApi~searchUsingGET1Callback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link module:model/OrderList} */ }, { key: 'searchUsingGET1', value: function searchUsingGET1(opts, callback) { opts = opts || {}; var postBody = null; var pathParams = {}; var queryParams = { 'since': opts['since'], 'until': opts['until'], 'limit': opts['limit'], 'offset': opts['offset'], 'paid': opts['paid'], 'order': opts['order'], 'contact_id': opts['contactId'], 'product_id': opts['productId'] }; var headerParams = {}; var formParams = {}; var authNames = []; var contentTypes = ['application/json']; var accepts = ['application/json']; var returnType = _OrderList2.default; return this.apiClient.callApi('/orders', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback); } /** * Callback function to receive the result of the searchUsingGET2 operation. * @callback module:api/ECommerceApi~searchUsingGET2Callback * @param {String} error Error message, if any. * @param {module:model/TransactionList} data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * List Transactions * Retrieves a list transactions for a given contact * @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 {Number} opts.contactId Returns transactions for the provided contact id * @param {module:api/ECommerceApi~searchUsingGET2Callback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link module:model/TransactionList} */ }, { key: 'searchUsingGET2', value: function searchUsingGET2(opts, callback) { opts = opts || {}; var postBody = null; var pathParams = {}; var queryParams = { 'since': opts['since'], 'until': opts['until'], 'limit': opts['limit'], 'offset': opts['offset'], 'contact_id': opts['contactId'] }; var headerParams = {}; var formParams = {}; var authNames = []; var contentTypes = ['application/json']; var accepts = ['application/json']; var returnType = _TransactionList2.default; return this.apiClient.callApi('/transactions', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback); } /** * Callback function to receive the result of the transactionByIdUsingGET operation. * @callback module:api/ECommerceApi~transactionByIdUsingGETCallback * @param {String} error Error message, if any. * @param {module:model/Transaction} data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Retrieve a Transaction * Retrieves a single transaction * @param {Number} transactionId transactionId * @param {module:api/ECommerceApi~transactionByIdUsingGETCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link module:model/Transaction} */ }, { key: 'transactionByIdUsingGET', value: function transactionByIdUsingGET(transactionId, callback) { var postBody = null; // verify the required parameter 'transactionId' is set if (transactionId === undefined || transactionId === null) { throw new _Error2.default("Missing the required parameter 'transactionId' when calling transactionByIdUsingGET"); } var pathParams = { 'transactionId': transactionId }; var queryParams = {}; var headerParams = {}; var formParams = {}; var authNames = []; var contentTypes = ['application/json']; var accepts = ['application/json']; var returnType = _Transaction2.default; return this.apiClient.callApi('/transactions/{transactionId}', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback); } /** * Callback function to receive the result of the transactionsForOrderUsingGET operation. * @callback module:api/ECommerceApi~transactionsForOrderUsingGETCallback * @param {String} error Error message, if any. * @param {module:model/TransactionList} data The data returned by the service call. * @param {String} response The complete HTTP response. */ /** * Retrieve Order Transactions * Retrieves a list of all transactions on a given order using the specified search criteria * @param {String} orderId orderId * @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 {Number} opts.contactId Returns transactions for the provided contact id * @param {module:api/ECommerceApi~transactionsForOrderUsingGETCallback} callback The callback function, accepting three arguments: error, data, response * data is of type: {@link module:model/TransactionList} */ }, { key: 'transactionsForOrderUsingGET', value: function transactionsForOrderUsingGET(orderId, opts, callback) { opts = opts || {}; var postBody = null; // verify the required parameter 'orderId' is set if (orderId === undefined || orderId === null) { throw new _Error2.default("Missing the required parameter 'orderId' when calling transactionsForOrderUsingGET"); } var pathParams = { 'orderId': orderId }; var queryParams = { 'since': opts['since'], 'until': opts['until'], 'limit': opts['limit'], 'offset': opts['offset'], 'contact_id': opts['contactId'] }; var headerParams = {}; var formParams = {}; var authNames = []; var contentTypes = ['application/json']; var accepts = ['application/json']; var returnType = _TransactionList2.default; return this.apiClient.callApi('/orders/{orderId}/transactions', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback); } }]); return ECommerceApi; }(); exports.default = ECommerceApi;