amazon-creators-api 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (195) hide show
  1. package/LICENSE.txt +202 -0
  2. package/README.md +102 -0
  3. package/dist/ApiClient.d.ts +273 -0
  4. package/dist/ApiClient.js +895 -0
  5. package/dist/api/DefaultApi.d.ts +124 -0
  6. package/dist/api/DefaultApi.js +409 -0
  7. package/dist/api/TypedDefaultApi.d.ts +132 -0
  8. package/dist/api/TypedDefaultApi.js +223 -0
  9. package/dist/auth/OAuth2Config.d.ts +78 -0
  10. package/dist/auth/OAuth2Config.js +152 -0
  11. package/dist/auth/OAuth2TokenManager.d.ts +38 -0
  12. package/dist/auth/OAuth2TokenManager.js +177 -0
  13. package/dist/index.d.ts +94 -0
  14. package/dist/index.js +657 -0
  15. package/dist/model/AccessDeniedExceptionResponseContent.d.ts +42 -0
  16. package/dist/model/AccessDeniedExceptionResponseContent.js +139 -0
  17. package/dist/model/AccessDeniedReason.d.ts +32 -0
  18. package/dist/model/AccessDeniedReason.js +65 -0
  19. package/dist/model/Availability.d.ts +27 -0
  20. package/dist/model/Availability.js +60 -0
  21. package/dist/model/BrowseNode.d.ts +35 -0
  22. package/dist/model/BrowseNode.js +184 -0
  23. package/dist/model/BrowseNodeAncestor.d.ts +32 -0
  24. package/dist/model/BrowseNodeAncestor.js +129 -0
  25. package/dist/model/BrowseNodeChild.d.ts +31 -0
  26. package/dist/model/BrowseNodeChild.js +116 -0
  27. package/dist/model/BrowseNodeInfo.d.ts +30 -0
  28. package/dist/model/BrowseNodeInfo.js +128 -0
  29. package/dist/model/BrowseNodesResult.d.ts +29 -0
  30. package/dist/model/BrowseNodesResult.js +114 -0
  31. package/dist/model/ByLineInfo.d.ts +31 -0
  32. package/dist/model/ByLineInfo.js +141 -0
  33. package/dist/model/Classifications.d.ts +30 -0
  34. package/dist/model/Classifications.js +107 -0
  35. package/dist/model/Condition.d.ts +27 -0
  36. package/dist/model/Condition.js +60 -0
  37. package/dist/model/ContentInfo.d.ts +32 -0
  38. package/dist/model/ContentInfo.js +135 -0
  39. package/dist/model/ContentRating.d.ts +29 -0
  40. package/dist/model/ContentRating.js +94 -0
  41. package/dist/model/Contributor.d.ts +32 -0
  42. package/dist/model/Contributor.js +128 -0
  43. package/dist/model/CustomerReviews.d.ts +30 -0
  44. package/dist/model/CustomerReviews.js +102 -0
  45. package/dist/model/DealDetails.d.ts +34 -0
  46. package/dist/model/DealDetails.js +144 -0
  47. package/dist/model/DeliveryFlag.d.ts +37 -0
  48. package/dist/model/DeliveryFlag.js +70 -0
  49. package/dist/model/DimensionBasedAttribute.d.ts +32 -0
  50. package/dist/model/DimensionBasedAttribute.js +133 -0
  51. package/dist/model/ErrorData.d.ts +41 -0
  52. package/dist/model/ErrorData.js +131 -0
  53. package/dist/model/ExternalIds.d.ts +31 -0
  54. package/dist/model/ExternalIds.js +120 -0
  55. package/dist/model/Feed.d.ts +44 -0
  56. package/dist/model/Feed.js +152 -0
  57. package/dist/model/GetBrowseNodesRequestContent.d.ts +43 -0
  58. package/dist/model/GetBrowseNodesRequestContent.js +158 -0
  59. package/dist/model/GetBrowseNodesResource.d.ts +27 -0
  60. package/dist/model/GetBrowseNodesResource.js +60 -0
  61. package/dist/model/GetBrowseNodesResponseContent.d.ts +30 -0
  62. package/dist/model/GetBrowseNodesResponseContent.js +128 -0
  63. package/dist/model/GetFeedRequestContent.d.ts +38 -0
  64. package/dist/model/GetFeedRequestContent.js +114 -0
  65. package/dist/model/GetFeedResponseContent.d.ts +38 -0
  66. package/dist/model/GetFeedResponseContent.js +114 -0
  67. package/dist/model/GetItemsRequestContent.d.ts +45 -0
  68. package/dist/model/GetItemsRequestContent.js +188 -0
  69. package/dist/model/GetItemsResource.d.ts +187 -0
  70. package/dist/model/GetItemsResource.js +220 -0
  71. package/dist/model/GetItemsResponseContent.d.ts +30 -0
  72. package/dist/model/GetItemsResponseContent.js +128 -0
  73. package/dist/model/GetReportRequestContent.d.ts +38 -0
  74. package/dist/model/GetReportRequestContent.js +114 -0
  75. package/dist/model/GetReportResponseContent.d.ts +38 -0
  76. package/dist/model/GetReportResponseContent.js +114 -0
  77. package/dist/model/GetVariationsRequestContent.d.ts +48 -0
  78. package/dist/model/GetVariationsRequestContent.js +209 -0
  79. package/dist/model/GetVariationsResource.d.ts +202 -0
  80. package/dist/model/GetVariationsResource.js +235 -0
  81. package/dist/model/GetVariationsResponseContent.d.ts +30 -0
  82. package/dist/model/GetVariationsResponseContent.js +128 -0
  83. package/dist/model/ImageSize.d.ts +31 -0
  84. package/dist/model/ImageSize.js +108 -0
  85. package/dist/model/ImageType.d.ts +32 -0
  86. package/dist/model/ImageType.js +133 -0
  87. package/dist/model/Images.d.ts +30 -0
  88. package/dist/model/Images.js +127 -0
  89. package/dist/model/InternalServerExceptionResponseContent.d.ts +40 -0
  90. package/dist/model/InternalServerExceptionResponseContent.js +128 -0
  91. package/dist/model/Item.d.ts +38 -0
  92. package/dist/model/Item.js +228 -0
  93. package/dist/model/ItemInfo.d.ts +39 -0
  94. package/dist/model/ItemInfo.js +234 -0
  95. package/dist/model/ItemsResult.d.ts +29 -0
  96. package/dist/model/ItemsResult.js +114 -0
  97. package/dist/model/LanguageType.d.ts +30 -0
  98. package/dist/model/LanguageType.js +104 -0
  99. package/dist/model/Languages.d.ts +31 -0
  100. package/dist/model/Languages.js +138 -0
  101. package/dist/model/ListFeedsResponseContent.d.ts +29 -0
  102. package/dist/model/ListFeedsResponseContent.js +112 -0
  103. package/dist/model/ListReportsResponseContent.d.ts +38 -0
  104. package/dist/model/ListReportsResponseContent.js +132 -0
  105. package/dist/model/ManufactureInfo.d.ts +31 -0
  106. package/dist/model/ManufactureInfo.js +120 -0
  107. package/dist/model/Money.d.ts +31 -0
  108. package/dist/model/Money.js +112 -0
  109. package/dist/model/MultiValuedAttribute.d.ts +31 -0
  110. package/dist/model/MultiValuedAttribute.js +117 -0
  111. package/dist/model/OfferAvailabilityV2.d.ts +32 -0
  112. package/dist/model/OfferAvailabilityV2.js +120 -0
  113. package/dist/model/OfferConditionV2.d.ts +31 -0
  114. package/dist/model/OfferConditionV2.js +116 -0
  115. package/dist/model/OfferListingV2.d.ts +37 -0
  116. package/dist/model/OfferListingV2.js +189 -0
  117. package/dist/model/OfferLoyaltyPointsV2.d.ts +29 -0
  118. package/dist/model/OfferLoyaltyPointsV2.js +88 -0
  119. package/dist/model/OfferMerchantInfoV2.d.ts +30 -0
  120. package/dist/model/OfferMerchantInfoV2.js +104 -0
  121. package/dist/model/OfferPriceV2.d.ts +32 -0
  122. package/dist/model/OfferPriceV2.js +135 -0
  123. package/dist/model/OfferSavingBasis.d.ts +31 -0
  124. package/dist/model/OfferSavingBasis.js +115 -0
  125. package/dist/model/OfferSavings.d.ts +30 -0
  126. package/dist/model/OfferSavings.js +102 -0
  127. package/dist/model/OfferType.d.ts +32 -0
  128. package/dist/model/OfferType.js +65 -0
  129. package/dist/model/OffersV2.d.ts +29 -0
  130. package/dist/model/OffersV2.js +114 -0
  131. package/dist/model/ProductInfo.d.ts +34 -0
  132. package/dist/model/ProductInfo.js +162 -0
  133. package/dist/model/Rating.d.ts +29 -0
  134. package/dist/model/Rating.js +88 -0
  135. package/dist/model/Refinement.d.ts +31 -0
  136. package/dist/model/Refinement.js +138 -0
  137. package/dist/model/RefinementBin.d.ts +30 -0
  138. package/dist/model/RefinementBin.js +104 -0
  139. package/dist/model/ReportMetadata.d.ts +44 -0
  140. package/dist/model/ReportMetadata.js +152 -0
  141. package/dist/model/ResourceNotFoundExceptionResponseContent.d.ts +44 -0
  142. package/dist/model/ResourceNotFoundExceptionResponseContent.js +156 -0
  143. package/dist/model/SavingBasisType.d.ts +37 -0
  144. package/dist/model/SavingBasisType.js +70 -0
  145. package/dist/model/SearchItemsRequestContent.d.ts +51 -0
  146. package/dist/model/SearchItemsRequestContent.js +343 -0
  147. package/dist/model/SearchItemsResource.d.ts +192 -0
  148. package/dist/model/SearchItemsResource.js +225 -0
  149. package/dist/model/SearchItemsResponseContent.d.ts +30 -0
  150. package/dist/model/SearchItemsResponseContent.js +128 -0
  151. package/dist/model/SearchRefinements.d.ts +31 -0
  152. package/dist/model/SearchRefinements.js +140 -0
  153. package/dist/model/SearchResult.d.ts +32 -0
  154. package/dist/model/SearchResult.js +148 -0
  155. package/dist/model/SingleBooleanValuedAttribute.d.ts +31 -0
  156. package/dist/model/SingleBooleanValuedAttribute.js +112 -0
  157. package/dist/model/SingleIntegerValuedAttribute.d.ts +31 -0
  158. package/dist/model/SingleIntegerValuedAttribute.js +112 -0
  159. package/dist/model/SingleStringValuedAttribute.d.ts +31 -0
  160. package/dist/model/SingleStringValuedAttribute.js +116 -0
  161. package/dist/model/SortBy.d.ts +47 -0
  162. package/dist/model/SortBy.js +80 -0
  163. package/dist/model/TechnicalInfo.d.ts +30 -0
  164. package/dist/model/TechnicalInfo.js +108 -0
  165. package/dist/model/ThrottleExceptionResponseContent.d.ts +42 -0
  166. package/dist/model/ThrottleExceptionResponseContent.js +152 -0
  167. package/dist/model/TradeInInfo.d.ts +30 -0
  168. package/dist/model/TradeInInfo.js +102 -0
  169. package/dist/model/TradeInPrice.d.ts +31 -0
  170. package/dist/model/TradeInPrice.js +112 -0
  171. package/dist/model/UnauthorizedExceptionReason.d.ts +62 -0
  172. package/dist/model/UnauthorizedExceptionReason.js +95 -0
  173. package/dist/model/UnauthorizedExceptionResponseContent.d.ts +41 -0
  174. package/dist/model/UnauthorizedExceptionResponseContent.js +137 -0
  175. package/dist/model/UnitBasedAttribute.d.ts +32 -0
  176. package/dist/model/UnitBasedAttribute.js +124 -0
  177. package/dist/model/ValidationExceptionField.d.ts +41 -0
  178. package/dist/model/ValidationExceptionField.js +129 -0
  179. package/dist/model/ValidationExceptionReason.d.ts +47 -0
  180. package/dist/model/ValidationExceptionReason.js +80 -0
  181. package/dist/model/ValidationExceptionResponseContent.d.ts +43 -0
  182. package/dist/model/ValidationExceptionResponseContent.js +170 -0
  183. package/dist/model/VariationAttribute.d.ts +30 -0
  184. package/dist/model/VariationAttribute.js +104 -0
  185. package/dist/model/VariationDimension.d.ts +32 -0
  186. package/dist/model/VariationDimension.js +132 -0
  187. package/dist/model/VariationSummary.d.ts +32 -0
  188. package/dist/model/VariationSummary.js +146 -0
  189. package/dist/model/VariationSummaryPrice.d.ts +30 -0
  190. package/dist/model/VariationSummaryPrice.js +107 -0
  191. package/dist/model/VariationsResult.d.ts +30 -0
  192. package/dist/model/VariationsResult.js +128 -0
  193. package/dist/model/WebsiteSalesRank.d.ts +32 -0
  194. package/dist/model/WebsiteSalesRank.js +124 -0
  195. package/package.json +67 -0
