neuralseekui 1.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.
Files changed (103) hide show
  1. package/README.md +163 -0
  2. package/docs/AddIntentBody.md +10 -0
  3. package/docs/AnswersApi.md +160 -0
  4. package/docs/CategoriesApi.md +58 -0
  5. package/docs/CategoryBody.md +8 -0
  6. package/docs/CurateBody.md +9 -0
  7. package/docs/CuratedDataApi.md +59 -0
  8. package/docs/DelAnswerBody.md +6 -0
  9. package/docs/DelQuestionBody.md +7 -0
  10. package/docs/DelUserDataBody.md +7 -0
  11. package/docs/EditAnswerBody.md +7 -0
  12. package/docs/ExploreFilesBody.md +6 -0
  13. package/docs/ExploreUploadBody.md +6 -0
  14. package/docs/FdelBody.md +7 -0
  15. package/docs/FindAnswerIdBody.md +6 -0
  16. package/docs/FlagBody.md +7 -0
  17. package/docs/GodocumentBody.md +9 -0
  18. package/docs/GomaistroBody.md +7 -0
  19. package/docs/GomaistrotokensBody.md +7 -0
  20. package/docs/GooverBody.md +9 -0
  21. package/docs/GoperfBody.md +7 -0
  22. package/docs/GosemanticBody.md +9 -0
  23. package/docs/GotokensBody.md +7 -0
  24. package/docs/GovernanceApi.md +410 -0
  25. package/docs/IntentsApi.md +364 -0
  26. package/docs/LoadUserResponseBody.md +7 -0
  27. package/docs/MAIstroApi.md +265 -0
  28. package/docs/MaistroFilesBody.md +8 -0
  29. package/docs/MaistroOCRBody.md +6 -0
  30. package/docs/MergeBody.md +7 -0
  31. package/docs/QuestionsApi.md +58 -0
  32. package/docs/RenBody.md +7 -0
  33. package/docs/UnmergeBody.md +6 -0
  34. package/git_push.sh +52 -0
  35. package/mocha.opts +1 -0
  36. package/package.json +55 -0
  37. package/src/ApiClient.js +585 -0
  38. package/src/api/AnswersApi.js +179 -0
  39. package/src/api/CategoriesApi.js +85 -0
  40. package/src/api/CuratedDataApi.js +82 -0
  41. package/src/api/GovernanceApi.js +408 -0
  42. package/src/api/IntentsApi.js +367 -0
  43. package/src/api/MAIstroApi.js +262 -0
  44. package/src/api/QuestionsApi.js +85 -0
  45. package/src/index.js +279 -0
  46. package/src/model/AddIntentBody.js +91 -0
  47. package/src/model/CategoryBody.js +71 -0
  48. package/src/model/CurateBody.js +75 -0
  49. package/src/model/DelAnswerBody.js +55 -0
  50. package/src/model/DelQuestionBody.js +64 -0
  51. package/src/model/DelUserDataBody.js +62 -0
  52. package/src/model/EditAnswerBody.js +64 -0
  53. package/src/model/ExploreFilesBody.js +55 -0
  54. package/src/model/ExploreUploadBody.js +53 -0
  55. package/src/model/FdelBody.js +62 -0
  56. package/src/model/FindAnswerIdBody.js +55 -0
  57. package/src/model/FlagBody.js +61 -0
  58. package/src/model/GodocumentBody.js +76 -0
  59. package/src/model/GomaistroBody.js +62 -0
  60. package/src/model/GomaistrotokensBody.js +62 -0
  61. package/src/model/GooverBody.js +76 -0
  62. package/src/model/GoperfBody.js +62 -0
  63. package/src/model/GosemanticBody.js +76 -0
  64. package/src/model/GotokensBody.js +62 -0
  65. package/src/model/LoadUserResponseBody.js +64 -0
  66. package/src/model/MaistroFilesBody.js +69 -0
  67. package/src/model/MaistroOCRBody.js +53 -0
  68. package/src/model/MergeBody.js +64 -0
  69. package/src/model/RenBody.js +62 -0
  70. package/src/model/UnmergeBody.js +53 -0
  71. package/test/api/AnswersApi.spec.js +95 -0
  72. package/test/api/CategoriesApi.spec.js +59 -0
  73. package/test/api/CuratedDataApi.spec.js +60 -0
  74. package/test/api/GovernanceApi.spec.js +185 -0
  75. package/test/api/IntentsApi.spec.js +167 -0
  76. package/test/api/MAIstroApi.spec.js +134 -0
  77. package/test/api/QuestionsApi.spec.js +59 -0
  78. package/test/assert-equals.js +81 -0
  79. package/test/model/AddIntentBody.spec.js +76 -0
  80. package/test/model/CategoryBody.spec.js +64 -0
  81. package/test/model/CurateBody.spec.js +70 -0
  82. package/test/model/DelAnswerBody.spec.js +52 -0
  83. package/test/model/DelQuestionBody.spec.js +58 -0
  84. package/test/model/DelUserDataBody.spec.js +58 -0
  85. package/test/model/EditAnswerBody.spec.js +58 -0
  86. package/test/model/ExploreFilesBody.spec.js +52 -0
  87. package/test/model/ExploreUploadBody.spec.js +52 -0
  88. package/test/model/FdelBody.spec.js +58 -0
  89. package/test/model/FindAnswerIdBody.spec.js +52 -0
  90. package/test/model/FlagBody.spec.js +58 -0
  91. package/test/model/GodocumentBody.spec.js +70 -0
  92. package/test/model/GomaistroBody.spec.js +58 -0
  93. package/test/model/GomaistrotokensBody.spec.js +58 -0
  94. package/test/model/GooverBody.spec.js +70 -0
  95. package/test/model/GoperfBody.spec.js +58 -0
  96. package/test/model/GosemanticBody.spec.js +70 -0
  97. package/test/model/GotokensBody.spec.js +58 -0
  98. package/test/model/LoadUserResponseBody.spec.js +58 -0
  99. package/test/model/MaistroFilesBody.spec.js +64 -0
  100. package/test/model/MaistroOCRBody.spec.js +52 -0
  101. package/test/model/MergeBody.spec.js +58 -0
  102. package/test/model/RenBody.spec.js +58 -0
  103. package/test/model/UnmergeBody.spec.js +52 -0
