@blues-inc/notehub-js 1.0.9 → 1.0.11
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 +181 -178
- package/dist/ApiClient.js +157 -154
- package/dist/api/AuthorizationApi.js +63 -18
- package/dist/api/BillingAccountApi.js +15 -15
- package/dist/api/DeviceApi.js +159 -159
- package/dist/api/DevicesApi.js +58 -58
- package/dist/api/EnvironmentVariablesApi.js +110 -110
- package/dist/api/EventApi.js +94 -94
- package/dist/api/FilesApi.js +42 -42
- package/dist/api/FleetApi.js +160 -160
- package/dist/api/NotesApi.js +105 -105
- package/dist/api/ProductApi.js +29 -29
- package/dist/api/ProjectApi.js +139 -139
- package/dist/api/RouteApi.js +51 -51
- package/dist/index.js +7 -0
- package/dist/model/Aws.js +65 -64
- package/dist/model/Azure.js +51 -37
- package/dist/model/BillingAccount.js +20 -20
- package/dist/model/Body.js +4 -4
- package/dist/model/Contact.js +21 -21
- package/dist/model/CreateFleetRequest.js +6 -6
- package/dist/model/CreateProductRequest.js +21 -21
- package/dist/model/CreateProjectRequest.js +13 -13
- package/dist/model/DFUEnv.js +11 -11
- package/dist/model/DFUState.js +64 -64
- package/dist/model/DeleteDeviceFleetsRequest.js +7 -7
- package/dist/model/Device.js +82 -82
- package/dist/model/DeviceSession.js +181 -181
- package/dist/model/DeviceTowerInfo.js +13 -13
- package/dist/model/DeviceUsage.js +31 -31
- package/dist/model/EnvironmentVariables.js +7 -7
- package/dist/model/Error.js +30 -30
- package/dist/model/Event.js +222 -222
- package/dist/model/Fleet.js +20 -20
- package/dist/model/GenerateAuthToken200Response.js +114 -0
- package/dist/model/GetBillingAccounts200Response.js +8 -9
- package/dist/model/GetDeviceEnvironmentVariables200Response.js +11 -11
- package/dist/model/GetDeviceHealthLog200Response.js +10 -11
- package/dist/model/GetDeviceHealthLog200ResponseHealthLogInner.js +18 -18
- package/dist/model/GetDeviceLatest200Response.js +8 -9
- package/dist/model/GetDevicePublicKey200Response.js +15 -15
- package/dist/model/GetDeviceSessions200Response.js +15 -16
- package/dist/model/GetProjectDevicePublicKeys200Response.js +15 -16
- package/dist/model/GetProjectDevicePublicKeys200ResponseDevicePublicKeysInner.js +11 -11
- package/dist/model/GetProjectDevices200Response.js +15 -16
- package/dist/model/GetProjectEvents200Response.js +20 -21
- package/dist/model/GetProjectEventsByCursor200Response.js +22 -23
- package/dist/model/GetProjectFleets200Response.js +10 -11
- package/dist/model/GetProjectMembers200Response.js +10 -11
- package/dist/model/GetProjectProducts200Response.js +8 -9
- package/dist/model/GetProjects200Response.js +8 -9
- package/dist/model/Google.js +27 -27
- package/dist/model/HandleNoteChanges200Response.js +10 -10
- package/dist/model/HandleNoteGet200Response.js +12 -12
- package/dist/model/HandleNoteSignal200Response.js +4 -4
- package/dist/model/HandleNotefileChanges200Response.js +10 -10
- package/dist/model/HandleNotefileChangesPending200Response.js +13 -13
- package/dist/model/HandleNotefileDeleteRequest.js +6 -6
- package/dist/model/Http.js +34 -34
- package/dist/model/HttpFilter.js +18 -18
- package/dist/model/HttpTransform.js +19 -19
- package/dist/model/Location.js +39 -39
- package/dist/model/Login200Response.js +6 -6
- package/dist/model/LoginRequest.js +11 -11
- package/dist/model/Mqtt.js +70 -71
- package/dist/model/Note.js +9 -9
- package/dist/model/Product.js +25 -25
- package/dist/model/Project.js +33 -33
- package/dist/model/ProjectMember.js +21 -21
- package/dist/model/Proxy.js +23 -23
- package/dist/model/PutDeviceFleetsRequest.js +7 -7
- package/dist/model/Radresponder.js +25 -25
- package/dist/model/Route.js +35 -35
- package/dist/model/RouteSchema.js +53 -43
- package/dist/model/Snowflake.js +45 -45
- package/dist/model/SnowflakeTransform.js +11 -11
- package/dist/model/Thingworx.js +33 -32
- package/dist/model/TowerLocation.js +51 -51
- package/dist/model/Twilio.js +43 -43
- package/dist/model/UpdateFleetRequest.js +16 -16
- package/dist/model/UserDbRoute.js +24 -24
- package/package.json +3 -3
package/dist/ApiClient.js
CHANGED
|
@@ -14,16 +14,16 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
|
|
|
14
14
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
15
15
|
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
16
16
|
/**
|
|
17
|
-
* @module ApiClient
|
|
18
|
-
* @version 1.0.
|
|
19
|
-
*/
|
|
17
|
+
* @module ApiClient
|
|
18
|
+
* @version 1.0.11
|
|
19
|
+
*/
|
|
20
20
|
/**
|
|
21
|
-
* Manages low level client-server communications, parameter marshalling, etc. There should not be any need for an
|
|
22
|
-
* application to use this class directly - the *Api and model classes provide the public API for the service. The
|
|
23
|
-
* contents of this file should be regarded as internal but are documented for completeness.
|
|
24
|
-
* @alias module:ApiClient
|
|
25
|
-
* @class
|
|
26
|
-
*/
|
|
21
|
+
* Manages low level client-server communications, parameter marshalling, etc. There should not be any need for an
|
|
22
|
+
* application to use this class directly - the *Api and model classes provide the public API for the service. The
|
|
23
|
+
* contents of this file should be regarded as internal but are documented for completeness.
|
|
24
|
+
* @alias module:ApiClient
|
|
25
|
+
* @class
|
|
26
|
+
*/
|
|
27
27
|
var ApiClient = /*#__PURE__*/function () {
|
|
28
28
|
/**
|
|
29
29
|
* The base URL against which to resolve every API call's (relative) path.
|
|
@@ -31,29 +31,32 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
31
31
|
* @param {String} basePath
|
|
32
32
|
*/
|
|
33
33
|
function ApiClient() {
|
|
34
|
-
var basePath = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] :
|
|
34
|
+
var basePath = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "https://api.notefile.net";
|
|
35
35
|
_classCallCheck(this, ApiClient);
|
|
36
36
|
/**
|
|
37
37
|
* The base URL against which to resolve every API call's (relative) path.
|
|
38
38
|
* @type {String}
|
|
39
39
|
* @default https://api.notefile.net
|
|
40
40
|
*/
|
|
41
|
-
this.basePath = basePath.replace(/\/+$/,
|
|
41
|
+
this.basePath = basePath.replace(/\/+$/, "");
|
|
42
42
|
|
|
43
43
|
/**
|
|
44
44
|
* The authentication methods to be included for all API calls.
|
|
45
45
|
* @type {Array.<String>}
|
|
46
46
|
*/
|
|
47
47
|
this.authentications = {
|
|
48
|
-
|
|
49
|
-
type:
|
|
50
|
-
|
|
51
|
-
name:
|
|
48
|
+
api_key: {
|
|
49
|
+
type: "apiKey",
|
|
50
|
+
"in": "header",
|
|
51
|
+
name: "X-Session-Token"
|
|
52
|
+
},
|
|
53
|
+
bearer_access_token: {
|
|
54
|
+
type: "bearer"
|
|
52
55
|
},
|
|
53
|
-
|
|
54
|
-
type:
|
|
55
|
-
|
|
56
|
-
name:
|
|
56
|
+
pin: {
|
|
57
|
+
type: "apiKey",
|
|
58
|
+
"in": "header",
|
|
59
|
+
name: "X-Auth-Token"
|
|
57
60
|
}
|
|
58
61
|
};
|
|
59
62
|
|
|
@@ -63,7 +66,7 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
63
66
|
* @default {}
|
|
64
67
|
*/
|
|
65
68
|
this.defaultHeaders = {
|
|
66
|
-
|
|
69
|
+
"User-Agent": "OpenAPI-Generator/1.0.11/Javascript"
|
|
67
70
|
};
|
|
68
71
|
|
|
69
72
|
/**
|
|
@@ -92,7 +95,7 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
92
95
|
* Used to save and return cookies in a node.js (non-browser) setting,
|
|
93
96
|
* if this.enableCookies is set to true.
|
|
94
97
|
*/
|
|
95
|
-
if (typeof window ===
|
|
98
|
+
if (typeof window === "undefined") {
|
|
96
99
|
this.agent = new _superagent["default"].agent();
|
|
97
100
|
}
|
|
98
101
|
|
|
@@ -108,15 +111,15 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
108
111
|
}
|
|
109
112
|
|
|
110
113
|
/**
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
114
|
+
* Returns a string representation for an actual parameter.
|
|
115
|
+
* @param param The actual parameter.
|
|
116
|
+
* @returns {String} The string representation of <code>param</code>.
|
|
117
|
+
*/
|
|
115
118
|
_createClass(ApiClient, [{
|
|
116
119
|
key: "paramToString",
|
|
117
120
|
value: function paramToString(param) {
|
|
118
121
|
if (param == undefined || param == null) {
|
|
119
|
-
return
|
|
122
|
+
return "";
|
|
120
123
|
}
|
|
121
124
|
if (param instanceof Date) {
|
|
122
125
|
return param.toJSON();
|
|
@@ -128,10 +131,10 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
128
131
|
}
|
|
129
132
|
|
|
130
133
|
/**
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
134
|
+
* Returns a boolean indicating if the parameter could be JSON.stringified
|
|
135
|
+
* @param param The actual parameter
|
|
136
|
+
* @returns {Boolean} Flag indicating if <code>param</code> can be JSON.stringified
|
|
137
|
+
*/
|
|
135
138
|
}, {
|
|
136
139
|
key: "buildUrl",
|
|
137
140
|
value:
|
|
@@ -146,7 +149,7 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
146
149
|
function buildUrl(path, pathParams, apiBasePath) {
|
|
147
150
|
var _this = this;
|
|
148
151
|
if (!path.match(/^\//)) {
|
|
149
|
-
path =
|
|
152
|
+
path = "/" + path;
|
|
150
153
|
}
|
|
151
154
|
var url = this.basePath + path;
|
|
152
155
|
|
|
@@ -167,16 +170,16 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
167
170
|
}
|
|
168
171
|
|
|
169
172
|
/**
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
173
|
+
* Checks whether the given content type represents JSON.<br>
|
|
174
|
+
* JSON content type examples:<br>
|
|
175
|
+
* <ul>
|
|
176
|
+
* <li>application/json</li>
|
|
177
|
+
* <li>application/json; charset=UTF8</li>
|
|
178
|
+
* <li>APPLICATION/JSON</li>
|
|
179
|
+
* </ul>
|
|
180
|
+
* @param {String} contentType The MIME content type to check.
|
|
181
|
+
* @returns {Boolean} <code>true</code> if <code>contentType</code> represents JSON, otherwise <code>false</code>.
|
|
182
|
+
*/
|
|
180
183
|
}, {
|
|
181
184
|
key: "isJsonMime",
|
|
182
185
|
value: function isJsonMime(contentType) {
|
|
@@ -184,10 +187,10 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
184
187
|
}
|
|
185
188
|
|
|
186
189
|
/**
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
190
|
+
* Chooses a content type from the given array, with JSON preferred; i.e. return JSON if included, otherwise return the first.
|
|
191
|
+
* @param {Array.<String>} contentTypes
|
|
192
|
+
* @returns {String} The chosen content type, preferring JSON.
|
|
193
|
+
*/
|
|
191
194
|
}, {
|
|
192
195
|
key: "jsonPreferredMime",
|
|
193
196
|
value: function jsonPreferredMime(contentTypes) {
|
|
@@ -200,18 +203,18 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
200
203
|
}
|
|
201
204
|
|
|
202
205
|
/**
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
206
|
+
* Checks whether the given parameter value represents file-like content.
|
|
207
|
+
* @param param The parameter to check.
|
|
208
|
+
* @returns {Boolean} <code>true</code> if <code>param</code> represents a file.
|
|
209
|
+
*/
|
|
207
210
|
}, {
|
|
208
211
|
key: "isFileParam",
|
|
209
212
|
value: function isFileParam(param) {
|
|
210
213
|
// fs.ReadStream in Node.js and Electron (but not in runtime like browserify)
|
|
211
|
-
if (typeof require ===
|
|
214
|
+
if (typeof require === "function") {
|
|
212
215
|
var fs;
|
|
213
216
|
try {
|
|
214
|
-
fs = require(
|
|
217
|
+
fs = require("fs");
|
|
215
218
|
} catch (err) {}
|
|
216
219
|
if (fs && fs.ReadStream && param instanceof fs.ReadStream) {
|
|
217
220
|
return true;
|
|
@@ -219,32 +222,32 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
219
222
|
}
|
|
220
223
|
|
|
221
224
|
// Buffer in Node.js
|
|
222
|
-
if (typeof Buffer ===
|
|
225
|
+
if (typeof Buffer === "function" && param instanceof Buffer) {
|
|
223
226
|
return true;
|
|
224
227
|
}
|
|
225
228
|
|
|
226
229
|
// Blob in browser
|
|
227
|
-
if (typeof Blob ===
|
|
230
|
+
if (typeof Blob === "function" && param instanceof Blob) {
|
|
228
231
|
return true;
|
|
229
232
|
}
|
|
230
233
|
|
|
231
234
|
// File in browser (it seems File object is also instance of Blob, but keep this for safe)
|
|
232
|
-
if (typeof File ===
|
|
235
|
+
if (typeof File === "function" && param instanceof File) {
|
|
233
236
|
return true;
|
|
234
237
|
}
|
|
235
238
|
return false;
|
|
236
239
|
}
|
|
237
240
|
|
|
238
241
|
/**
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
242
|
+
* Normalizes parameter values:
|
|
243
|
+
* <ul>
|
|
244
|
+
* <li>remove nils</li>
|
|
245
|
+
* <li>keep files and arrays</li>
|
|
246
|
+
* <li>format to string with `paramToString` for other cases</li>
|
|
247
|
+
* </ul>
|
|
248
|
+
* @param {Object.<String, Object>} params The parameters as object properties.
|
|
249
|
+
* @returns {Object.<String, Object>} normalized parameters.
|
|
250
|
+
*/
|
|
248
251
|
}, {
|
|
249
252
|
key: "normalizeParams",
|
|
250
253
|
value: function normalizeParams(params) {
|
|
@@ -263,12 +266,12 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
263
266
|
}
|
|
264
267
|
|
|
265
268
|
/**
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
269
|
+
* Builds a string representation of an array-type actual parameter, according to the given collection format.
|
|
270
|
+
* @param {Array} param An array parameter.
|
|
271
|
+
* @param {module:ApiClient.CollectionFormatEnum} collectionFormat The array element separator strategy.
|
|
272
|
+
* @returns {String|Array} A string representation of the supplied collection, using the specified delimiter. Returns
|
|
273
|
+
* <code>param</code> as is if <code>collectionFormat</code> is <code>multi</code>.
|
|
274
|
+
*/
|
|
272
275
|
}, {
|
|
273
276
|
key: "buildCollectionParam",
|
|
274
277
|
value: function buildCollectionParam(param, collectionFormat) {
|
|
@@ -276,29 +279,29 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
276
279
|
return null;
|
|
277
280
|
}
|
|
278
281
|
switch (collectionFormat) {
|
|
279
|
-
case
|
|
280
|
-
return param.map(this.paramToString, this).join(
|
|
281
|
-
case
|
|
282
|
-
return param.map(this.paramToString, this).join(
|
|
283
|
-
case
|
|
284
|
-
return param.map(this.paramToString, this).join(
|
|
285
|
-
case
|
|
286
|
-
return param.map(this.paramToString, this).join(
|
|
287
|
-
case
|
|
282
|
+
case "csv":
|
|
283
|
+
return param.map(this.paramToString, this).join(",");
|
|
284
|
+
case "ssv":
|
|
285
|
+
return param.map(this.paramToString, this).join(" ");
|
|
286
|
+
case "tsv":
|
|
287
|
+
return param.map(this.paramToString, this).join("\t");
|
|
288
|
+
case "pipes":
|
|
289
|
+
return param.map(this.paramToString, this).join("|");
|
|
290
|
+
case "multi":
|
|
288
291
|
//return the array directly as SuperAgent will handle it as expected
|
|
289
292
|
return param.map(this.paramToString, this);
|
|
290
|
-
case
|
|
293
|
+
case "passthrough":
|
|
291
294
|
return param;
|
|
292
295
|
default:
|
|
293
|
-
throw new Error(
|
|
296
|
+
throw new Error("Unknown collection format: " + collectionFormat);
|
|
294
297
|
}
|
|
295
298
|
}
|
|
296
299
|
|
|
297
300
|
/**
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
301
|
+
* Applies authentication headers to the request.
|
|
302
|
+
* @param {Object} request The request object created by a <code>superagent()</code> call.
|
|
303
|
+
* @param {Array.<String>} authNames An array of authentication method names.
|
|
304
|
+
*/
|
|
302
305
|
}, {
|
|
303
306
|
key: "applyAuthToRequest",
|
|
304
307
|
value: function applyAuthToRequest(request, authNames) {
|
|
@@ -306,39 +309,39 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
306
309
|
authNames.forEach(function (authName) {
|
|
307
310
|
var auth = _this2.authentications[authName];
|
|
308
311
|
switch (auth.type) {
|
|
309
|
-
case
|
|
312
|
+
case "basic":
|
|
310
313
|
if (auth.username || auth.password) {
|
|
311
|
-
request.auth(auth.username ||
|
|
314
|
+
request.auth(auth.username || "", auth.password || "");
|
|
312
315
|
}
|
|
313
316
|
break;
|
|
314
|
-
case
|
|
317
|
+
case "bearer":
|
|
315
318
|
if (auth.accessToken) {
|
|
316
|
-
var localVarBearerToken = typeof auth.accessToken ===
|
|
319
|
+
var localVarBearerToken = typeof auth.accessToken === "function" ? auth.accessToken() : auth.accessToken;
|
|
317
320
|
request.set({
|
|
318
|
-
|
|
321
|
+
Authorization: "Bearer " + localVarBearerToken
|
|
319
322
|
});
|
|
320
323
|
}
|
|
321
324
|
break;
|
|
322
|
-
case
|
|
325
|
+
case "apiKey":
|
|
323
326
|
if (auth.apiKey) {
|
|
324
327
|
var data = {};
|
|
325
328
|
data[auth.name] = auth.apiKey;
|
|
326
|
-
if (auth[
|
|
329
|
+
if (auth["in"] === "header") {
|
|
327
330
|
request.set(data);
|
|
328
331
|
} else {
|
|
329
332
|
request.query(data);
|
|
330
333
|
}
|
|
331
334
|
}
|
|
332
335
|
break;
|
|
333
|
-
case
|
|
336
|
+
case "oauth2":
|
|
334
337
|
if (auth.accessToken) {
|
|
335
338
|
request.set({
|
|
336
|
-
|
|
339
|
+
Authorization: "Bearer " + auth.accessToken
|
|
337
340
|
});
|
|
338
341
|
}
|
|
339
342
|
break;
|
|
340
343
|
default:
|
|
341
|
-
throw new Error(
|
|
344
|
+
throw new Error("Unknown authentication type: " + auth.type);
|
|
342
345
|
}
|
|
343
346
|
});
|
|
344
347
|
}
|
|
@@ -362,7 +365,7 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
362
365
|
// Rely on SuperAgent for parsing response body.
|
|
363
366
|
// See http://visionmedia.github.io/superagent/#parsing-response-bodies
|
|
364
367
|
var data = response.body;
|
|
365
|
-
if (data == null || _typeof(data) ===
|
|
368
|
+
if (data == null || _typeof(data) === "object" && typeof data.length === "undefined" && !Object.keys(data).length) {
|
|
366
369
|
// SuperAgent does not always produce a body; use the unparsed response as a fallback
|
|
367
370
|
data = response.text;
|
|
368
371
|
}
|
|
@@ -404,8 +407,8 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
404
407
|
this.applyAuthToRequest(request, authNames);
|
|
405
408
|
|
|
406
409
|
// set query parameters
|
|
407
|
-
if (httpMethod.toUpperCase() ===
|
|
408
|
-
queryParams[
|
|
410
|
+
if (httpMethod.toUpperCase() === "GET" && this.cache === false) {
|
|
411
|
+
queryParams["_"] = new Date().getTime();
|
|
409
412
|
}
|
|
410
413
|
request.query(this.normalizeParams(queryParams));
|
|
411
414
|
|
|
@@ -422,13 +425,13 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
422
425
|
var contentType = this.jsonPreferredMime(contentTypes);
|
|
423
426
|
if (contentType) {
|
|
424
427
|
// Issue with superagent and multipart/form-data (https://github.com/visionmedia/superagent/issues/746)
|
|
425
|
-
if (contentType !=
|
|
428
|
+
if (contentType != "multipart/form-data") {
|
|
426
429
|
request.type(contentType);
|
|
427
430
|
}
|
|
428
431
|
}
|
|
429
|
-
if (contentType ===
|
|
432
|
+
if (contentType === "application/x-www-form-urlencoded") {
|
|
430
433
|
request.send(_querystring["default"].stringify(this.normalizeParams(formParams)));
|
|
431
|
-
} else if (contentType ==
|
|
434
|
+
} else if (contentType == "multipart/form-data") {
|
|
432
435
|
var _formParams = this.normalizeParams(formParams);
|
|
433
436
|
for (var key in _formParams) {
|
|
434
437
|
if (_formParams.hasOwnProperty(key)) {
|
|
@@ -447,8 +450,8 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
447
450
|
}
|
|
448
451
|
}
|
|
449
452
|
} else if (bodyParam !== null && bodyParam !== undefined) {
|
|
450
|
-
if (!request.header[
|
|
451
|
-
request.type(
|
|
453
|
+
if (!request.header["Content-Type"]) {
|
|
454
|
+
request.type("application/json");
|
|
452
455
|
}
|
|
453
456
|
request.send(bodyParam);
|
|
454
457
|
}
|
|
@@ -456,15 +459,15 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
456
459
|
if (accept) {
|
|
457
460
|
request.accept(accept);
|
|
458
461
|
}
|
|
459
|
-
if (returnType ===
|
|
460
|
-
request.responseType(
|
|
461
|
-
} else if (returnType ===
|
|
462
|
-
request.responseType(
|
|
462
|
+
if (returnType === "Blob") {
|
|
463
|
+
request.responseType("blob");
|
|
464
|
+
} else if (returnType === "String") {
|
|
465
|
+
request.responseType("text");
|
|
463
466
|
}
|
|
464
467
|
|
|
465
468
|
// Attach previously saved cookies, if enabled
|
|
466
469
|
if (this.enableCookies) {
|
|
467
|
-
if (typeof window ===
|
|
470
|
+
if (typeof window === "undefined") {
|
|
468
471
|
this.agent._attachCookies(request);
|
|
469
472
|
} else {
|
|
470
473
|
request.withCredentials();
|
|
@@ -485,7 +488,7 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
485
488
|
} else {
|
|
486
489
|
try {
|
|
487
490
|
var data = _this3.deserialize(response, returnType);
|
|
488
|
-
if (_this3.enableCookies && typeof window ===
|
|
491
|
+
if (_this3.enableCookies && typeof window === "undefined") {
|
|
489
492
|
_this3.agent._saveCookies(response);
|
|
490
493
|
}
|
|
491
494
|
resolve({
|
|
@@ -501,21 +504,21 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
501
504
|
}
|
|
502
505
|
|
|
503
506
|
/**
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
507
|
+
* Parses an ISO-8601 string representation or epoch representation of a date value.
|
|
508
|
+
* @param {String} str The date value as a string.
|
|
509
|
+
* @returns {Date} The parsed date object.
|
|
510
|
+
*/
|
|
508
511
|
}, {
|
|
509
512
|
key: "hostSettings",
|
|
510
513
|
value:
|
|
511
514
|
/**
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
+
* Gets an array of host settings
|
|
516
|
+
* @returns An array of host settings
|
|
517
|
+
*/
|
|
515
518
|
function hostSettings() {
|
|
516
519
|
return [{
|
|
517
|
-
|
|
518
|
-
|
|
520
|
+
url: "https://api.notefile.net",
|
|
521
|
+
description: "Production server"
|
|
519
522
|
}];
|
|
520
523
|
}
|
|
521
524
|
}, {
|
|
@@ -529,37 +532,37 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
529
532
|
throw new Error("Invalid index " + index + " when selecting the host settings. Must be less than " + servers.length);
|
|
530
533
|
}
|
|
531
534
|
var server = servers[index];
|
|
532
|
-
var url = server[
|
|
535
|
+
var url = server["url"];
|
|
533
536
|
|
|
534
537
|
// go through variable and assign a value
|
|
535
|
-
for (var variable_name in server[
|
|
538
|
+
for (var variable_name in server["variables"]) {
|
|
536
539
|
if (variable_name in variables) {
|
|
537
|
-
var variable = server[
|
|
538
|
-
if (!(
|
|
540
|
+
var variable = server["variables"][variable_name];
|
|
541
|
+
if (!("enum_values" in variable) || variable["enum_values"].includes(variables[variable_name])) {
|
|
539
542
|
url = url.replace("{" + variable_name + "}", variables[variable_name]);
|
|
540
543
|
} else {
|
|
541
|
-
throw new Error("The variable `" + variable_name + "` in the host URL has invalid value " + variables[variable_name] + ". Must be " + server[
|
|
544
|
+
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"] + ".");
|
|
542
545
|
}
|
|
543
546
|
} else {
|
|
544
547
|
// use default value
|
|
545
|
-
url = url.replace("{" + variable_name + "}", server[
|
|
548
|
+
url = url.replace("{" + variable_name + "}", server["variables"][variable_name]["default_value"]);
|
|
546
549
|
}
|
|
547
550
|
}
|
|
548
551
|
return url;
|
|
549
552
|
}
|
|
550
553
|
|
|
551
554
|
/**
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
555
|
+
* Constructs a new map or array model from REST data.
|
|
556
|
+
* @param data {Object|Array} The REST data.
|
|
557
|
+
* @param obj {Object|Array} The target object or array.
|
|
558
|
+
*/
|
|
556
559
|
}], [{
|
|
557
560
|
key: "canBeJsonified",
|
|
558
561
|
value: function canBeJsonified(str) {
|
|
559
|
-
if (typeof str !==
|
|
562
|
+
if (typeof str !== "string" && _typeof(str) !== "object") return false;
|
|
560
563
|
try {
|
|
561
564
|
var type = str.toString();
|
|
562
|
-
return type ===
|
|
565
|
+
return type === "[object Object]" || type === "[object Array]";
|
|
563
566
|
} catch (err) {
|
|
564
567
|
return false;
|
|
565
568
|
}
|
|
@@ -568,42 +571,42 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
568
571
|
key: "parseDate",
|
|
569
572
|
value: function parseDate(str) {
|
|
570
573
|
if (isNaN(str)) {
|
|
571
|
-
return new Date(str.replace(/(\d)(T)(\d)/i,
|
|
574
|
+
return new Date(str.replace(/(\d)(T)(\d)/i, "$1 $3"));
|
|
572
575
|
}
|
|
573
576
|
return new Date(+str);
|
|
574
577
|
}
|
|
575
578
|
|
|
576
579
|
/**
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
580
|
+
* Converts a value to the specified type.
|
|
581
|
+
* @param {(String|Object)} data The data to convert, as a string or object.
|
|
582
|
+
* @param {(String|Array.<String>|Object.<String, Object>|Function)} type The type to return. Pass a string for simple types
|
|
583
|
+
* or the constructor function for a complex type. Pass an array containing the type name to return an array of that type. To
|
|
584
|
+
* return an object, pass an object with one property whose name is the key type and whose value is the corresponding value type:
|
|
585
|
+
* all properties on <code>data<code> will be converted to this type.
|
|
586
|
+
* @returns An instance of the specified type or null or undefined if data is null or undefined.
|
|
587
|
+
*/
|
|
585
588
|
}, {
|
|
586
589
|
key: "convertToType",
|
|
587
590
|
value: function convertToType(data, type) {
|
|
588
591
|
if (data === null || data === undefined) return data;
|
|
589
592
|
switch (type) {
|
|
590
|
-
case
|
|
593
|
+
case "Boolean":
|
|
591
594
|
return Boolean(data);
|
|
592
|
-
case
|
|
595
|
+
case "Integer":
|
|
593
596
|
return parseInt(data, 10);
|
|
594
|
-
case
|
|
597
|
+
case "Number":
|
|
595
598
|
return parseFloat(data);
|
|
596
|
-
case
|
|
599
|
+
case "String":
|
|
597
600
|
return String(data);
|
|
598
|
-
case
|
|
601
|
+
case "Date":
|
|
599
602
|
return String(data);
|
|
600
|
-
case
|
|
603
|
+
case "Blob":
|
|
601
604
|
return data;
|
|
602
605
|
default:
|
|
603
606
|
if (type === Object) {
|
|
604
607
|
// generic object, return directly
|
|
605
608
|
return data;
|
|
606
|
-
} else if (typeof type.constructFromObject ===
|
|
609
|
+
} else if (typeof type.constructFromObject === "function") {
|
|
607
610
|
// for model type like User and enum class
|
|
608
611
|
return type.constructFromObject(data);
|
|
609
612
|
} else if (Array.isArray(type)) {
|
|
@@ -612,7 +615,7 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
612
615
|
return data.map(function (item) {
|
|
613
616
|
return ApiClient.convertToType(item, itemType);
|
|
614
617
|
});
|
|
615
|
-
} else if (_typeof(type) ===
|
|
618
|
+
} else if (_typeof(type) === "object") {
|
|
616
619
|
// for plain object type like: {'String': 'Integer'}
|
|
617
620
|
var keyType, valueType;
|
|
618
621
|
for (var k in type) {
|
|
@@ -663,33 +666,33 @@ ApiClient.CollectionFormatEnum = {
|
|
|
663
666
|
* Comma-separated values. Value: <code>csv</code>
|
|
664
667
|
* @const
|
|
665
668
|
*/
|
|
666
|
-
CSV:
|
|
669
|
+
CSV: ",",
|
|
667
670
|
/**
|
|
668
671
|
* Space-separated values. Value: <code>ssv</code>
|
|
669
672
|
* @const
|
|
670
673
|
*/
|
|
671
|
-
SSV:
|
|
674
|
+
SSV: " ",
|
|
672
675
|
/**
|
|
673
676
|
* Tab-separated values. Value: <code>tsv</code>
|
|
674
677
|
* @const
|
|
675
678
|
*/
|
|
676
|
-
TSV:
|
|
679
|
+
TSV: "\t",
|
|
677
680
|
/**
|
|
678
681
|
* Pipe(|)-separated values. Value: <code>pipes</code>
|
|
679
682
|
* @const
|
|
680
683
|
*/
|
|
681
|
-
PIPES:
|
|
684
|
+
PIPES: "|",
|
|
682
685
|
/**
|
|
683
686
|
* Native array. Value: <code>multi</code>
|
|
684
687
|
* @const
|
|
685
688
|
*/
|
|
686
|
-
MULTI:
|
|
689
|
+
MULTI: "multi"
|
|
687
690
|
};
|
|
688
691
|
|
|
689
692
|
/**
|
|
690
|
-
* The default API client implementation.
|
|
691
|
-
* @type {module:ApiClient}
|
|
692
|
-
*/
|
|
693
|
+
* The default API client implementation.
|
|
694
|
+
* @type {module:ApiClient}
|
|
695
|
+
*/
|
|
693
696
|
ApiClient.instance = new ApiClient();
|
|
694
697
|
var _default = ApiClient;
|
|
695
698
|
exports["default"] = _default;
|