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