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