@blues-inc/notehub-js 1.0.24-beta.9 → 1.0.25
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 +190 -199
- package/dist/ApiClient.js +156 -157
- package/dist/api/AlertApi.js +22 -22
- package/dist/api/AuthorizationApi.js +16 -16
- package/dist/api/BillingAccountApi.js +14 -14
- package/dist/api/DeviceApi.js +351 -351
- package/dist/api/EventApi.js +122 -122
- package/dist/api/MonitorApi.js +52 -52
- package/dist/api/ProjectApi.js +326 -326
- package/dist/api/RouteApi.js +74 -74
- package/dist/model/Alert.js +74 -76
- package/dist/model/AlertDataInner.js +35 -35
- package/dist/model/AlertNotificationsInner.js +18 -18
- package/dist/model/Aws.js +65 -65
- package/dist/model/Azure.js +43 -43
- package/dist/model/BillingAccount.js +21 -21
- package/dist/model/BillingAccountRole.js +9 -9
- package/dist/model/Body.js +5 -5
- package/dist/model/CloneProjectRequest.js +20 -20
- package/dist/model/Contact.js +22 -22
- package/dist/model/CreateFleetRequest.js +7 -7
- package/dist/model/CreateMonitor.js +125 -126
- package/dist/model/CreateProductRequest.js +22 -22
- package/dist/model/CreateProjectRequest.js +16 -16
- package/dist/model/CurrentFirmware.js +12 -12
- package/dist/model/DFUEnv.js +12 -12
- package/dist/model/DFUState.js +65 -65
- package/dist/model/DeleteDeviceFleetsRequest.js +8 -8
- package/dist/model/Device.js +84 -84
- package/dist/model/DeviceDfuHistory.js +19 -20
- package/dist/model/DeviceDfuHistoryPage.js +12 -13
- package/dist/model/DeviceDfuStateMachine.js +24 -25
- package/dist/model/DeviceDfuStateMachineNode.js +22 -22
- package/dist/model/DeviceDfuStatus.js +20 -20
- package/dist/model/DeviceDfuStatusCurrent.js +32 -32
- package/dist/model/DeviceDfuStatusPage.js +12 -13
- package/dist/model/DeviceSession.js +182 -182
- package/dist/model/DeviceTowerInfo.js +14 -14
- package/dist/model/DeviceUsage.js +32 -32
- package/dist/model/DfuActionRequest.js +7 -7
- package/dist/model/EmailNotification.js +7 -7
- package/dist/model/EnvironmentVariables.js +8 -8
- package/dist/model/Error.js +31 -31
- package/dist/model/Event.js +223 -223
- package/dist/model/Firmware.js +49 -49
- package/dist/model/FirmwareInfo.js +60 -60
- package/dist/model/Fleet.js +21 -21
- package/dist/model/GetAlerts200Response.js +14 -15
- package/dist/model/GetBillingAccounts200Response.js +9 -10
- package/dist/model/GetDeviceEnvironmentVariables200Response.js +12 -12
- package/dist/model/GetDeviceHealthLog200Response.js +11 -12
- package/dist/model/GetDeviceHealthLog200ResponseHealthLogInner.js +19 -19
- package/dist/model/GetDeviceLatest200Response.js +9 -10
- package/dist/model/GetDevicePublicKey200Response.js +16 -16
- package/dist/model/GetDeviceSessions200Response.js +16 -17
- package/dist/model/GetProjectDevicePublicKeys200Response.js +16 -17
- package/dist/model/GetProjectDevicePublicKeys200ResponseDevicePublicKeysInner.js +12 -12
- package/dist/model/GetProjectDevices200Response.js +16 -17
- package/dist/model/GetProjectEvents200Response.js +20 -21
- package/dist/model/GetProjectEventsByCursor200Response.js +23 -24
- package/dist/model/GetProjectFleets200Response.js +11 -12
- package/dist/model/GetProjectMembers200Response.js +11 -12
- package/dist/model/GetProjectProducts200Response.js +9 -10
- package/dist/model/GetProjects200Response.js +9 -10
- package/dist/model/GetRouteLogsByRoute200ResponseInner.js +35 -35
- package/dist/model/Google.js +33 -33
- package/dist/model/HandleNoteChanges200Response.js +11 -11
- package/dist/model/HandleNoteGet200Response.js +13 -13
- package/dist/model/HandleNoteSignal200Response.js +5 -5
- package/dist/model/HandleNotefileChanges200Response.js +11 -11
- package/dist/model/HandleNotefileChangesPending200Response.js +14 -14
- package/dist/model/HandleNotefileDeleteRequest.js +7 -7
- package/dist/model/Http.js +35 -35
- package/dist/model/HttpFilter.js +19 -19
- package/dist/model/HttpTransform.js +20 -20
- package/dist/model/Location.js +40 -40
- package/dist/model/Login200Response.js +7 -7
- package/dist/model/LoginRequest.js +12 -12
- package/dist/model/Monitor.js +99 -100
- package/dist/model/MonitorAlertRoutesInner.js +10 -9
- package/dist/model/Mqtt.js +66 -66
- package/dist/model/Note.js +10 -10
- package/dist/model/NotehubRoute.js +36 -36
- package/dist/model/NotehubRouteSchema.js +46 -45
- package/dist/model/PostProvisionProjectDeviceRequest.js +26 -13
- package/dist/model/Product.js +26 -26
- package/dist/model/Project.js +34 -34
- package/dist/model/ProjectMember.js +22 -22
- package/dist/model/Proxy.js +24 -24
- package/dist/model/PutDeviceFleetsRequest.js +8 -8
- package/dist/model/Radresponder.js +25 -25
- package/dist/model/Role.js +9 -9
- package/dist/model/Slack.js +53 -53
- package/dist/model/SlackBearerNotification.js +25 -25
- package/dist/model/SlackWebHookNotification.js +20 -20
- package/dist/model/Snowflake.js +45 -45
- package/dist/model/SnowflakeTransform.js +12 -12
- package/dist/model/Thingworx.js +33 -33
- package/dist/model/TowerLocation.js +52 -52
- package/dist/model/Twilio.js +43 -43
- package/dist/model/UpdateFleetRequest.js +17 -17
- package/dist/model/UploadMetadata.js +59 -59
- package/dist/model/UserDbRoute.js +25 -25
- package/dist/model/UserDfuStateMachine.js +20 -20
- package/dist/model/UserDfuStateMachineStatus.js +20 -20
- package/dist/model/UserFirmwareInfo.js +12 -12
- package/package.json +4 -4
package/dist/ApiClient.js
CHANGED
|
@@ -14,7 +14,7 @@ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r),
|
|
|
14
14
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
15
15
|
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); } /**
|
|
16
16
|
* Notehub API
|
|
17
|
-
* The OpenAPI definition for the Notehub.io API.
|
|
17
|
+
* The OpenAPI definition for the Notehub.io API.
|
|
18
18
|
*
|
|
19
19
|
* The version of the OpenAPI document: 1.2.0
|
|
20
20
|
* Contact: engineering@blues.io
|
|
@@ -25,16 +25,16 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
25
25
|
*
|
|
26
26
|
*/
|
|
27
27
|
/**
|
|
28
|
-
* @module ApiClient
|
|
29
|
-
* @version 1.0.
|
|
30
|
-
*/
|
|
28
|
+
* @module ApiClient
|
|
29
|
+
* @version 1.0.25
|
|
30
|
+
*/
|
|
31
31
|
/**
|
|
32
|
-
* Manages low level client-server communications, parameter marshalling, etc. There should not be any need for an
|
|
33
|
-
* application to use this class directly - the *Api and model classes provide the public API for the service. The
|
|
34
|
-
* contents of this file should be regarded as internal but are documented for completeness.
|
|
35
|
-
* @alias module:ApiClient
|
|
36
|
-
* @class
|
|
37
|
-
*/
|
|
32
|
+
* Manages low level client-server communications, parameter marshalling, etc. There should not be any need for an
|
|
33
|
+
* application to use this class directly - the *Api and model classes provide the public API for the service. The
|
|
34
|
+
* contents of this file should be regarded as internal but are documented for completeness.
|
|
35
|
+
* @alias module:ApiClient
|
|
36
|
+
* @class
|
|
37
|
+
*/
|
|
38
38
|
var ApiClient = /*#__PURE__*/function () {
|
|
39
39
|
/**
|
|
40
40
|
* The base URL against which to resolve every API call's (relative) path.
|
|
@@ -42,29 +42,29 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
42
42
|
* @param {String} basePath
|
|
43
43
|
*/
|
|
44
44
|
function ApiClient() {
|
|
45
|
-
var basePath = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] :
|
|
45
|
+
var basePath = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "https://api.notefile.net";
|
|
46
46
|
_classCallCheck(this, ApiClient);
|
|
47
47
|
/**
|
|
48
48
|
* The base URL against which to resolve every API call's (relative) path.
|
|
49
49
|
* @type {String}
|
|
50
50
|
* @default https://api.notefile.net
|
|
51
51
|
*/
|
|
52
|
-
this.basePath = basePath.replace(/\/+$/,
|
|
52
|
+
this.basePath = basePath.replace(/\/+$/, "");
|
|
53
53
|
|
|
54
54
|
/**
|
|
55
55
|
* The authentication methods to be included for all API calls.
|
|
56
56
|
* @type {Array.<String>}
|
|
57
57
|
*/
|
|
58
58
|
this.authentications = {
|
|
59
|
-
|
|
60
|
-
type:
|
|
61
|
-
|
|
62
|
-
name:
|
|
59
|
+
api_key: {
|
|
60
|
+
type: "apiKey",
|
|
61
|
+
"in": "header",
|
|
62
|
+
name: "X-Session-Token"
|
|
63
63
|
},
|
|
64
|
-
|
|
65
|
-
type:
|
|
66
|
-
|
|
67
|
-
name:
|
|
64
|
+
pin: {
|
|
65
|
+
type: "apiKey",
|
|
66
|
+
"in": "header",
|
|
67
|
+
name: "X-Auth-Token"
|
|
68
68
|
}
|
|
69
69
|
};
|
|
70
70
|
|
|
@@ -74,10 +74,9 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
74
74
|
* @default {}
|
|
75
75
|
*/
|
|
76
76
|
this.defaultHeaders = {};
|
|
77
|
-
if (typeof window ===
|
|
78
|
-
this.defaultHeaders[
|
|
77
|
+
if (typeof window === "undefined") {
|
|
78
|
+
this.defaultHeaders["User-Agent"] = "OpenAPI-Generator/1.0.25/Javascript";
|
|
79
79
|
}
|
|
80
|
-
;
|
|
81
80
|
|
|
82
81
|
/**
|
|
83
82
|
* The default HTTP timeout for all API calls.
|
|
@@ -105,7 +104,7 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
105
104
|
* Used to save and return cookies in a node.js (non-browser) setting,
|
|
106
105
|
* if this.enableCookies is set to true.
|
|
107
106
|
*/
|
|
108
|
-
if (typeof window ===
|
|
107
|
+
if (typeof window === "undefined") {
|
|
109
108
|
this.agent = new _superagent["default"].agent();
|
|
110
109
|
}
|
|
111
110
|
|
|
@@ -121,15 +120,15 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
121
120
|
}
|
|
122
121
|
|
|
123
122
|
/**
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
123
|
+
* Returns a string representation for an actual parameter.
|
|
124
|
+
* @param param The actual parameter.
|
|
125
|
+
* @returns {String} The string representation of <code>param</code>.
|
|
126
|
+
*/
|
|
128
127
|
return _createClass(ApiClient, [{
|
|
129
128
|
key: "paramToString",
|
|
130
129
|
value: function paramToString(param) {
|
|
131
130
|
if (param == undefined || param == null) {
|
|
132
|
-
return
|
|
131
|
+
return "";
|
|
133
132
|
}
|
|
134
133
|
if (param instanceof Date) {
|
|
135
134
|
return param.toJSON();
|
|
@@ -141,10 +140,10 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
141
140
|
}
|
|
142
141
|
|
|
143
142
|
/**
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
143
|
+
* Returns a boolean indicating if the parameter could be JSON.stringified
|
|
144
|
+
* @param param The actual parameter
|
|
145
|
+
* @returns {Boolean} Flag indicating if <code>param</code> can be JSON.stringified
|
|
146
|
+
*/
|
|
148
147
|
}, {
|
|
149
148
|
key: "buildUrl",
|
|
150
149
|
value:
|
|
@@ -159,7 +158,7 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
159
158
|
function buildUrl(path, pathParams, apiBasePath) {
|
|
160
159
|
var _this = this;
|
|
161
160
|
if (!path.match(/^\//)) {
|
|
162
|
-
path =
|
|
161
|
+
path = "/" + path;
|
|
163
162
|
}
|
|
164
163
|
var url = this.basePath + path;
|
|
165
164
|
|
|
@@ -180,16 +179,16 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
180
179
|
}
|
|
181
180
|
|
|
182
181
|
/**
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
182
|
+
* Checks whether the given content type represents JSON.<br>
|
|
183
|
+
* JSON content type examples:<br>
|
|
184
|
+
* <ul>
|
|
185
|
+
* <li>application/json</li>
|
|
186
|
+
* <li>application/json; charset=UTF8</li>
|
|
187
|
+
* <li>APPLICATION/JSON</li>
|
|
188
|
+
* </ul>
|
|
189
|
+
* @param {String} contentType The MIME content type to check.
|
|
190
|
+
* @returns {Boolean} <code>true</code> if <code>contentType</code> represents JSON, otherwise <code>false</code>.
|
|
191
|
+
*/
|
|
193
192
|
}, {
|
|
194
193
|
key: "isJsonMime",
|
|
195
194
|
value: function isJsonMime(contentType) {
|
|
@@ -197,10 +196,10 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
197
196
|
}
|
|
198
197
|
|
|
199
198
|
/**
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
199
|
+
* Chooses a content type from the given array, with JSON preferred; i.e. return JSON if included, otherwise return the first.
|
|
200
|
+
* @param {Array.<String>} contentTypes
|
|
201
|
+
* @returns {String} The chosen content type, preferring JSON.
|
|
202
|
+
*/
|
|
204
203
|
}, {
|
|
205
204
|
key: "jsonPreferredMime",
|
|
206
205
|
value: function jsonPreferredMime(contentTypes) {
|
|
@@ -213,18 +212,18 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
213
212
|
}
|
|
214
213
|
|
|
215
214
|
/**
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
215
|
+
* Checks whether the given parameter value represents file-like content.
|
|
216
|
+
* @param param The parameter to check.
|
|
217
|
+
* @returns {Boolean} <code>true</code> if <code>param</code> represents a file.
|
|
218
|
+
*/
|
|
220
219
|
}, {
|
|
221
220
|
key: "isFileParam",
|
|
222
221
|
value: function isFileParam(param) {
|
|
223
222
|
// fs.ReadStream in Node.js and Electron (but not in runtime like browserify)
|
|
224
|
-
if (typeof require ===
|
|
223
|
+
if (typeof require === "function") {
|
|
225
224
|
var fs;
|
|
226
225
|
try {
|
|
227
|
-
fs = require(
|
|
226
|
+
fs = require("fs");
|
|
228
227
|
} catch (err) {}
|
|
229
228
|
if (fs && fs.ReadStream && param instanceof fs.ReadStream) {
|
|
230
229
|
return true;
|
|
@@ -232,32 +231,32 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
232
231
|
}
|
|
233
232
|
|
|
234
233
|
// Buffer in Node.js
|
|
235
|
-
if (typeof Buffer ===
|
|
234
|
+
if (typeof Buffer === "function" && param instanceof Buffer) {
|
|
236
235
|
return true;
|
|
237
236
|
}
|
|
238
237
|
|
|
239
238
|
// Blob in browser
|
|
240
|
-
if (typeof Blob ===
|
|
239
|
+
if (typeof Blob === "function" && param instanceof Blob) {
|
|
241
240
|
return true;
|
|
242
241
|
}
|
|
243
242
|
|
|
244
243
|
// File in browser (it seems File object is also instance of Blob, but keep this for safe)
|
|
245
|
-
if (typeof File ===
|
|
244
|
+
if (typeof File === "function" && param instanceof File) {
|
|
246
245
|
return true;
|
|
247
246
|
}
|
|
248
247
|
return false;
|
|
249
248
|
}
|
|
250
249
|
|
|
251
250
|
/**
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
251
|
+
* Normalizes parameter values:
|
|
252
|
+
* <ul>
|
|
253
|
+
* <li>remove nils</li>
|
|
254
|
+
* <li>keep files and arrays</li>
|
|
255
|
+
* <li>format to string with `paramToString` for other cases</li>
|
|
256
|
+
* </ul>
|
|
257
|
+
* @param {Object.<String, Object>} params The parameters as object properties.
|
|
258
|
+
* @returns {Object.<String, Object>} normalized parameters.
|
|
259
|
+
*/
|
|
261
260
|
}, {
|
|
262
261
|
key: "normalizeParams",
|
|
263
262
|
value: function normalizeParams(params) {
|
|
@@ -276,12 +275,12 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
276
275
|
}
|
|
277
276
|
|
|
278
277
|
/**
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
278
|
+
* Builds a string representation of an array-type actual parameter, according to the given collection format.
|
|
279
|
+
* @param {Array} param An array parameter.
|
|
280
|
+
* @param {module:ApiClient.CollectionFormatEnum} collectionFormat The array element separator strategy.
|
|
281
|
+
* @returns {String|Array} A string representation of the supplied collection, using the specified delimiter. Returns
|
|
282
|
+
* <code>param</code> as is if <code>collectionFormat</code> is <code>multi</code>.
|
|
283
|
+
*/
|
|
285
284
|
}, {
|
|
286
285
|
key: "buildCollectionParam",
|
|
287
286
|
value: function buildCollectionParam(param, collectionFormat) {
|
|
@@ -289,29 +288,29 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
289
288
|
return null;
|
|
290
289
|
}
|
|
291
290
|
switch (collectionFormat) {
|
|
292
|
-
case
|
|
293
|
-
return param.map(this.paramToString, this).join(
|
|
294
|
-
case
|
|
295
|
-
return param.map(this.paramToString, this).join(
|
|
296
|
-
case
|
|
297
|
-
return param.map(this.paramToString, this).join(
|
|
298
|
-
case
|
|
299
|
-
return param.map(this.paramToString, this).join(
|
|
300
|
-
case
|
|
291
|
+
case "csv":
|
|
292
|
+
return param.map(this.paramToString, this).join(",");
|
|
293
|
+
case "ssv":
|
|
294
|
+
return param.map(this.paramToString, this).join(" ");
|
|
295
|
+
case "tsv":
|
|
296
|
+
return param.map(this.paramToString, this).join("\t");
|
|
297
|
+
case "pipes":
|
|
298
|
+
return param.map(this.paramToString, this).join("|");
|
|
299
|
+
case "multi":
|
|
301
300
|
//return the array directly as SuperAgent will handle it as expected
|
|
302
301
|
return param.map(this.paramToString, this);
|
|
303
|
-
case
|
|
302
|
+
case "passthrough":
|
|
304
303
|
return param;
|
|
305
304
|
default:
|
|
306
|
-
throw new Error(
|
|
305
|
+
throw new Error("Unknown collection format: " + collectionFormat);
|
|
307
306
|
}
|
|
308
307
|
}
|
|
309
308
|
|
|
310
309
|
/**
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
310
|
+
* Applies authentication headers to the request.
|
|
311
|
+
* @param {Object} request The request object created by a <code>superagent()</code> call.
|
|
312
|
+
* @param {Array.<String>} authNames An array of authentication method names.
|
|
313
|
+
*/
|
|
315
314
|
}, {
|
|
316
315
|
key: "applyAuthToRequest",
|
|
317
316
|
value: function applyAuthToRequest(request, authNames) {
|
|
@@ -319,39 +318,39 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
319
318
|
authNames.forEach(function (authName) {
|
|
320
319
|
var auth = _this2.authentications[authName];
|
|
321
320
|
switch (auth.type) {
|
|
322
|
-
case
|
|
321
|
+
case "basic":
|
|
323
322
|
if (auth.username || auth.password) {
|
|
324
|
-
request.auth(auth.username ||
|
|
323
|
+
request.auth(auth.username || "", auth.password || "");
|
|
325
324
|
}
|
|
326
325
|
break;
|
|
327
|
-
case
|
|
326
|
+
case "bearer":
|
|
328
327
|
if (auth.accessToken) {
|
|
329
|
-
var localVarBearerToken = typeof auth.accessToken ===
|
|
328
|
+
var localVarBearerToken = typeof auth.accessToken === "function" ? auth.accessToken() : auth.accessToken;
|
|
330
329
|
request.set({
|
|
331
|
-
|
|
330
|
+
Authorization: "Bearer " + localVarBearerToken
|
|
332
331
|
});
|
|
333
332
|
}
|
|
334
333
|
break;
|
|
335
|
-
case
|
|
334
|
+
case "apiKey":
|
|
336
335
|
if (auth.apiKey) {
|
|
337
336
|
var data = {};
|
|
338
337
|
data[auth.name] = auth.apiKey;
|
|
339
|
-
if (auth[
|
|
338
|
+
if (auth["in"] === "header") {
|
|
340
339
|
request.set(data);
|
|
341
340
|
} else {
|
|
342
341
|
request.query(data);
|
|
343
342
|
}
|
|
344
343
|
}
|
|
345
344
|
break;
|
|
346
|
-
case
|
|
345
|
+
case "oauth2":
|
|
347
346
|
if (auth.accessToken) {
|
|
348
347
|
request.set({
|
|
349
|
-
|
|
348
|
+
Authorization: "Bearer " + auth.accessToken
|
|
350
349
|
});
|
|
351
350
|
}
|
|
352
351
|
break;
|
|
353
352
|
default:
|
|
354
|
-
throw new Error(
|
|
353
|
+
throw new Error("Unknown authentication type: " + auth.type);
|
|
355
354
|
}
|
|
356
355
|
});
|
|
357
356
|
}
|
|
@@ -375,7 +374,7 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
375
374
|
// Rely on SuperAgent for parsing response body.
|
|
376
375
|
// See http://visionmedia.github.io/superagent/#parsing-response-bodies
|
|
377
376
|
var data = response.body;
|
|
378
|
-
if (data == null || _typeof(data) ===
|
|
377
|
+
if (data == null || _typeof(data) === "object" && typeof data.length === "undefined" && !Object.keys(data).length) {
|
|
379
378
|
// SuperAgent does not always produce a body; use the unparsed response as a fallback
|
|
380
379
|
data = response.text;
|
|
381
380
|
}
|
|
@@ -417,8 +416,8 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
417
416
|
this.applyAuthToRequest(request, authNames);
|
|
418
417
|
|
|
419
418
|
// set query parameters
|
|
420
|
-
if (httpMethod.toUpperCase() ===
|
|
421
|
-
queryParams[
|
|
419
|
+
if (httpMethod.toUpperCase() === "GET" && this.cache === false) {
|
|
420
|
+
queryParams["_"] = new Date().getTime();
|
|
422
421
|
}
|
|
423
422
|
request.query(this.normalizeParams(queryParams));
|
|
424
423
|
|
|
@@ -435,13 +434,13 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
435
434
|
var contentType = this.jsonPreferredMime(contentTypes);
|
|
436
435
|
if (contentType) {
|
|
437
436
|
// Issue with superagent and multipart/form-data (https://github.com/visionmedia/superagent/issues/746)
|
|
438
|
-
if (contentType !=
|
|
437
|
+
if (contentType != "multipart/form-data") {
|
|
439
438
|
request.type(contentType);
|
|
440
439
|
}
|
|
441
440
|
}
|
|
442
|
-
if (contentType ===
|
|
441
|
+
if (contentType === "application/x-www-form-urlencoded") {
|
|
443
442
|
request.send(_querystring["default"].stringify(this.normalizeParams(formParams)));
|
|
444
|
-
} else if (contentType ==
|
|
443
|
+
} else if (contentType == "multipart/form-data") {
|
|
445
444
|
var _formParams = this.normalizeParams(formParams);
|
|
446
445
|
for (var key in _formParams) {
|
|
447
446
|
if (_formParams.hasOwnProperty(key)) {
|
|
@@ -460,8 +459,8 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
460
459
|
}
|
|
461
460
|
}
|
|
462
461
|
} else if (bodyParam !== null && bodyParam !== undefined) {
|
|
463
|
-
if (!request.header[
|
|
464
|
-
request.type(
|
|
462
|
+
if (!request.header["Content-Type"]) {
|
|
463
|
+
request.type("application/json");
|
|
465
464
|
}
|
|
466
465
|
request.send(bodyParam);
|
|
467
466
|
}
|
|
@@ -469,15 +468,15 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
469
468
|
if (accept) {
|
|
470
469
|
request.accept(accept);
|
|
471
470
|
}
|
|
472
|
-
if (returnType ===
|
|
473
|
-
request.responseType(
|
|
474
|
-
} else if (returnType ===
|
|
475
|
-
request.responseType(
|
|
471
|
+
if (returnType === "Blob") {
|
|
472
|
+
request.responseType("blob");
|
|
473
|
+
} else if (returnType === "String") {
|
|
474
|
+
request.responseType("text");
|
|
476
475
|
}
|
|
477
476
|
|
|
478
477
|
// Attach previously saved cookies, if enabled
|
|
479
478
|
if (this.enableCookies) {
|
|
480
|
-
if (typeof window ===
|
|
479
|
+
if (typeof window === "undefined") {
|
|
481
480
|
this.agent._attachCookies(request);
|
|
482
481
|
} else {
|
|
483
482
|
request.withCredentials(); // Allows credentials to be sent with cross-origin requests in the browser
|
|
@@ -498,7 +497,7 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
498
497
|
} else {
|
|
499
498
|
try {
|
|
500
499
|
var data = _this3.deserialize(response, returnType);
|
|
501
|
-
if (_this3.enableCookies && typeof window ===
|
|
500
|
+
if (_this3.enableCookies && typeof window === "undefined") {
|
|
502
501
|
_this3.agent._saveCookies(response);
|
|
503
502
|
}
|
|
504
503
|
resolve({
|
|
@@ -514,21 +513,21 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
514
513
|
}
|
|
515
514
|
|
|
516
515
|
/**
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
516
|
+
* Parses an ISO-8601 string representation or epoch representation of a date value.
|
|
517
|
+
* @param {String} str The date value as a string.
|
|
518
|
+
* @returns {Date} The parsed date object.
|
|
519
|
+
*/
|
|
521
520
|
}, {
|
|
522
521
|
key: "hostSettings",
|
|
523
522
|
value:
|
|
524
523
|
/**
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
524
|
+
* Gets an array of host settings
|
|
525
|
+
* @returns An array of host settings
|
|
526
|
+
*/
|
|
528
527
|
function hostSettings() {
|
|
529
528
|
return [{
|
|
530
|
-
|
|
531
|
-
|
|
529
|
+
url: "https://api.notefile.net",
|
|
530
|
+
description: "Production server"
|
|
532
531
|
}];
|
|
533
532
|
}
|
|
534
533
|
}, {
|
|
@@ -542,37 +541,37 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
542
541
|
throw new Error("Invalid index " + index + " when selecting the host settings. Must be less than " + servers.length);
|
|
543
542
|
}
|
|
544
543
|
var server = servers[index];
|
|
545
|
-
var url = server[
|
|
544
|
+
var url = server["url"];
|
|
546
545
|
|
|
547
546
|
// go through variable and assign a value
|
|
548
|
-
for (var variable_name in server[
|
|
547
|
+
for (var variable_name in server["variables"]) {
|
|
549
548
|
if (variable_name in variables) {
|
|
550
|
-
var variable = server[
|
|
551
|
-
if (!(
|
|
549
|
+
var variable = server["variables"][variable_name];
|
|
550
|
+
if (!("enum_values" in variable) || variable["enum_values"].includes(variables[variable_name])) {
|
|
552
551
|
url = url.replace("{" + variable_name + "}", variables[variable_name]);
|
|
553
552
|
} else {
|
|
554
|
-
throw new Error("The variable `" + variable_name + "` in the host URL has invalid value " + variables[variable_name] + ". Must be " + server[
|
|
553
|
+
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"] + ".");
|
|
555
554
|
}
|
|
556
555
|
} else {
|
|
557
556
|
// use default value
|
|
558
|
-
url = url.replace("{" + variable_name + "}", server[
|
|
557
|
+
url = url.replace("{" + variable_name + "}", server["variables"][variable_name]["default_value"]);
|
|
559
558
|
}
|
|
560
559
|
}
|
|
561
560
|
return url;
|
|
562
561
|
}
|
|
563
562
|
|
|
564
563
|
/**
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
564
|
+
* Constructs a new map or array model from REST data.
|
|
565
|
+
* @param data {Object|Array} The REST data.
|
|
566
|
+
* @param obj {Object|Array} The target object or array.
|
|
567
|
+
*/
|
|
569
568
|
}], [{
|
|
570
569
|
key: "canBeJsonified",
|
|
571
570
|
value: function canBeJsonified(str) {
|
|
572
|
-
if (typeof str !==
|
|
571
|
+
if (typeof str !== "string" && _typeof(str) !== "object") return false;
|
|
573
572
|
try {
|
|
574
573
|
var type = str.toString();
|
|
575
|
-
return type ===
|
|
574
|
+
return type === "[object Object]" || type === "[object Array]";
|
|
576
575
|
} catch (err) {
|
|
577
576
|
return false;
|
|
578
577
|
}
|
|
@@ -581,42 +580,42 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
581
580
|
key: "parseDate",
|
|
582
581
|
value: function parseDate(str) {
|
|
583
582
|
if (isNaN(str)) {
|
|
584
|
-
return new Date(str.replace(/(\d)(T)(\d)/i,
|
|
583
|
+
return new Date(str.replace(/(\d)(T)(\d)/i, "$1 $3"));
|
|
585
584
|
}
|
|
586
585
|
return new Date(+str);
|
|
587
586
|
}
|
|
588
587
|
|
|
589
588
|
/**
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
589
|
+
* Converts a value to the specified type.
|
|
590
|
+
* @param {(String|Object)} data The data to convert, as a string or object.
|
|
591
|
+
* @param {(String|Array.<String>|Object.<String, Object>|Function)} type The type to return. Pass a string for simple types
|
|
592
|
+
* or the constructor function for a complex type. Pass an array containing the type name to return an array of that type. To
|
|
593
|
+
* return an object, pass an object with one property whose name is the key type and whose value is the corresponding value type:
|
|
594
|
+
* all properties on <code>data<code> will be converted to this type.
|
|
595
|
+
* @returns An instance of the specified type or null or undefined if data is null or undefined.
|
|
596
|
+
*/
|
|
598
597
|
}, {
|
|
599
598
|
key: "convertToType",
|
|
600
599
|
value: function convertToType(data, type) {
|
|
601
600
|
if (data === null || data === undefined) return data;
|
|
602
601
|
switch (type) {
|
|
603
|
-
case
|
|
602
|
+
case "Boolean":
|
|
604
603
|
return Boolean(data);
|
|
605
|
-
case
|
|
604
|
+
case "Integer":
|
|
606
605
|
return parseInt(data, 10);
|
|
607
|
-
case
|
|
606
|
+
case "Number":
|
|
608
607
|
return parseFloat(data);
|
|
609
|
-
case
|
|
608
|
+
case "String":
|
|
610
609
|
return String(data);
|
|
611
|
-
case
|
|
610
|
+
case "Date":
|
|
612
611
|
return String(data);
|
|
613
|
-
case
|
|
612
|
+
case "Blob":
|
|
614
613
|
return data;
|
|
615
614
|
default:
|
|
616
615
|
if (type === Object) {
|
|
617
616
|
// generic object, return directly
|
|
618
617
|
return data;
|
|
619
|
-
} else if (typeof type.constructFromObject ===
|
|
618
|
+
} else if (typeof type.constructFromObject === "function") {
|
|
620
619
|
// for model type like User and enum class
|
|
621
620
|
return type.constructFromObject(data);
|
|
622
621
|
} else if (Array.isArray(type)) {
|
|
@@ -625,7 +624,7 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
625
624
|
return data.map(function (item) {
|
|
626
625
|
return ApiClient.convertToType(item, itemType);
|
|
627
626
|
});
|
|
628
|
-
} else if (_typeof(type) ===
|
|
627
|
+
} else if (_typeof(type) === "object") {
|
|
629
628
|
// for plain object type like: {'String': 'Integer'}
|
|
630
629
|
var keyType, valueType;
|
|
631
630
|
for (var k in type) {
|
|
@@ -675,32 +674,32 @@ ApiClient.CollectionFormatEnum = {
|
|
|
675
674
|
* Comma-separated values. Value: <code>csv</code>
|
|
676
675
|
* @const
|
|
677
676
|
*/
|
|
678
|
-
CSV:
|
|
677
|
+
CSV: ",",
|
|
679
678
|
/**
|
|
680
679
|
* Space-separated values. Value: <code>ssv</code>
|
|
681
680
|
* @const
|
|
682
681
|
*/
|
|
683
|
-
SSV:
|
|
682
|
+
SSV: " ",
|
|
684
683
|
/**
|
|
685
684
|
* Tab-separated values. Value: <code>tsv</code>
|
|
686
685
|
* @const
|
|
687
686
|
*/
|
|
688
|
-
TSV:
|
|
687
|
+
TSV: "\t",
|
|
689
688
|
/**
|
|
690
689
|
* Pipe(|)-separated values. Value: <code>pipes</code>
|
|
691
690
|
* @const
|
|
692
691
|
*/
|
|
693
|
-
PIPES:
|
|
692
|
+
PIPES: "|",
|
|
694
693
|
/**
|
|
695
694
|
* Native array. Value: <code>multi</code>
|
|
696
695
|
* @const
|
|
697
696
|
*/
|
|
698
|
-
MULTI:
|
|
697
|
+
MULTI: "multi"
|
|
699
698
|
};
|
|
700
699
|
|
|
701
700
|
/**
|
|
702
|
-
* The default API client implementation.
|
|
703
|
-
* @type {module:ApiClient}
|
|
704
|
-
*/
|
|
701
|
+
* The default API client implementation.
|
|
702
|
+
* @type {module:ApiClient}
|
|
703
|
+
*/
|
|
705
704
|
ApiClient.instance = new ApiClient();
|
|
706
705
|
var _default = exports["default"] = ApiClient;
|