@blues-inc/notehub-js 1.0.36-beta.9 → 1.0.37
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 +227 -241
- package/dist/ApiClient.js +156 -156
- 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 +362 -362
- package/dist/api/EventApi.js +118 -118
- package/dist/api/ExternalDevicesApi.js +41 -41
- package/dist/api/MonitorApi.js +52 -52
- package/dist/api/ProjectApi.js +370 -370
- package/dist/api/RouteApi.js +77 -77
- package/dist/api/WebhookApi.js +51 -51
- package/dist/index.js +0 -7
- package/dist/model/Alert.js +74 -76
- package/dist/model/AlertDataInner.js +35 -35
- package/dist/model/AlertNotificationsInner.js +18 -18
- package/dist/model/AnalyticsEventsData.js +17 -17
- package/dist/model/AnalyticsEventsResponse.js +11 -12
- package/dist/model/AnalyticsRouteLogsData.js +22 -22
- package/dist/model/AnalyticsRouteLogsResponse.js +11 -12
- package/dist/model/AnalyticsSessionsData.js +22 -22
- package/dist/model/AnalyticsSessionsResponse.js +11 -12
- 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 +12 -12
- package/dist/model/CreateMonitor.js +125 -126
- package/dist/model/CreateProductRequest.js +22 -22
- package/dist/model/CreateProjectRequest.js +16 -16
- package/dist/model/CreateUpdateRepository.js +17 -17
- package/dist/model/CurrentFirmware.js +12 -12
- package/dist/model/DFUEnv.js +12 -12
- package/dist/model/DFUState.js +65 -65
- package/dist/model/DataField.js +7 -7
- package/dist/model/DataSet.js +29 -30
- package/dist/model/DataSetField.js +19 -19
- package/dist/model/DeleteDeviceFleetsRequest.js +8 -8
- package/dist/model/Device.js +101 -102
- 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 +221 -221
- 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/EnvTreeJsonNode.js +67 -69
- package/dist/model/EnvVar.js +18 -18
- package/dist/model/EnvironmentVariables.js +8 -8
- package/dist/model/Error.js +31 -31
- package/dist/model/Event.js +248 -248
- package/dist/model/Firmware.js +49 -49
- package/dist/model/FirmwareInfo.js +60 -60
- package/dist/model/Fleet.js +30 -30
- package/dist/model/GetAlerts200Response.js +14 -15
- package/dist/model/GetBillingAccounts200Response.js +9 -10
- package/dist/model/GetDeviceEnvironmentVariables200Response.js +16 -16
- 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/GetWebhooks200Response.js +9 -10
- 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/NotefileSchema.js +18 -19
- package/dist/model/NotehubRoute.js +36 -36
- package/dist/model/NotehubRouteSchema.js +46 -45
- package/dist/model/PersonalAccessToken.js +40 -31
- package/dist/model/PersonalAccessTokenCreatedBy.js +17 -17
- package/dist/model/PersonalAccessTokenInfo.js +24 -15
- package/dist/model/PersonalAccessTokenSecret.js +12 -12
- package/dist/model/PostProvisionProjectDeviceRequest.js +18 -18
- 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/QuestionDataResponseLineChart.js +39 -39
- package/dist/model/QuestionDataResponseMap.js +16 -16
- package/dist/model/Radresponder.js +25 -25
- package/dist/model/Repository.js +22 -22
- package/dist/model/Role.js +9 -9
- package/dist/model/RouteLog.js +38 -38
- package/dist/model/SchemaProperty.js +38 -40
- package/dist/model/SimUsage.js +19 -19
- 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 +54 -54
- package/dist/model/Twilio.js +43 -43
- package/dist/model/UpdateFleetRequest.js +25 -25
- 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/dist/model/WebhookSettings.js +15 -15
- package/package.json +3 -3
- package/dist/api/ApiAccessApi.js +0 -238
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.37
|
|
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,8 +74,8 @@ 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.37/Javascript";
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
/**
|
|
@@ -104,7 +104,7 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
104
104
|
* Used to save and return cookies in a node.js (non-browser) setting,
|
|
105
105
|
* if this.enableCookies is set to true.
|
|
106
106
|
*/
|
|
107
|
-
if (typeof window ===
|
|
107
|
+
if (typeof window === "undefined") {
|
|
108
108
|
this.agent = new _superagent["default"].agent();
|
|
109
109
|
}
|
|
110
110
|
|
|
@@ -120,15 +120,15 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
120
120
|
}
|
|
121
121
|
|
|
122
122
|
/**
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
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
|
+
*/
|
|
127
127
|
return _createClass(ApiClient, [{
|
|
128
128
|
key: "paramToString",
|
|
129
129
|
value: function paramToString(param) {
|
|
130
130
|
if (param == undefined || param == null) {
|
|
131
|
-
return
|
|
131
|
+
return "";
|
|
132
132
|
}
|
|
133
133
|
if (param instanceof Date) {
|
|
134
134
|
return param.toJSON();
|
|
@@ -140,10 +140,10 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
140
140
|
}
|
|
141
141
|
|
|
142
142
|
/**
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
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
|
+
*/
|
|
147
147
|
}, {
|
|
148
148
|
key: "buildUrl",
|
|
149
149
|
value:
|
|
@@ -158,7 +158,7 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
158
158
|
function buildUrl(path, pathParams, apiBasePath) {
|
|
159
159
|
var _this = this;
|
|
160
160
|
if (!path.match(/^\//)) {
|
|
161
|
-
path =
|
|
161
|
+
path = "/" + path;
|
|
162
162
|
}
|
|
163
163
|
var url = this.basePath + path;
|
|
164
164
|
|
|
@@ -179,16 +179,16 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
179
179
|
}
|
|
180
180
|
|
|
181
181
|
/**
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
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
|
+
*/
|
|
192
192
|
}, {
|
|
193
193
|
key: "isJsonMime",
|
|
194
194
|
value: function isJsonMime(contentType) {
|
|
@@ -196,10 +196,10 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
196
196
|
}
|
|
197
197
|
|
|
198
198
|
/**
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
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
|
+
*/
|
|
203
203
|
}, {
|
|
204
204
|
key: "jsonPreferredMime",
|
|
205
205
|
value: function jsonPreferredMime(contentTypes) {
|
|
@@ -212,18 +212,18 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
212
212
|
}
|
|
213
213
|
|
|
214
214
|
/**
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
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
|
+
*/
|
|
219
219
|
}, {
|
|
220
220
|
key: "isFileParam",
|
|
221
221
|
value: function isFileParam(param) {
|
|
222
222
|
// fs.ReadStream in Node.js and Electron (but not in runtime like browserify)
|
|
223
|
-
if (typeof require ===
|
|
223
|
+
if (typeof require === "function") {
|
|
224
224
|
var fs;
|
|
225
225
|
try {
|
|
226
|
-
fs = require(
|
|
226
|
+
fs = require("fs");
|
|
227
227
|
} catch (err) {}
|
|
228
228
|
if (fs && fs.ReadStream && param instanceof fs.ReadStream) {
|
|
229
229
|
return true;
|
|
@@ -231,32 +231,32 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
231
231
|
}
|
|
232
232
|
|
|
233
233
|
// Buffer in Node.js
|
|
234
|
-
if (typeof Buffer ===
|
|
234
|
+
if (typeof Buffer === "function" && param instanceof Buffer) {
|
|
235
235
|
return true;
|
|
236
236
|
}
|
|
237
237
|
|
|
238
238
|
// Blob in browser
|
|
239
|
-
if (typeof Blob ===
|
|
239
|
+
if (typeof Blob === "function" && param instanceof Blob) {
|
|
240
240
|
return true;
|
|
241
241
|
}
|
|
242
242
|
|
|
243
243
|
// File in browser (it seems File object is also instance of Blob, but keep this for safe)
|
|
244
|
-
if (typeof File ===
|
|
244
|
+
if (typeof File === "function" && param instanceof File) {
|
|
245
245
|
return true;
|
|
246
246
|
}
|
|
247
247
|
return false;
|
|
248
248
|
}
|
|
249
249
|
|
|
250
250
|
/**
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
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
|
+
*/
|
|
260
260
|
}, {
|
|
261
261
|
key: "normalizeParams",
|
|
262
262
|
value: function normalizeParams(params) {
|
|
@@ -275,12 +275,12 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
275
275
|
}
|
|
276
276
|
|
|
277
277
|
/**
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
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
|
+
*/
|
|
284
284
|
}, {
|
|
285
285
|
key: "buildCollectionParam",
|
|
286
286
|
value: function buildCollectionParam(param, collectionFormat) {
|
|
@@ -288,29 +288,29 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
288
288
|
return null;
|
|
289
289
|
}
|
|
290
290
|
switch (collectionFormat) {
|
|
291
|
-
case
|
|
292
|
-
return param.map(this.paramToString, this).join(
|
|
293
|
-
case
|
|
294
|
-
return param.map(this.paramToString, this).join(
|
|
295
|
-
case
|
|
296
|
-
return param.map(this.paramToString, this).join(
|
|
297
|
-
case
|
|
298
|
-
return param.map(this.paramToString, this).join(
|
|
299
|
-
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":
|
|
300
300
|
//return the array directly as SuperAgent will handle it as expected
|
|
301
301
|
return param.map(this.paramToString, this);
|
|
302
|
-
case
|
|
302
|
+
case "passthrough":
|
|
303
303
|
return param;
|
|
304
304
|
default:
|
|
305
|
-
throw new Error(
|
|
305
|
+
throw new Error("Unknown collection format: " + collectionFormat);
|
|
306
306
|
}
|
|
307
307
|
}
|
|
308
308
|
|
|
309
309
|
/**
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
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
|
+
*/
|
|
314
314
|
}, {
|
|
315
315
|
key: "applyAuthToRequest",
|
|
316
316
|
value: function applyAuthToRequest(request, authNames) {
|
|
@@ -318,39 +318,39 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
318
318
|
authNames.forEach(function (authName) {
|
|
319
319
|
var auth = _this2.authentications[authName];
|
|
320
320
|
switch (auth.type) {
|
|
321
|
-
case
|
|
321
|
+
case "basic":
|
|
322
322
|
if (auth.username || auth.password) {
|
|
323
|
-
request.auth(auth.username ||
|
|
323
|
+
request.auth(auth.username || "", auth.password || "");
|
|
324
324
|
}
|
|
325
325
|
break;
|
|
326
|
-
case
|
|
326
|
+
case "bearer":
|
|
327
327
|
if (auth.accessToken) {
|
|
328
|
-
var localVarBearerToken = typeof auth.accessToken ===
|
|
328
|
+
var localVarBearerToken = typeof auth.accessToken === "function" ? auth.accessToken() : auth.accessToken;
|
|
329
329
|
request.set({
|
|
330
|
-
|
|
330
|
+
Authorization: "Bearer " + localVarBearerToken
|
|
331
331
|
});
|
|
332
332
|
}
|
|
333
333
|
break;
|
|
334
|
-
case
|
|
334
|
+
case "apiKey":
|
|
335
335
|
if (auth.apiKey) {
|
|
336
336
|
var data = {};
|
|
337
337
|
data[auth.name] = auth.apiKey;
|
|
338
|
-
if (auth[
|
|
338
|
+
if (auth["in"] === "header") {
|
|
339
339
|
request.set(data);
|
|
340
340
|
} else {
|
|
341
341
|
request.query(data);
|
|
342
342
|
}
|
|
343
343
|
}
|
|
344
344
|
break;
|
|
345
|
-
case
|
|
345
|
+
case "oauth2":
|
|
346
346
|
if (auth.accessToken) {
|
|
347
347
|
request.set({
|
|
348
|
-
|
|
348
|
+
Authorization: "Bearer " + auth.accessToken
|
|
349
349
|
});
|
|
350
350
|
}
|
|
351
351
|
break;
|
|
352
352
|
default:
|
|
353
|
-
throw new Error(
|
|
353
|
+
throw new Error("Unknown authentication type: " + auth.type);
|
|
354
354
|
}
|
|
355
355
|
});
|
|
356
356
|
}
|
|
@@ -374,7 +374,7 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
374
374
|
// Rely on SuperAgent for parsing response body.
|
|
375
375
|
// See http://visionmedia.github.io/superagent/#parsing-response-bodies
|
|
376
376
|
var data = response.body;
|
|
377
|
-
if (data == null || _typeof(data) ===
|
|
377
|
+
if (data == null || _typeof(data) === "object" && typeof data.length === "undefined" && !Object.keys(data).length) {
|
|
378
378
|
// SuperAgent does not always produce a body; use the unparsed response as a fallback
|
|
379
379
|
data = response.text;
|
|
380
380
|
}
|
|
@@ -416,8 +416,8 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
416
416
|
this.applyAuthToRequest(request, authNames);
|
|
417
417
|
|
|
418
418
|
// set query parameters
|
|
419
|
-
if (httpMethod.toUpperCase() ===
|
|
420
|
-
queryParams[
|
|
419
|
+
if (httpMethod.toUpperCase() === "GET" && this.cache === false) {
|
|
420
|
+
queryParams["_"] = new Date().getTime();
|
|
421
421
|
}
|
|
422
422
|
request.query(this.normalizeParams(queryParams));
|
|
423
423
|
|
|
@@ -434,13 +434,13 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
434
434
|
var contentType = this.jsonPreferredMime(contentTypes);
|
|
435
435
|
if (contentType) {
|
|
436
436
|
// Issue with superagent and multipart/form-data (https://github.com/visionmedia/superagent/issues/746)
|
|
437
|
-
if (contentType !=
|
|
437
|
+
if (contentType != "multipart/form-data") {
|
|
438
438
|
request.type(contentType);
|
|
439
439
|
}
|
|
440
440
|
}
|
|
441
|
-
if (contentType ===
|
|
441
|
+
if (contentType === "application/x-www-form-urlencoded") {
|
|
442
442
|
request.send(_querystring["default"].stringify(this.normalizeParams(formParams)));
|
|
443
|
-
} else if (contentType ==
|
|
443
|
+
} else if (contentType == "multipart/form-data") {
|
|
444
444
|
var _formParams = this.normalizeParams(formParams);
|
|
445
445
|
for (var key in _formParams) {
|
|
446
446
|
if (_formParams.hasOwnProperty(key)) {
|
|
@@ -459,8 +459,8 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
459
459
|
}
|
|
460
460
|
}
|
|
461
461
|
} else if (bodyParam !== null && bodyParam !== undefined) {
|
|
462
|
-
if (!request.header[
|
|
463
|
-
request.type(
|
|
462
|
+
if (!request.header["Content-Type"]) {
|
|
463
|
+
request.type("application/json");
|
|
464
464
|
}
|
|
465
465
|
request.send(bodyParam);
|
|
466
466
|
}
|
|
@@ -468,15 +468,15 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
468
468
|
if (accept) {
|
|
469
469
|
request.accept(accept);
|
|
470
470
|
}
|
|
471
|
-
if (returnType ===
|
|
472
|
-
request.responseType(
|
|
473
|
-
} else if (returnType ===
|
|
474
|
-
request.responseType(
|
|
471
|
+
if (returnType === "Blob") {
|
|
472
|
+
request.responseType("blob");
|
|
473
|
+
} else if (returnType === "String") {
|
|
474
|
+
request.responseType("text");
|
|
475
475
|
}
|
|
476
476
|
|
|
477
477
|
// Attach previously saved cookies, if enabled
|
|
478
478
|
if (this.enableCookies) {
|
|
479
|
-
if (typeof window ===
|
|
479
|
+
if (typeof window === "undefined") {
|
|
480
480
|
this.agent._attachCookies(request);
|
|
481
481
|
} else {
|
|
482
482
|
request.withCredentials(); // Allows credentials to be sent with cross-origin requests in the browser
|
|
@@ -497,7 +497,7 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
497
497
|
} else {
|
|
498
498
|
try {
|
|
499
499
|
var data = _this3.deserialize(response, returnType);
|
|
500
|
-
if (_this3.enableCookies && typeof window ===
|
|
500
|
+
if (_this3.enableCookies && typeof window === "undefined") {
|
|
501
501
|
_this3.agent._saveCookies(response);
|
|
502
502
|
}
|
|
503
503
|
resolve({
|
|
@@ -513,21 +513,21 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
513
513
|
}
|
|
514
514
|
|
|
515
515
|
/**
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
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
|
+
*/
|
|
520
520
|
}, {
|
|
521
521
|
key: "hostSettings",
|
|
522
522
|
value:
|
|
523
523
|
/**
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
524
|
+
* Gets an array of host settings
|
|
525
|
+
* @returns An array of host settings
|
|
526
|
+
*/
|
|
527
527
|
function hostSettings() {
|
|
528
528
|
return [{
|
|
529
|
-
|
|
530
|
-
|
|
529
|
+
url: "https://api.notefile.net",
|
|
530
|
+
description: "Production server"
|
|
531
531
|
}];
|
|
532
532
|
}
|
|
533
533
|
}, {
|
|
@@ -541,37 +541,37 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
541
541
|
throw new Error("Invalid index " + index + " when selecting the host settings. Must be less than " + servers.length);
|
|
542
542
|
}
|
|
543
543
|
var server = servers[index];
|
|
544
|
-
var url = server[
|
|
544
|
+
var url = server["url"];
|
|
545
545
|
|
|
546
546
|
// go through variable and assign a value
|
|
547
|
-
for (var variable_name in server[
|
|
547
|
+
for (var variable_name in server["variables"]) {
|
|
548
548
|
if (variable_name in variables) {
|
|
549
|
-
var variable = server[
|
|
550
|
-
if (!(
|
|
549
|
+
var variable = server["variables"][variable_name];
|
|
550
|
+
if (!("enum_values" in variable) || variable["enum_values"].includes(variables[variable_name])) {
|
|
551
551
|
url = url.replace("{" + variable_name + "}", variables[variable_name]);
|
|
552
552
|
} else {
|
|
553
|
-
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"] + ".");
|
|
554
554
|
}
|
|
555
555
|
} else {
|
|
556
556
|
// use default value
|
|
557
|
-
url = url.replace("{" + variable_name + "}", server[
|
|
557
|
+
url = url.replace("{" + variable_name + "}", server["variables"][variable_name]["default_value"]);
|
|
558
558
|
}
|
|
559
559
|
}
|
|
560
560
|
return url;
|
|
561
561
|
}
|
|
562
562
|
|
|
563
563
|
/**
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
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
|
+
*/
|
|
568
568
|
}], [{
|
|
569
569
|
key: "canBeJsonified",
|
|
570
570
|
value: function canBeJsonified(str) {
|
|
571
|
-
if (typeof str !==
|
|
571
|
+
if (typeof str !== "string" && _typeof(str) !== "object") return false;
|
|
572
572
|
try {
|
|
573
573
|
var type = str.toString();
|
|
574
|
-
return type ===
|
|
574
|
+
return type === "[object Object]" || type === "[object Array]";
|
|
575
575
|
} catch (err) {
|
|
576
576
|
return false;
|
|
577
577
|
}
|
|
@@ -580,42 +580,42 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
580
580
|
key: "parseDate",
|
|
581
581
|
value: function parseDate(str) {
|
|
582
582
|
if (isNaN(str)) {
|
|
583
|
-
return new Date(str.replace(/(\d)(T)(\d)/i,
|
|
583
|
+
return new Date(str.replace(/(\d)(T)(\d)/i, "$1 $3"));
|
|
584
584
|
}
|
|
585
585
|
return new Date(+str);
|
|
586
586
|
}
|
|
587
587
|
|
|
588
588
|
/**
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
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
|
+
*/
|
|
597
597
|
}, {
|
|
598
598
|
key: "convertToType",
|
|
599
599
|
value: function convertToType(data, type) {
|
|
600
600
|
if (data === null || data === undefined) return data;
|
|
601
601
|
switch (type) {
|
|
602
|
-
case
|
|
602
|
+
case "Boolean":
|
|
603
603
|
return Boolean(data);
|
|
604
|
-
case
|
|
604
|
+
case "Integer":
|
|
605
605
|
return parseInt(data, 10);
|
|
606
|
-
case
|
|
606
|
+
case "Number":
|
|
607
607
|
return parseFloat(data);
|
|
608
|
-
case
|
|
608
|
+
case "String":
|
|
609
609
|
return String(data);
|
|
610
|
-
case
|
|
610
|
+
case "Date":
|
|
611
611
|
return String(data);
|
|
612
|
-
case
|
|
612
|
+
case "Blob":
|
|
613
613
|
return data;
|
|
614
614
|
default:
|
|
615
615
|
if (type === Object) {
|
|
616
616
|
// generic object, return directly
|
|
617
617
|
return data;
|
|
618
|
-
} else if (typeof type.constructFromObject ===
|
|
618
|
+
} else if (typeof type.constructFromObject === "function") {
|
|
619
619
|
// for model type like User and enum class
|
|
620
620
|
return type.constructFromObject(data);
|
|
621
621
|
} else if (Array.isArray(type)) {
|
|
@@ -624,7 +624,7 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
624
624
|
return data.map(function (item) {
|
|
625
625
|
return ApiClient.convertToType(item, itemType);
|
|
626
626
|
});
|
|
627
|
-
} else if (_typeof(type) ===
|
|
627
|
+
} else if (_typeof(type) === "object") {
|
|
628
628
|
// for plain object type like: {'String': 'Integer'}
|
|
629
629
|
var keyType, valueType;
|
|
630
630
|
for (var k in type) {
|
|
@@ -674,32 +674,32 @@ ApiClient.CollectionFormatEnum = {
|
|
|
674
674
|
* Comma-separated values. Value: <code>csv</code>
|
|
675
675
|
* @const
|
|
676
676
|
*/
|
|
677
|
-
CSV:
|
|
677
|
+
CSV: ",",
|
|
678
678
|
/**
|
|
679
679
|
* Space-separated values. Value: <code>ssv</code>
|
|
680
680
|
* @const
|
|
681
681
|
*/
|
|
682
|
-
SSV:
|
|
682
|
+
SSV: " ",
|
|
683
683
|
/**
|
|
684
684
|
* Tab-separated values. Value: <code>tsv</code>
|
|
685
685
|
* @const
|
|
686
686
|
*/
|
|
687
|
-
TSV:
|
|
687
|
+
TSV: "\t",
|
|
688
688
|
/**
|
|
689
689
|
* Pipe(|)-separated values. Value: <code>pipes</code>
|
|
690
690
|
* @const
|
|
691
691
|
*/
|
|
692
|
-
PIPES:
|
|
692
|
+
PIPES: "|",
|
|
693
693
|
/**
|
|
694
694
|
* Native array. Value: <code>multi</code>
|
|
695
695
|
* @const
|
|
696
696
|
*/
|
|
697
|
-
MULTI:
|
|
697
|
+
MULTI: "multi"
|
|
698
698
|
};
|
|
699
699
|
|
|
700
700
|
/**
|
|
701
|
-
* The default API client implementation.
|
|
702
|
-
* @type {module:ApiClient}
|
|
703
|
-
*/
|
|
701
|
+
* The default API client implementation.
|
|
702
|
+
* @type {module:ApiClient}
|
|
703
|
+
*/
|
|
704
704
|
ApiClient.instance = new ApiClient();
|
|
705
705
|
var _default = exports["default"] = ApiClient;
|