@@ -0,0 +1,585 @@
1
+ /*
2
+ * NeuralSeek UI
3
+ * NeuralSeek - The business LLM accelerator
4
+ *
5
+ * OpenAPI spec version: 1.0.0
6
+ * Contact: support@NeuralSeek.com
7
+ *
8
+ * NOTE: This class is auto generated by the swagger code generator program.
9
+ * https://github.com/swagger-api/swagger-codegen.git
10
+ *
11
+ * Swagger Codegen version: 3.0.78
12
+ *
13
+ * Do not edit the class manually.
14
+ *
15
+ */
16
+ import superagent from "superagent";
17
+
18
+ /**
19
+ * @module ApiClient
20
+ * @version 1.0.0
21
+ */
22
+
23
+ /**
24
+ * Manages low level client-server communications, parameter marshalling, etc. There should not be any need for an
25
+ * application to use this class directly - the *Api and model classes provide the public API for the service. The
26
+ * contents of this file should be regarded as internal but are documented for completeness.
27
+ * @alias module:ApiClient
28
+ * @class
29
+ */
30
+ export default class ApiClient {
31
+ constructor() {
32
+ /**
33
+ * The base URL against which to resolve every API call's (relative) path.
34
+ * @type {String}
35
+ * @default https://console.neuralseek.com/{instance}
36
+ */
37
+ this.basePath = 'https://console.neuralseek.com/{instance}'.replace(/\/+$/, '');
38
+
39
+ /**
40
+ * The authentication methods to be included for all API calls.
41
+ * @type {Array.<String>}
42
+ */
43
+ this.authentications = {
44
+ 'apiKey': {type: 'apiKey', 'in': 'header', name: 'apikey'}
45
+ }
46
+
47
+ /**
48
+ * The default HTTP headers to be included for all API calls.
49
+ * @type {Array.<String>}
50
+ * @default {}
51
+ */
52
+ this.defaultHeaders = {};
53
+
54
+ /**
55
+ * The default HTTP timeout for all API calls.
56
+ * @type {Number}
57
+ * @default 60000
58
+ */
59
+ this.timeout = 60000;
60
+
61
+ /**
62
+ * If set to false an additional timestamp parameter is added to all API GET calls to
63
+ * prevent browser caching
64
+ * @type {Boolean}
65
+ * @default true
66
+ */
67
+ this.cache = true;
68
+
69
+ /**
70
+ * If set to true, the client will save the cookies from each server
71
+ * response, and return them in the next request.
72
+ * @default false
73
+ */
74
+ this.enableCookies = false;
75
+
76
+ /*
77
+ * Used to save and return cookies in a node.js (non-browser) setting,
78
+ * if this.enableCookies is set to true.
79
+ */
80
+ if (typeof window === 'undefined') {
81
+ this.agent = new superagent.agent();
82
+ }
83
+
84
+ /*
85
+ * Allow user to override superagent agent
86
+ */
87
+ this.requestAgent = null;
88
+
89
+ }
90
+
91
+ /**
92
+ * Returns a string representation for an actual parameter.
93
+ * @param param The actual parameter.
94
+ * @returns {String} The string representation of <code>param</code>.
95
+ */
96
+ paramToString(param) {
97
+ if (param == undefined || param == null) {
98
+ return '';
99
+ }
100
+ if (param instanceof Date) {
101
+ return param.toJSON();
102
+ }
103
+
104
+ return param.toString();
105
+ }
106
+
107
+ /**
108
+ * Builds full URL by appending the given path to the base URL and replacing path parameter place-holders with parameter values.
109
+ * NOTE: query parameters are not handled here.
110
+ * @param {String} path The path to append to the base URL.
111
+ * @param {Object} pathParams The parameter values to append.
112
+ * @returns {String} The encoded path with parameter values substituted.
113
+ */
114
+ buildUrl(path, pathParams) {
115
+ if (!path.match(/^\//)) {
116
+ path = '/' + path;
117
+ }
118
+
119
+ var url = this.basePath + path;
120
+ url = url.replace(/\{([\w-]+)\}/g, (fullMatch, key) => {
121
+ var value;
122
+ if (pathParams.hasOwnProperty(key)) {
123
+ value = this.paramToString(pathParams[key]);
124
+ } else {
125
+ value = fullMatch;
126
+ }
127
+
128
+ return encodeURIComponent(value);
129
+ });
130
+
131
+ return url;
132
+ }
133
+
134
+ /**
135
+ * Checks whether the given content type represents JSON.<br>
136
+ * JSON content type examples:<br>
137
+ * <ul>
138
+ * <li>application/json</li>
139
+ * <li>application/json; charset=UTF8</li>
140
+ * <li>APPLICATION/JSON</li>
141
+ * </ul>
142
+ * @param {String} contentType The MIME content type to check.
143
+ * @returns {Boolean} <code>true</code> if <code>contentType</code> represents JSON, otherwise <code>false</code>.
144
+ */
145
+ isJsonMime(contentType) {
146
+ return Boolean(contentType != null && contentType.match(/^application\/json(;.*)?$/i));
147
+ }
148
+
149
+ /**
150
+ * Chooses a content type from the given array, with JSON preferred; i.e. return JSON if included, otherwise return the first.
151
+ * @param {Array.<String>} contentTypes
152
+ * @returns {String} The chosen content type, preferring JSON.
153
+ */
154
+ jsonPreferredMime(contentTypes) {
155
+ for (var i = 0; i < contentTypes.length; i++) {
156
+ if (this.isJsonMime(contentTypes[i])) {
157
+ return contentTypes[i];
158
+ }
159
+ }
160
+
161
+ return contentTypes[0];
162
+ }
163
+
164
+ /**
165
+ * Checks whether the given parameter value represents file-like content.
166
+ * @param param The parameter to check.
167
+ * @returns {Boolean} <code>true</code> if <code>param</code> represents a file.
168
+ */
169
+ isFileParam(param) {
170
+ // fs.ReadStream in Node.js and Electron (but not in runtime like browserify)
171
+ if (typeof require === 'function') {
172
+ let fs;
173
+ try {
174
+ fs = require('fs');
175
+ } catch (err) {}
176
+ if (fs && fs.ReadStream && param instanceof fs.ReadStream) {
177
+ return true;
178
+ }
179
+ }
180
+
181
+ // Buffer in Node.js
182
+ if (typeof Buffer === 'function' && param instanceof Buffer) {
183
+ return true;
184
+ }
185
+
186
+ // Blob in browser
187
+ if (typeof Blob === 'function' && param instanceof Blob) {
188
+ return true;
189
+ }
190
+
191
+ // File in browser (it seems File object is also instance of Blob, but keep this for safe)
192
+ if (typeof File === 'function' && param instanceof File) {
193
+ return true;
194
+ }
195
+
196
+ return false;
197
+ }
198
+
199
+ /**
200
+ * Normalizes parameter values:
201
+ * <ul>
202
+ * <li>remove nils</li>
203
+ * <li>keep files and arrays</li>
204
+ * <li>format to string with `paramToString` for other cases</li>
205
+ * </ul>
206
+ * @param {Object.<String, Object>} params The parameters as object properties.
207
+ * @returns {Object.<String, Object>} normalized parameters.
208
+ */
209
+ normalizeParams(params) {
210
+ var newParams = {};
211
+ for (var key in params) {
212
+ if (params.hasOwnProperty(key) && params[key] != undefined && params[key] != null) {
213
+ var value = params[key];
214
+ if (this.isFileParam(value) || Array.isArray(value)) {
215
+ newParams[key] = value;
216
+ } else {
217
+ newParams[key] = this.paramToString(value);
218
+ }
219
+ }
220
+ }
221
+
222
+ return newParams;
223
+ }
224
+
225
+ /**
226
+ * Enumeration of collection format separator strategies.
227
+ * @enum {String}
228
+ * @readonly
229
+ */
230
+ static CollectionFormatEnum = {
231
+ /**
232
+ * Comma-separated values. Value: <code>csv</code>
233
+ * @const
234
+ */
235
+ CSV: ',',
236
+
237
+ /**
238
+ * Space-separated values. Value: <code>ssv</code>
239
+ * @const
240
+ */
241
+ SSV: ' ',
242
+
243
+ /**
244
+ * Tab-separated values. Value: <code>tsv</code>
245
+ * @const
246
+ */
247
+ TSV: '\t',
248
+
249
+ /**
250
+ * Pipe(|)-separated values. Value: <code>pipes</code>
251
+ * @const
252
+ */
253
+ PIPES: '|',
254
+
255
+ /**
256
+ * Native array. Value: <code>multi</code>
257
+ * @const
258
+ */
259
+ MULTI: 'multi'
260
+ };
261
+
262
+ /**
263
+ * Builds a string representation of an array-type actual parameter, according to the given collection format.
264
+ * @param {Array} param An array parameter.
265
+ * @param {module:ApiClient.CollectionFormatEnum} collectionFormat The array element separator strategy.
266
+ * @returns {String|Array} A string representation of the supplied collection, using the specified delimiter. Returns
267
+ * <code>param</code> as is if <code>collectionFormat</code> is <code>multi</code>.
268
+ */
269
+ buildCollectionParam(param, collectionFormat) {
270
+ if (param == null) {
271
+ return null;
272
+ }
273
+ switch (collectionFormat) {
274
+ case 'csv':
275
+ return param.map(this.paramToString).join(',');
276
+ case 'ssv':
277
+ return param.map(this.paramToString).join(' ');
278
+ case 'tsv':
279
+ return param.map(this.paramToString).join('\t');
280
+ case 'pipes':
281
+ return param.map(this.paramToString).join('|');
282
+ case 'multi':
283
+ //return the array directly as SuperAgent will handle it as expected
284
+ return param.map(this.paramToString);
285
+ default:
286
+ throw new Error('Unknown collection format: ' + collectionFormat);
287
+ }
288
+ }
289
+
290
+ /**
291
+ * Applies authentication headers to the request.
292
+ * @param {Object} request The request object created by a <code>superagent()</code> call.
293
+ * @param {Array.<String>} authNames An array of authentication method names.
294
+ */
295
+ applyAuthToRequest(request, authNames) {
296
+ authNames.forEach((authName) => {
297
+ var auth = this.authentications[authName];
298
+ switch (auth.type) {
299
+ case 'basic':
300
+ if (auth.username || auth.password) {
301
+ request.auth(auth.username || '', auth.password || '');
302
+ }
303
+
304
+ break;
305
+ case 'apiKey':
306
+ if (auth.apiKey) {
307
+ var data = {};
308
+ if (auth.apiKeyPrefix) {
309
+ data[auth.name] = auth.apiKeyPrefix + ' ' + auth.apiKey;
310
+ } else {
311
+ data[auth.name] = auth.apiKey;
312
+ }
313
+
314
+ if (auth['in'] === 'header') {
315
+ request.set(data);
316
+ } else {
317
+ request.query(data);
318
+ }
319
+ }
320
+
321
+ break;
322
+ case 'oauth2':
323
+ if (auth.accessToken) {
324
+ request.set({'Authorization': 'Bearer ' + auth.accessToken});
325
+ }
326
+
327
+ break;
328
+ default:
329
+ throw new Error('Unknown authentication type: ' + auth.type);
330
+ }
331
+ });
332
+ }
333
+
334
+ /**
335
+ * Deserializes an HTTP response body into a value of the specified type.
336
+ * @param {Object} response A SuperAgent response object.
337
+ * @param {(String|Array.<String>|Object.<String, Object>|Function)} returnType The type to return. Pass a string for simple types
338
+ * or the constructor function for a complex type. Pass an array containing the type name to return an array of that type. To
339
+ * return an object, pass an object with one property whose name is the key type and whose value is the corresponding value type:
340
+ * all properties on <code>data<code> will be converted to this type.
341
+ * @returns A value of the specified type.
342
+ */
343
+ deserialize(response, returnType) {
344
+ if (response == null || returnType == null || response.status == 204) {
345
+ return null;
346
+ }
347
+
348
+ // Rely on SuperAgent for parsing response body.
349
+ // See http://visionmedia.github.io/superagent/#parsing-response-bodies
350
+ var data = response.body;
351
+ if (data == null || (typeof data === 'object' && typeof data.length === 'undefined' && !Object.keys(data).length)) {
352
+ // SuperAgent does not always produce a body; use the unparsed response as a fallback
353
+ data = response.text;
354
+ }
355
+
356
+ return ApiClient.convertToType(data, returnType);
357
+ }
358
+
359
+ /**
360
+ * Callback function to receive the result of the operation.
361
+ * @callback module:ApiClient~callApiCallback
362
+ * @param {String} error Error message, if any.
363
+ * @param data The data returned by the service call.
364
+ * @param {String} response The complete HTTP response.
365
+ */
366
+
367
+ /**
368
+ * Invokes the REST service using the supplied settings and parameters.
369
+ * @param {String} path The base URL to invoke.
370
+ * @param {String} httpMethod The HTTP method to use.
371
+ * @param {Object.<String, String>} pathParams A map of path parameters and their values.
372
+ * @param {Object.<String, Object>} queryParams A map of query parameters and their values.
373
+ * @param {Object.<String, Object>} headerParams A map of header parameters and their values.
374
+ * @param {Object.<String, Object>} formParams A map of form parameters and their values.
375
+ * @param {Object} bodyParam The value to pass as the request body.
376
+ * @param {Array.<String>} authNames An array of authentication type names.
377
+ * @param {Array.<String>} contentTypes An array of request MIME types.
378
+ * @param {Array.<String>} accepts An array of acceptable response MIME types.
379
+ * @param {(String|Array|ObjectFunction)} returnType The required type to return; can be a string for simple types or the
380
+ * constructor for a complex type.
381
+ * @param {module:ApiClient~callApiCallback} callback The callback function.
382
+ * @returns {Object} The SuperAgent request object.
383
+ */
384
+ callApi(path, httpMethod, pathParams,
385
+ queryParams, headerParams, formParams, bodyParam, authNames, contentTypes, accepts,
386
+ returnType, callback) {
387
+
388
+ var url = this.buildUrl(path, pathParams);
389
+ var request = superagent(httpMethod, url);
390
+
391
+ // apply authentications
392
+ this.applyAuthToRequest(request, authNames);
393
+
394
+ // set query parameters
395
+ if (httpMethod.toUpperCase() === 'GET' && this.cache === false) {
396
+ queryParams['_'] = new Date().getTime();
397
+ }
398
+
399
+ request.query(this.normalizeParams(queryParams));
400
+
401
+ // set header parameters
402
+ request.set(this.defaultHeaders).set(this.normalizeParams(headerParams));
403
+
404
+ // set requestAgent if it is set by user
405
+ if (this.requestAgent) {
406
+ request.agent(this.requestAgent);
407
+ }
408
+
409
+ // set request timeout
410
+ request.timeout(this.timeout);
411
+
412
+ var contentType = this.jsonPreferredMime(contentTypes);
413
+ if (contentType) {
414
+ // Issue with superagent and multipart/form-data (https://github.com/visionmedia/superagent/issues/746)
415
+ if(contentType != 'multipart/form-data') {
416
+ request.type(contentType);
417
+ }
418
+ } else if (!request.header['Content-Type']) {
419
+ request.type('application/json');
420
+ }
421
+
422
+ if (contentType === 'application/x-www-form-urlencoded') {
423
+ request.send(new URLSearchParams(this.normalizeParams(formParams)));
424
+ } else if (contentType == 'multipart/form-data') {
425
+ var _formParams = this.normalizeParams(formParams);
426
+ for (var key in _formParams) {
427
+ if (_formParams.hasOwnProperty(key)) {
428
+ if (this.isFileParam(_formParams[key])) {
429
+ // file field
430
+ request.attach(key, _formParams[key]);
431
+ } else {
432
+ request.field(key, _formParams[key]);
433
+ }
434
+ }
435
+ }
436
+ } else if (bodyParam) {
437
+ request.send(bodyParam);
438
+ }
439
+
440
+ var accept = this.jsonPreferredMime(accepts);
441
+ if (accept) {
442
+ request.accept(accept);
443
+ }
444
+
445
+ if (returnType === 'Blob') {
446
+ request.responseType('blob');
447
+ } else if (returnType === 'String') {
448
+ request.responseType('string');
449
+ }
450
+
451
+ // Attach previously saved cookies, if enabled
452
+ if (this.enableCookies){
453
+ if (typeof window === 'undefined') {
454
+ this.agent.attachCookies(request);
455
+ }
456
+ else {
457
+ request.withCredentials();
458
+ }
459
+ }
460
+
461
+
462
+
463
+ request.end((error, response) => {
464
+ if (callback) {
465
+ var data = null;
466
+ if (!error) {
467
+ try {
468
+ data = this.deserialize(response, returnType);
469
+ if (this.enableCookies && typeof window === 'undefined'){
470
+ this.agent.saveCookies(response);
471
+ }
472
+ } catch (err) {
473
+ error = err;
474
+ }
475
+ }
476
+
477
+ callback(error, data, response);
478
+ }
479
+ });
480
+
481
+ return request;
482
+ }
483
+
484
+ /**
485
+ * Parses an ISO-8601 string representation of a date value.
486
+ * @param {String} str The date value as a string.
487
+ * @returns {Date} The parsed date object.
488
+ */
489
+ static parseDate(str) {
490
+ return new Date(str);
491
+ }
492
+
493
+ /**
494
+ * Converts a value to the specified type.
495
+ * @param {(String|Object)} data The data to convert, as a string or object.
496
+ * @param {(String|Array.<String>|Object.<String, Object>|Function)} type The type to return. Pass a string for simple types
497
+ * or the constructor function for a complex type. Pass an array containing the type name to return an array of that type. To
498
+ * return an object, pass an object with one property whose name is the key type and whose value is the corresponding value type:
499
+ * all properties on <code>data<code> will be converted to this type.
500
+ * @returns An instance of the specified type or null or undefined if data is null or undefined.
501
+ */
502
+ static convertToType(data, type) {
503
+ if (data === null || data === undefined)
504
+ return data
505
+
506
+ switch (type) {
507
+ case 'Boolean':
508
+ return Boolean(data);
509
+ case 'Integer':
510
+ return parseInt(data, 10);
511
+ case 'Number':
512
+ return parseFloat(data);
513
+ case 'String':
514
+ return String(data);
515
+ case 'Date':
516
+ return ApiClient.parseDate(String(data));
517
+ case 'Blob':
518
+ return data;
519
+ default:
520
+ if (type === Object) {
521
+ // generic object, return directly
522
+ return data;
523
+ } else if (typeof type === 'function') {
524
+ // for model type like: User
525
+ return type.constructFromObject(data);
526
+ } else if (Array.isArray(type)) {
527
+ // for array type like: ['String']
528
+ var itemType = type[0];
529
+
530
+ return data.map((item) => {
531
+ return ApiClient.convertToType(item, itemType);
532
+ });
533
+ } else if (typeof type === 'object') {
534
+ // for plain object type like: {'String': 'Integer'}
535
+ var keyType, valueType;
536
+ for (var k in type) {
537
+ if (type.hasOwnProperty(k)) {
538
+ keyType = k;
539
+ valueType = type[k];
540
+ break;
541
+ }
542
+ }
543
+
544
+ var result = {};
545
+ for (var k in data) {
546
+ if (data.hasOwnProperty(k)) {
547
+ var key = ApiClient.convertToType(k, keyType);
548
+ var value = ApiClient.convertToType(data[k], valueType);
549
+ result[key] = value;
550
+ }
551
+ }
552
+
553
+ return result;
554
+ } else {
555
+ // for unknown type, return the data directly
556
+ return data;
557
+ }
558
+ }
559
+ }
560
+
561
+ /**
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
+ */
566
+ static constructFromObject(data, obj, itemType) {
567
+ if (Array.isArray(data)) {
568
+ for (var i = 0; i < data.length; i++) {
569
+ if (data.hasOwnProperty(i))
570
+ obj[i] = ApiClient.convertToType(data[i], itemType);
571
+ }
572
+ } else {
573
+ for (var k in data) {
574
+ if (data.hasOwnProperty(k))
575
+ obj[k] = ApiClient.convertToType(data[k], itemType);
576
+ }
577
+ }
578
+ };
579
+ }
580
+
581
+ /**
582
+ * The default API client implementation.
583
+ * @type {module:ApiClient}
584
+ */
585
+ ApiClient.instance = new ApiClient();