@@ -0,0 +1,895 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports["default"] = void 0;
7
+ var _superagent = _interopRequireDefault(require("superagent"));
8
+ function _interopRequireDefault(e) { return e && e.__esModule ? e : { "default": e }; }
9
+ function _regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return _regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i["return"]) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, _regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, _regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), _regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", _regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), _regeneratorDefine2(u), _regeneratorDefine2(u, o, "Generator"), _regeneratorDefine2(u, n, function () { return this; }), _regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
10
+ function _regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } _regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { _regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, _regeneratorDefine2(e, r, n, t); }
11
+ function asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
12
+ function _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
13
+ 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); }
14
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
15
+ 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); } }
16
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
17
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
18
+ 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); } /**
19
+ * Copyright 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved.
20
+ *
21
+ * Licensed under the Apache License, Version 2.0 (the "License").
22
+ * You may not use this file except in compliance with the License.
23
+ * A copy of the License is located at
24
+ *
25
+ * http://www.apache.org/licenses/LICENSE-2.0
26
+ *
27
+ * or in the "license" file accompanying this file. This file is distributed
28
+ * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
29
+ * express or implied. See the License for the specific language governing
30
+ * permissions and limitations under the License.
31
+ */
32
+ var OAuth2Config = require('./auth/OAuth2Config.js');
33
+ var OAuth2TokenManager = require('./auth/OAuth2TokenManager.js');
34
+
35
+ /**
36
+ * @module ApiClient
37
+ * @version 1.2.0
38
+ */
39
+
40
+ /**
41
+ * Manages low level client-server communications, parameter marshalling, etc. There should not be any need for an
42
+ * application to use this class directly - the *Api and model classes provide the public API for the service. The
43
+ * contents of this file should be regarded as internal but are documented for completeness.
44
+ * @alias module:ApiClient
45
+ * @class
46
+ */
47
+ var ApiClient = /*#__PURE__*/function () {
48
+ /**
49
+ * The base URL against which to resolve every API call's (relative) path.
50
+ * Overrides the default value set in spec file if present
51
+ * @param {String} basePath
52
+ */
53
+ function ApiClient() {
54
+ var basePath = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'https://creatorsapi.amazon';
55
+ _classCallCheck(this, ApiClient);
56
+ /**
57
+ * The base URL against which to resolve every API call's (relative) path.
58
+ * @type {String}
59
+ * @default https://creatorsapi.amazon
60
+ */
61
+ this.basePath = basePath.replace(/\/+$/, '');
62
+
63
+ /**
64
+ * The authentication methods to be included for all API calls.
65
+ * @type {Array.<String>}
66
+ */
67
+ this.authentications = {};
68
+
69
+ /**
70
+ * The default HTTP headers to be included for all API calls.
71
+ * @type {Array.<String>}
72
+ * @default {}
73
+ */
74
+ this.defaultHeaders = {
75
+ 'User-Agent': 'creatorsapi-nodejs-sdk/1.2.0'
76
+ };
77
+
78
+ /**
79
+ * The default HTTP timeout for all API calls.
80
+ * @type {Number}
81
+ * @default 60000
82
+ */
83
+ this.timeout = 60000;
84
+
85
+ /**
86
+ * If set to false an additional timestamp parameter is added to all API GET calls to
87
+ * prevent browser caching
88
+ * @type {Boolean}
89
+ * @default true
90
+ */
91
+ this.cache = true;
92
+
93
+ /**
94
+ * If set to true, the client will save the cookies from each server
95
+ * response, and return them in the next request.
96
+ * @default false
97
+ */
98
+ this.enableCookies = false;
99
+
100
+ /*
101
+ * Used to save and return cookies in a node.js (non-browser) setting,
102
+ * if this.enableCookies is set to true.
103
+ */
104
+ if (typeof window === 'undefined') {
105
+ this.agent = new _superagent["default"].agent();
106
+ }
107
+
108
+ /*
109
+ * Allow user to override superagent agent
110
+ */
111
+ this.requestAgent = null;
112
+
113
+ /*
114
+ * Allow user to add superagent plugins
115
+ */
116
+ this.plugins = null;
117
+
118
+ /**
119
+ * OAuth2 credential ID
120
+ * @type {String}
121
+ */
122
+ this.credentialId = null;
123
+
124
+ /**
125
+ * OAuth2 credential secret
126
+ * @type {String}
127
+ */
128
+ this.credentialSecret = null;
129
+
130
+ /**
131
+ * OAuth2 credential version
132
+ * @type {String}
133
+ */
134
+ this.version = null;
135
+
136
+ /**
137
+ * Marketplace identifier
138
+ * @type {String}
139
+ */
140
+ this.marketplace = null;
141
+
142
+ /**
143
+ * OAuth2 token manager instance
144
+ * @type {OAuth2TokenManager}
145
+ */
146
+ this.tokenManager = null;
147
+
148
+ /**
149
+ * Custom OAuth2 auth endpoint URL
150
+ * @type {String}
151
+ */
152
+ this.authEndpoint = null;
153
+ }
154
+
155
+ /**
156
+ * Sets the OAuth2 credential ID
157
+ * @param {String} credentialId The OAuth2 credential ID
158
+ */
159
+ return _createClass(ApiClient, [{
160
+ key: "setCredentialId",
161
+ value: function setCredentialId(credentialId) {
162
+ // Credentials changed, invalidate token manager to force new token fetch
163
+ if (this.credentialId !== credentialId) {
164
+ this.tokenManager = null;
165
+ }
166
+ this.credentialId = credentialId;
167
+ }
168
+
169
+ /**
170
+ * Gets the OAuth2 credential ID
171
+ * @returns {String} The OAuth2 credential ID
172
+ */
173
+ }, {
174
+ key: "getCredentialId",
175
+ value: function getCredentialId() {
176
+ return this.credentialId;
177
+ }
178
+
179
+ /**
180
+ * Sets the OAuth2 credential secret
181
+ * @param {String} credentialSecret The OAuth2 credential secret
182
+ */
183
+ }, {
184
+ key: "setCredentialSecret",
185
+ value: function setCredentialSecret(credentialSecret) {
186
+ // Credentials changed, invalidate token manager to force new token fetch
187
+ if (this.credentialSecret !== credentialSecret) {
188
+ this.tokenManager = null;
189
+ }
190
+ this.credentialSecret = credentialSecret;
191
+ }
192
+
193
+ /**
194
+ * Gets the OAuth2 credential secret
195
+ * @returns {String} The OAuth2 credential secret
196
+ */
197
+ }, {
198
+ key: "getCredentialSecret",
199
+ value: function getCredentialSecret() {
200
+ return this.credentialSecret;
201
+ }
202
+
203
+ /**
204
+ * Sets the credential version
205
+ * @param {String} version The credential version
206
+ */
207
+ }, {
208
+ key: "setVersion",
209
+ value: function setVersion(version) {
210
+ // Version changed, invalidate token manager to force new token fetch
211
+ if (this.version !== version) {
212
+ this.tokenManager = null;
213
+ }
214
+ this.version = version;
215
+ }
216
+
217
+ /**
218
+ * Gets the credential version
219
+ * @returns {String} The credential version
220
+ */
221
+ }, {
222
+ key: "getVersion",
223
+ value: function getVersion() {
224
+ return this.version;
225
+ }
226
+
227
+ /**
228
+ * Sets the custom OAuth2 auth endpoint URL
229
+ * @param {String} authEndpoint The custom OAuth2 auth endpoint URL
230
+ */
231
+ }, {
232
+ key: "setAuthEndpoint",
233
+ value: function setAuthEndpoint(authEndpoint) {
234
+ // Auth endpoint changed, invalidate token manager to force new token fetch
235
+ if (this.authEndpoint !== authEndpoint) {
236
+ this.tokenManager = null;
237
+ }
238
+ this.authEndpoint = authEndpoint;
239
+ }
240
+
241
+ /**
242
+ * Gets the custom OAuth2 auth endpoint URL
243
+ * @returns {String} The custom OAuth2 auth endpoint URL
244
+ */
245
+ }, {
246
+ key: "getAuthEndpoint",
247
+ value: function getAuthEndpoint() {
248
+ return this.authEndpoint;
249
+ }
250
+
251
+ /**
252
+ * Returns a string representation for an actual parameter.
253
+ * @param param The actual parameter.
254
+ * @returns {String} The string representation of <code>param</code>.
255
+ */
256
+ }, {
257
+ key: "paramToString",
258
+ value: function paramToString(param) {
259
+ if (param == undefined || param == null) {
260
+ return '';
261
+ }
262
+ if (param instanceof Date) {
263
+ return param.toJSON();
264
+ }
265
+ if (ApiClient.canBeJsonified(param)) {
266
+ return JSON.stringify(param);
267
+ }
268
+ return param.toString();
269
+ }
270
+
271
+ /**
272
+ * Returns a boolean indicating if the parameter could be JSON.stringified
273
+ * @param param The actual parameter
274
+ * @returns {Boolean} Flag indicating if <code>param</code> can be JSON.stringified
275
+ */
276
+ }, {
277
+ key: "buildUrl",
278
+ value:
279
+ /**
280
+ * Builds full URL by appending the given path to the base URL and replacing path parameter place-holders with parameter values.
281
+ * NOTE: query parameters are not handled here.
282
+ * @param {String} path The path to append to the base URL.
283
+ * @param {Object} pathParams The parameter values to append.
284
+ * @param {String} apiBasePath Base path defined in the path, operation level to override the default one
285
+ * @returns {String} The encoded path with parameter values substituted.
286
+ */
287
+ function buildUrl(path, pathParams, apiBasePath) {
288
+ var _this = this;
289
+ if (!path.match(/^\//)) {
290
+ path = '/' + path;
291
+ }
292
+ var url = this.basePath + path;
293
+
294
+ // use API (operation, path) base path if defined
295
+ if (apiBasePath !== null && apiBasePath !== undefined) {
296
+ url = apiBasePath + path;
297
+ }
298
+ url = url.replace(/\{([\w-\.#]+)\}/g, function (fullMatch, key) {
299
+ var value;
300
+ if (pathParams.hasOwnProperty(key)) {
301
+ value = _this.paramToString(pathParams[key]);
302
+ } else {
303
+ value = fullMatch;
304
+ }
305
+ return encodeURIComponent(value);
306
+ });
307
+ return url;
308
+ }
309
+
310
+ /**
311
+ * Checks whether the given content type represents JSON.<br>
312
+ * JSON content type examples:<br>
313
+ * <ul>
314
+ * <li>application/json</li>
315
+ * <li>application/json; charset=UTF8</li>
316
+ * <li>APPLICATION/JSON</li>
317
+ * </ul>
318
+ * @param {String} contentType The MIME content type to check.
319
+ * @returns {Boolean} <code>true</code> if <code>contentType</code> represents JSON, otherwise <code>false</code>.
320
+ */
321
+ }, {
322
+ key: "isJsonMime",
323
+ value: function isJsonMime(contentType) {
324
+ return Boolean(contentType != null && contentType.match(/^application\/json(;.*)?$/i));
325
+ }
326
+
327
+ /**
328
+ * Chooses a content type from the given array, with JSON preferred; i.e. return JSON if included, otherwise return the first.
329
+ * @param {Array.<String>} contentTypes
330
+ * @returns {String} The chosen content type, preferring JSON.
331
+ */
332
+ }, {
333
+ key: "jsonPreferredMime",
334
+ value: function jsonPreferredMime(contentTypes) {
335
+ for (var i = 0; i < contentTypes.length; i++) {
336
+ if (this.isJsonMime(contentTypes[i])) {
337
+ return contentTypes[i];
338
+ }
339
+ }
340
+ return contentTypes[0];
341
+ }
342
+
343
+ /**
344
+ * Checks whether the given parameter value represents file-like content.
345
+ * @param param The parameter to check.
346
+ * @returns {Boolean} <code>true</code> if <code>param</code> represents a file.
347
+ */
348
+ }, {
349
+ key: "isFileParam",
350
+ value: function isFileParam(param) {
351
+ // fs.ReadStream in Node.js and Electron (but not in runtime like browserify)
352
+ if (typeof require === 'function') {
353
+ var fs;
354
+ try {
355
+ fs = require('fs');
356
+ } catch (err) {}
357
+ if (fs && fs.ReadStream && param instanceof fs.ReadStream) {
358
+ return true;
359
+ }
360
+ }
361
+
362
+ // Buffer in Node.js
363
+ if (typeof Buffer === 'function' && param instanceof Buffer) {
364
+ return true;
365
+ }
366
+
367
+ // Blob in browser
368
+ if (typeof Blob === 'function' && param instanceof Blob) {
369
+ return true;
370
+ }
371
+
372
+ // File in browser (it seems File object is also instance of Blob, but keep this for safe)
373
+ if (typeof File === 'function' && param instanceof File) {
374
+ return true;
375
+ }
376
+ return false;
377
+ }
378
+
379
+ /**
380
+ * Normalizes parameter values:
381
+ * <ul>
382
+ * <li>remove nils</li>
383
+ * <li>keep files and arrays</li>
384
+ * <li>format to string with `paramToString` for other cases</li>
385
+ * </ul>
386
+ * @param {Object.<String, Object>} params The parameters as object properties.
387
+ * @returns {Object.<String, Object>} normalized parameters.
388
+ */
389
+ }, {
390
+ key: "normalizeParams",
391
+ value: function normalizeParams(params) {
392
+ var newParams = {};
393
+ for (var key in params) {
394
+ if (params.hasOwnProperty(key) && params[key] != undefined && params[key] != null) {
395
+ var value = params[key];
396
+ if (this.isFileParam(value) || Array.isArray(value)) {
397
+ newParams[key] = value;
398
+ } else {
399
+ newParams[key] = this.paramToString(value);
400
+ }
401
+ }
402
+ }
403
+ return newParams;
404
+ }
405
+
406
+ /**
407
+ * Builds a string representation of an array-type actual parameter, according to the given collection format.
408
+ * @param {Array} param An array parameter.
409
+ * @param {module:ApiClient.CollectionFormatEnum} collectionFormat The array element separator strategy.
410
+ * @returns {String|Array} A string representation of the supplied collection, using the specified delimiter. Returns
411
+ * <code>param</code> as is if <code>collectionFormat</code> is <code>multi</code>.
412
+ */
413
+ }, {
414
+ key: "buildCollectionParam",
415
+ value: function buildCollectionParam(param, collectionFormat) {
416
+ if (param == null) {
417
+ return null;
418
+ }
419
+ switch (collectionFormat) {
420
+ case 'csv':
421
+ return param.map(this.paramToString, this).join(',');
422
+ case 'ssv':
423
+ return param.map(this.paramToString, this).join(' ');
424
+ case 'tsv':
425
+ return param.map(this.paramToString, this).join('\t');
426
+ case 'pipes':
427
+ return param.map(this.paramToString, this).join('|');
428
+ case 'multi':
429
+ //return the array directly as SuperAgent will handle it as expected
430
+ return param.map(this.paramToString, this);
431
+ case 'passthrough':
432
+ return param;
433
+ default:
434
+ throw new Error('Unknown collection format: ' + collectionFormat);
435
+ }
436
+ }
437
+
438
+ /**
439
+ * Applies authentication headers to the request.
440
+ * @param {Object} request The request object created by a <code>superagent()</code> call.
441
+ * @param {Array.<String>} authNames An array of authentication method names.
442
+ */
443
+ }, {
444
+ key: "applyAuthToRequest",
445
+ value: function applyAuthToRequest(request, authNames) {
446
+ var _this2 = this;
447
+ authNames.forEach(function (authName) {
448
+ var auth = _this2.authentications[authName];
449
+ switch (auth.type) {
450
+ case 'basic':
451
+ if (auth.username || auth.password) {
452
+ request.auth(auth.username || '', auth.password || '');
453
+ }
454
+ break;
455
+ case 'bearer':
456
+ if (auth.accessToken) {
457
+ var localVarBearerToken = typeof auth.accessToken === 'function' ? auth.accessToken() : auth.accessToken;
458
+ request.set({
459
+ 'Authorization': 'Bearer ' + localVarBearerToken
460
+ });
461
+ }
462
+ break;
463
+ case 'apiKey':
464
+ if (auth.apiKey) {
465
+ var data = {};
466
+ if (auth.apiKeyPrefix) {
467
+ data[auth.name] = auth.apiKeyPrefix + ' ' + auth.apiKey;
468
+ } else {
469
+ data[auth.name] = auth.apiKey;
470
+ }
471
+ if (auth['in'] === 'header') {
472
+ request.set(data);
473
+ } else {
474
+ request.query(data);
475
+ }
476
+ }
477
+ break;
478
+ case 'oauth2':
479
+ if (auth.accessToken) {
480
+ request.set({
481
+ 'Authorization': 'Bearer ' + auth.accessToken
482
+ });
483
+ }
484
+ break;
485
+ default:
486
+ throw new Error('Unknown authentication type: ' + auth.type);
487
+ }
488
+ });
489
+ }
490
+
491
+ /**
492
+ * Deserializes an HTTP response body into a value of the specified type.
493
+ * @param {Object} response A SuperAgent response object.
494
+ * @param {(String|Array.<String>|Object.<String, Object>|Function)} returnType The type to return. Pass a string for simple types
495
+ * or the constructor function for a complex type. Pass an array containing the type name to return an array of that type. To
496
+ * return an object, pass an object with one property whose name is the key type and whose value is the corresponding value type:
497
+ * all properties on <code>data<code> will be converted to this type.
498
+ * @returns A value of the specified type.
499
+ */
500
+ }, {
501
+ key: "deserialize",
502
+ value: function deserialize(response, returnType) {
503
+ if (response == null || returnType == null || response.status == 204) {
504
+ return null;
505
+ }
506
+
507
+ // Rely on SuperAgent for parsing response body.
508
+ // See http://visionmedia.github.io/superagent/#parsing-response-bodies
509
+ var data = response.body;
510
+ if (data == null || _typeof(data) === 'object' && typeof data.length === 'undefined' && !Object.keys(data).length) {
511
+ // SuperAgent does not always produce a body; use the unparsed response as a fallback
512
+ data = response.text;
513
+ }
514
+ return ApiClient.convertToType(data, returnType);
515
+ }
516
+
517
+ /**
518
+ * Invokes the REST service using the supplied settings and parameters.
519
+ * @param {String} path The base URL to invoke.
520
+ * @param {String} httpMethod The HTTP method to use.
521
+ * @param {Object.<String, String>} pathParams A map of path parameters and their values.
522
+ * @param {Object.<String, Object>} queryParams A map of query parameters and their values.
523
+ * @param {Object.<String, Object>} headerParams A map of header parameters and their values.
524
+ * @param {Object.<String, Object>} formParams A map of form parameters and their values.
525
+ * @param {Object} bodyParam The value to pass as the request body.
526
+ * @param {Array.<String>} authNames An array of authentication type names.
527
+ * @param {Array.<String>} contentTypes An array of request MIME types.
528
+ * @param {Array.<String>} accepts An array of acceptable response MIME types.
529
+ * @param {(String|Array|ObjectFunction)} returnType The required type to return; can be a string for simple types or the
530
+ * constructor for a complex type.
531
+ * @param {String} apiBasePath base path defined in the operation/path level to override the default one
532
+ * @returns {Promise} A {@link https://www.promisejs.org/|Promise} object.
533
+ */
534
+ }, {
535
+ key: "callApi",
536
+ value: (function () {
537
+ var _callApi = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(path, httpMethod, pathParams, queryParams, headerParams, formParams, bodyParam, authNames, contentTypes, accepts, returnType, apiBasePath) {
538
+ var _this3 = this;
539
+ var config, token, url, request, index, contentType, _formParams, key, _formParamsValue, accept, _t;
540
+ return _regenerator().w(function (_context) {
541
+ while (1) switch (_context.p = _context.n) {
542
+ case 0:
543
+ if (!(!this.credentialId || !this.credentialSecret || !this.version)) {
544
+ _context.n = 1;
545
+ break;
546
+ }
547
+ throw new Error("Missing configuration. Please specify credentialId, credentialSecret, and version in client object.");
548
+ case 1:
549
+ // Handle POST requests with null/undefined body - convert to empty object
550
+ if (httpMethod.toUpperCase() === 'POST' && (bodyParam === null || bodyParam === undefined)) {
551
+ bodyParam = {};
552
+ }
553
+
554
+ // Initialize headers
555
+ if (!headerParams) {
556
+ headerParams = {};
557
+ }
558
+
559
+ // Add Content-Type if not present
560
+ if (!headerParams['Content-Type']) {
561
+ headerParams['Content-Type'] = 'application/json; charset=utf-8';
562
+ }
563
+
564
+ // Get OAuth2 token and add Authorization header
565
+ _context.p = 2;
566
+ // Initialize OAuth2TokenManager
567
+ if (!this.tokenManager) {
568
+ config = new OAuth2Config(this.credentialId, this.credentialSecret, this.version, this.authEndpoint);
569
+ this.tokenManager = new OAuth2TokenManager(config);
570
+ }
571
+ _context.n = 3;
572
+ return this.tokenManager.getToken();
573
+ case 3:
574
+ token = _context.v;
575
+ // Add Authorization headers - Version only for v2.x
576
+ if (this.version.startsWith("3.")) {
577
+ headerParams['Authorization'] = "Bearer ".concat(token);
578
+ } else {
579
+ headerParams['Authorization'] = "Bearer ".concat(token, ", Version ").concat(this.version);
580
+ }
581
+ _context.n = 5;
582
+ break;
583
+ case 4:
584
+ _context.p = 4;
585
+ _t = _context.v;
586
+ throw _t;
587
+ case 5:
588
+ url = this.buildUrl(path, pathParams, apiBasePath);
589
+ request = (0, _superagent["default"])(httpMethod, url);
590
+ if (this.plugins !== null) {
591
+ for (index in this.plugins) {
592
+ if (this.plugins.hasOwnProperty(index)) {
593
+ request.use(this.plugins[index]);
594
+ }
595
+ }
596
+ }
597
+
598
+ // apply authentications
599
+ this.applyAuthToRequest(request, authNames);
600
+
601
+ // set query parameters
602
+ if (httpMethod.toUpperCase() === 'GET' && this.cache === false) {
603
+ queryParams['_'] = new Date().getTime();
604
+ }
605
+ request.query(this.normalizeParams(queryParams));
606
+
607
+ // set header parameters
608
+ request.set(this.defaultHeaders).set(this.normalizeParams(headerParams));
609
+
610
+ // set requestAgent if it is set by user
611
+ if (this.requestAgent) {
612
+ request.agent(this.requestAgent);
613
+ }
614
+
615
+ // set request timeout
616
+ request.timeout(this.timeout);
617
+ contentType = this.jsonPreferredMime(contentTypes);
618
+ if (contentType) {
619
+ // Issue with superagent and multipart/form-data (https://github.com/visionmedia/superagent/issues/746)
620
+ if (contentType != 'multipart/form-data') {
621
+ request.type(contentType);
622
+ }
623
+ }
624
+ if (contentType === 'application/x-www-form-urlencoded') {
625
+ request.send(querystring.stringify(this.normalizeParams(formParams)));
626
+ } else if (contentType == 'multipart/form-data') {
627
+ _formParams = this.normalizeParams(formParams);
628
+ for (key in _formParams) {
629
+ if (_formParams.hasOwnProperty(key)) {
630
+ _formParamsValue = _formParams[key];
631
+ if (this.isFileParam(_formParamsValue)) {
632
+ // file field
633
+ request.attach(key, _formParamsValue);
634
+ } else if (Array.isArray(_formParamsValue) && _formParamsValue.length && this.isFileParam(_formParamsValue[0])) {
635
+ // multiple files
636
+ _formParamsValue.forEach(function (file) {
637
+ return request.attach(key, file);
638
+ });
639
+ } else {
640
+ request.field(key, _formParamsValue);
641
+ }
642
+ }
643
+ }
644
+ } else if (bodyParam !== null && bodyParam !== undefined) {
645
+ if (!request.header['Content-Type']) {
646
+ request.type('application/json');
647
+ }
648
+ request.send(bodyParam);
649
+ }
650
+ accept = this.jsonPreferredMime(accepts);
651
+ if (accept) {
652
+ request.accept(accept);
653
+ }
654
+ if (returnType === 'Blob') {
655
+ request.responseType('blob');
656
+ } else if (returnType === 'String') {
657
+ request.responseType('text');
658
+ }
659
+
660
+ // Attach previously saved cookies, if enabled
661
+ if (this.enableCookies) {
662
+ if (typeof window === 'undefined') {
663
+ this.agent._attachCookies(request);
664
+ } else {
665
+ request.withCredentials();
666
+ }
667
+ }
668
+ return _context.a(2, new Promise(function (resolve, reject) {
669
+ request.end(function (error, response) {
670
+ if (error) {
671
+ var err = {};
672
+ if (response) {
673
+ err.status = response.status;
674
+ err.statusText = response.statusText;
675
+ err.body = response.body;
676
+ err.response = response;
677
+ }
678
+ err.error = error;
679
+ reject(err);
680
+ } else {
681
+ try {
682
+ var data = _this3.deserialize(response, returnType);
683
+ if (_this3.enableCookies && typeof window === 'undefined') {
684
+ _this3.agent._saveCookies(response);
685
+ }
686
+ resolve({
687
+ data: data,
688
+ response: response
689
+ });
690
+ } catch (err) {
691
+ reject(err);
692
+ }
693
+ }
694
+ });
695
+ }));
696
+ }
697
+ }, _callee, this, [[2, 4]]);
698
+ }));
699
+ function callApi(_x, _x2, _x3, _x4, _x5, _x6, _x7, _x8, _x9, _x0, _x1, _x10) {
700
+ return _callApi.apply(this, arguments);
701
+ }
702
+ return callApi;
703
+ }()
704
+ /**
705
+ * Parses an ISO-8601 string representation or epoch representation of a date value.
706
+ * @param {String} str The date value as a string.
707
+ * @returns {Date} The parsed date object.
708
+ */
709
+ )
710
+ }, {
711
+ key: "hostSettings",
712
+ value:
713
+ /**
714
+ * Gets an array of host settings
715
+ * @returns An array of host settings
716
+ */
717
+ function hostSettings() {
718
+ return [{
719
+ 'url': "",
720
+ 'description': "No description provided"
721
+ }];
722
+ }
723
+ }, {
724
+ key: "getBasePathFromSettings",
725
+ value: function getBasePathFromSettings(index) {
726
+ var variables = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
727
+ var servers = this.hostSettings();
728
+
729
+ // check array index out of bound
730
+ if (index < 0 || index >= servers.length) {
731
+ throw new Error("Invalid index " + index + " when selecting the host settings. Must be less than " + servers.length);
732
+ }
733
+ var server = servers[index];
734
+ var url = server['url'];
735
+
736
+ // go through variable and assign a value
737
+ for (var variable_name in server['variables']) {
738
+ if (variable_name in variables) {
739
+ var variable = server['variables'][variable_name];
740
+ if (!('enum_values' in variable) || variable['enum_values'].includes(variables[variable_name])) {
741
+ url = url.replace("{" + variable_name + "}", variables[variable_name]);
742
+ } else {
743
+ throw new Error("The variable `" + variable_name + "` in the host URL has invalid value " + variables[variable_name] + ". Must be " + server['variables'][variable_name]['enum_values'] + ".");
744
+ }
745
+ } else {
746
+ // use default value
747
+ url = url.replace("{" + variable_name + "}", server['variables'][variable_name]['default_value']);
748
+ }
749
+ }
750
+ return url;
751
+ }
752
+
753
+ /**
754
+ * Constructs a new map or array model from REST data.
755
+ * @param data {Object|Array} The REST data.
756
+ * @param obj {Object|Array} The target object or array.
757
+ */
758
+ }], [{
759
+ key: "canBeJsonified",
760
+ value: function canBeJsonified(str) {
761
+ if (typeof str !== 'string' && _typeof(str) !== 'object') return false;
762
+ try {
763
+ var type = str.toString();
764
+ return type === '[object Object]' || type === '[object Array]';
765
+ } catch (err) {
766
+ return false;
767
+ }
768
+ }
769
+ }, {
770
+ key: "parseDate",
771
+ value: function parseDate(str) {
772
+ if (isNaN(str)) {
773
+ return new Date(str.replace(/(\d)(T)(\d)/i, '$1 $3'));
774
+ }
775
+ return new Date(+str);
776
+ }
777
+
778
+ /**
779
+ * Converts a value to the specified type.
780
+ * @param {(String|Object)} data The data to convert, as a string or object.
781
+ * @param {(String|Array.<String>|Object.<String, Object>|Function)} type The type to return. Pass a string for simple types
782
+ * or the constructor function for a complex type. Pass an array containing the type name to return an array of that type. To
783
+ * return an object, pass an object with one property whose name is the key type and whose value is the corresponding value type:
784
+ * all properties on <code>data<code> will be converted to this type.
785
+ * @returns An instance of the specified type or null or undefined if data is null or undefined.
786
+ */
787
+ }, {
788
+ key: "convertToType",
789
+ value: function convertToType(data, type) {
790
+ if (data === null || data === undefined) return data;
791
+ switch (type) {
792
+ case 'Boolean':
793
+ return Boolean(data);
794
+ case 'Integer':
795
+ return parseInt(data, 10);
796
+ case 'Number':
797
+ return parseFloat(data);
798
+ case 'String':
799
+ return String(data);
800
+ case 'Date':
801
+ return ApiClient.parseDate(String(data));
802
+ case 'Blob':
803
+ return data;
804
+ default:
805
+ if (type === Object) {
806
+ // generic object, return directly
807
+ return data;
808
+ } else if (typeof type.constructFromObject === 'function') {
809
+ // for model type like User and enum class
810
+ return type.constructFromObject(data);
811
+ } else if (Array.isArray(type)) {
812
+ // for array type like: ['String']
813
+ var itemType = type[0];
814
+ return data.map(function (item) {
815
+ return ApiClient.convertToType(item, itemType);
816
+ });
817
+ } else if (_typeof(type) === 'object') {
818
+ // for plain object type like: {'String': 'Integer'}
819
+ var keyType, valueType;
820
+ for (var k in type) {
821
+ if (type.hasOwnProperty(k)) {
822
+ keyType = k;
823
+ valueType = type[k];
824
+ break;
825
+ }
826
+ }
827
+ var result = {};
828
+ for (var k in data) {
829
+ if (data.hasOwnProperty(k)) {
830
+ var key = ApiClient.convertToType(k, keyType);
831
+ var value = ApiClient.convertToType(data[k], valueType);
832
+ result[key] = value;
833
+ }
834
+ }
835
+ return result;
836
+ } else {
837
+ // for unknown type, return the data directly
838
+ return data;
839
+ }
840
+ }
841
+ }
842
+ }, {
843
+ key: "constructFromObject",
844
+ value: function constructFromObject(data, obj, itemType) {
845
+ if (Array.isArray(data)) {
846
+ for (var i = 0; i < data.length; i++) {
847
+ if (data.hasOwnProperty(i)) obj[i] = ApiClient.convertToType(data[i], itemType);
848
+ }
849
+ } else {
850
+ for (var k in data) {
851
+ if (data.hasOwnProperty(k)) obj[k] = ApiClient.convertToType(data[k], itemType);
852
+ }
853
+ }
854
+ }
855
+ }]);
856
+ }();
857
+ /**
858
+ * Enumeration of collection format separator strategies.
859
+ * @enum {String}
860
+ * @readonly
861
+ */
862
+ ApiClient.CollectionFormatEnum = {
863
+ /**
864
+ * Comma-separated values. Value: <code>csv</code>
865
+ * @const
866
+ */
867
+ CSV: ',',
868
+ /**
869
+ * Space-separated values. Value: <code>ssv</code>
870
+ * @const
871
+ */
872
+ SSV: ' ',
873
+ /**
874
+ * Tab-separated values. Value: <code>tsv</code>
875
+ * @const
876
+ */
877
+ TSV: '\t',
878
+ /**
879
+ * Pipe(|)-separated values. Value: <code>pipes</code>
880
+ * @const
881
+ */
882
+ PIPES: '|',
883
+ /**
884
+ * Native array. Value: <code>multi</code>
885
+ * @const
886
+ */
887
+ MULTI: 'multi'
888
+ };
889
+
890
+ /**
891
+ * The default API client implementation.
892
+ * @type {module:ApiClient}
893
+ */
894
+ ApiClient.instance = new ApiClient();
895
+ var _default = exports["default"] = ApiClient;