infusionsoft-nodejs
Version:
A NodeJS SDK automatically generated from Infusionsoft API Swagger definitions.
194 lines (155 loc) • 13.5 kB
JavaScript
'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 _Product = require('../model/Product');
var _Product2 = _interopRequireDefault(_Product);
var _ProductList = require('../model/ProductList');
var _ProductList2 = _interopRequireDefault(_ProductList);
var _ProductStatusList = require('../model/ProductStatusList');
var _ProductStatusList2 = _interopRequireDefault(_ProductStatusList);
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"); } }
/**
* Product service.
* @module api/ProductApi
* @version V1.0
*/
var ProductApi = function () {
/**
* Constructs a new ProductApi.
* @alias module:api/ProductApi
* @class
* @param {module:ApiClient} apiClient Optional API client implementation to use,
* default to {@link module:ApiClient#instance} if unspecified.
*/
function ProductApi(apiClient) {
_classCallCheck(this, ProductApi);
this.apiClient = apiClient || _ApiClient2.default.instance;
}
/**
* Callback function to receive the result of the loadProductUsingGET operation.
* @callback module:api/ProductApi~loadProductUsingGETCallback
* @param {String} error Error message, if any.
* @param {module:model/Product} data The data returned by the service call.
* @param {String} response The complete HTTP response.
*/
/**
* Retrieve a Product
* Retrieves a single product from the authorized Infusionsoft account
* @param {Number} productId productId
* @param {module:api/ProductApi~loadProductUsingGETCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link module:model/Product}
*/
_createClass(ProductApi, [{
key: 'loadProductUsingGET',
value: function loadProductUsingGET(productId, callback) {
var postBody = null;
// verify the required parameter 'productId' is set
if (productId === undefined || productId === null) {
throw new _Error2.default("Missing the required parameter 'productId' when calling loadProductUsingGET");
}
var pathParams = {
'productId': productId
};
var queryParams = {};
var headerParams = {};
var formParams = {};
var authNames = [];
var contentTypes = ['application/json'];
var accepts = ['application/json'];
var returnType = _Product2.default;
return this.apiClient.callApi('/products/{productId}', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback);
}
/**
* Callback function to receive the result of the searchUsingGET3 operation.
* @callback module:api/ProductApi~searchUsingGET3Callback
* @param {String} error Error message, if any.
* @param {module:model/ProductList} data The data returned by the service call.
* @param {String} response The complete HTTP response.
*/
/**
* List Products
* Retrieves a list of all products
* @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 {Boolean} opts.active Sets status of items to return
* @param {module:api/ProductApi~searchUsingGET3Callback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link module:model/ProductList}
*/
}, {
key: 'searchUsingGET3',
value: function searchUsingGET3(opts, callback) {
opts = opts || {};
var postBody = null;
var pathParams = {};
var queryParams = {
'limit': opts['limit'],
'offset': opts['offset'],
'active': opts['active']
};
var headerParams = {};
var formParams = {};
var authNames = [];
var contentTypes = ['application/json'];
var accepts = ['application/json'];
var returnType = _ProductList2.default;
return this.apiClient.callApi('/products/search', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback);
}
/**
* Callback function to receive the result of the syncUsingGET1 operation.
* @callback module:api/ProductApi~syncUsingGET1Callback
* @param {String} error Error message, if any.
* @param {module:model/ProductStatusList} data The data returned by the service call.
* @param {String} response The complete HTTP response.
*/
/**
* Retrieve Synced Products
* The Sync endpoint returns a set of products that have been updated or created since the last result set was retrieved, minus any products 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/ProductApi~syncUsingGET1Callback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link module:model/ProductStatusList}
*/
}, {
key: 'syncUsingGET1',
value: function syncUsingGET1(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 = _ProductStatusList2.default;
return this.apiClient.callApi('/products/sync', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, callback);
}
}]);
return ProductApi;
}();
exports.default = ProductApi;