@blues-inc/notehub-js 4.0.0-beta.4 → 4.0.0
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 +248 -247
- package/dist/ApiClient.js +155 -150
- 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 +379 -387
- 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 +381 -381
- package/dist/api/RouteApi.js +77 -77
- package/dist/api/UsageApi.js +62 -65
- package/dist/api/WebhookApi.js +51 -51
- package/dist/model/AddDeviceToFleetsRequest.js +8 -8
- package/dist/model/Alert.js +74 -76
- package/dist/model/AlertDataInner.js +35 -40
- package/dist/model/AlertNotificationsInner.js +18 -18
- package/dist/model/AwsRoute.js +65 -65
- package/dist/model/AzureRoute.js +43 -43
- package/dist/model/BillingAccount.js +21 -21
- package/dist/model/BillingAccountRole.js +9 -9
- package/dist/model/BlynkRoute.js +28 -28
- package/dist/model/Body.js +5 -5
- package/dist/model/CellularPlan.js +34 -34
- package/dist/model/CloneProjectRequest.js +20 -20
- package/dist/model/Contact.js +22 -22
- package/dist/model/CreateFleetRequest.js +20 -20
- package/dist/model/CreateMonitor.js +131 -139
- 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/DataUsage.js +14 -14
- package/dist/model/DatacakeRoute.js +35 -35
- package/dist/model/DeleteDeviceFromFleetsRequest.js +8 -8
- package/dist/model/DeleteNotefilesRequest.js +7 -7
- package/dist/model/Device.js +106 -107
- 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/Filter.js +16 -16
- package/dist/model/Firmware.js +49 -49
- package/dist/model/FirmwareInfo.js +60 -60
- package/dist/model/Fleet.js +38 -38
- package/dist/model/FleetConnectivityAssurance.js +5 -5
- package/dist/model/GetAlerts200Response.js +14 -15
- package/dist/model/GetBillingAccounts200Response.js +9 -10
- package/dist/model/GetDataUsage200Response.js +9 -10
- package/dist/model/GetDataUsage200ResponseDataInner.js +40 -50
- package/dist/model/GetDbNote200Response.js +13 -13
- 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/GetDeviceLatestEvents200Response.js +9 -10
- package/dist/model/GetDevicePlans200Response.js +9 -10
- package/dist/model/GetDevicePublicKey200Response.js +16 -16
- package/dist/model/GetDevicePublicKeys200Response.js +16 -17
- package/dist/model/GetDevicePublicKeys200ResponseDevicePublicKeysInner.js +12 -12
- package/dist/model/GetDeviceSessions200Response.js +16 -17
- package/dist/model/GetDevices200Response.js +16 -17
- package/dist/model/GetEvents200Response.js +20 -21
- package/dist/model/GetEventsByCursor200Response.js +23 -24
- package/dist/model/GetNotefile200Response.js +11 -11
- package/dist/model/GetProducts200Response.js +9 -10
- package/dist/model/GetProjectMembers200Response.js +11 -12
- package/dist/model/GetProjects200Response.js +9 -10
- package/dist/model/GetRouteLogsUsage200Response.js +11 -12
- package/dist/model/GetSessionsUsage200Response.js +11 -12
- package/dist/model/GetWebhooks200Response.js +9 -10
- package/dist/model/GoogleRoute.js +33 -33
- package/dist/model/HttpRoute.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 +100 -106
- package/dist/model/MonitorAlertRoutesInner.js +10 -9
- package/dist/model/MqttRoute.js +68 -68
- package/dist/model/Note.js +31 -31
- package/dist/model/NoteInput.js +9 -9
- package/dist/model/Notefile.js +22 -23
- package/dist/model/NotefileSchema.js +18 -19
- package/dist/model/NotehubRoute.js +103 -103
- package/dist/model/NotehubRouteSummary.js +23 -23
- 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/Product.js +26 -26
- package/dist/model/Project.js +34 -34
- package/dist/model/ProjectMember.js +22 -22
- package/dist/model/ProvisionDeviceRequest.js +18 -18
- package/dist/model/ProxyRoute.js +29 -29
- package/dist/model/QubitroRoute.js +33 -33
- package/dist/model/RadRoute.js +31 -31
- package/dist/model/Repository.js +22 -22
- package/dist/model/Role.js +9 -9
- package/dist/model/RouteLog.js +38 -38
- package/dist/model/RouteTransformSettings.js +18 -18
- package/dist/model/S3ArchiveRoute.js +79 -79
- package/dist/model/SatellitePlan.js +26 -26
- package/dist/model/SchemaProperty.js +36 -38
- package/dist/model/SignalDevice200Response.js +5 -5
- package/dist/model/SimUsage.js +19 -19
- package/dist/model/SlackBearerNotification.js +25 -25
- package/dist/model/SlackRoute.js +48 -48
- package/dist/model/SlackWebHookNotification.js +20 -20
- package/dist/model/SnowflakeRoute.js +45 -45
- package/dist/model/SnowpipeStreamingRoute.js +60 -60
- package/dist/model/ThingworxRoute.js +33 -33
- package/dist/model/TowerLocation.js +54 -54
- package/dist/model/TwilioRoute.js +43 -43
- package/dist/model/UpdateFleetRequest.js +33 -33
- package/dist/model/UploadMetadata.js +64 -64
- package/dist/model/UsageData.js +18 -18
- package/dist/model/UsageEventsData.js +37 -37
- package/dist/model/UsageEventsResponse.js +11 -12
- package/dist/model/UsageRouteLogsData.js +27 -27
- package/dist/model/UsageSessionsData.js +32 -32
- 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/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 4.0.0
|
|
30
|
-
*/
|
|
28
|
+
* @module ApiClient
|
|
29
|
+
* @version 4.0.0
|
|
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,22 +42,27 @@ 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
|
+
personalAccessToken: {
|
|
60
|
+
type: "bearer"
|
|
61
|
+
},
|
|
62
|
+
pin: {
|
|
63
|
+
type: "apiKey",
|
|
64
|
+
"in": "header",
|
|
65
|
+
name: "X-Auth-Token"
|
|
61
66
|
}
|
|
62
67
|
};
|
|
63
68
|
|
|
@@ -67,8 +72,8 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
67
72
|
* @default {}
|
|
68
73
|
*/
|
|
69
74
|
this.defaultHeaders = {};
|
|
70
|
-
if (typeof window ===
|
|
71
|
-
this.defaultHeaders[
|
|
75
|
+
if (typeof window === "undefined") {
|
|
76
|
+
this.defaultHeaders["User-Agent"] = "OpenAPI-Generator/4.0.0/Javascript";
|
|
72
77
|
}
|
|
73
78
|
|
|
74
79
|
/**
|
|
@@ -97,7 +102,7 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
97
102
|
* Used to save and return cookies in a node.js (non-browser) setting,
|
|
98
103
|
* if this.enableCookies is set to true.
|
|
99
104
|
*/
|
|
100
|
-
if (typeof window ===
|
|
105
|
+
if (typeof window === "undefined") {
|
|
101
106
|
this.agent = new _superagent["default"].agent();
|
|
102
107
|
}
|
|
103
108
|
|
|
@@ -113,15 +118,15 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
113
118
|
}
|
|
114
119
|
|
|
115
120
|
/**
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
121
|
+
* Returns a string representation for an actual parameter.
|
|
122
|
+
* @param param The actual parameter.
|
|
123
|
+
* @returns {String} The string representation of <code>param</code>.
|
|
124
|
+
*/
|
|
120
125
|
return _createClass(ApiClient, [{
|
|
121
126
|
key: "paramToString",
|
|
122
127
|
value: function paramToString(param) {
|
|
123
128
|
if (param == undefined || param == null) {
|
|
124
|
-
return
|
|
129
|
+
return "";
|
|
125
130
|
}
|
|
126
131
|
if (param instanceof Date) {
|
|
127
132
|
return param.toJSON();
|
|
@@ -133,10 +138,10 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
133
138
|
}
|
|
134
139
|
|
|
135
140
|
/**
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
141
|
+
* Returns a boolean indicating if the parameter could be JSON.stringified
|
|
142
|
+
* @param param The actual parameter
|
|
143
|
+
* @returns {Boolean} Flag indicating if <code>param</code> can be JSON.stringified
|
|
144
|
+
*/
|
|
140
145
|
}, {
|
|
141
146
|
key: "buildUrl",
|
|
142
147
|
value:
|
|
@@ -151,7 +156,7 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
151
156
|
function buildUrl(path, pathParams, apiBasePath) {
|
|
152
157
|
var _this = this;
|
|
153
158
|
if (!path.match(/^\//)) {
|
|
154
|
-
path =
|
|
159
|
+
path = "/" + path;
|
|
155
160
|
}
|
|
156
161
|
var url = this.basePath + path;
|
|
157
162
|
|
|
@@ -172,16 +177,16 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
172
177
|
}
|
|
173
178
|
|
|
174
179
|
/**
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
180
|
+
* Checks whether the given content type represents JSON.<br>
|
|
181
|
+
* JSON content type examples:<br>
|
|
182
|
+
* <ul>
|
|
183
|
+
* <li>application/json</li>
|
|
184
|
+
* <li>application/json; charset=UTF8</li>
|
|
185
|
+
* <li>APPLICATION/JSON</li>
|
|
186
|
+
* </ul>
|
|
187
|
+
* @param {String} contentType The MIME content type to check.
|
|
188
|
+
* @returns {Boolean} <code>true</code> if <code>contentType</code> represents JSON, otherwise <code>false</code>.
|
|
189
|
+
*/
|
|
185
190
|
}, {
|
|
186
191
|
key: "isJsonMime",
|
|
187
192
|
value: function isJsonMime(contentType) {
|
|
@@ -189,10 +194,10 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
189
194
|
}
|
|
190
195
|
|
|
191
196
|
/**
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
197
|
+
* Chooses a content type from the given array, with JSON preferred; i.e. return JSON if included, otherwise return the first.
|
|
198
|
+
* @param {Array.<String>} contentTypes
|
|
199
|
+
* @returns {String} The chosen content type, preferring JSON.
|
|
200
|
+
*/
|
|
196
201
|
}, {
|
|
197
202
|
key: "jsonPreferredMime",
|
|
198
203
|
value: function jsonPreferredMime(contentTypes) {
|
|
@@ -205,18 +210,18 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
205
210
|
}
|
|
206
211
|
|
|
207
212
|
/**
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
213
|
+
* Checks whether the given parameter value represents file-like content.
|
|
214
|
+
* @param param The parameter to check.
|
|
215
|
+
* @returns {Boolean} <code>true</code> if <code>param</code> represents a file.
|
|
216
|
+
*/
|
|
212
217
|
}, {
|
|
213
218
|
key: "isFileParam",
|
|
214
219
|
value: function isFileParam(param) {
|
|
215
220
|
// fs.ReadStream in Node.js and Electron (but not in runtime like browserify)
|
|
216
|
-
if (typeof require ===
|
|
221
|
+
if (typeof require === "function") {
|
|
217
222
|
var fs;
|
|
218
223
|
try {
|
|
219
|
-
fs = require(
|
|
224
|
+
fs = require("fs");
|
|
220
225
|
} catch (err) {}
|
|
221
226
|
if (fs && fs.ReadStream && param instanceof fs.ReadStream) {
|
|
222
227
|
return true;
|
|
@@ -224,32 +229,32 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
224
229
|
}
|
|
225
230
|
|
|
226
231
|
// Buffer in Node.js
|
|
227
|
-
if (typeof Buffer ===
|
|
232
|
+
if (typeof Buffer === "function" && param instanceof Buffer) {
|
|
228
233
|
return true;
|
|
229
234
|
}
|
|
230
235
|
|
|
231
236
|
// Blob in browser
|
|
232
|
-
if (typeof Blob ===
|
|
237
|
+
if (typeof Blob === "function" && param instanceof Blob) {
|
|
233
238
|
return true;
|
|
234
239
|
}
|
|
235
240
|
|
|
236
241
|
// File in browser (it seems File object is also instance of Blob, but keep this for safe)
|
|
237
|
-
if (typeof File ===
|
|
242
|
+
if (typeof File === "function" && param instanceof File) {
|
|
238
243
|
return true;
|
|
239
244
|
}
|
|
240
245
|
return false;
|
|
241
246
|
}
|
|
242
247
|
|
|
243
248
|
/**
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
249
|
+
* Normalizes parameter values:
|
|
250
|
+
* <ul>
|
|
251
|
+
* <li>remove nils</li>
|
|
252
|
+
* <li>keep files and arrays</li>
|
|
253
|
+
* <li>format to string with `paramToString` for other cases</li>
|
|
254
|
+
* </ul>
|
|
255
|
+
* @param {Object.<String, Object>} params The parameters as object properties.
|
|
256
|
+
* @returns {Object.<String, Object>} normalized parameters.
|
|
257
|
+
*/
|
|
253
258
|
}, {
|
|
254
259
|
key: "normalizeParams",
|
|
255
260
|
value: function normalizeParams(params) {
|
|
@@ -268,12 +273,12 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
268
273
|
}
|
|
269
274
|
|
|
270
275
|
/**
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
276
|
+
* Builds a string representation of an array-type actual parameter, according to the given collection format.
|
|
277
|
+
* @param {Array} param An array parameter.
|
|
278
|
+
* @param {module:ApiClient.CollectionFormatEnum} collectionFormat The array element separator strategy.
|
|
279
|
+
* @returns {String|Array} A string representation of the supplied collection, using the specified delimiter. Returns
|
|
280
|
+
* <code>param</code> as is if <code>collectionFormat</code> is <code>multi</code>.
|
|
281
|
+
*/
|
|
277
282
|
}, {
|
|
278
283
|
key: "buildCollectionParam",
|
|
279
284
|
value: function buildCollectionParam(param, collectionFormat) {
|
|
@@ -281,29 +286,29 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
281
286
|
return null;
|
|
282
287
|
}
|
|
283
288
|
switch (collectionFormat) {
|
|
284
|
-
case
|
|
285
|
-
return param.map(this.paramToString, this).join(
|
|
286
|
-
case
|
|
287
|
-
return param.map(this.paramToString, this).join(
|
|
288
|
-
case
|
|
289
|
-
return param.map(this.paramToString, this).join(
|
|
290
|
-
case
|
|
291
|
-
return param.map(this.paramToString, this).join(
|
|
292
|
-
case
|
|
289
|
+
case "csv":
|
|
290
|
+
return param.map(this.paramToString, this).join(",");
|
|
291
|
+
case "ssv":
|
|
292
|
+
return param.map(this.paramToString, this).join(" ");
|
|
293
|
+
case "tsv":
|
|
294
|
+
return param.map(this.paramToString, this).join("\t");
|
|
295
|
+
case "pipes":
|
|
296
|
+
return param.map(this.paramToString, this).join("|");
|
|
297
|
+
case "multi":
|
|
293
298
|
//return the array directly as SuperAgent will handle it as expected
|
|
294
299
|
return param.map(this.paramToString, this);
|
|
295
|
-
case
|
|
300
|
+
case "passthrough":
|
|
296
301
|
return param;
|
|
297
302
|
default:
|
|
298
|
-
throw new Error(
|
|
303
|
+
throw new Error("Unknown collection format: " + collectionFormat);
|
|
299
304
|
}
|
|
300
305
|
}
|
|
301
306
|
|
|
302
307
|
/**
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
308
|
+
* Applies authentication headers to the request.
|
|
309
|
+
* @param {Object} request The request object created by a <code>superagent()</code> call.
|
|
310
|
+
* @param {Array.<String>} authNames An array of authentication method names.
|
|
311
|
+
*/
|
|
307
312
|
}, {
|
|
308
313
|
key: "applyAuthToRequest",
|
|
309
314
|
value: function applyAuthToRequest(request, authNames) {
|
|
@@ -311,39 +316,39 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
311
316
|
authNames.forEach(function (authName) {
|
|
312
317
|
var auth = _this2.authentications[authName];
|
|
313
318
|
switch (auth.type) {
|
|
314
|
-
case
|
|
319
|
+
case "basic":
|
|
315
320
|
if (auth.username || auth.password) {
|
|
316
|
-
request.auth(auth.username ||
|
|
321
|
+
request.auth(auth.username || "", auth.password || "");
|
|
317
322
|
}
|
|
318
323
|
break;
|
|
319
|
-
case
|
|
324
|
+
case "bearer":
|
|
320
325
|
if (auth.accessToken) {
|
|
321
|
-
var localVarBearerToken = typeof auth.accessToken ===
|
|
326
|
+
var localVarBearerToken = typeof auth.accessToken === "function" ? auth.accessToken() : auth.accessToken;
|
|
322
327
|
request.set({
|
|
323
|
-
|
|
328
|
+
Authorization: "Bearer " + localVarBearerToken
|
|
324
329
|
});
|
|
325
330
|
}
|
|
326
331
|
break;
|
|
327
|
-
case
|
|
332
|
+
case "apiKey":
|
|
328
333
|
if (auth.apiKey) {
|
|
329
334
|
var data = {};
|
|
330
335
|
data[auth.name] = auth.apiKey;
|
|
331
|
-
if (auth[
|
|
336
|
+
if (auth["in"] === "header") {
|
|
332
337
|
request.set(data);
|
|
333
338
|
} else {
|
|
334
339
|
request.query(data);
|
|
335
340
|
}
|
|
336
341
|
}
|
|
337
342
|
break;
|
|
338
|
-
case
|
|
343
|
+
case "oauth2":
|
|
339
344
|
if (auth.accessToken) {
|
|
340
345
|
request.set({
|
|
341
|
-
|
|
346
|
+
Authorization: "Bearer " + auth.accessToken
|
|
342
347
|
});
|
|
343
348
|
}
|
|
344
349
|
break;
|
|
345
350
|
default:
|
|
346
|
-
throw new Error(
|
|
351
|
+
throw new Error("Unknown authentication type: " + auth.type);
|
|
347
352
|
}
|
|
348
353
|
});
|
|
349
354
|
}
|
|
@@ -367,7 +372,7 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
367
372
|
// Rely on SuperAgent for parsing response body.
|
|
368
373
|
// See http://visionmedia.github.io/superagent/#parsing-response-bodies
|
|
369
374
|
var data = response.body;
|
|
370
|
-
if (data == null || _typeof(data) ===
|
|
375
|
+
if (data == null || _typeof(data) === "object" && typeof data.length === "undefined" && !Object.keys(data).length) {
|
|
371
376
|
// SuperAgent does not always produce a body; use the unparsed response as a fallback
|
|
372
377
|
data = response.text;
|
|
373
378
|
}
|
|
@@ -409,8 +414,8 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
409
414
|
this.applyAuthToRequest(request, authNames);
|
|
410
415
|
|
|
411
416
|
// set query parameters
|
|
412
|
-
if (httpMethod.toUpperCase() ===
|
|
413
|
-
queryParams[
|
|
417
|
+
if (httpMethod.toUpperCase() === "GET" && this.cache === false) {
|
|
418
|
+
queryParams["_"] = new Date().getTime();
|
|
414
419
|
}
|
|
415
420
|
request.query(this.normalizeParams(queryParams));
|
|
416
421
|
|
|
@@ -427,13 +432,13 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
427
432
|
var contentType = this.jsonPreferredMime(contentTypes);
|
|
428
433
|
if (contentType) {
|
|
429
434
|
// Issue with superagent and multipart/form-data (https://github.com/visionmedia/superagent/issues/746)
|
|
430
|
-
if (contentType !=
|
|
435
|
+
if (contentType != "multipart/form-data") {
|
|
431
436
|
request.type(contentType);
|
|
432
437
|
}
|
|
433
438
|
}
|
|
434
|
-
if (contentType ===
|
|
439
|
+
if (contentType === "application/x-www-form-urlencoded") {
|
|
435
440
|
request.send(_querystring["default"].stringify(this.normalizeParams(formParams)));
|
|
436
|
-
} else if (contentType ==
|
|
441
|
+
} else if (contentType == "multipart/form-data") {
|
|
437
442
|
var _formParams = this.normalizeParams(formParams);
|
|
438
443
|
for (var key in _formParams) {
|
|
439
444
|
if (_formParams.hasOwnProperty(key)) {
|
|
@@ -452,8 +457,8 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
452
457
|
}
|
|
453
458
|
}
|
|
454
459
|
} else if (bodyParam !== null && bodyParam !== undefined) {
|
|
455
|
-
if (!request.header[
|
|
456
|
-
request.type(
|
|
460
|
+
if (!request.header["Content-Type"]) {
|
|
461
|
+
request.type("application/json");
|
|
457
462
|
}
|
|
458
463
|
request.send(bodyParam);
|
|
459
464
|
}
|
|
@@ -461,15 +466,15 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
461
466
|
if (accept) {
|
|
462
467
|
request.accept(accept);
|
|
463
468
|
}
|
|
464
|
-
if (returnType ===
|
|
465
|
-
request.responseType(
|
|
466
|
-
} else if (returnType ===
|
|
467
|
-
request.responseType(
|
|
469
|
+
if (returnType === "Blob") {
|
|
470
|
+
request.responseType("blob");
|
|
471
|
+
} else if (returnType === "String") {
|
|
472
|
+
request.responseType("text");
|
|
468
473
|
}
|
|
469
474
|
|
|
470
475
|
// Attach previously saved cookies, if enabled
|
|
471
476
|
if (this.enableCookies) {
|
|
472
|
-
if (typeof window ===
|
|
477
|
+
if (typeof window === "undefined") {
|
|
473
478
|
this.agent._attachCookies(request);
|
|
474
479
|
} else {
|
|
475
480
|
request.withCredentials(); // Allows credentials to be sent with cross-origin requests in the browser
|
|
@@ -490,7 +495,7 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
490
495
|
} else {
|
|
491
496
|
try {
|
|
492
497
|
var data = _this3.deserialize(response, returnType);
|
|
493
|
-
if (_this3.enableCookies && typeof window ===
|
|
498
|
+
if (_this3.enableCookies && typeof window === "undefined") {
|
|
494
499
|
_this3.agent._saveCookies(response);
|
|
495
500
|
}
|
|
496
501
|
resolve({
|
|
@@ -506,21 +511,21 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
506
511
|
}
|
|
507
512
|
|
|
508
513
|
/**
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
514
|
+
* Parses an ISO-8601 string representation or epoch representation of a date value.
|
|
515
|
+
* @param {String} str The date value as a string.
|
|
516
|
+
* @returns {Date} The parsed date object.
|
|
517
|
+
*/
|
|
513
518
|
}, {
|
|
514
519
|
key: "hostSettings",
|
|
515
520
|
value:
|
|
516
521
|
/**
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
522
|
+
* Gets an array of host settings
|
|
523
|
+
* @returns An array of host settings
|
|
524
|
+
*/
|
|
520
525
|
function hostSettings() {
|
|
521
526
|
return [{
|
|
522
|
-
|
|
523
|
-
|
|
527
|
+
url: "https://api.notefile.net",
|
|
528
|
+
description: "Production server"
|
|
524
529
|
}];
|
|
525
530
|
}
|
|
526
531
|
}, {
|
|
@@ -534,37 +539,37 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
534
539
|
throw new Error("Invalid index " + index + " when selecting the host settings. Must be less than " + servers.length);
|
|
535
540
|
}
|
|
536
541
|
var server = servers[index];
|
|
537
|
-
var url = server[
|
|
542
|
+
var url = server["url"];
|
|
538
543
|
|
|
539
544
|
// go through variable and assign a value
|
|
540
|
-
for (var variable_name in server[
|
|
545
|
+
for (var variable_name in server["variables"]) {
|
|
541
546
|
if (variable_name in variables) {
|
|
542
|
-
var variable = server[
|
|
543
|
-
if (!(
|
|
547
|
+
var variable = server["variables"][variable_name];
|
|
548
|
+
if (!("enum_values" in variable) || variable["enum_values"].includes(variables[variable_name])) {
|
|
544
549
|
url = url.replace("{" + variable_name + "}", variables[variable_name]);
|
|
545
550
|
} else {
|
|
546
|
-
throw new Error("The variable `" + variable_name + "` in the host URL has invalid value " + variables[variable_name] + ". Must be " + server[
|
|
551
|
+
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"] + ".");
|
|
547
552
|
}
|
|
548
553
|
} else {
|
|
549
554
|
// use default value
|
|
550
|
-
url = url.replace("{" + variable_name + "}", server[
|
|
555
|
+
url = url.replace("{" + variable_name + "}", server["variables"][variable_name]["default_value"]);
|
|
551
556
|
}
|
|
552
557
|
}
|
|
553
558
|
return url;
|
|
554
559
|
}
|
|
555
560
|
|
|
556
561
|
/**
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
562
|
+
* Constructs a new map or array model from REST data.
|
|
563
|
+
* @param data {Object|Array} The REST data.
|
|
564
|
+
* @param obj {Object|Array} The target object or array.
|
|
565
|
+
*/
|
|
561
566
|
}], [{
|
|
562
567
|
key: "canBeJsonified",
|
|
563
568
|
value: function canBeJsonified(str) {
|
|
564
|
-
if (typeof str !==
|
|
569
|
+
if (typeof str !== "string" && _typeof(str) !== "object") return false;
|
|
565
570
|
try {
|
|
566
571
|
var type = str.toString();
|
|
567
|
-
return type ===
|
|
572
|
+
return type === "[object Object]" || type === "[object Array]";
|
|
568
573
|
} catch (err) {
|
|
569
574
|
return false;
|
|
570
575
|
}
|
|
@@ -573,42 +578,42 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
573
578
|
key: "parseDate",
|
|
574
579
|
value: function parseDate(str) {
|
|
575
580
|
if (isNaN(str)) {
|
|
576
|
-
return new Date(str.replace(/(\d)(T)(\d)/i,
|
|
581
|
+
return new Date(str.replace(/(\d)(T)(\d)/i, "$1 $3"));
|
|
577
582
|
}
|
|
578
583
|
return new Date(+str);
|
|
579
584
|
}
|
|
580
585
|
|
|
581
586
|
/**
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
587
|
+
* Converts a value to the specified type.
|
|
588
|
+
* @param {(String|Object)} data The data to convert, as a string or object.
|
|
589
|
+
* @param {(String|Array.<String>|Object.<String, Object>|Function)} type The type to return. Pass a string for simple types
|
|
590
|
+
* or the constructor function for a complex type. Pass an array containing the type name to return an array of that type. To
|
|
591
|
+
* return an object, pass an object with one property whose name is the key type and whose value is the corresponding value type:
|
|
592
|
+
* all properties on <code>data<code> will be converted to this type.
|
|
593
|
+
* @returns An instance of the specified type or null or undefined if data is null or undefined.
|
|
594
|
+
*/
|
|
590
595
|
}, {
|
|
591
596
|
key: "convertToType",
|
|
592
597
|
value: function convertToType(data, type) {
|
|
593
598
|
if (data === null || data === undefined) return data;
|
|
594
599
|
switch (type) {
|
|
595
|
-
case
|
|
600
|
+
case "Boolean":
|
|
596
601
|
return Boolean(data);
|
|
597
|
-
case
|
|
602
|
+
case "Integer":
|
|
598
603
|
return parseInt(data, 10);
|
|
599
|
-
case
|
|
604
|
+
case "Number":
|
|
600
605
|
return parseFloat(data);
|
|
601
|
-
case
|
|
606
|
+
case "String":
|
|
602
607
|
return String(data);
|
|
603
|
-
case
|
|
608
|
+
case "Date":
|
|
604
609
|
return String(data);
|
|
605
|
-
case
|
|
610
|
+
case "Blob":
|
|
606
611
|
return data;
|
|
607
612
|
default:
|
|
608
613
|
if (type === Object) {
|
|
609
614
|
// generic object, return directly
|
|
610
615
|
return data;
|
|
611
|
-
} else if (typeof type.constructFromObject ===
|
|
616
|
+
} else if (typeof type.constructFromObject === "function") {
|
|
612
617
|
// for model type like User and enum class
|
|
613
618
|
return type.constructFromObject(data);
|
|
614
619
|
} else if (Array.isArray(type)) {
|
|
@@ -617,7 +622,7 @@ var ApiClient = /*#__PURE__*/function () {
|
|
|
617
622
|
return data.map(function (item) {
|
|
618
623
|
return ApiClient.convertToType(item, itemType);
|
|
619
624
|
});
|
|
620
|
-
} else if (_typeof(type) ===
|
|
625
|
+
} else if (_typeof(type) === "object") {
|
|
621
626
|
// for plain object type like: {'String': 'Integer'}
|
|
622
627
|
var keyType, valueType;
|
|
623
628
|
for (var k in type) {
|
|
@@ -667,32 +672,32 @@ ApiClient.CollectionFormatEnum = {
|
|
|
667
672
|
* Comma-separated values. Value: <code>csv</code>
|
|
668
673
|
* @const
|
|
669
674
|
*/
|
|
670
|
-
CSV:
|
|
675
|
+
CSV: ",",
|
|
671
676
|
/**
|
|
672
677
|
* Space-separated values. Value: <code>ssv</code>
|
|
673
678
|
* @const
|
|
674
679
|
*/
|
|
675
|
-
SSV:
|
|
680
|
+
SSV: " ",
|
|
676
681
|
/**
|
|
677
682
|
* Tab-separated values. Value: <code>tsv</code>
|
|
678
683
|
* @const
|
|
679
684
|
*/
|
|
680
|
-
TSV:
|
|
685
|
+
TSV: "\t",
|
|
681
686
|
/**
|
|
682
687
|
* Pipe(|)-separated values. Value: <code>pipes</code>
|
|
683
688
|
* @const
|
|
684
689
|
*/
|
|
685
|
-
PIPES:
|
|
690
|
+
PIPES: "|",
|
|
686
691
|
/**
|
|
687
692
|
* Native array. Value: <code>multi</code>
|
|
688
693
|
* @const
|
|
689
694
|
*/
|
|
690
|
-
MULTI:
|
|
695
|
+
MULTI: "multi"
|
|
691
696
|
};
|
|
692
697
|
|
|
693
698
|
/**
|
|
694
|
-
* The default API client implementation.
|
|
695
|
-
* @type {module:ApiClient}
|
|
696
|
-
*/
|
|
699
|
+
* The default API client implementation.
|
|
700
|
+
* @type {module:ApiClient}
|
|
701
|
+
*/
|
|
697
702
|
ApiClient.instance = new ApiClient();
|
|
698
703
|
var _default = exports["default"] = ApiClient;
|