@corellium/corellium-cli 1.3.4 → 1.3.5
Sign up to get free protection for your applications and to get access to all the features.
- package/coverage/cobertura-coverage.xml +1 -1
- package/coverage/lcov-report/index.html +1 -1
- package/node_modules/@corellium/client-api/README.md +177 -14
- package/node_modules/@corellium/client-api/dist/ApiClient.js +67 -138
- package/node_modules/@corellium/client-api/dist/api/CorelliumApi.js +4668 -905
- package/node_modules/@corellium/client-api/dist/index.js +469 -37
- package/node_modules/@corellium/client-api/dist/model/Address.js +158 -0
- package/node_modules/@corellium/client-api/dist/model/AgentApp.js +159 -0
- package/node_modules/@corellium/client-api/dist/model/AgentAppReadyResponse.js +112 -0
- package/node_modules/@corellium/client-api/dist/model/AgentAppStatus.js +102 -0
- package/node_modules/@corellium/client-api/dist/model/AgentAppsList.js +127 -0
- package/node_modules/@corellium/client-api/dist/model/AgentAppsStatusList.js +127 -0
- package/node_modules/@corellium/client-api/dist/model/AgentError.js +153 -0
- package/node_modules/@corellium/client-api/dist/model/AgentIcons.js +89 -0
- package/node_modules/@corellium/client-api/dist/model/AgentInstallBody.js +93 -0
- package/node_modules/@corellium/client-api/dist/model/AgentProfilesReturn.js +116 -0
- package/node_modules/@corellium/client-api/dist/model/AgentSystemAdbAuth.js +89 -0
- package/node_modules/@corellium/client-api/dist/model/AgentSystemGetPropBody.js +116 -0
- package/node_modules/@corellium/client-api/dist/model/AgentValueReturn.js +93 -0
- package/node_modules/@corellium/client-api/dist/model/AgreedAck.js +89 -0
- package/node_modules/@corellium/client-api/dist/model/ApiConflictError.js +61 -22
- package/node_modules/@corellium/client-api/dist/model/ApiError.js +64 -21
- package/node_modules/@corellium/client-api/dist/model/ApiInternalConsistencyError.js +144 -0
- package/node_modules/@corellium/client-api/dist/model/ApiNotFoundError.js +65 -23
- package/node_modules/@corellium/client-api/dist/model/ApiToken.js +55 -17
- package/node_modules/@corellium/client-api/dist/model/Bit.js +24 -14
- package/node_modules/@corellium/client-api/dist/model/BtraceEnableOptions.js +93 -0
- package/node_modules/@corellium/client-api/dist/model/Button.js +90 -0
- package/node_modules/@corellium/client-api/dist/model/CouponOptions.js +161 -0
- package/node_modules/@corellium/client-api/dist/model/CreateTeam.js +116 -0
- package/node_modules/@corellium/client-api/dist/model/CreatedBy.js +128 -0
- package/node_modules/@corellium/client-api/dist/model/Credentials.js +59 -19
- package/node_modules/@corellium/client-api/dist/model/DomainOptions.js +103 -0
- package/node_modules/@corellium/client-api/dist/model/Extension.js +167 -0
- package/node_modules/@corellium/client-api/dist/model/Features.js +260 -0
- package/node_modules/@corellium/client-api/dist/model/FileChanges.js +120 -0
- package/node_modules/@corellium/client-api/dist/model/Firmware.js +97 -46
- package/node_modules/@corellium/client-api/dist/model/GpioStateDefinition.js +55 -20
- package/node_modules/@corellium/client-api/dist/model/GpiosState.js +120 -0
- package/node_modules/@corellium/client-api/dist/model/GrantTrialRequestResponse.js +93 -0
- package/node_modules/@corellium/client-api/dist/model/Hook.js +211 -0
- package/node_modules/@corellium/client-api/dist/model/Image.js +99 -49
- package/node_modules/@corellium/client-api/dist/model/Instance.js +201 -71
- package/node_modules/@corellium/client-api/dist/model/InstanceAgentState.js +106 -0
- package/node_modules/@corellium/client-api/dist/model/InstanceBootOptions.js +72 -29
- package/node_modules/@corellium/client-api/dist/model/InstanceBootOptionsAdditionalTag.js +90 -0
- package/node_modules/@corellium/client-api/dist/model/InstanceConsoleEndpoint.js +34 -17
- package/node_modules/@corellium/client-api/dist/model/InstanceCreateOptions.js +126 -49
- package/node_modules/@corellium/client-api/dist/model/InstanceInput.js +181 -0
- package/node_modules/@corellium/client-api/dist/model/InstanceNetdumpState.js +115 -0
- package/node_modules/@corellium/client-api/dist/model/InstanceNetmonState.js +56 -16
- package/node_modules/@corellium/client-api/dist/model/InstanceReturn.js +55 -20
- package/node_modules/@corellium/client-api/dist/model/InstanceServices.js +35 -18
- package/node_modules/@corellium/client-api/dist/model/InstanceStartOptions.js +39 -17
- package/node_modules/@corellium/client-api/dist/model/InstanceState.js +52 -21
- package/node_modules/@corellium/client-api/dist/model/InstanceStopOptions.js +30 -17
- package/node_modules/@corellium/client-api/dist/model/InstanceUpgradeBody.js +129 -0
- package/node_modules/@corellium/client-api/dist/model/Invitation.js +115 -0
- package/node_modules/@corellium/client-api/dist/model/InviteRevokeParams.js +94 -0
- package/node_modules/@corellium/client-api/dist/model/InviteRevokeParamsIds.js +150 -0
- package/node_modules/@corellium/client-api/dist/model/Kcrange.js +106 -0
- package/node_modules/@corellium/client-api/dist/model/KernelTask.js +149 -0
- package/node_modules/@corellium/client-api/dist/model/KernelThread.js +115 -0
- package/node_modules/@corellium/client-api/dist/model/MediaPlayBody.js +106 -0
- package/node_modules/@corellium/client-api/dist/model/Model.js +97 -35
- package/node_modules/@corellium/client-api/dist/model/ModelSoftware.js +77 -28
- package/node_modules/@corellium/client-api/dist/model/NetdumpFilter.js +158 -0
- package/node_modules/@corellium/client-api/dist/model/PasswordChangeBody.js +146 -0
- package/node_modules/@corellium/client-api/dist/model/PasswordResetBody.js +146 -0
- package/node_modules/@corellium/client-api/dist/model/PatchInstanceOptions.js +182 -0
- package/node_modules/@corellium/client-api/dist/model/PeripheralsData.js +63 -33
- package/node_modules/@corellium/client-api/dist/model/Plan.js +106 -0
- package/node_modules/@corellium/client-api/dist/model/Project.js +77 -28
- package/node_modules/@corellium/client-api/dist/model/ProjectKey.js +206 -0
- package/node_modules/@corellium/client-api/dist/model/ProjectQuota.js +35 -21
- package/node_modules/@corellium/client-api/dist/model/ProjectSettings.js +35 -21
- package/node_modules/@corellium/client-api/dist/model/ProjectUsage.js +37 -23
- package/node_modules/@corellium/client-api/dist/model/ProxyConfig.js +116 -0
- package/node_modules/@corellium/client-api/dist/model/RateInfo.js +98 -0
- package/node_modules/@corellium/client-api/dist/model/ResetLinkBody.js +116 -0
- package/node_modules/@corellium/client-api/dist/model/Role.js +164 -0
- package/node_modules/@corellium/client-api/dist/model/RotateBody.js +140 -0
- package/node_modules/@corellium/client-api/dist/model/Snapshot.js +56 -32
- package/node_modules/@corellium/client-api/dist/model/SnapshotCreationOptions.js +54 -17
- package/node_modules/@corellium/client-api/dist/model/SnapshotStatus.js +37 -19
- package/node_modules/@corellium/client-api/dist/model/SubscriberInvite.js +277 -0
- package/node_modules/@corellium/client-api/dist/model/Team.js +162 -0
- package/node_modules/@corellium/client-api/dist/model/TeamCreate.js +93 -0
- package/node_modules/@corellium/client-api/dist/model/TextInput.js +93 -0
- package/node_modules/@corellium/client-api/dist/model/Token.js +56 -19
- package/node_modules/@corellium/client-api/dist/model/TouchCurveInput.js +98 -0
- package/node_modules/@corellium/client-api/dist/model/TouchInput.js +89 -0
- package/node_modules/@corellium/client-api/dist/model/Trial.js +112 -0
- package/node_modules/@corellium/client-api/dist/model/TrialExtension.js +124 -0
- package/node_modules/@corellium/client-api/dist/model/TrialRequestMetadata.js +146 -0
- package/node_modules/@corellium/client-api/dist/model/TrialRequestOptions.js +156 -0
- package/node_modules/@corellium/client-api/dist/model/UpdateExtension.js +89 -0
- package/node_modules/@corellium/client-api/dist/model/User.js +170 -0
- package/node_modules/@corellium/client-api/dist/model/UserError.js +65 -22
- package/node_modules/@corellium/client-api/dist/model/V1CreateHookParameters.js +179 -0
- package/node_modules/@corellium/client-api/dist/model/V1LoadExtensionParameters.js +116 -0
- package/node_modules/@corellium/client-api/dist/model/V1SetStateBody.js +50 -18
- package/node_modules/@corellium/client-api/dist/model/ValidationError.js +157 -0
- package/node_modules/@corellium/client-api/dist/model/VolumeOptions.js +42 -21
- package/node_modules/@corellium/client-api/dist/model/VpnDefinition.js +45 -23
- package/node_modules/@corellium/client-api/dist/model/WebPlayerCreateSessionRequest.js +171 -0
- package/node_modules/@corellium/client-api/dist/model/WebPlayerSession.js +142 -0
- package/node_modules/@corellium/client-api/package.json +1 -1
- package/package.json +2 -2
- package/renovate.json +96 -0
- package/src/commands/login.js +6 -4
- package/src/commands/mast/constants.js +1 -2
- package/src/commands/mast/create-assessment.js +2 -3
- package/src/commands/mast/delete-assessment.js +2 -3
- package/src/commands/mast/download-report.js +4 -4
- package/src/commands/mast/get-assessment.js +2 -3
- package/src/commands/mast/get-assessments.js +2 -3
- package/src/commands/mast/start-monitor.js +2 -3
- package/src/commands/mast/stop-monitor.js +2 -3
- package/src/commands/mast/test.js +2 -3
- package/src/commands/mast/api-base-path.js +0 -21
@@ -4,26 +4,30 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports["default"] = void 0;
|
7
|
-
|
8
7
|
var _superagent = _interopRequireDefault(require("superagent"));
|
9
|
-
|
10
8
|
var _querystring = _interopRequireDefault(require("querystring"));
|
11
|
-
|
12
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
13
|
-
|
14
10
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
15
|
-
|
16
11
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
17
|
-
|
18
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
19
|
-
|
12
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
20
13
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
21
|
-
|
14
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
15
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } /**
|
16
|
+
* Corellium API
|
17
|
+
* REST API to manage your virtual devices.
|
18
|
+
*
|
19
|
+
* The version of the OpenAPI document: 4.5.0-16775
|
20
|
+
*
|
21
|
+
*
|
22
|
+
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
|
23
|
+
* https://openapi-generator.tech
|
24
|
+
* Do not edit the class manually.
|
25
|
+
*
|
26
|
+
*/
|
22
27
|
/**
|
23
28
|
* @module ApiClient
|
24
|
-
* @version 0.
|
29
|
+
* @version 0.3.2
|
25
30
|
*/
|
26
|
-
|
27
31
|
/**
|
28
32
|
* Manages low level client-server communications, parameter marshalling, etc. There should not be any need for an
|
29
33
|
* application to use this class directly - the *Api and model classes provide the public API for the service. The
|
@@ -39,107 +43,99 @@ var ApiClient = /*#__PURE__*/function () {
|
|
39
43
|
*/
|
40
44
|
function ApiClient() {
|
41
45
|
var basePath = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'https://app.corellium.com/api';
|
42
|
-
|
43
46
|
_classCallCheck(this, ApiClient);
|
44
|
-
|
45
47
|
/**
|
46
48
|
* The base URL against which to resolve every API call's (relative) path.
|
47
49
|
* @type {String}
|
48
50
|
* @default https://app.corellium.com/api
|
49
51
|
*/
|
50
52
|
this.basePath = basePath.replace(/\/+$/, '');
|
53
|
+
|
51
54
|
/**
|
52
55
|
* The authentication methods to be included for all API calls.
|
53
56
|
* @type {Array.<String>}
|
54
57
|
*/
|
55
|
-
|
56
58
|
this.authentications = {
|
57
59
|
'BearerAuth': {
|
58
60
|
type: 'bearer'
|
59
61
|
} // ApiToken or JWT
|
60
|
-
|
61
62
|
};
|
63
|
+
|
62
64
|
/**
|
63
65
|
* The default HTTP headers to be included for all API calls.
|
64
66
|
* @type {Array.<String>}
|
65
67
|
* @default {}
|
66
68
|
*/
|
67
|
-
|
68
69
|
this.defaultHeaders = {
|
69
|
-
'User-Agent': 'OpenAPI-Generator/0.
|
70
|
+
'User-Agent': 'OpenAPI-Generator/0.3.2/Javascript'
|
70
71
|
};
|
72
|
+
|
71
73
|
/**
|
72
74
|
* The default HTTP timeout for all API calls.
|
73
75
|
* @type {Number}
|
74
76
|
* @default 60000
|
75
77
|
*/
|
76
|
-
|
77
78
|
this.timeout = 60000;
|
79
|
+
|
78
80
|
/**
|
79
81
|
* If set to false an additional timestamp parameter is added to all API GET calls to
|
80
82
|
* prevent browser caching
|
81
83
|
* @type {Boolean}
|
82
84
|
* @default true
|
83
85
|
*/
|
84
|
-
|
85
86
|
this.cache = true;
|
87
|
+
|
86
88
|
/**
|
87
89
|
* If set to true, the client will save the cookies from each server
|
88
90
|
* response, and return them in the next request.
|
89
91
|
* @default false
|
90
92
|
*/
|
91
|
-
|
92
93
|
this.enableCookies = false;
|
94
|
+
|
93
95
|
/*
|
94
96
|
* Used to save and return cookies in a node.js (non-browser) setting,
|
95
97
|
* if this.enableCookies is set to true.
|
96
98
|
*/
|
97
|
-
|
98
99
|
if (typeof window === 'undefined') {
|
99
100
|
this.agent = new _superagent["default"].agent();
|
100
101
|
}
|
102
|
+
|
101
103
|
/*
|
102
104
|
* Allow user to override superagent agent
|
103
105
|
*/
|
104
|
-
|
105
|
-
|
106
106
|
this.requestAgent = null;
|
107
|
+
|
107
108
|
/*
|
108
109
|
* Allow user to add superagent plugins
|
109
110
|
*/
|
110
|
-
|
111
111
|
this.plugins = null;
|
112
112
|
}
|
113
|
+
|
113
114
|
/**
|
114
115
|
* Returns a string representation for an actual parameter.
|
115
116
|
* @param param The actual parameter.
|
116
117
|
* @returns {String} The string representation of <code>param</code>.
|
117
118
|
*/
|
118
|
-
|
119
|
-
|
120
119
|
_createClass(ApiClient, [{
|
121
120
|
key: "paramToString",
|
122
121
|
value: function paramToString(param) {
|
123
122
|
if (param == undefined || param == null) {
|
124
123
|
return '';
|
125
124
|
}
|
126
|
-
|
127
125
|
if (param instanceof Date) {
|
128
126
|
return param.toJSON();
|
129
127
|
}
|
130
|
-
|
131
128
|
if (ApiClient.canBeJsonified(param)) {
|
132
129
|
return JSON.stringify(param);
|
133
130
|
}
|
134
|
-
|
135
131
|
return param.toString();
|
136
132
|
}
|
133
|
+
|
137
134
|
/**
|
138
135
|
* Returns a boolean indicating if the parameter could be JSON.stringified
|
139
136
|
* @param param The actual parameter
|
140
137
|
* @returns {Boolean} Flag indicating if <code>param</code> can be JSON.stringified
|
141
138
|
*/
|
142
|
-
|
143
139
|
}, {
|
144
140
|
key: "buildUrl",
|
145
141
|
value:
|
@@ -153,30 +149,27 @@ var ApiClient = /*#__PURE__*/function () {
|
|
153
149
|
*/
|
154
150
|
function buildUrl(path, pathParams, apiBasePath) {
|
155
151
|
var _this = this;
|
156
|
-
|
157
152
|
if (!path.match(/^\//)) {
|
158
153
|
path = '/' + path;
|
159
154
|
}
|
155
|
+
var url = this.basePath + path;
|
160
156
|
|
161
|
-
|
162
|
-
|
157
|
+
// use API (operation, path) base path if defined
|
163
158
|
if (apiBasePath !== null && apiBasePath !== undefined) {
|
164
159
|
url = apiBasePath + path;
|
165
160
|
}
|
166
|
-
|
167
161
|
url = url.replace(/\{([\w-\.]+)\}/g, function (fullMatch, key) {
|
168
162
|
var value;
|
169
|
-
|
170
163
|
if (pathParams.hasOwnProperty(key)) {
|
171
164
|
value = _this.paramToString(pathParams[key]);
|
172
165
|
} else {
|
173
166
|
value = fullMatch;
|
174
167
|
}
|
175
|
-
|
176
168
|
return encodeURIComponent(value);
|
177
169
|
});
|
178
170
|
return url;
|
179
171
|
}
|
172
|
+
|
180
173
|
/**
|
181
174
|
* Checks whether the given content type represents JSON.<br>
|
182
175
|
* JSON content type examples:<br>
|
@@ -188,18 +181,17 @@ var ApiClient = /*#__PURE__*/function () {
|
|
188
181
|
* @param {String} contentType The MIME content type to check.
|
189
182
|
* @returns {Boolean} <code>true</code> if <code>contentType</code> represents JSON, otherwise <code>false</code>.
|
190
183
|
*/
|
191
|
-
|
192
184
|
}, {
|
193
185
|
key: "isJsonMime",
|
194
186
|
value: function isJsonMime(contentType) {
|
195
187
|
return Boolean(contentType != null && contentType.match(/^application\/json(;.*)?$/i));
|
196
188
|
}
|
189
|
+
|
197
190
|
/**
|
198
191
|
* Chooses a content type from the given array, with JSON preferred; i.e. return JSON if included, otherwise return the first.
|
199
192
|
* @param {Array.<String>} contentTypes
|
200
193
|
* @returns {String} The chosen content type, preferring JSON.
|
201
194
|
*/
|
202
|
-
|
203
195
|
}, {
|
204
196
|
key: "jsonPreferredMime",
|
205
197
|
value: function jsonPreferredMime(contentTypes) {
|
@@ -208,48 +200,45 @@ var ApiClient = /*#__PURE__*/function () {
|
|
208
200
|
return contentTypes[i];
|
209
201
|
}
|
210
202
|
}
|
211
|
-
|
212
203
|
return contentTypes[0];
|
213
204
|
}
|
205
|
+
|
214
206
|
/**
|
215
207
|
* Checks whether the given parameter value represents file-like content.
|
216
208
|
* @param param The parameter to check.
|
217
209
|
* @returns {Boolean} <code>true</code> if <code>param</code> represents a file.
|
218
210
|
*/
|
219
|
-
|
220
211
|
}, {
|
221
212
|
key: "isFileParam",
|
222
213
|
value: function isFileParam(param) {
|
223
214
|
// fs.ReadStream in Node.js and Electron (but not in runtime like browserify)
|
224
215
|
if (typeof require === 'function') {
|
225
216
|
var fs;
|
226
|
-
|
227
217
|
try {
|
228
218
|
fs = require('fs');
|
229
219
|
} catch (err) {}
|
230
|
-
|
231
220
|
if (fs && fs.ReadStream && param instanceof fs.ReadStream) {
|
232
221
|
return true;
|
233
222
|
}
|
234
|
-
}
|
235
|
-
|
223
|
+
}
|
236
224
|
|
225
|
+
// Buffer in Node.js
|
237
226
|
if (typeof Buffer === 'function' && param instanceof Buffer) {
|
238
227
|
return true;
|
239
|
-
}
|
240
|
-
|
228
|
+
}
|
241
229
|
|
230
|
+
// Blob in browser
|
242
231
|
if (typeof Blob === 'function' && param instanceof Blob) {
|
243
232
|
return true;
|
244
|
-
}
|
245
|
-
|
233
|
+
}
|
246
234
|
|
235
|
+
// File in browser (it seems File object is also instance of Blob, but keep this for safe)
|
247
236
|
if (typeof File === 'function' && param instanceof File) {
|
248
237
|
return true;
|
249
238
|
}
|
250
|
-
|
251
239
|
return false;
|
252
240
|
}
|
241
|
+
|
253
242
|
/**
|
254
243
|
* Normalizes parameter values:
|
255
244
|
* <ul>
|
@@ -260,16 +249,13 @@ var ApiClient = /*#__PURE__*/function () {
|
|
260
249
|
* @param {Object.<String, Object>} params The parameters as object properties.
|
261
250
|
* @returns {Object.<String, Object>} normalized parameters.
|
262
251
|
*/
|
263
|
-
|
264
252
|
}, {
|
265
253
|
key: "normalizeParams",
|
266
254
|
value: function normalizeParams(params) {
|
267
255
|
var newParams = {};
|
268
|
-
|
269
256
|
for (var key in params) {
|
270
257
|
if (params.hasOwnProperty(key) && params[key] != undefined && params[key] != null) {
|
271
258
|
var value = params[key];
|
272
|
-
|
273
259
|
if (this.isFileParam(value) || Array.isArray(value)) {
|
274
260
|
newParams[key] = value;
|
275
261
|
} else {
|
@@ -277,9 +263,9 @@ var ApiClient = /*#__PURE__*/function () {
|
|
277
263
|
}
|
278
264
|
}
|
279
265
|
}
|
280
|
-
|
281
266
|
return newParams;
|
282
267
|
}
|
268
|
+
|
283
269
|
/**
|
284
270
|
* Builds a string representation of an array-type actual parameter, according to the given collection format.
|
285
271
|
* @param {Array} param An array parameter.
|
@@ -287,60 +273,48 @@ var ApiClient = /*#__PURE__*/function () {
|
|
287
273
|
* @returns {String|Array} A string representation of the supplied collection, using the specified delimiter. Returns
|
288
274
|
* <code>param</code> as is if <code>collectionFormat</code> is <code>multi</code>.
|
289
275
|
*/
|
290
|
-
|
291
276
|
}, {
|
292
277
|
key: "buildCollectionParam",
|
293
278
|
value: function buildCollectionParam(param, collectionFormat) {
|
294
279
|
if (param == null) {
|
295
280
|
return null;
|
296
281
|
}
|
297
|
-
|
298
282
|
switch (collectionFormat) {
|
299
283
|
case 'csv':
|
300
284
|
return param.map(this.paramToString, this).join(',');
|
301
|
-
|
302
285
|
case 'ssv':
|
303
286
|
return param.map(this.paramToString, this).join(' ');
|
304
|
-
|
305
287
|
case 'tsv':
|
306
288
|
return param.map(this.paramToString, this).join('\t');
|
307
|
-
|
308
289
|
case 'pipes':
|
309
290
|
return param.map(this.paramToString, this).join('|');
|
310
|
-
|
311
291
|
case 'multi':
|
312
292
|
//return the array directly as SuperAgent will handle it as expected
|
313
293
|
return param.map(this.paramToString, this);
|
314
|
-
|
315
294
|
case 'passthrough':
|
316
295
|
return param;
|
317
|
-
|
318
296
|
default:
|
319
297
|
throw new Error('Unknown collection format: ' + collectionFormat);
|
320
298
|
}
|
321
299
|
}
|
300
|
+
|
322
301
|
/**
|
323
302
|
* Applies authentication headers to the request.
|
324
303
|
* @param {Object} request The request object created by a <code>superagent()</code> call.
|
325
304
|
* @param {Array.<String>} authNames An array of authentication method names.
|
326
305
|
*/
|
327
|
-
|
328
306
|
}, {
|
329
307
|
key: "applyAuthToRequest",
|
330
308
|
value: function applyAuthToRequest(request, authNames) {
|
331
309
|
var _this2 = this;
|
332
|
-
|
333
310
|
authNames.forEach(function (authName) {
|
334
311
|
var auth = _this2.authentications[authName];
|
335
|
-
|
336
312
|
switch (auth.type) {
|
337
313
|
case 'basic':
|
338
314
|
if (auth.username || auth.password) {
|
339
315
|
request.auth(auth.username || '', auth.password || '');
|
340
316
|
}
|
341
|
-
|
342
317
|
break;
|
343
|
-
|
344
318
|
case 'bearer':
|
345
319
|
if (auth.accessToken) {
|
346
320
|
var localVarBearerToken = typeof auth.accessToken === 'function' ? auth.accessToken() : auth.accessToken;
|
@@ -348,42 +322,35 @@ var ApiClient = /*#__PURE__*/function () {
|
|
348
322
|
'Authorization': 'Bearer ' + localVarBearerToken
|
349
323
|
});
|
350
324
|
}
|
351
|
-
|
352
325
|
break;
|
353
|
-
|
354
326
|
case 'apiKey':
|
355
327
|
if (auth.apiKey) {
|
356
328
|
var data = {};
|
357
|
-
|
358
329
|
if (auth.apiKeyPrefix) {
|
359
330
|
data[auth.name] = auth.apiKeyPrefix + ' ' + auth.apiKey;
|
360
331
|
} else {
|
361
332
|
data[auth.name] = auth.apiKey;
|
362
333
|
}
|
363
|
-
|
364
334
|
if (auth['in'] === 'header') {
|
365
335
|
request.set(data);
|
366
336
|
} else {
|
367
337
|
request.query(data);
|
368
338
|
}
|
369
339
|
}
|
370
|
-
|
371
340
|
break;
|
372
|
-
|
373
341
|
case 'oauth2':
|
374
342
|
if (auth.accessToken) {
|
375
343
|
request.set({
|
376
344
|
'Authorization': 'Bearer ' + auth.accessToken
|
377
345
|
});
|
378
346
|
}
|
379
|
-
|
380
347
|
break;
|
381
|
-
|
382
348
|
default:
|
383
349
|
throw new Error('Unknown authentication type: ' + auth.type);
|
384
350
|
}
|
385
351
|
});
|
386
352
|
}
|
353
|
+
|
387
354
|
/**
|
388
355
|
* Deserializes an HTTP response body into a value of the specified type.
|
389
356
|
* @param {Object} response A SuperAgent response object.
|
@@ -393,25 +360,23 @@ var ApiClient = /*#__PURE__*/function () {
|
|
393
360
|
* all properties on <code>data<code> will be converted to this type.
|
394
361
|
* @returns A value of the specified type.
|
395
362
|
*/
|
396
|
-
|
397
363
|
}, {
|
398
364
|
key: "deserialize",
|
399
365
|
value: function deserialize(response, returnType) {
|
400
366
|
if (response == null || returnType == null || response.status == 204) {
|
401
367
|
return null;
|
402
|
-
}
|
403
|
-
// See http://visionmedia.github.io/superagent/#parsing-response-bodies
|
404
|
-
|
368
|
+
}
|
405
369
|
|
370
|
+
// Rely on SuperAgent for parsing response body.
|
371
|
+
// See http://visionmedia.github.io/superagent/#parsing-response-bodies
|
406
372
|
var data = response.body;
|
407
|
-
|
408
373
|
if (data == null || _typeof(data) === 'object' && typeof data.length === 'undefined' && !Object.keys(data).length) {
|
409
374
|
// SuperAgent does not always produce a body; use the unparsed response as a fallback
|
410
375
|
data = response.text;
|
411
376
|
}
|
412
|
-
|
413
377
|
return ApiClient.convertToType(data, returnType);
|
414
378
|
}
|
379
|
+
|
415
380
|
/**
|
416
381
|
* Invokes the REST service using the supplied settings and parameters.
|
417
382
|
* @param {String} path The base URL to invoke.
|
@@ -429,58 +394,53 @@ var ApiClient = /*#__PURE__*/function () {
|
|
429
394
|
* @param {String} apiBasePath base path defined in the operation/path level to override the default one
|
430
395
|
* @returns {Promise} A {@link https://www.promisejs.org/|Promise} object.
|
431
396
|
*/
|
432
|
-
|
433
397
|
}, {
|
434
398
|
key: "callApi",
|
435
399
|
value: function callApi(path, httpMethod, pathParams, queryParams, headerParams, formParams, bodyParam, authNames, contentTypes, accepts, returnType, apiBasePath) {
|
436
400
|
var _this3 = this;
|
437
|
-
|
438
401
|
var url = this.buildUrl(path, pathParams, apiBasePath);
|
439
402
|
var request = (0, _superagent["default"])(httpMethod, url);
|
440
|
-
|
441
403
|
if (this.plugins !== null) {
|
442
404
|
for (var index in this.plugins) {
|
443
405
|
if (this.plugins.hasOwnProperty(index)) {
|
444
406
|
request.use(this.plugins[index]);
|
445
407
|
}
|
446
408
|
}
|
447
|
-
}
|
448
|
-
|
409
|
+
}
|
449
410
|
|
450
|
-
|
411
|
+
// apply authentications
|
412
|
+
this.applyAuthToRequest(request, authNames);
|
451
413
|
|
414
|
+
// set query parameters
|
452
415
|
if (httpMethod.toUpperCase() === 'GET' && this.cache === false) {
|
453
416
|
queryParams['_'] = new Date().getTime();
|
454
417
|
}
|
418
|
+
request.query(this.normalizeParams(queryParams));
|
455
419
|
|
456
|
-
|
457
|
-
|
458
|
-
request.set(this.defaultHeaders).set(this.normalizeParams(headerParams)); // set requestAgent if it is set by user
|
420
|
+
// set header parameters
|
421
|
+
request.set(this.defaultHeaders).set(this.normalizeParams(headerParams));
|
459
422
|
|
423
|
+
// set requestAgent if it is set by user
|
460
424
|
if (this.requestAgent) {
|
461
425
|
request.agent(this.requestAgent);
|
462
|
-
}
|
463
|
-
|
426
|
+
}
|
464
427
|
|
428
|
+
// set request timeout
|
465
429
|
request.timeout(this.timeout);
|
466
430
|
var contentType = this.jsonPreferredMime(contentTypes);
|
467
|
-
|
468
431
|
if (contentType) {
|
469
432
|
// Issue with superagent and multipart/form-data (https://github.com/visionmedia/superagent/issues/746)
|
470
433
|
if (contentType != 'multipart/form-data') {
|
471
434
|
request.type(contentType);
|
472
435
|
}
|
473
436
|
}
|
474
|
-
|
475
437
|
if (contentType === 'application/x-www-form-urlencoded') {
|
476
438
|
request.send(_querystring["default"].stringify(this.normalizeParams(formParams)));
|
477
439
|
} else if (contentType == 'multipart/form-data') {
|
478
440
|
var _formParams = this.normalizeParams(formParams);
|
479
|
-
|
480
441
|
for (var key in _formParams) {
|
481
442
|
if (_formParams.hasOwnProperty(key)) {
|
482
443
|
var _formParamsValue = _formParams[key];
|
483
|
-
|
484
444
|
if (this.isFileParam(_formParamsValue)) {
|
485
445
|
// file field
|
486
446
|
request.attach(key, _formParamsValue);
|
@@ -498,23 +458,19 @@ var ApiClient = /*#__PURE__*/function () {
|
|
498
458
|
if (!request.header['Content-Type']) {
|
499
459
|
request.type('application/json');
|
500
460
|
}
|
501
|
-
|
502
461
|
request.send(bodyParam);
|
503
462
|
}
|
504
|
-
|
505
463
|
var accept = this.jsonPreferredMime(accepts);
|
506
|
-
|
507
464
|
if (accept) {
|
508
465
|
request.accept(accept);
|
509
466
|
}
|
510
|
-
|
511
467
|
if (returnType === 'Blob') {
|
512
468
|
request.responseType('blob');
|
513
469
|
} else if (returnType === 'String') {
|
514
|
-
request.responseType('
|
515
|
-
}
|
516
|
-
|
470
|
+
request.responseType('text');
|
471
|
+
}
|
517
472
|
|
473
|
+
// Attach previously saved cookies, if enabled
|
518
474
|
if (this.enableCookies) {
|
519
475
|
if (typeof window === 'undefined') {
|
520
476
|
this.agent._attachCookies(request);
|
@@ -522,29 +478,24 @@ var ApiClient = /*#__PURE__*/function () {
|
|
522
478
|
request.withCredentials();
|
523
479
|
}
|
524
480
|
}
|
525
|
-
|
526
481
|
return new Promise(function (resolve, reject) {
|
527
482
|
request.end(function (error, response) {
|
528
483
|
if (error) {
|
529
484
|
var err = {};
|
530
|
-
|
531
485
|
if (response) {
|
532
486
|
err.status = response.status;
|
533
487
|
err.statusText = response.statusText;
|
534
488
|
err.body = response.body;
|
535
489
|
err.response = response;
|
536
490
|
}
|
537
|
-
|
538
491
|
err.error = error;
|
539
492
|
reject(err);
|
540
493
|
} else {
|
541
494
|
try {
|
542
495
|
var data = _this3.deserialize(response, returnType);
|
543
|
-
|
544
496
|
if (_this3.enableCookies && typeof window === 'undefined') {
|
545
497
|
_this3.agent._saveCookies(response);
|
546
498
|
}
|
547
|
-
|
548
499
|
resolve({
|
549
500
|
data: data,
|
550
501
|
response: response
|
@@ -556,12 +507,12 @@ var ApiClient = /*#__PURE__*/function () {
|
|
556
507
|
});
|
557
508
|
});
|
558
509
|
}
|
510
|
+
|
559
511
|
/**
|
560
512
|
* Parses an ISO-8601 string representation or epoch representation of a date value.
|
561
513
|
* @param {String} str The date value as a string.
|
562
514
|
* @returns {Date} The parsed date object.
|
563
515
|
*/
|
564
|
-
|
565
516
|
}, {
|
566
517
|
key: "hostSettings",
|
567
518
|
value:
|
@@ -572,7 +523,7 @@ var ApiClient = /*#__PURE__*/function () {
|
|
572
523
|
function hostSettings() {
|
573
524
|
return [{
|
574
525
|
'url': "https://{serverName}/api",
|
575
|
-
'description': "
|
526
|
+
'description': "",
|
576
527
|
'variables': {
|
577
528
|
serverName: {
|
578
529
|
'description': "No description provided",
|
@@ -585,19 +536,19 @@ var ApiClient = /*#__PURE__*/function () {
|
|
585
536
|
key: "getBasePathFromSettings",
|
586
537
|
value: function getBasePathFromSettings(index) {
|
587
538
|
var variables = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
588
|
-
var servers = this.hostSettings();
|
539
|
+
var servers = this.hostSettings();
|
589
540
|
|
541
|
+
// check array index out of bound
|
590
542
|
if (index < 0 || index >= servers.length) {
|
591
543
|
throw new Error("Invalid index " + index + " when selecting the host settings. Must be less than " + servers.length);
|
592
544
|
}
|
593
|
-
|
594
545
|
var server = servers[index];
|
595
|
-
var url = server['url'];
|
546
|
+
var url = server['url'];
|
596
547
|
|
548
|
+
// go through variable and assign a value
|
597
549
|
for (var variable_name in server['variables']) {
|
598
550
|
if (variable_name in variables) {
|
599
551
|
var variable = server['variables'][variable_name];
|
600
|
-
|
601
552
|
if (!('enum_values' in variable) || variable['enum_values'].includes(variables[variable_name])) {
|
602
553
|
url = url.replace("{" + variable_name + "}", variables[variable_name]);
|
603
554
|
} else {
|
@@ -608,20 +559,18 @@ var ApiClient = /*#__PURE__*/function () {
|
|
608
559
|
url = url.replace("{" + variable_name + "}", server['variables'][variable_name]['default_value']);
|
609
560
|
}
|
610
561
|
}
|
611
|
-
|
612
562
|
return url;
|
613
563
|
}
|
564
|
+
|
614
565
|
/**
|
615
566
|
* Constructs a new map or array model from REST data.
|
616
567
|
* @param data {Object|Array} The REST data.
|
617
568
|
* @param obj {Object|Array} The target object or array.
|
618
569
|
*/
|
619
|
-
|
620
570
|
}], [{
|
621
571
|
key: "canBeJsonified",
|
622
572
|
value: function canBeJsonified(str) {
|
623
573
|
if (typeof str !== 'string' && _typeof(str) !== 'object') return false;
|
624
|
-
|
625
574
|
try {
|
626
575
|
var type = str.toString();
|
627
576
|
return type === '[object Object]' || type === '[object Array]';
|
@@ -635,9 +584,9 @@ var ApiClient = /*#__PURE__*/function () {
|
|
635
584
|
if (isNaN(str)) {
|
636
585
|
return new Date(str.replace(/(\d)(T)(\d)/i, '$1 $3'));
|
637
586
|
}
|
638
|
-
|
639
587
|
return new Date(+str);
|
640
588
|
}
|
589
|
+
|
641
590
|
/**
|
642
591
|
* Converts a value to the specified type.
|
643
592
|
* @param {(String|Object)} data The data to convert, as a string or object.
|
@@ -647,31 +596,23 @@ var ApiClient = /*#__PURE__*/function () {
|
|
647
596
|
* all properties on <code>data<code> will be converted to this type.
|
648
597
|
* @returns An instance of the specified type or null or undefined if data is null or undefined.
|
649
598
|
*/
|
650
|
-
|
651
599
|
}, {
|
652
600
|
key: "convertToType",
|
653
601
|
value: function convertToType(data, type) {
|
654
602
|
if (data === null || data === undefined) return data;
|
655
|
-
|
656
603
|
switch (type) {
|
657
604
|
case 'Boolean':
|
658
605
|
return Boolean(data);
|
659
|
-
|
660
606
|
case 'Integer':
|
661
607
|
return parseInt(data, 10);
|
662
|
-
|
663
608
|
case 'Number':
|
664
609
|
return parseFloat(data);
|
665
|
-
|
666
610
|
case 'String':
|
667
611
|
return String(data);
|
668
|
-
|
669
612
|
case 'Date':
|
670
613
|
return ApiClient.parseDate(String(data));
|
671
|
-
|
672
614
|
case 'Blob':
|
673
615
|
return data;
|
674
|
-
|
675
616
|
default:
|
676
617
|
if (type === Object) {
|
677
618
|
// generic object, return directly
|
@@ -688,7 +629,6 @@ var ApiClient = /*#__PURE__*/function () {
|
|
688
629
|
} else if (_typeof(type) === 'object') {
|
689
630
|
// for plain object type like: {'String': 'Integer'}
|
690
631
|
var keyType, valueType;
|
691
|
-
|
692
632
|
for (var k in type) {
|
693
633
|
if (type.hasOwnProperty(k)) {
|
694
634
|
keyType = k;
|
@@ -696,9 +636,7 @@ var ApiClient = /*#__PURE__*/function () {
|
|
696
636
|
break;
|
697
637
|
}
|
698
638
|
}
|
699
|
-
|
700
639
|
var result = {};
|
701
|
-
|
702
640
|
for (var k in data) {
|
703
641
|
if (data.hasOwnProperty(k)) {
|
704
642
|
var key = ApiClient.convertToType(k, keyType);
|
@@ -706,13 +644,11 @@ var ApiClient = /*#__PURE__*/function () {
|
|
706
644
|
result[key] = value;
|
707
645
|
}
|
708
646
|
}
|
709
|
-
|
710
647
|
return result;
|
711
648
|
} else {
|
712
649
|
// for unknown type, return the data directly
|
713
650
|
return data;
|
714
651
|
}
|
715
|
-
|
716
652
|
}
|
717
653
|
}
|
718
654
|
}, {
|
@@ -729,7 +665,6 @@ var ApiClient = /*#__PURE__*/function () {
|
|
729
665
|
}
|
730
666
|
}
|
731
667
|
}]);
|
732
|
-
|
733
668
|
return ApiClient;
|
734
669
|
}();
|
735
670
|
/**
|
@@ -737,44 +672,38 @@ var ApiClient = /*#__PURE__*/function () {
|
|
737
672
|
* @enum {String}
|
738
673
|
* @readonly
|
739
674
|
*/
|
740
|
-
|
741
|
-
|
742
675
|
ApiClient.CollectionFormatEnum = {
|
743
676
|
/**
|
744
677
|
* Comma-separated values. Value: <code>csv</code>
|
745
678
|
* @const
|
746
679
|
*/
|
747
680
|
CSV: ',',
|
748
|
-
|
749
681
|
/**
|
750
682
|
* Space-separated values. Value: <code>ssv</code>
|
751
683
|
* @const
|
752
684
|
*/
|
753
685
|
SSV: ' ',
|
754
|
-
|
755
686
|
/**
|
756
687
|
* Tab-separated values. Value: <code>tsv</code>
|
757
688
|
* @const
|
758
689
|
*/
|
759
690
|
TSV: '\t',
|
760
|
-
|
761
691
|
/**
|
762
692
|
* Pipe(|)-separated values. Value: <code>pipes</code>
|
763
693
|
* @const
|
764
694
|
*/
|
765
695
|
PIPES: '|',
|
766
|
-
|
767
696
|
/**
|
768
697
|
* Native array. Value: <code>multi</code>
|
769
698
|
* @const
|
770
699
|
*/
|
771
700
|
MULTI: 'multi'
|
772
701
|
};
|
702
|
+
|
773
703
|
/**
|
774
704
|
* The default API client implementation.
|
775
705
|
* @type {module:ApiClient}
|
776
706
|
*/
|
777
|
-
|
778
707
|
ApiClient.instance = new ApiClient();
|
779
708
|
var _default = ApiClient;
|
780
709
|
exports["default"] = _default;
|