@blues-inc/notehub-js 1.0.10 → 1.0.12
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 +175 -180
- package/dist/ApiClient.js +155 -155
- package/dist/api/AuthorizationApi.js +15 -15
- package/dist/api/BillingAccountApi.js +13 -13
- package/dist/api/DeviceApi.js +157 -157
- 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 +137 -137
- package/dist/api/RouteApi.js +51 -51
- package/dist/index.js +14 -0
- package/dist/model/Aws.js +64 -64
- package/dist/model/Azure.js +42 -42
- 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/Edgeimpulse.js +214 -0
- package/dist/model/EdgeimpulseSensorsInner.js +106 -0
- 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/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 +65 -65
- 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 +24 -24
- package/dist/model/Route.js +40 -35
- package/dist/model/RouteSchema.js +39 -38
- package/dist/model/Snowflake.js +44 -44
- package/dist/model/SnowflakeTransform.js +11 -11
- package/dist/model/Thingworx.js +32 -32
- package/dist/model/TowerLocation.js +51 -51
- package/dist/model/Twilio.js +42 -42
- 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.12
|
|
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,29 @@ 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
52
|
},
|
|
53
|
-
|
|
54
|
-
type:
|
|
55
|
-
|
|
56
|
-
name:
|
|
53
|
+
pin: {
|
|
54
|
+
type: "apiKey",
|
|
55
|
+
"in": "header",
|
|
56
|
+
name: "X-Auth-Token"
|
|
57
57
|
}
|
|
58
58
|
};
|
|
59
59
|
|
|
@@ -63,7 +63,7 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
63
63
|
* @default {}
|
|
64
64
|
*/
|
|
65
65
|
this.defaultHeaders = {
|
|
66
|
-
|
|
66
|
+
"User-Agent": "OpenAPI-Generator/1.0.12/Javascript"
|
|
67
67
|
};
|
|
68
68
|
|
|
69
69
|
/**
|
|
@@ -92,7 +92,7 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
92
92
|
* Used to save and return cookies in a node.js (non-browser) setting,
|
|
93
93
|
* if this.enableCookies is set to true.
|
|
94
94
|
*/
|
|
95
|
-
if (typeof window ===
|
|
95
|
+
if (typeof window === "undefined") {
|
|
96
96
|
this.agent = new _superagent["default"].agent();
|
|
97
97
|
}
|
|
98
98
|
|
|
@@ -108,15 +108,15 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
108
108
|
}
|
|
109
109
|
|
|
110
110
|
/**
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
111
|
+
* Returns a string representation for an actual parameter.
|
|
112
|
+
* @param param The actual parameter.
|
|
113
|
+
* @returns {String} The string representation of <code>param</code>.
|
|
114
|
+
*/
|
|
115
115
|
_createClass(ApiClient, [{
|
|
116
116
|
key: "paramToString",
|
|
117
117
|
value: function paramToString(param) {
|
|
118
118
|
if (param == undefined || param == null) {
|
|
119
|
-
return
|
|
119
|
+
return "";
|
|
120
120
|
}
|
|
121
121
|
if (param instanceof Date) {
|
|
122
122
|
return param.toJSON();
|
|
@@ -128,10 +128,10 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
128
128
|
}
|
|
129
129
|
|
|
130
130
|
/**
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
131
|
+
* Returns a boolean indicating if the parameter could be JSON.stringified
|
|
132
|
+
* @param param The actual parameter
|
|
133
|
+
* @returns {Boolean} Flag indicating if <code>param</code> can be JSON.stringified
|
|
134
|
+
*/
|
|
135
135
|
}, {
|
|
136
136
|
key: "buildUrl",
|
|
137
137
|
value:
|
|
@@ -146,7 +146,7 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
146
146
|
function buildUrl(path, pathParams, apiBasePath) {
|
|
147
147
|
var _this = this;
|
|
148
148
|
if (!path.match(/^\//)) {
|
|
149
|
-
path =
|
|
149
|
+
path = "/" + path;
|
|
150
150
|
}
|
|
151
151
|
var url = this.basePath + path;
|
|
152
152
|
|
|
@@ -161,22 +161,22 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
161
161
|
} else {
|
|
162
162
|
value = fullMatch;
|
|
163
163
|
}
|
|
164
|
-
return value;
|
|
164
|
+
return encodeURIComponent(value);
|
|
165
165
|
});
|
|
166
166
|
return url;
|
|
167
167
|
}
|
|
168
168
|
|
|
169
169
|
/**
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
170
|
+
* Checks whether the given content type represents JSON.<br>
|
|
171
|
+
* JSON content type examples:<br>
|
|
172
|
+
* <ul>
|
|
173
|
+
* <li>application/json</li>
|
|
174
|
+
* <li>application/json; charset=UTF8</li>
|
|
175
|
+
* <li>APPLICATION/JSON</li>
|
|
176
|
+
* </ul>
|
|
177
|
+
* @param {String} contentType The MIME content type to check.
|
|
178
|
+
* @returns {Boolean} <code>true</code> if <code>contentType</code> represents JSON, otherwise <code>false</code>.
|
|
179
|
+
*/
|
|
180
180
|
}, {
|
|
181
181
|
key: "isJsonMime",
|
|
182
182
|
value: function isJsonMime(contentType) {
|
|
@@ -184,10 +184,10 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
184
184
|
}
|
|
185
185
|
|
|
186
186
|
/**
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
187
|
+
* Chooses a content type from the given array, with JSON preferred; i.e. return JSON if included, otherwise return the first.
|
|
188
|
+
* @param {Array.<String>} contentTypes
|
|
189
|
+
* @returns {String} The chosen content type, preferring JSON.
|
|
190
|
+
*/
|
|
191
191
|
}, {
|
|
192
192
|
key: "jsonPreferredMime",
|
|
193
193
|
value: function jsonPreferredMime(contentTypes) {
|
|
@@ -200,18 +200,18 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
200
200
|
}
|
|
201
201
|
|
|
202
202
|
/**
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
203
|
+
* Checks whether the given parameter value represents file-like content.
|
|
204
|
+
* @param param The parameter to check.
|
|
205
|
+
* @returns {Boolean} <code>true</code> if <code>param</code> represents a file.
|
|
206
|
+
*/
|
|
207
207
|
}, {
|
|
208
208
|
key: "isFileParam",
|
|
209
209
|
value: function isFileParam(param) {
|
|
210
210
|
// fs.ReadStream in Node.js and Electron (but not in runtime like browserify)
|
|
211
|
-
if (typeof require ===
|
|
211
|
+
if (typeof require === "function") {
|
|
212
212
|
var fs;
|
|
213
213
|
try {
|
|
214
|
-
fs = require(
|
|
214
|
+
fs = require("fs");
|
|
215
215
|
} catch (err) {}
|
|
216
216
|
if (fs && fs.ReadStream && param instanceof fs.ReadStream) {
|
|
217
217
|
return true;
|
|
@@ -219,32 +219,32 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
219
219
|
}
|
|
220
220
|
|
|
221
221
|
// Buffer in Node.js
|
|
222
|
-
if (typeof Buffer ===
|
|
222
|
+
if (typeof Buffer === "function" && param instanceof Buffer) {
|
|
223
223
|
return true;
|
|
224
224
|
}
|
|
225
225
|
|
|
226
226
|
// Blob in browser
|
|
227
|
-
if (typeof Blob ===
|
|
227
|
+
if (typeof Blob === "function" && param instanceof Blob) {
|
|
228
228
|
return true;
|
|
229
229
|
}
|
|
230
230
|
|
|
231
231
|
// File in browser (it seems File object is also instance of Blob, but keep this for safe)
|
|
232
|
-
if (typeof File ===
|
|
232
|
+
if (typeof File === "function" && param instanceof File) {
|
|
233
233
|
return true;
|
|
234
234
|
}
|
|
235
235
|
return false;
|
|
236
236
|
}
|
|
237
237
|
|
|
238
238
|
/**
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
239
|
+
* Normalizes parameter values:
|
|
240
|
+
* <ul>
|
|
241
|
+
* <li>remove nils</li>
|
|
242
|
+
* <li>keep files and arrays</li>
|
|
243
|
+
* <li>format to string with `paramToString` for other cases</li>
|
|
244
|
+
* </ul>
|
|
245
|
+
* @param {Object.<String, Object>} params The parameters as object properties.
|
|
246
|
+
* @returns {Object.<String, Object>} normalized parameters.
|
|
247
|
+
*/
|
|
248
248
|
}, {
|
|
249
249
|
key: "normalizeParams",
|
|
250
250
|
value: function normalizeParams(params) {
|
|
@@ -263,12 +263,12 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
263
263
|
}
|
|
264
264
|
|
|
265
265
|
/**
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
266
|
+
* Builds a string representation of an array-type actual parameter, according to the given collection format.
|
|
267
|
+
* @param {Array} param An array parameter.
|
|
268
|
+
* @param {module:ApiClient.CollectionFormatEnum} collectionFormat The array element separator strategy.
|
|
269
|
+
* @returns {String|Array} A string representation of the supplied collection, using the specified delimiter. Returns
|
|
270
|
+
* <code>param</code> as is if <code>collectionFormat</code> is <code>multi</code>.
|
|
271
|
+
*/
|
|
272
272
|
}, {
|
|
273
273
|
key: "buildCollectionParam",
|
|
274
274
|
value: function buildCollectionParam(param, collectionFormat) {
|
|
@@ -276,29 +276,29 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
276
276
|
return null;
|
|
277
277
|
}
|
|
278
278
|
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
|
|
279
|
+
case "csv":
|
|
280
|
+
return param.map(this.paramToString, this).join(",");
|
|
281
|
+
case "ssv":
|
|
282
|
+
return param.map(this.paramToString, this).join(" ");
|
|
283
|
+
case "tsv":
|
|
284
|
+
return param.map(this.paramToString, this).join("\t");
|
|
285
|
+
case "pipes":
|
|
286
|
+
return param.map(this.paramToString, this).join("|");
|
|
287
|
+
case "multi":
|
|
288
288
|
//return the array directly as SuperAgent will handle it as expected
|
|
289
289
|
return param.map(this.paramToString, this);
|
|
290
|
-
case
|
|
290
|
+
case "passthrough":
|
|
291
291
|
return param;
|
|
292
292
|
default:
|
|
293
|
-
throw new Error(
|
|
293
|
+
throw new Error("Unknown collection format: " + collectionFormat);
|
|
294
294
|
}
|
|
295
295
|
}
|
|
296
296
|
|
|
297
297
|
/**
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
298
|
+
* Applies authentication headers to the request.
|
|
299
|
+
* @param {Object} request The request object created by a <code>superagent()</code> call.
|
|
300
|
+
* @param {Array.<String>} authNames An array of authentication method names.
|
|
301
|
+
*/
|
|
302
302
|
}, {
|
|
303
303
|
key: "applyAuthToRequest",
|
|
304
304
|
value: function applyAuthToRequest(request, authNames) {
|
|
@@ -306,39 +306,39 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
306
306
|
authNames.forEach(function (authName) {
|
|
307
307
|
var auth = _this2.authentications[authName];
|
|
308
308
|
switch (auth.type) {
|
|
309
|
-
case
|
|
309
|
+
case "basic":
|
|
310
310
|
if (auth.username || auth.password) {
|
|
311
|
-
request.auth(auth.username ||
|
|
311
|
+
request.auth(auth.username || "", auth.password || "");
|
|
312
312
|
}
|
|
313
313
|
break;
|
|
314
|
-
case
|
|
314
|
+
case "bearer":
|
|
315
315
|
if (auth.accessToken) {
|
|
316
|
-
var localVarBearerToken = typeof auth.accessToken ===
|
|
316
|
+
var localVarBearerToken = typeof auth.accessToken === "function" ? auth.accessToken() : auth.accessToken;
|
|
317
317
|
request.set({
|
|
318
|
-
|
|
318
|
+
Authorization: "Bearer " + localVarBearerToken
|
|
319
319
|
});
|
|
320
320
|
}
|
|
321
321
|
break;
|
|
322
|
-
case
|
|
322
|
+
case "apiKey":
|
|
323
323
|
if (auth.apiKey) {
|
|
324
324
|
var data = {};
|
|
325
325
|
data[auth.name] = auth.apiKey;
|
|
326
|
-
if (auth[
|
|
326
|
+
if (auth["in"] === "header") {
|
|
327
327
|
request.set(data);
|
|
328
328
|
} else {
|
|
329
329
|
request.query(data);
|
|
330
330
|
}
|
|
331
331
|
}
|
|
332
332
|
break;
|
|
333
|
-
case
|
|
333
|
+
case "oauth2":
|
|
334
334
|
if (auth.accessToken) {
|
|
335
335
|
request.set({
|
|
336
|
-
|
|
336
|
+
Authorization: "Bearer " + auth.accessToken
|
|
337
337
|
});
|
|
338
338
|
}
|
|
339
339
|
break;
|
|
340
340
|
default:
|
|
341
|
-
throw new Error(
|
|
341
|
+
throw new Error("Unknown authentication type: " + auth.type);
|
|
342
342
|
}
|
|
343
343
|
});
|
|
344
344
|
}
|
|
@@ -362,7 +362,7 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
362
362
|
// Rely on SuperAgent for parsing response body.
|
|
363
363
|
// See http://visionmedia.github.io/superagent/#parsing-response-bodies
|
|
364
364
|
var data = response.body;
|
|
365
|
-
if (data == null || _typeof(data) ===
|
|
365
|
+
if (data == null || _typeof(data) === "object" && typeof data.length === "undefined" && !Object.keys(data).length) {
|
|
366
366
|
// SuperAgent does not always produce a body; use the unparsed response as a fallback
|
|
367
367
|
data = response.text;
|
|
368
368
|
}
|
|
@@ -404,8 +404,8 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
404
404
|
this.applyAuthToRequest(request, authNames);
|
|
405
405
|
|
|
406
406
|
// set query parameters
|
|
407
|
-
if (httpMethod.toUpperCase() ===
|
|
408
|
-
queryParams[
|
|
407
|
+
if (httpMethod.toUpperCase() === "GET" && this.cache === false) {
|
|
408
|
+
queryParams["_"] = new Date().getTime();
|
|
409
409
|
}
|
|
410
410
|
request.query(this.normalizeParams(queryParams));
|
|
411
411
|
|
|
@@ -422,13 +422,13 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
422
422
|
var contentType = this.jsonPreferredMime(contentTypes);
|
|
423
423
|
if (contentType) {
|
|
424
424
|
// Issue with superagent and multipart/form-data (https://github.com/visionmedia/superagent/issues/746)
|
|
425
|
-
if (contentType !=
|
|
425
|
+
if (contentType != "multipart/form-data") {
|
|
426
426
|
request.type(contentType);
|
|
427
427
|
}
|
|
428
428
|
}
|
|
429
|
-
if (contentType ===
|
|
429
|
+
if (contentType === "application/x-www-form-urlencoded") {
|
|
430
430
|
request.send(_querystring["default"].stringify(this.normalizeParams(formParams)));
|
|
431
|
-
} else if (contentType ==
|
|
431
|
+
} else if (contentType == "multipart/form-data") {
|
|
432
432
|
var _formParams = this.normalizeParams(formParams);
|
|
433
433
|
for (var key in _formParams) {
|
|
434
434
|
if (_formParams.hasOwnProperty(key)) {
|
|
@@ -447,8 +447,8 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
447
447
|
}
|
|
448
448
|
}
|
|
449
449
|
} else if (bodyParam !== null && bodyParam !== undefined) {
|
|
450
|
-
if (!request.header[
|
|
451
|
-
request.type(
|
|
450
|
+
if (!request.header["Content-Type"]) {
|
|
451
|
+
request.type("application/json");
|
|
452
452
|
}
|
|
453
453
|
request.send(bodyParam);
|
|
454
454
|
}
|
|
@@ -456,15 +456,15 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
456
456
|
if (accept) {
|
|
457
457
|
request.accept(accept);
|
|
458
458
|
}
|
|
459
|
-
if (returnType ===
|
|
460
|
-
request.responseType(
|
|
461
|
-
} else if (returnType ===
|
|
462
|
-
request.responseType(
|
|
459
|
+
if (returnType === "Blob") {
|
|
460
|
+
request.responseType("blob");
|
|
461
|
+
} else if (returnType === "String") {
|
|
462
|
+
request.responseType("text");
|
|
463
463
|
}
|
|
464
464
|
|
|
465
465
|
// Attach previously saved cookies, if enabled
|
|
466
466
|
if (this.enableCookies) {
|
|
467
|
-
if (typeof window ===
|
|
467
|
+
if (typeof window === "undefined") {
|
|
468
468
|
this.agent._attachCookies(request);
|
|
469
469
|
} else {
|
|
470
470
|
request.withCredentials();
|
|
@@ -485,7 +485,7 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
485
485
|
} else {
|
|
486
486
|
try {
|
|
487
487
|
var data = _this3.deserialize(response, returnType);
|
|
488
|
-
if (_this3.enableCookies && typeof window ===
|
|
488
|
+
if (_this3.enableCookies && typeof window === "undefined") {
|
|
489
489
|
_this3.agent._saveCookies(response);
|
|
490
490
|
}
|
|
491
491
|
resolve({
|
|
@@ -501,21 +501,21 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
501
501
|
}
|
|
502
502
|
|
|
503
503
|
/**
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
504
|
+
* Parses an ISO-8601 string representation or epoch representation of a date value.
|
|
505
|
+
* @param {String} str The date value as a string.
|
|
506
|
+
* @returns {Date} The parsed date object.
|
|
507
|
+
*/
|
|
508
508
|
}, {
|
|
509
509
|
key: "hostSettings",
|
|
510
510
|
value:
|
|
511
511
|
/**
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
512
|
+
* Gets an array of host settings
|
|
513
|
+
* @returns An array of host settings
|
|
514
|
+
*/
|
|
515
515
|
function hostSettings() {
|
|
516
516
|
return [{
|
|
517
|
-
|
|
518
|
-
|
|
517
|
+
url: "https://api.notefile.net",
|
|
518
|
+
description: "Production server"
|
|
519
519
|
}];
|
|
520
520
|
}
|
|
521
521
|
}, {
|
|
@@ -529,37 +529,37 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
529
529
|
throw new Error("Invalid index " + index + " when selecting the host settings. Must be less than " + servers.length);
|
|
530
530
|
}
|
|
531
531
|
var server = servers[index];
|
|
532
|
-
var url = server[
|
|
532
|
+
var url = server["url"];
|
|
533
533
|
|
|
534
534
|
// go through variable and assign a value
|
|
535
|
-
for (var variable_name in server[
|
|
535
|
+
for (var variable_name in server["variables"]) {
|
|
536
536
|
if (variable_name in variables) {
|
|
537
|
-
var variable = server[
|
|
538
|
-
if (!(
|
|
537
|
+
var variable = server["variables"][variable_name];
|
|
538
|
+
if (!("enum_values" in variable) || variable["enum_values"].includes(variables[variable_name])) {
|
|
539
539
|
url = url.replace("{" + variable_name + "}", variables[variable_name]);
|
|
540
540
|
} else {
|
|
541
|
-
throw new Error("The variable `" + variable_name + "` in the host URL has invalid value " + variables[variable_name] + ". Must be " + server[
|
|
541
|
+
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
542
|
}
|
|
543
543
|
} else {
|
|
544
544
|
// use default value
|
|
545
|
-
url = url.replace("{" + variable_name + "}", server[
|
|
545
|
+
url = url.replace("{" + variable_name + "}", server["variables"][variable_name]["default_value"]);
|
|
546
546
|
}
|
|
547
547
|
}
|
|
548
548
|
return url;
|
|
549
549
|
}
|
|
550
550
|
|
|
551
551
|
/**
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
552
|
+
* Constructs a new map or array model from REST data.
|
|
553
|
+
* @param data {Object|Array} The REST data.
|
|
554
|
+
* @param obj {Object|Array} The target object or array.
|
|
555
|
+
*/
|
|
556
556
|
}], [{
|
|
557
557
|
key: "canBeJsonified",
|
|
558
558
|
value: function canBeJsonified(str) {
|
|
559
|
-
if (typeof str !==
|
|
559
|
+
if (typeof str !== "string" && _typeof(str) !== "object") return false;
|
|
560
560
|
try {
|
|
561
561
|
var type = str.toString();
|
|
562
|
-
return type ===
|
|
562
|
+
return type === "[object Object]" || type === "[object Array]";
|
|
563
563
|
} catch (err) {
|
|
564
564
|
return false;
|
|
565
565
|
}
|
|
@@ -568,42 +568,42 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
568
568
|
key: "parseDate",
|
|
569
569
|
value: function parseDate(str) {
|
|
570
570
|
if (isNaN(str)) {
|
|
571
|
-
return new Date(str.replace(/(\d)(T)(\d)/i,
|
|
571
|
+
return new Date(str.replace(/(\d)(T)(\d)/i, "$1 $3"));
|
|
572
572
|
}
|
|
573
573
|
return new Date(+str);
|
|
574
574
|
}
|
|
575
575
|
|
|
576
576
|
/**
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
577
|
+
* Converts a value to the specified type.
|
|
578
|
+
* @param {(String|Object)} data The data to convert, as a string or object.
|
|
579
|
+
* @param {(String|Array.<String>|Object.<String, Object>|Function)} type The type to return. Pass a string for simple types
|
|
580
|
+
* or the constructor function for a complex type. Pass an array containing the type name to return an array of that type. To
|
|
581
|
+
* return an object, pass an object with one property whose name is the key type and whose value is the corresponding value type:
|
|
582
|
+
* all properties on <code>data<code> will be converted to this type.
|
|
583
|
+
* @returns An instance of the specified type or null or undefined if data is null or undefined.
|
|
584
|
+
*/
|
|
585
585
|
}, {
|
|
586
586
|
key: "convertToType",
|
|
587
587
|
value: function convertToType(data, type) {
|
|
588
588
|
if (data === null || data === undefined) return data;
|
|
589
589
|
switch (type) {
|
|
590
|
-
case
|
|
590
|
+
case "Boolean":
|
|
591
591
|
return Boolean(data);
|
|
592
|
-
case
|
|
592
|
+
case "Integer":
|
|
593
593
|
return parseInt(data, 10);
|
|
594
|
-
case
|
|
594
|
+
case "Number":
|
|
595
595
|
return parseFloat(data);
|
|
596
|
-
case
|
|
596
|
+
case "String":
|
|
597
597
|
return String(data);
|
|
598
|
-
case
|
|
598
|
+
case "Date":
|
|
599
599
|
return String(data);
|
|
600
|
-
case
|
|
600
|
+
case "Blob":
|
|
601
601
|
return data;
|
|
602
602
|
default:
|
|
603
603
|
if (type === Object) {
|
|
604
604
|
// generic object, return directly
|
|
605
605
|
return data;
|
|
606
|
-
} else if (typeof type.constructFromObject ===
|
|
606
|
+
} else if (typeof type.constructFromObject === "function") {
|
|
607
607
|
// for model type like User and enum class
|
|
608
608
|
return type.constructFromObject(data);
|
|
609
609
|
} else if (Array.isArray(type)) {
|
|
@@ -612,7 +612,7 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
612
612
|
return data.map(function (item) {
|
|
613
613
|
return ApiClient.convertToType(item, itemType);
|
|
614
614
|
});
|
|
615
|
-
} else if (_typeof(type) ===
|
|
615
|
+
} else if (_typeof(type) === "object") {
|
|
616
616
|
// for plain object type like: {'String': 'Integer'}
|
|
617
617
|
var keyType, valueType;
|
|
618
618
|
for (var k in type) {
|
|
@@ -663,33 +663,33 @@ ApiClient.CollectionFormatEnum = {
|
|
|
663
663
|
* Comma-separated values. Value: <code>csv</code>
|
|
664
664
|
* @const
|
|
665
665
|
*/
|
|
666
|
-
CSV:
|
|
666
|
+
CSV: ",",
|
|
667
667
|
/**
|
|
668
668
|
* Space-separated values. Value: <code>ssv</code>
|
|
669
669
|
* @const
|
|
670
670
|
*/
|
|
671
|
-
SSV:
|
|
671
|
+
SSV: " ",
|
|
672
672
|
/**
|
|
673
673
|
* Tab-separated values. Value: <code>tsv</code>
|
|
674
674
|
* @const
|
|
675
675
|
*/
|
|
676
|
-
TSV:
|
|
676
|
+
TSV: "\t",
|
|
677
677
|
/**
|
|
678
678
|
* Pipe(|)-separated values. Value: <code>pipes</code>
|
|
679
679
|
* @const
|
|
680
680
|
*/
|
|
681
|
-
PIPES:
|
|
681
|
+
PIPES: "|",
|
|
682
682
|
/**
|
|
683
683
|
* Native array. Value: <code>multi</code>
|
|
684
684
|
* @const
|
|
685
685
|
*/
|
|
686
|
-
MULTI:
|
|
686
|
+
MULTI: "multi"
|
|
687
687
|
};
|
|
688
688
|
|
|
689
689
|
/**
|
|
690
|
-
* The default API client implementation.
|
|
691
|
-
* @type {module:ApiClient}
|
|
692
|
-
*/
|
|
690
|
+
* The default API client implementation.
|
|
691
|
+
* @type {module:ApiClient}
|
|
692
|
+
*/
|
|
693
693
|
ApiClient.instance = new ApiClient();
|
|
694
694
|
var _default = ApiClient;
|
|
695
695
|
exports["default"] = _default;
|