green_link_api 1.10.2 → 1.10.4
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.
- package/README.md +2 -2
- package/dist/ApiClient.js +51 -133
- package/dist/api/BlockchainApi.js +19 -38
- package/dist/api/EnergyAssetsApi.js +61 -106
- package/dist/api/EnergyDataApi.js +88 -152
- package/dist/api/HealthCheckApi.js +2 -12
- package/dist/api/LicensedProductionSitesOnEpiasApi.js +2 -12
- package/dist/api/LocationsApi.js +21 -40
- package/dist/api/LogsApi.js +36 -67
- package/dist/api/MaintenanceCheckApi.js +2 -12
- package/dist/api/OrganizationprofilesApi.js +19 -38
- package/dist/api/OrganizationsApi.js +91 -146
- package/dist/api/SchemaApi.js +2 -12
- package/dist/api/SentryDebugApi.js +2 -12
- package/dist/api/UsersApi.js +23 -47
- package/dist/index.js +0 -110
- package/dist/model/Activities.js +9 -28
- package/dist/model/BlockchainTransaction.js +12 -36
- package/dist/model/Consumer.js +13 -37
- package/dist/model/ConsumptionDataFileList.js +8 -26
- package/dist/model/ConsumptionDataFromRetailerRequest.js +5 -20
- package/dist/model/ConsumptionDataPointCreate.js +24 -59
- package/dist/model/ConsumptionDataPointListOrDetail.js +24 -64
- package/dist/model/ConsumptionDataPointUpdate.js +24 -59
- package/dist/model/ConsumptionSite.js +15 -41
- package/dist/model/ConsumptionSiteContract.js +9 -29
- package/dist/model/ConsumptionSiteContractImport.js +5 -20
- package/dist/model/ConsumptionSiteCreate.js +15 -41
- package/dist/model/ConsumptionSiteFileUpload.js +8 -26
- package/dist/model/ConsumptionSiteListOrDetail.js +14 -41
- package/dist/model/ContentTypeEnum.js +0 -15
- package/dist/model/EacTypeEnum.js +0 -11
- package/dist/model/EmissionFactor.js +9 -28
- package/dist/model/EnergySourceEnum.js +0 -18
- package/dist/model/EnergySourcePreference.js +10 -32
- package/dist/model/GetFromEpias.js +5 -20
- package/dist/model/GridOperator.js +11 -33
- package/dist/model/ImportRequest.js +14 -40
- package/dist/model/ImportRequestStatusEnum.js +0 -14
- package/dist/model/ImportedEnergyDataPoint.js +11 -32
- package/dist/model/Issuer.js +11 -33
- package/dist/model/Location.js +19 -48
- package/dist/model/Login.js +5 -20
- package/dist/model/MatchRequest.js +23 -63
- package/dist/model/MatchTypeEnum.js +0 -12
- package/dist/model/MatchedEnergyDataPoint.js +14 -39
- package/dist/model/MatchingConsumerRequest.js +7 -24
- package/dist/model/MatchingSiteRequest.js +7 -24
- package/dist/model/OrganizationTypeEnum.js +0 -16
- package/dist/model/PaginatedActivitiesList.js +6 -23
- package/dist/model/PaginatedConsumerList.js +6 -23
- package/dist/model/PaginatedConsumptionDataPointListOrDetailList.js +6 -23
- package/dist/model/PaginatedConsumptionSiteContractList.js +6 -23
- package/dist/model/PaginatedConsumptionSiteListOrDetailList.js +6 -23
- package/dist/model/PaginatedEmissionFactorList.js +6 -23
- package/dist/model/PaginatedEnergySourcePreferenceList.js +6 -23
- package/dist/model/PaginatedGridOperatorList.js +6 -23
- package/dist/model/PaginatedImportRequestList.js +6 -23
- package/dist/model/PaginatedImportedEnergyDataPointList.js +6 -23
- package/dist/model/PaginatedIssuerList.js +6 -23
- package/dist/model/PaginatedLocationList.js +6 -23
- package/dist/model/PaginatedMatchRequestList.js +6 -23
- package/dist/model/PaginatedMatchedEnergyDataPointList.js +6 -23
- package/dist/model/PaginatedProducerList.js +6 -23
- package/dist/model/PaginatedProductionDataFromEpiasRequestList.js +6 -23
- package/dist/model/PaginatedProductionDataPointListOrDetailList.js +6 -23
- package/dist/model/PaginatedProductionSiteListOrDetailList.js +6 -23
- package/dist/model/PaginatedRetailerList.js +6 -23
- package/dist/model/PaginatedSmartContractList.js +6 -23
- package/dist/model/PaginatedUnprocessedRowList.js +6 -23
- package/dist/model/PaginatedUploadedCertificateListorDetailList.js +6 -23
- package/dist/model/PaginatedUploadedFileList.js +6 -23
- package/dist/model/PaginatedUserList.js +6 -23
- package/dist/model/PatchedConsumer.js +13 -37
- package/dist/model/PatchedConsumptionDataPointUpdate.js +24 -59
- package/dist/model/PatchedConsumptionSite.js +15 -41
- package/dist/model/PatchedEmissionFactor.js +9 -28
- package/dist/model/PatchedEnergySourcePreference.js +10 -32
- package/dist/model/PatchedGridOperator.js +11 -33
- package/dist/model/PatchedIssuer.js +11 -33
- package/dist/model/PatchedLocation.js +19 -48
- package/dist/model/PatchedProducer.js +11 -33
- package/dist/model/PatchedProductionDataPointUpdate.js +18 -47
- package/dist/model/PatchedProductionSiteUpdate.js +20 -51
- package/dist/model/PatchedRetailer.js +12 -35
- package/dist/model/PatchedSmartContract.js +9 -28
- package/dist/model/PatchedUser.js +18 -47
- package/dist/model/PatchedUserDetail.js +18 -47
- package/dist/model/PriorityEnum.js +0 -18
- package/dist/model/Producer.js +11 -33
- package/dist/model/ProductionDataFileList.js +8 -26
- package/dist/model/ProductionDataFromEpiasRequest.js +11 -36
- package/dist/model/ProductionDataPointCreate.js +18 -47
- package/dist/model/ProductionDataPointListOrDetail.js +19 -53
- package/dist/model/ProductionDataPointUpdate.js +18 -47
- package/dist/model/ProductionSite.js +20 -51
- package/dist/model/ProductionSiteFileUpload.js +12 -34
- package/dist/model/ProductionSiteListOrDetail.js +18 -48
- package/dist/model/ProductionSiteUpdate.js +20 -51
- package/dist/model/Register.js +14 -38
- package/dist/model/Retailer.js +12 -35
- package/dist/model/SmartContract.js +9 -28
- package/dist/model/Status619Enum.js +0 -13
- package/dist/model/Token.js +3 -16
- package/dist/model/TypeEnum.js +0 -13
- package/dist/model/UnprocessedRow.js +9 -28
- package/dist/model/UploadedCertificate.js +12 -35
- package/dist/model/UploadedCertificateListorDetail.js +12 -36
- package/dist/model/UploadedFile.js +10 -32
- package/dist/model/User.js +18 -47
- package/dist/model/UserDetail.js +18 -47
- package/package.json +1 -1
package/dist/ApiClient.js
CHANGED
|
@@ -4,26 +4,17 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = void 0;
|
|
7
|
-
|
|
8
7
|
var _superagent = _interopRequireDefault(require("superagent"));
|
|
9
|
-
|
|
10
8
|
var _querystring = _interopRequireDefault(require("querystring"));
|
|
11
|
-
|
|
12
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
13
|
-
|
|
14
10
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
15
|
-
|
|
16
11
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
17
|
-
|
|
18
12
|
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); } }
|
|
19
|
-
|
|
20
13
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
21
|
-
|
|
22
14
|
/**
|
|
23
15
|
* @module ApiClient
|
|
24
|
-
* @version 1.10.
|
|
16
|
+
* @version 1.10.4
|
|
25
17
|
*/
|
|
26
|
-
|
|
27
18
|
/**
|
|
28
19
|
* Manages low level client-server communications, parameter marshalling, etc. There should not be any need for an
|
|
29
20
|
* application to use this class directly - the *Api and model classes provide the public API for the service. The
|
|
@@ -39,20 +30,18 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
39
30
|
*/
|
|
40
31
|
function ApiClient() {
|
|
41
32
|
var basePath = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'http://localhost';
|
|
42
|
-
|
|
43
33
|
_classCallCheck(this, ApiClient);
|
|
44
|
-
|
|
45
34
|
/**
|
|
46
35
|
* The base URL against which to resolve every API call's (relative) path.
|
|
47
36
|
* @type {String}
|
|
48
37
|
* @default http://localhost
|
|
49
38
|
*/
|
|
50
39
|
this.basePath = basePath.replace(/\/+$/, '');
|
|
40
|
+
|
|
51
41
|
/**
|
|
52
42
|
* The authentication methods to be included for all API calls.
|
|
53
43
|
* @type {Array.<String>}
|
|
54
44
|
*/
|
|
55
|
-
|
|
56
45
|
this.authentications = {
|
|
57
46
|
'basicAuth': {
|
|
58
47
|
type: 'basic'
|
|
@@ -72,87 +61,82 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
72
61
|
name: 'Authorization'
|
|
73
62
|
}
|
|
74
63
|
};
|
|
64
|
+
|
|
75
65
|
/**
|
|
76
66
|
* The default HTTP headers to be included for all API calls.
|
|
77
67
|
* @type {Array.<String>}
|
|
78
68
|
* @default {}
|
|
79
69
|
*/
|
|
80
|
-
|
|
81
70
|
this.defaultHeaders = {
|
|
82
|
-
'User-Agent': 'OpenAPI-Generator/1.10.
|
|
71
|
+
'User-Agent': 'OpenAPI-Generator/1.10.4/Javascript'
|
|
83
72
|
};
|
|
73
|
+
|
|
84
74
|
/**
|
|
85
75
|
* The default HTTP timeout for all API calls.
|
|
86
76
|
* @type {Number}
|
|
87
77
|
* @default 60000
|
|
88
78
|
*/
|
|
89
|
-
|
|
90
79
|
this.timeout = 60000;
|
|
80
|
+
|
|
91
81
|
/**
|
|
92
82
|
* If set to false an additional timestamp parameter is added to all API GET calls to
|
|
93
83
|
* prevent browser caching
|
|
94
84
|
* @type {Boolean}
|
|
95
85
|
* @default true
|
|
96
86
|
*/
|
|
97
|
-
|
|
98
87
|
this.cache = true;
|
|
88
|
+
|
|
99
89
|
/**
|
|
100
90
|
* If set to true, the client will save the cookies from each server
|
|
101
91
|
* response, and return them in the next request.
|
|
102
92
|
* @default false
|
|
103
93
|
*/
|
|
104
|
-
|
|
105
94
|
this.enableCookies = false;
|
|
95
|
+
|
|
106
96
|
/*
|
|
107
97
|
* Used to save and return cookies in a node.js (non-browser) setting,
|
|
108
98
|
* if this.enableCookies is set to true.
|
|
109
99
|
*/
|
|
110
|
-
|
|
111
100
|
if (typeof window === 'undefined') {
|
|
112
101
|
this.agent = new _superagent["default"].agent();
|
|
113
102
|
}
|
|
103
|
+
|
|
114
104
|
/*
|
|
115
105
|
* Allow user to override superagent agent
|
|
116
106
|
*/
|
|
117
|
-
|
|
118
|
-
|
|
119
107
|
this.requestAgent = null;
|
|
108
|
+
|
|
120
109
|
/*
|
|
121
110
|
* Allow user to add superagent plugins
|
|
122
111
|
*/
|
|
123
|
-
|
|
124
112
|
this.plugins = null;
|
|
125
113
|
}
|
|
114
|
+
|
|
126
115
|
/**
|
|
127
116
|
* Returns a string representation for an actual parameter.
|
|
128
117
|
* @param param The actual parameter.
|
|
129
118
|
* @returns {String} The string representation of <code>param</code>.
|
|
130
119
|
*/
|
|
131
|
-
|
|
132
|
-
|
|
133
120
|
_createClass(ApiClient, [{
|
|
134
121
|
key: "paramToString",
|
|
135
122
|
value: function paramToString(param) {
|
|
136
123
|
if (param == undefined || param == null) {
|
|
137
124
|
return '';
|
|
138
125
|
}
|
|
139
|
-
|
|
140
126
|
if (param instanceof Date) {
|
|
141
127
|
return param.toJSON();
|
|
142
128
|
}
|
|
143
|
-
|
|
144
129
|
if (ApiClient.canBeJsonified(param)) {
|
|
145
130
|
return JSON.stringify(param);
|
|
146
131
|
}
|
|
147
|
-
|
|
148
132
|
return param.toString();
|
|
149
133
|
}
|
|
134
|
+
|
|
150
135
|
/**
|
|
151
136
|
* Returns a boolean indicating if the parameter could be JSON.stringified
|
|
152
137
|
* @param param The actual parameter
|
|
153
138
|
* @returns {Boolean} Flag indicating if <code>param</code> can be JSON.stringified
|
|
154
139
|
*/
|
|
155
|
-
|
|
156
140
|
}, {
|
|
157
141
|
key: "buildUrl",
|
|
158
142
|
value:
|
|
@@ -166,30 +150,27 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
166
150
|
*/
|
|
167
151
|
function buildUrl(path, pathParams, apiBasePath) {
|
|
168
152
|
var _this = this;
|
|
169
|
-
|
|
170
153
|
if (!path.match(/^\//)) {
|
|
171
154
|
path = '/' + path;
|
|
172
155
|
}
|
|
156
|
+
var url = this.basePath + path;
|
|
173
157
|
|
|
174
|
-
|
|
175
|
-
|
|
158
|
+
// use API (operation, path) base path if defined
|
|
176
159
|
if (apiBasePath !== null && apiBasePath !== undefined) {
|
|
177
160
|
url = apiBasePath + path;
|
|
178
161
|
}
|
|
179
|
-
|
|
180
162
|
url = url.replace(/\{([\w-\.]+)\}/g, function (fullMatch, key) {
|
|
181
163
|
var value;
|
|
182
|
-
|
|
183
164
|
if (pathParams.hasOwnProperty(key)) {
|
|
184
165
|
value = _this.paramToString(pathParams[key]);
|
|
185
166
|
} else {
|
|
186
167
|
value = fullMatch;
|
|
187
168
|
}
|
|
188
|
-
|
|
189
169
|
return encodeURIComponent(value);
|
|
190
170
|
});
|
|
191
171
|
return url;
|
|
192
172
|
}
|
|
173
|
+
|
|
193
174
|
/**
|
|
194
175
|
* Checks whether the given content type represents JSON.<br>
|
|
195
176
|
* JSON content type examples:<br>
|
|
@@ -201,18 +182,17 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
201
182
|
* @param {String} contentType The MIME content type to check.
|
|
202
183
|
* @returns {Boolean} <code>true</code> if <code>contentType</code> represents JSON, otherwise <code>false</code>.
|
|
203
184
|
*/
|
|
204
|
-
|
|
205
185
|
}, {
|
|
206
186
|
key: "isJsonMime",
|
|
207
187
|
value: function isJsonMime(contentType) {
|
|
208
188
|
return Boolean(contentType != null && contentType.match(/^application\/json(;.*)?$/i));
|
|
209
189
|
}
|
|
190
|
+
|
|
210
191
|
/**
|
|
211
192
|
* Chooses a content type from the given array, with JSON preferred; i.e. return JSON if included, otherwise return the first.
|
|
212
193
|
* @param {Array.<String>} contentTypes
|
|
213
194
|
* @returns {String} The chosen content type, preferring JSON.
|
|
214
195
|
*/
|
|
215
|
-
|
|
216
196
|
}, {
|
|
217
197
|
key: "jsonPreferredMime",
|
|
218
198
|
value: function jsonPreferredMime(contentTypes) {
|
|
@@ -221,48 +201,45 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
221
201
|
return contentTypes[i];
|
|
222
202
|
}
|
|
223
203
|
}
|
|
224
|
-
|
|
225
204
|
return contentTypes[0];
|
|
226
205
|
}
|
|
206
|
+
|
|
227
207
|
/**
|
|
228
208
|
* Checks whether the given parameter value represents file-like content.
|
|
229
209
|
* @param param The parameter to check.
|
|
230
210
|
* @returns {Boolean} <code>true</code> if <code>param</code> represents a file.
|
|
231
211
|
*/
|
|
232
|
-
|
|
233
212
|
}, {
|
|
234
213
|
key: "isFileParam",
|
|
235
214
|
value: function isFileParam(param) {
|
|
236
215
|
// fs.ReadStream in Node.js and Electron (but not in runtime like browserify)
|
|
237
216
|
if (typeof require === 'function') {
|
|
238
217
|
var fs;
|
|
239
|
-
|
|
240
218
|
try {
|
|
241
219
|
fs = require('fs');
|
|
242
220
|
} catch (err) {}
|
|
243
|
-
|
|
244
221
|
if (fs && fs.ReadStream && param instanceof fs.ReadStream) {
|
|
245
222
|
return true;
|
|
246
223
|
}
|
|
247
|
-
}
|
|
248
|
-
|
|
224
|
+
}
|
|
249
225
|
|
|
226
|
+
// Buffer in Node.js
|
|
250
227
|
if (typeof Buffer === 'function' && param instanceof Buffer) {
|
|
251
228
|
return true;
|
|
252
|
-
}
|
|
253
|
-
|
|
229
|
+
}
|
|
254
230
|
|
|
231
|
+
// Blob in browser
|
|
255
232
|
if (typeof Blob === 'function' && param instanceof Blob) {
|
|
256
233
|
return true;
|
|
257
|
-
}
|
|
258
|
-
|
|
234
|
+
}
|
|
259
235
|
|
|
236
|
+
// File in browser (it seems File object is also instance of Blob, but keep this for safe)
|
|
260
237
|
if (typeof File === 'function' && param instanceof File) {
|
|
261
238
|
return true;
|
|
262
239
|
}
|
|
263
|
-
|
|
264
240
|
return false;
|
|
265
241
|
}
|
|
242
|
+
|
|
266
243
|
/**
|
|
267
244
|
* Normalizes parameter values:
|
|
268
245
|
* <ul>
|
|
@@ -273,16 +250,13 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
273
250
|
* @param {Object.<String, Object>} params The parameters as object properties.
|
|
274
251
|
* @returns {Object.<String, Object>} normalized parameters.
|
|
275
252
|
*/
|
|
276
|
-
|
|
277
253
|
}, {
|
|
278
254
|
key: "normalizeParams",
|
|
279
255
|
value: function normalizeParams(params) {
|
|
280
256
|
var newParams = {};
|
|
281
|
-
|
|
282
257
|
for (var key in params) {
|
|
283
258
|
if (params.hasOwnProperty(key) && params[key] != undefined && params[key] != null) {
|
|
284
259
|
var value = params[key];
|
|
285
|
-
|
|
286
260
|
if (this.isFileParam(value) || Array.isArray(value)) {
|
|
287
261
|
newParams[key] = value;
|
|
288
262
|
} else {
|
|
@@ -290,9 +264,9 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
290
264
|
}
|
|
291
265
|
}
|
|
292
266
|
}
|
|
293
|
-
|
|
294
267
|
return newParams;
|
|
295
268
|
}
|
|
269
|
+
|
|
296
270
|
/**
|
|
297
271
|
* Builds a string representation of an array-type actual parameter, according to the given collection format.
|
|
298
272
|
* @param {Array} param An array parameter.
|
|
@@ -300,60 +274,48 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
300
274
|
* @returns {String|Array} A string representation of the supplied collection, using the specified delimiter. Returns
|
|
301
275
|
* <code>param</code> as is if <code>collectionFormat</code> is <code>multi</code>.
|
|
302
276
|
*/
|
|
303
|
-
|
|
304
277
|
}, {
|
|
305
278
|
key: "buildCollectionParam",
|
|
306
279
|
value: function buildCollectionParam(param, collectionFormat) {
|
|
307
280
|
if (param == null) {
|
|
308
281
|
return null;
|
|
309
282
|
}
|
|
310
|
-
|
|
311
283
|
switch (collectionFormat) {
|
|
312
284
|
case 'csv':
|
|
313
285
|
return param.map(this.paramToString, this).join(',');
|
|
314
|
-
|
|
315
286
|
case 'ssv':
|
|
316
287
|
return param.map(this.paramToString, this).join(' ');
|
|
317
|
-
|
|
318
288
|
case 'tsv':
|
|
319
289
|
return param.map(this.paramToString, this).join('\t');
|
|
320
|
-
|
|
321
290
|
case 'pipes':
|
|
322
291
|
return param.map(this.paramToString, this).join('|');
|
|
323
|
-
|
|
324
292
|
case 'multi':
|
|
325
293
|
//return the array directly as SuperAgent will handle it as expected
|
|
326
294
|
return param.map(this.paramToString, this);
|
|
327
|
-
|
|
328
295
|
case 'passthrough':
|
|
329
296
|
return param;
|
|
330
|
-
|
|
331
297
|
default:
|
|
332
298
|
throw new Error('Unknown collection format: ' + collectionFormat);
|
|
333
299
|
}
|
|
334
300
|
}
|
|
301
|
+
|
|
335
302
|
/**
|
|
336
303
|
* Applies authentication headers to the request.
|
|
337
304
|
* @param {Object} request The request object created by a <code>superagent()</code> call.
|
|
338
305
|
* @param {Array.<String>} authNames An array of authentication method names.
|
|
339
306
|
*/
|
|
340
|
-
|
|
341
307
|
}, {
|
|
342
308
|
key: "applyAuthToRequest",
|
|
343
309
|
value: function applyAuthToRequest(request, authNames) {
|
|
344
310
|
var _this2 = this;
|
|
345
|
-
|
|
346
311
|
authNames.forEach(function (authName) {
|
|
347
312
|
var auth = _this2.authentications[authName];
|
|
348
|
-
|
|
349
313
|
switch (auth.type) {
|
|
350
314
|
case 'basic':
|
|
351
315
|
if (auth.username || auth.password) {
|
|
352
316
|
request.auth(auth.username || '', auth.password || '');
|
|
353
317
|
}
|
|
354
|
-
|
|
355
318
|
break;
|
|
356
|
-
|
|
357
319
|
case 'bearer':
|
|
358
320
|
if (auth.accessToken) {
|
|
359
321
|
var localVarBearerToken = typeof auth.accessToken === 'function' ? auth.accessToken() : auth.accessToken;
|
|
@@ -361,42 +323,35 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
361
323
|
'Authorization': 'Bearer ' + localVarBearerToken
|
|
362
324
|
});
|
|
363
325
|
}
|
|
364
|
-
|
|
365
326
|
break;
|
|
366
|
-
|
|
367
327
|
case 'apiKey':
|
|
368
328
|
if (auth.apiKey) {
|
|
369
329
|
var data = {};
|
|
370
|
-
|
|
371
330
|
if (auth.apiKeyPrefix) {
|
|
372
331
|
data[auth.name] = auth.apiKeyPrefix + ' ' + auth.apiKey;
|
|
373
332
|
} else {
|
|
374
333
|
data[auth.name] = auth.apiKey;
|
|
375
334
|
}
|
|
376
|
-
|
|
377
335
|
if (auth['in'] === 'header') {
|
|
378
336
|
request.set(data);
|
|
379
337
|
} else {
|
|
380
338
|
request.query(data);
|
|
381
339
|
}
|
|
382
340
|
}
|
|
383
|
-
|
|
384
341
|
break;
|
|
385
|
-
|
|
386
342
|
case 'oauth2':
|
|
387
343
|
if (auth.accessToken) {
|
|
388
344
|
request.set({
|
|
389
345
|
'Authorization': 'Bearer ' + auth.accessToken
|
|
390
346
|
});
|
|
391
347
|
}
|
|
392
|
-
|
|
393
348
|
break;
|
|
394
|
-
|
|
395
349
|
default:
|
|
396
350
|
throw new Error('Unknown authentication type: ' + auth.type);
|
|
397
351
|
}
|
|
398
352
|
});
|
|
399
353
|
}
|
|
354
|
+
|
|
400
355
|
/**
|
|
401
356
|
* Deserializes an HTTP response body into a value of the specified type.
|
|
402
357
|
* @param {Object} response A SuperAgent response object.
|
|
@@ -406,25 +361,23 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
406
361
|
* all properties on <code>data<code> will be converted to this type.
|
|
407
362
|
* @returns A value of the specified type.
|
|
408
363
|
*/
|
|
409
|
-
|
|
410
364
|
}, {
|
|
411
365
|
key: "deserialize",
|
|
412
366
|
value: function deserialize(response, returnType) {
|
|
413
367
|
if (response == null || returnType == null || response.status == 204) {
|
|
414
368
|
return null;
|
|
415
|
-
}
|
|
416
|
-
// See http://visionmedia.github.io/superagent/#parsing-response-bodies
|
|
417
|
-
|
|
369
|
+
}
|
|
418
370
|
|
|
371
|
+
// Rely on SuperAgent for parsing response body.
|
|
372
|
+
// See http://visionmedia.github.io/superagent/#parsing-response-bodies
|
|
419
373
|
var data = response.body;
|
|
420
|
-
|
|
421
374
|
if (data == null || _typeof(data) === 'object' && typeof data.length === 'undefined' && !Object.keys(data).length) {
|
|
422
375
|
// SuperAgent does not always produce a body; use the unparsed response as a fallback
|
|
423
376
|
data = response.text;
|
|
424
377
|
}
|
|
425
|
-
|
|
426
378
|
return ApiClient.convertToType(data, returnType);
|
|
427
379
|
}
|
|
380
|
+
|
|
428
381
|
/**
|
|
429
382
|
* Callback function to receive the result of the operation.
|
|
430
383
|
* @callback module:ApiClient~callApiCallback
|
|
@@ -451,58 +404,53 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
451
404
|
* @param {module:ApiClient~callApiCallback} callback The callback function.
|
|
452
405
|
* @returns {Object} The SuperAgent request object.
|
|
453
406
|
*/
|
|
454
|
-
|
|
455
407
|
}, {
|
|
456
408
|
key: "callApi",
|
|
457
409
|
value: function callApi(path, httpMethod, pathParams, queryParams, headerParams, formParams, bodyParam, authNames, contentTypes, accepts, returnType, apiBasePath, callback) {
|
|
458
410
|
var _this3 = this;
|
|
459
|
-
|
|
460
411
|
var url = this.buildUrl(path, pathParams, apiBasePath);
|
|
461
412
|
var request = (0, _superagent["default"])(httpMethod, url);
|
|
462
|
-
|
|
463
413
|
if (this.plugins !== null) {
|
|
464
414
|
for (var index in this.plugins) {
|
|
465
415
|
if (this.plugins.hasOwnProperty(index)) {
|
|
466
416
|
request.use(this.plugins[index]);
|
|
467
417
|
}
|
|
468
418
|
}
|
|
469
|
-
}
|
|
470
|
-
|
|
419
|
+
}
|
|
471
420
|
|
|
472
|
-
|
|
421
|
+
// apply authentications
|
|
422
|
+
this.applyAuthToRequest(request, authNames);
|
|
473
423
|
|
|
424
|
+
// set query parameters
|
|
474
425
|
if (httpMethod.toUpperCase() === 'GET' && this.cache === false) {
|
|
475
426
|
queryParams['_'] = new Date().getTime();
|
|
476
427
|
}
|
|
428
|
+
request.query(this.normalizeParams(queryParams));
|
|
477
429
|
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
request.set(this.defaultHeaders).set(this.normalizeParams(headerParams)); // set requestAgent if it is set by user
|
|
430
|
+
// set header parameters
|
|
431
|
+
request.set(this.defaultHeaders).set(this.normalizeParams(headerParams));
|
|
481
432
|
|
|
433
|
+
// set requestAgent if it is set by user
|
|
482
434
|
if (this.requestAgent) {
|
|
483
435
|
request.agent(this.requestAgent);
|
|
484
|
-
}
|
|
485
|
-
|
|
436
|
+
}
|
|
486
437
|
|
|
438
|
+
// set request timeout
|
|
487
439
|
request.timeout(this.timeout);
|
|
488
440
|
var contentType = this.jsonPreferredMime(contentTypes);
|
|
489
|
-
|
|
490
441
|
if (contentType) {
|
|
491
442
|
// Issue with superagent and multipart/form-data (https://github.com/visionmedia/superagent/issues/746)
|
|
492
443
|
if (contentType != 'multipart/form-data') {
|
|
493
444
|
request.type(contentType);
|
|
494
445
|
}
|
|
495
446
|
}
|
|
496
|
-
|
|
497
447
|
if (contentType === 'application/x-www-form-urlencoded') {
|
|
498
448
|
request.send(_querystring["default"].stringify(this.normalizeParams(formParams)));
|
|
499
449
|
} else if (contentType == 'multipart/form-data') {
|
|
500
450
|
var _formParams = this.normalizeParams(formParams);
|
|
501
|
-
|
|
502
451
|
for (var key in _formParams) {
|
|
503
452
|
if (_formParams.hasOwnProperty(key)) {
|
|
504
453
|
var _formParamsValue = _formParams[key];
|
|
505
|
-
|
|
506
454
|
if (this.isFileParam(_formParamsValue)) {
|
|
507
455
|
// file field
|
|
508
456
|
request.attach(key, _formParamsValue);
|
|
@@ -520,23 +468,19 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
520
468
|
if (!request.header['Content-Type']) {
|
|
521
469
|
request.type('application/json');
|
|
522
470
|
}
|
|
523
|
-
|
|
524
471
|
request.send(bodyParam);
|
|
525
472
|
}
|
|
526
|
-
|
|
527
473
|
var accept = this.jsonPreferredMime(accepts);
|
|
528
|
-
|
|
529
474
|
if (accept) {
|
|
530
475
|
request.accept(accept);
|
|
531
476
|
}
|
|
532
|
-
|
|
533
477
|
if (returnType === 'Blob') {
|
|
534
478
|
request.responseType('blob');
|
|
535
479
|
} else if (returnType === 'String') {
|
|
536
480
|
request.responseType('string');
|
|
537
|
-
}
|
|
538
|
-
|
|
481
|
+
}
|
|
539
482
|
|
|
483
|
+
// Attach previously saved cookies, if enabled
|
|
540
484
|
if (this.enableCookies) {
|
|
541
485
|
if (typeof window === 'undefined') {
|
|
542
486
|
this.agent._attachCookies(request);
|
|
@@ -544,15 +488,12 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
544
488
|
request.withCredentials();
|
|
545
489
|
}
|
|
546
490
|
}
|
|
547
|
-
|
|
548
491
|
request.end(function (error, response) {
|
|
549
492
|
if (callback) {
|
|
550
493
|
var data = null;
|
|
551
|
-
|
|
552
494
|
if (!error) {
|
|
553
495
|
try {
|
|
554
496
|
data = _this3.deserialize(response, returnType);
|
|
555
|
-
|
|
556
497
|
if (_this3.enableCookies && typeof window === 'undefined') {
|
|
557
498
|
_this3.agent._saveCookies(response);
|
|
558
499
|
}
|
|
@@ -560,18 +501,17 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
560
501
|
error = err;
|
|
561
502
|
}
|
|
562
503
|
}
|
|
563
|
-
|
|
564
504
|
callback(error, data, response);
|
|
565
505
|
}
|
|
566
506
|
});
|
|
567
507
|
return request;
|
|
568
508
|
}
|
|
509
|
+
|
|
569
510
|
/**
|
|
570
511
|
* Parses an ISO-8601 string representation or epoch representation of a date value.
|
|
571
512
|
* @param {String} str The date value as a string.
|
|
572
513
|
* @returns {Date} The parsed date object.
|
|
573
514
|
*/
|
|
574
|
-
|
|
575
515
|
}, {
|
|
576
516
|
key: "hostSettings",
|
|
577
517
|
value:
|
|
@@ -589,19 +529,19 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
589
529
|
key: "getBasePathFromSettings",
|
|
590
530
|
value: function getBasePathFromSettings(index) {
|
|
591
531
|
var variables = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
592
|
-
var servers = this.hostSettings();
|
|
532
|
+
var servers = this.hostSettings();
|
|
593
533
|
|
|
534
|
+
// check array index out of bound
|
|
594
535
|
if (index < 0 || index >= servers.length) {
|
|
595
536
|
throw new Error("Invalid index " + index + " when selecting the host settings. Must be less than " + servers.length);
|
|
596
537
|
}
|
|
597
|
-
|
|
598
538
|
var server = servers[index];
|
|
599
|
-
var url = server['url'];
|
|
539
|
+
var url = server['url'];
|
|
600
540
|
|
|
541
|
+
// go through variable and assign a value
|
|
601
542
|
for (var variable_name in server['variables']) {
|
|
602
543
|
if (variable_name in variables) {
|
|
603
544
|
var variable = server['variables'][variable_name];
|
|
604
|
-
|
|
605
545
|
if (!('enum_values' in variable) || variable['enum_values'].includes(variables[variable_name])) {
|
|
606
546
|
url = url.replace("{" + variable_name + "}", variables[variable_name]);
|
|
607
547
|
} else {
|
|
@@ -612,20 +552,18 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
612
552
|
url = url.replace("{" + variable_name + "}", server['variables'][variable_name]['default_value']);
|
|
613
553
|
}
|
|
614
554
|
}
|
|
615
|
-
|
|
616
555
|
return url;
|
|
617
556
|
}
|
|
557
|
+
|
|
618
558
|
/**
|
|
619
559
|
* Constructs a new map or array model from REST data.
|
|
620
560
|
* @param data {Object|Array} The REST data.
|
|
621
561
|
* @param obj {Object|Array} The target object or array.
|
|
622
562
|
*/
|
|
623
|
-
|
|
624
563
|
}], [{
|
|
625
564
|
key: "canBeJsonified",
|
|
626
565
|
value: function canBeJsonified(str) {
|
|
627
566
|
if (typeof str !== 'string' && _typeof(str) !== 'object') return false;
|
|
628
|
-
|
|
629
567
|
try {
|
|
630
568
|
var type = str.toString();
|
|
631
569
|
return type === '[object Object]' || type === '[object Array]';
|
|
@@ -639,9 +577,9 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
639
577
|
if (isNaN(str)) {
|
|
640
578
|
return new Date(str.replace(/(\d)(T)(\d)/i, '$1 $3'));
|
|
641
579
|
}
|
|
642
|
-
|
|
643
580
|
return new Date(+str);
|
|
644
581
|
}
|
|
582
|
+
|
|
645
583
|
/**
|
|
646
584
|
* Converts a value to the specified type.
|
|
647
585
|
* @param {(String|Object)} data The data to convert, as a string or object.
|
|
@@ -651,31 +589,23 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
651
589
|
* all properties on <code>data<code> will be converted to this type.
|
|
652
590
|
* @returns An instance of the specified type or null or undefined if data is null or undefined.
|
|
653
591
|
*/
|
|
654
|
-
|
|
655
592
|
}, {
|
|
656
593
|
key: "convertToType",
|
|
657
594
|
value: function convertToType(data, type) {
|
|
658
595
|
if (data === null || data === undefined) return data;
|
|
659
|
-
|
|
660
596
|
switch (type) {
|
|
661
597
|
case 'Boolean':
|
|
662
598
|
return Boolean(data);
|
|
663
|
-
|
|
664
599
|
case 'Integer':
|
|
665
600
|
return parseInt(data, 10);
|
|
666
|
-
|
|
667
601
|
case 'Number':
|
|
668
602
|
return parseFloat(data);
|
|
669
|
-
|
|
670
603
|
case 'String':
|
|
671
604
|
return String(data);
|
|
672
|
-
|
|
673
605
|
case 'Date':
|
|
674
606
|
return ApiClient.parseDate(String(data));
|
|
675
|
-
|
|
676
607
|
case 'Blob':
|
|
677
608
|
return data;
|
|
678
|
-
|
|
679
609
|
default:
|
|
680
610
|
if (type === Object) {
|
|
681
611
|
// generic object, return directly
|
|
@@ -692,7 +622,6 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
692
622
|
} else if (_typeof(type) === 'object') {
|
|
693
623
|
// for plain object type like: {'String': 'Integer'}
|
|
694
624
|
var keyType, valueType;
|
|
695
|
-
|
|
696
625
|
for (var k in type) {
|
|
697
626
|
if (type.hasOwnProperty(k)) {
|
|
698
627
|
keyType = k;
|
|
@@ -700,9 +629,7 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
700
629
|
break;
|
|
701
630
|
}
|
|
702
631
|
}
|
|
703
|
-
|
|
704
632
|
var result = {};
|
|
705
|
-
|
|
706
633
|
for (var k in data) {
|
|
707
634
|
if (data.hasOwnProperty(k)) {
|
|
708
635
|
var key = ApiClient.convertToType(k, keyType);
|
|
@@ -710,13 +637,11 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
710
637
|
result[key] = value;
|
|
711
638
|
}
|
|
712
639
|
}
|
|
713
|
-
|
|
714
640
|
return result;
|
|
715
641
|
} else {
|
|
716
642
|
// for unknown type, return the data directly
|
|
717
643
|
return data;
|
|
718
644
|
}
|
|
719
|
-
|
|
720
645
|
}
|
|
721
646
|
}
|
|
722
647
|
}, {
|
|
@@ -733,7 +658,6 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
733
658
|
}
|
|
734
659
|
}
|
|
735
660
|
}]);
|
|
736
|
-
|
|
737
661
|
return ApiClient;
|
|
738
662
|
}();
|
|
739
663
|
/**
|
|
@@ -741,44 +665,38 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
741
665
|
* @enum {String}
|
|
742
666
|
* @readonly
|
|
743
667
|
*/
|
|
744
|
-
|
|
745
|
-
|
|
746
668
|
ApiClient.CollectionFormatEnum = {
|
|
747
669
|
/**
|
|
748
670
|
* Comma-separated values. Value: <code>csv</code>
|
|
749
671
|
* @const
|
|
750
672
|
*/
|
|
751
673
|
CSV: ',',
|
|
752
|
-
|
|
753
674
|
/**
|
|
754
675
|
* Space-separated values. Value: <code>ssv</code>
|
|
755
676
|
* @const
|
|
756
677
|
*/
|
|
757
678
|
SSV: ' ',
|
|
758
|
-
|
|
759
679
|
/**
|
|
760
680
|
* Tab-separated values. Value: <code>tsv</code>
|
|
761
681
|
* @const
|
|
762
682
|
*/
|
|
763
683
|
TSV: '\t',
|
|
764
|
-
|
|
765
684
|
/**
|
|
766
685
|
* Pipe(|)-separated values. Value: <code>pipes</code>
|
|
767
686
|
* @const
|
|
768
687
|
*/
|
|
769
688
|
PIPES: '|',
|
|
770
|
-
|
|
771
689
|
/**
|
|
772
690
|
* Native array. Value: <code>multi</code>
|
|
773
691
|
* @const
|
|
774
692
|
*/
|
|
775
693
|
MULTI: 'multi'
|
|
776
694
|
};
|
|
695
|
+
|
|
777
696
|
/**
|
|
778
697
|
* The default API client implementation.
|
|
779
698
|
* @type {module:ApiClient}
|
|
780
699
|
*/
|
|
781
|
-
|
|
782
700
|
ApiClient.instance = new ApiClient();
|
|
783
701
|
var _default = ApiClient;
|
|
784
702
|
exports["default"] = _default;
|