xi_sdk_resellers
Version:
Ingram Micro - Xvantage Integration (XI) Node.Js Server-side SDK.
95 lines (92 loc) • 5.07 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
var _ApiClient = _interopRequireDefault(require("../ApiClient"));
var _AccesstokenResponse = _interopRequireDefault(require("../model/AccesstokenResponse"));
var _GetAccesstoken400Response = _interopRequireDefault(require("../model/GetAccesstoken400Response"));
var _GetAccesstoken500Response = _interopRequireDefault(require("../model/GetAccesstoken500Response"));
function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); } /**
* XI Sdk Resellers
* For Resellers seeking to innovate with Ingram Micro's API solutions, automate your eCommerce experience with our array of API's and webhooks to craft a seamless journey for your customers.
*
* The version of the OpenAPI document: 1.0.0
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*
*/
/**
* Accesstoken service.
* @module api/AccesstokenApi
* @version 1.0.0
*/
var AccesstokenApi = exports["default"] = /*#__PURE__*/function () {
/**
* Constructs a new AccesstokenApi.
* @alias module:api/AccesstokenApi
* @class
* @param {module:ApiClient} [apiClient] Optional API client implementation to use,
* default to {@link module:ApiClient#instance} if unspecified.
*/
function AccesstokenApi(apiClient) {
_classCallCheck(this, AccesstokenApi);
this.apiClient = apiClient || _ApiClient["default"].instance;
}
/**
* Callback function to receive the result of the getAccesstoken operation.
* @callback module:api/AccesstokenApi~getAccesstokenCallback
* @param {String} error Error message, if any.
* @param {module:model/AccesstokenResponse} data The data returned by the service call.
* @param {String} response The complete HTTP response.
*/
/**
* Accesstoken
* The Authentication endpoint will provide an access token to access the API.
* @param {String} grantType Keep grant_type as client_credentials only.
* @param {String} clientId
* @param {String} clientSecret
* @param {module:api/AccesstokenApi~getAccesstokenCallback} callback The callback function, accepting three arguments: error, data, response
* data is of type: {@link module:model/AccesstokenResponse}
*/
return _createClass(AccesstokenApi, [{
key: "getAccesstoken",
value: function getAccesstoken(grantType, clientId, clientSecret, callback) {
var postBody = null;
// verify the required parameter 'grantType' is set
if (grantType === undefined || grantType === null) {
throw new Error("Missing the required parameter 'grantType' when calling getAccesstoken");
}
// verify the required parameter 'clientId' is set
if (clientId === undefined || clientId === null) {
throw new Error("Missing the required parameter 'clientId' when calling getAccesstoken");
}
// verify the required parameter 'clientSecret' is set
if (clientSecret === undefined || clientSecret === null) {
throw new Error("Missing the required parameter 'clientSecret' when calling getAccesstoken");
}
var pathParams = {};
var queryParams = {
'grant_type': grantType,
'client_id': clientId,
'client_secret': clientSecret
};
var headerParams = {};
var formParams = {};
var authNames = [];
var contentTypes = [];
var accepts = ['application/json'];
var returnType = _AccesstokenResponse["default"];
return this.apiClient.callApi('/oauth/oauth20/token', 'GET', pathParams, queryParams, headerParams, formParams, postBody, authNames, contentTypes, accepts, returnType, null, callback);
}
}]);
}();