@memori.ai/memori-api-client 0.1.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 (70) hide show
  1. package/LICENSE +18 -0
  2. package/README.md +188 -0
  3. package/dist/apiFetcher.d.ts +13 -0
  4. package/dist/backend/asset.d.ts +44 -0
  5. package/dist/backend/integration.d.ts +55 -0
  6. package/dist/backend/invitation.d.ts +82 -0
  7. package/dist/backend/memori.d.ts +125 -0
  8. package/dist/backend/user.d.ts +109 -0
  9. package/dist/backend.d.ts +273 -0
  10. package/dist/constants.d.ts +2 -0
  11. package/dist/engine/correlationPairs.d.ts +20 -0
  12. package/dist/engine/dialog.d.ts +88 -0
  13. package/dist/engine/importExport.d.ts +34 -0
  14. package/dist/engine/intents.d.ts +65 -0
  15. package/dist/engine/localizationKeys.d.ts +50 -0
  16. package/dist/engine/media.d.ts +48 -0
  17. package/dist/engine/memori.d.ts +30 -0
  18. package/dist/engine/memories.d.ts +50 -0
  19. package/dist/engine/nlp.d.ts +25 -0
  20. package/dist/engine/people.d.ts +46 -0
  21. package/dist/engine/promptedQuestions.d.ts +37 -0
  22. package/dist/engine/search.d.ts +30 -0
  23. package/dist/engine/session.d.ts +28 -0
  24. package/dist/engine/stats.d.ts +25 -0
  25. package/dist/engine/unansweredQuestions.d.ts +22 -0
  26. package/dist/engine/webhooks.d.ts +21 -0
  27. package/dist/engine.d.ts +297 -0
  28. package/dist/helpers/asset.d.ts +20 -0
  29. package/dist/helpers/getApiUrl.d.ts +1 -0
  30. package/dist/index.d.ts +582 -0
  31. package/dist/index.js +8 -0
  32. package/dist/memori-api-client.cjs.development.js +3666 -0
  33. package/dist/memori-api-client.cjs.development.js.map +1 -0
  34. package/dist/memori-api-client.cjs.production.min.js +2 -0
  35. package/dist/memori-api-client.cjs.production.min.js.map +1 -0
  36. package/dist/memori-api-client.esm.js +3660 -0
  37. package/dist/memori-api-client.esm.js.map +1 -0
  38. package/dist/speech.d.ts +10 -0
  39. package/dist/types.d.ts +410 -0
  40. package/package.json +125 -0
  41. package/src/apiFetcher.ts +29 -0
  42. package/src/backend/asset.ts +86 -0
  43. package/src/backend/integration.ts +98 -0
  44. package/src/backend/invitation.ts +115 -0
  45. package/src/backend/memori.ts +223 -0
  46. package/src/backend/user.ts +186 -0
  47. package/src/backend.ts +20 -0
  48. package/src/constants.ts +21 -0
  49. package/src/engine/correlationPairs.ts +31 -0
  50. package/src/engine/dialog.ts +158 -0
  51. package/src/engine/importExport.ts +43 -0
  52. package/src/engine/intents.ts +116 -0
  53. package/src/engine/localizationKeys.ts +94 -0
  54. package/src/engine/media.ts +79 -0
  55. package/src/engine/memori.ts +51 -0
  56. package/src/engine/memories.ts +89 -0
  57. package/src/engine/nlp.ts +39 -0
  58. package/src/engine/people.ts +82 -0
  59. package/src/engine/promptedQuestions.ts +63 -0
  60. package/src/engine/search.ts +49 -0
  61. package/src/engine/session.ts +49 -0
  62. package/src/engine/stats.ts +44 -0
  63. package/src/engine/unansweredQuestions.ts +38 -0
  64. package/src/engine/webhooks.ts +32 -0
  65. package/src/engine.ts +51 -0
  66. package/src/helpers/asset.ts +52 -0
  67. package/src/helpers/getApiUrl.ts +6 -0
  68. package/src/index.ts +20 -0
  69. package/src/speech.ts +242 -0
  70. package/src/types.ts +440 -0
@@ -0,0 +1,3666 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
6
+
7
+ var fetch$1 = _interopDefault(require('cross-fetch'));
8
+ var speechSdk = require('microsoft-cognitiveservices-speech-sdk');
9
+
10
+ function _regeneratorRuntime() {
11
+ /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
12
+
13
+ _regeneratorRuntime = function () {
14
+ return exports;
15
+ };
16
+
17
+ var exports = {},
18
+ Op = Object.prototype,
19
+ hasOwn = Op.hasOwnProperty,
20
+ $Symbol = "function" == typeof Symbol ? Symbol : {},
21
+ iteratorSymbol = $Symbol.iterator || "@@iterator",
22
+ asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
23
+ toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
24
+
25
+ function define(obj, key, value) {
26
+ return Object.defineProperty(obj, key, {
27
+ value: value,
28
+ enumerable: !0,
29
+ configurable: !0,
30
+ writable: !0
31
+ }), obj[key];
32
+ }
33
+
34
+ try {
35
+ define({}, "");
36
+ } catch (err) {
37
+ define = function (obj, key, value) {
38
+ return obj[key] = value;
39
+ };
40
+ }
41
+
42
+ function wrap(innerFn, outerFn, self, tryLocsList) {
43
+ var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
44
+ generator = Object.create(protoGenerator.prototype),
45
+ context = new Context(tryLocsList || []);
46
+ return generator._invoke = function (innerFn, self, context) {
47
+ var state = "suspendedStart";
48
+ return function (method, arg) {
49
+ if ("executing" === state) throw new Error("Generator is already running");
50
+
51
+ if ("completed" === state) {
52
+ if ("throw" === method) throw arg;
53
+ return doneResult();
54
+ }
55
+
56
+ for (context.method = method, context.arg = arg;;) {
57
+ var delegate = context.delegate;
58
+
59
+ if (delegate) {
60
+ var delegateResult = maybeInvokeDelegate(delegate, context);
61
+
62
+ if (delegateResult) {
63
+ if (delegateResult === ContinueSentinel) continue;
64
+ return delegateResult;
65
+ }
66
+ }
67
+
68
+ if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
69
+ if ("suspendedStart" === state) throw state = "completed", context.arg;
70
+ context.dispatchException(context.arg);
71
+ } else "return" === context.method && context.abrupt("return", context.arg);
72
+ state = "executing";
73
+ var record = tryCatch(innerFn, self, context);
74
+
75
+ if ("normal" === record.type) {
76
+ if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
77
+ return {
78
+ value: record.arg,
79
+ done: context.done
80
+ };
81
+ }
82
+
83
+ "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
84
+ }
85
+ };
86
+ }(innerFn, self, context), generator;
87
+ }
88
+
89
+ function tryCatch(fn, obj, arg) {
90
+ try {
91
+ return {
92
+ type: "normal",
93
+ arg: fn.call(obj, arg)
94
+ };
95
+ } catch (err) {
96
+ return {
97
+ type: "throw",
98
+ arg: err
99
+ };
100
+ }
101
+ }
102
+
103
+ exports.wrap = wrap;
104
+ var ContinueSentinel = {};
105
+
106
+ function Generator() {}
107
+
108
+ function GeneratorFunction() {}
109
+
110
+ function GeneratorFunctionPrototype() {}
111
+
112
+ var IteratorPrototype = {};
113
+ define(IteratorPrototype, iteratorSymbol, function () {
114
+ return this;
115
+ });
116
+ var getProto = Object.getPrototypeOf,
117
+ NativeIteratorPrototype = getProto && getProto(getProto(values([])));
118
+ NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
119
+ var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
120
+
121
+ function defineIteratorMethods(prototype) {
122
+ ["next", "throw", "return"].forEach(function (method) {
123
+ define(prototype, method, function (arg) {
124
+ return this._invoke(method, arg);
125
+ });
126
+ });
127
+ }
128
+
129
+ function AsyncIterator(generator, PromiseImpl) {
130
+ function invoke(method, arg, resolve, reject) {
131
+ var record = tryCatch(generator[method], generator, arg);
132
+
133
+ if ("throw" !== record.type) {
134
+ var result = record.arg,
135
+ value = result.value;
136
+ return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
137
+ invoke("next", value, resolve, reject);
138
+ }, function (err) {
139
+ invoke("throw", err, resolve, reject);
140
+ }) : PromiseImpl.resolve(value).then(function (unwrapped) {
141
+ result.value = unwrapped, resolve(result);
142
+ }, function (error) {
143
+ return invoke("throw", error, resolve, reject);
144
+ });
145
+ }
146
+
147
+ reject(record.arg);
148
+ }
149
+
150
+ var previousPromise;
151
+
152
+ this._invoke = function (method, arg) {
153
+ function callInvokeWithMethodAndArg() {
154
+ return new PromiseImpl(function (resolve, reject) {
155
+ invoke(method, arg, resolve, reject);
156
+ });
157
+ }
158
+
159
+ return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
160
+ };
161
+ }
162
+
163
+ function maybeInvokeDelegate(delegate, context) {
164
+ var method = delegate.iterator[context.method];
165
+
166
+ if (undefined === method) {
167
+ if (context.delegate = null, "throw" === context.method) {
168
+ if (delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel;
169
+ context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
170
+ }
171
+
172
+ return ContinueSentinel;
173
+ }
174
+
175
+ var record = tryCatch(method, delegate.iterator, context.arg);
176
+ if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
177
+ var info = record.arg;
178
+ return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
179
+ }
180
+
181
+ function pushTryEntry(locs) {
182
+ var entry = {
183
+ tryLoc: locs[0]
184
+ };
185
+ 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
186
+ }
187
+
188
+ function resetTryEntry(entry) {
189
+ var record = entry.completion || {};
190
+ record.type = "normal", delete record.arg, entry.completion = record;
191
+ }
192
+
193
+ function Context(tryLocsList) {
194
+ this.tryEntries = [{
195
+ tryLoc: "root"
196
+ }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
197
+ }
198
+
199
+ function values(iterable) {
200
+ if (iterable) {
201
+ var iteratorMethod = iterable[iteratorSymbol];
202
+ if (iteratorMethod) return iteratorMethod.call(iterable);
203
+ if ("function" == typeof iterable.next) return iterable;
204
+
205
+ if (!isNaN(iterable.length)) {
206
+ var i = -1,
207
+ next = function next() {
208
+ for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
209
+
210
+ return next.value = undefined, next.done = !0, next;
211
+ };
212
+
213
+ return next.next = next;
214
+ }
215
+ }
216
+
217
+ return {
218
+ next: doneResult
219
+ };
220
+ }
221
+
222
+ function doneResult() {
223
+ return {
224
+ value: undefined,
225
+ done: !0
226
+ };
227
+ }
228
+
229
+ return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
230
+ var ctor = "function" == typeof genFun && genFun.constructor;
231
+ return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
232
+ }, exports.mark = function (genFun) {
233
+ return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
234
+ }, exports.awrap = function (arg) {
235
+ return {
236
+ __await: arg
237
+ };
238
+ }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
239
+ return this;
240
+ }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
241
+ void 0 === PromiseImpl && (PromiseImpl = Promise);
242
+ var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
243
+ return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
244
+ return result.done ? result.value : iter.next();
245
+ });
246
+ }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
247
+ return this;
248
+ }), define(Gp, "toString", function () {
249
+ return "[object Generator]";
250
+ }), exports.keys = function (object) {
251
+ var keys = [];
252
+
253
+ for (var key in object) keys.push(key);
254
+
255
+ return keys.reverse(), function next() {
256
+ for (; keys.length;) {
257
+ var key = keys.pop();
258
+ if (key in object) return next.value = key, next.done = !1, next;
259
+ }
260
+
261
+ return next.done = !0, next;
262
+ };
263
+ }, exports.values = values, Context.prototype = {
264
+ constructor: Context,
265
+ reset: function (skipTempReset) {
266
+ if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
267
+ },
268
+ stop: function () {
269
+ this.done = !0;
270
+ var rootRecord = this.tryEntries[0].completion;
271
+ if ("throw" === rootRecord.type) throw rootRecord.arg;
272
+ return this.rval;
273
+ },
274
+ dispatchException: function (exception) {
275
+ if (this.done) throw exception;
276
+ var context = this;
277
+
278
+ function handle(loc, caught) {
279
+ return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
280
+ }
281
+
282
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
283
+ var entry = this.tryEntries[i],
284
+ record = entry.completion;
285
+ if ("root" === entry.tryLoc) return handle("end");
286
+
287
+ if (entry.tryLoc <= this.prev) {
288
+ var hasCatch = hasOwn.call(entry, "catchLoc"),
289
+ hasFinally = hasOwn.call(entry, "finallyLoc");
290
+
291
+ if (hasCatch && hasFinally) {
292
+ if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
293
+ if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
294
+ } else if (hasCatch) {
295
+ if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
296
+ } else {
297
+ if (!hasFinally) throw new Error("try statement without catch or finally");
298
+ if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
299
+ }
300
+ }
301
+ }
302
+ },
303
+ abrupt: function (type, arg) {
304
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
305
+ var entry = this.tryEntries[i];
306
+
307
+ if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
308
+ var finallyEntry = entry;
309
+ break;
310
+ }
311
+ }
312
+
313
+ finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
314
+ var record = finallyEntry ? finallyEntry.completion : {};
315
+ return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
316
+ },
317
+ complete: function (record, afterLoc) {
318
+ if ("throw" === record.type) throw record.arg;
319
+ return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
320
+ },
321
+ finish: function (finallyLoc) {
322
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
323
+ var entry = this.tryEntries[i];
324
+ if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
325
+ }
326
+ },
327
+ catch: function (tryLoc) {
328
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
329
+ var entry = this.tryEntries[i];
330
+
331
+ if (entry.tryLoc === tryLoc) {
332
+ var record = entry.completion;
333
+
334
+ if ("throw" === record.type) {
335
+ var thrown = record.arg;
336
+ resetTryEntry(entry);
337
+ }
338
+
339
+ return thrown;
340
+ }
341
+ }
342
+
343
+ throw new Error("illegal catch attempt");
344
+ },
345
+ delegateYield: function (iterable, resultName, nextLoc) {
346
+ return this.delegate = {
347
+ iterator: values(iterable),
348
+ resultName: resultName,
349
+ nextLoc: nextLoc
350
+ }, "next" === this.method && (this.arg = undefined), ContinueSentinel;
351
+ }
352
+ }, exports;
353
+ }
354
+
355
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
356
+ try {
357
+ var info = gen[key](arg);
358
+ var value = info.value;
359
+ } catch (error) {
360
+ reject(error);
361
+ return;
362
+ }
363
+
364
+ if (info.done) {
365
+ resolve(value);
366
+ } else {
367
+ Promise.resolve(value).then(_next, _throw);
368
+ }
369
+ }
370
+
371
+ function _asyncToGenerator(fn) {
372
+ return function () {
373
+ var self = this,
374
+ args = arguments;
375
+ return new Promise(function (resolve, reject) {
376
+ var gen = fn.apply(self, args);
377
+
378
+ function _next(value) {
379
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
380
+ }
381
+
382
+ function _throw(err) {
383
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
384
+ }
385
+
386
+ _next(undefined);
387
+ });
388
+ };
389
+ }
390
+
391
+ function _extends() {
392
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
393
+ for (var i = 1; i < arguments.length; i++) {
394
+ var source = arguments[i];
395
+
396
+ for (var key in source) {
397
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
398
+ target[key] = source[key];
399
+ }
400
+ }
401
+ }
402
+
403
+ return target;
404
+ };
405
+ return _extends.apply(this, arguments);
406
+ }
407
+
408
+ var getApiUrl = function getApiUrl(hostname) {
409
+ return hostname ? new URL(hostname.startsWith('http') ? hostname : "https://" + hostname).origin.replace('http://', 'https://') : 'https://backend.memori.ai';
410
+ };
411
+
412
+ var fetcher = function fetcher(path, opts) {
413
+ return fetch$1("" + opts.apiUrl + path, _extends({}, opts, {
414
+ body: opts != null && opts.body ? JSON.stringify(opts.body) : undefined,
415
+ mode: 'cors',
416
+ credentials: 'include',
417
+ headers: _extends({
418
+ // "Access-Control-Allow-Origin": "*",
419
+ 'Content-Type': 'application/json'
420
+ }, opts == null ? void 0 : opts.headers)
421
+ })).then(function (res) {
422
+ return res.json();
423
+ });
424
+ };
425
+ var devFetcher = function devFetcher(data) {
426
+ return Promise.resolve(data);
427
+ };
428
+ var apiFetcher = process.env.CI === 'true' || "development" === 'test' ? devFetcher : fetcher;
429
+
430
+ var memori = (function (apiUrl) {
431
+ return {
432
+ /**
433
+ * Gets a list of all the public Memori objects for a specific Tenant.
434
+ * @param tenant - The name of the tenant
435
+ * @returns A list of Memori objects
436
+ */
437
+ getTenantPublicMemoriList: function getTenantPublicMemoriList(tenant) {
438
+ return apiFetcher("/TenantPublicMemori/" + encodeURI(tenant), {
439
+ apiUrl: apiUrl
440
+ });
441
+ },
442
+
443
+ /**
444
+ * Gets a list of all the public Memori objects for a specific Tenant accessible from user session.
445
+ * @param authToken - The login token
446
+ * @returns A list of Memori objects
447
+ */
448
+ getPublicMemoriList: function getPublicMemoriList(authToken) {
449
+ return apiFetcher("/PublicMemori/" + authToken, {
450
+ apiUrl: apiUrl
451
+ });
452
+ },
453
+
454
+ /**
455
+ * Gets a list of all Memori objects.
456
+ * @param authToken - The login token
457
+ * @returns A list of Memori objects
458
+ */
459
+ getAllMemori: function getAllMemori(authToken) {
460
+ return apiFetcher("/AllMemori/" + authToken, {
461
+ apiUrl: apiUrl
462
+ });
463
+ },
464
+
465
+ /**
466
+ * Gets a list of Memori objects for the currently logged in User.
467
+ * @param authToken - The login token
468
+ * @returns A list of Memori objects
469
+ */
470
+ getUserMemoriList: function getUserMemoriList(authToken) {
471
+ return apiFetcher("/Memori/" + authToken, {
472
+ apiUrl: apiUrl
473
+ });
474
+ },
475
+
476
+ /**
477
+ * Gets a list of Memori objects for the currently logged in User.
478
+ * @param authToken - The login token
479
+ * @returns A list of Memori objects
480
+ */
481
+ getSharedMemoriList: function getSharedMemoriList(authToken) {
482
+ return apiFetcher("/SharedMemori/" + authToken, {
483
+ apiUrl: apiUrl
484
+ });
485
+ },
486
+
487
+ /**
488
+ * Gets a list of all the known Memori categories (or tags).
489
+ * @param {string} tenant - The name of the tenant
490
+ * @returns A list of Memori categories
491
+ */
492
+ getTenantCategories: function getTenantCategories(tenant) {
493
+ return apiFetcher("/TenantMemoriCategories/" + encodeURI(tenant), {
494
+ apiUrl: apiUrl
495
+ });
496
+ },
497
+
498
+ /**
499
+ * Gets a list of all the Memori Configuration objects.
500
+ * @param authToken - The login token
501
+ * @returns A list of Memori Configuration objects
502
+ */
503
+ getMemoriConfigs: function getMemoriConfigs(authToken) {
504
+ return apiFetcher("/MemoriConfigs/" + authToken, {
505
+ apiUrl: apiUrl
506
+ });
507
+ },
508
+
509
+ /**
510
+ * Register a new Memori object.
511
+ * @param authToken - The login token
512
+ * @param memori - The Memori object
513
+ * @returns The created Memori object
514
+ */
515
+ createMemori: function createMemori(authToken, memori) {
516
+ return apiFetcher("/Memori/" + authToken, {
517
+ apiUrl: apiUrl,
518
+ body: memori,
519
+ method: 'POST'
520
+ });
521
+ },
522
+
523
+ /**
524
+ * Update an existing Memori object.
525
+ * @param authToken - The login token
526
+ * @param memori - The Memori object
527
+ * @returns The created Memori object
528
+ */
529
+ updateMemori: function updateMemori(authToken, memori) {
530
+ return apiFetcher("/Memori/" + authToken + "/" + memori.memoriID, {
531
+ apiUrl: apiUrl,
532
+ body: memori,
533
+ method: 'PATCH'
534
+ });
535
+ },
536
+
537
+ /**
538
+ * Deletes an existing Memori object.
539
+ * @param authToken - The login token
540
+ * @param memori - The Memori object
541
+ */
542
+ deleteMemori: function deleteMemori(authToken, memori) {
543
+ return apiFetcher("/Memori/" + authToken, {
544
+ apiUrl: apiUrl,
545
+ body: memori,
546
+ method: 'DELETE'
547
+ });
548
+ },
549
+
550
+ /**
551
+ * Gets the details of a Memori object of the currently logged in User.
552
+ * @param authToken - The login token
553
+ * @param memoriID - The ID of the Memori object
554
+ * @returns A Memori object
555
+ */
556
+ getMemoriById: function getMemoriById(authToken, memoriID) {
557
+ return apiFetcher("/Memori/" + authToken + "/" + memoriID, {
558
+ apiUrl: apiUrl
559
+ });
560
+ },
561
+
562
+ /**
563
+ * Gets the details of a Memori object of the currently logged in User.
564
+ * @param {string} tenantName - The Name of the Tenant
565
+ * @param {string} userID - The ID of the User object
566
+ * @param {string} memoriID - The ID of the Memori object
567
+ * @param {string?} authToken - The login token
568
+ * @returns A Memori object
569
+ */
570
+ getMemoriByUserAndId: function getMemoriByUserAndId(tenantName, userID, memoriID, authToken) {
571
+ return apiFetcher("/MemoriById/" + tenantName + "/" + userID + "/" + memoriID + (authToken ? "/" + authToken : ''), {
572
+ apiUrl: apiUrl
573
+ });
574
+ },
575
+
576
+ /**
577
+ * Gets the details of a Memori object by name, owner and tenant
578
+ * @param {string} tenant - The name of the tenant
579
+ * @param {string} userName - The name of the user
580
+ * @param {string} memoriName - The name of the Memori object
581
+ * @param {string=} [authToken=''] - The token of the Memori object
582
+ */
583
+ getMemori: function getMemori(tenant, userName, memoriName, authToken) {
584
+ return apiFetcher("/Memori/" + encodeURI(tenant) + "/" + encodeURI(userName) + "/" + encodeURI(memoriName) + "/" + (authToken != null ? authToken : ''), {
585
+ apiUrl: apiUrl
586
+ });
587
+ },
588
+
589
+ /**
590
+ * Gets the statistics for sessions opened in a specified interval for the specified Memori object.
591
+ * @param {string} authToken - The login token
592
+ * @param {string} memoriID - The ID of the Memori object
593
+ * @param {string=} dateFrom - The optional begin of the date interval, in UTC time, in the format yyyyMMddHHmmssfff
594
+ * @param {string=} dateTo - The optional end of the date interval, in UTC time, in the format yyyyMMddHHmmssfff
595
+ */
596
+ getMemoriSessions: function getMemoriSessions(authToken, memoriID, dateFrom, dateTo) {
597
+ return apiFetcher("/MemoriSessions/" + authToken + "/" + memoriID + (dateFrom ? "/" + dateFrom : '') + (dateFrom && dateTo ? "/" + dateTo : ''), {
598
+ apiUrl: apiUrl
599
+ });
600
+ }
601
+ };
602
+ });
603
+
604
+ var user = (function (apiUrl) {
605
+ return {
606
+ /**
607
+ * Registers a new user.
608
+ * @param user - The user object
609
+ * @returns The created user object
610
+ */
611
+ userSignIn: function userSignIn(user) {
612
+ return apiFetcher('/User', {
613
+ apiUrl: apiUrl,
614
+ body: user,
615
+ method: 'POST'
616
+ });
617
+ },
618
+
619
+ /**
620
+ * Confirms the registration of a User and performs a Login.
621
+ * @param user - The user object
622
+ * @returns The created user object
623
+ */
624
+ userConfirmSignIn: function userConfirmSignIn(user) {
625
+ return apiFetcher('/UserConfirm', {
626
+ apiUrl: apiUrl,
627
+ body: user,
628
+ method: 'POST'
629
+ });
630
+ },
631
+
632
+ /**
633
+ * Tries a login with the specified credentials and returns a login token if successful.
634
+ * @param user - The user object
635
+ * @returns The logged in user object
636
+ */
637
+ userLogin: function userLogin(user) {
638
+ return apiFetcher('/Login', {
639
+ apiUrl: apiUrl,
640
+ body: user,
641
+ method: 'POST'
642
+ });
643
+ },
644
+
645
+ /**
646
+ * Logs out the user.
647
+ * @param authToken - The login token
648
+ */
649
+ userLogout: function userLogout(authToken) {
650
+ return apiFetcher("/Logout/" + authToken, {
651
+ apiUrl: apiUrl,
652
+ method: 'POST'
653
+ });
654
+ },
655
+
656
+ /**
657
+ * Gets the details of a User object.
658
+ * @param authToken - The login token
659
+ * @param userID - The user ID
660
+ * @returns The user object
661
+ */
662
+ getUser: function getUser(authToken, userID) {
663
+ return apiFetcher("/User/" + authToken + "/" + userID, {
664
+ apiUrl: apiUrl
665
+ });
666
+ },
667
+
668
+ /**
669
+ * Gets a list of all the existing User objects.
670
+ * @param authToken - The login token
671
+ * @returns A list of User objects
672
+ */
673
+ getUsersList: function getUsersList(authToken) {
674
+ return apiFetcher("/Users/" + authToken, {
675
+ apiUrl: apiUrl
676
+ });
677
+ },
678
+
679
+ /**
680
+ * Deletes the currently logged in User.
681
+ * @param {string} authToken - The login token
682
+ * @param {string} userID: The User ID
683
+ */
684
+ deleteUser: function deleteUser(authToken, userID) {
685
+ return apiFetcher("/User/" + authToken + "/" + userID, {
686
+ apiUrl: apiUrl,
687
+ method: 'DELETE'
688
+ });
689
+ },
690
+
691
+ /**
692
+ * Updates the details of a User object.
693
+ * @param authToken - The login token
694
+ * @param userID - The user ID
695
+ * @returns The user object
696
+ */
697
+ updateUser: function updateUser(authToken, userID, user) {
698
+ return apiFetcher("/User/" + authToken + "/" + userID, {
699
+ apiUrl: apiUrl,
700
+ method: 'PATCH',
701
+ body: user
702
+ });
703
+ },
704
+
705
+ /**
706
+ * Resets a User's password.
707
+ * If found, the User receives a verification code via e-mail.
708
+ * The code must be sent via the ResetConfirm API, passing the same User object
709
+ * sent to this API with the addition of the verification code and the new password.
710
+ * @param {User} user - The user object
711
+ */
712
+ resetPassword: function resetPassword(user) {
713
+ return apiFetcher("/ResetPassword", {
714
+ apiUrl: apiUrl,
715
+ body: user,
716
+ method: 'POST'
717
+ });
718
+ },
719
+
720
+ /**
721
+ * Confirms the password reset of a User and performs a Login
722
+ * @param {User} user - The user object
723
+ */
724
+ resetConfirm: function resetConfirm(user) {
725
+ return apiFetcher("/ResetConfirm", {
726
+ apiUrl: apiUrl,
727
+ body: user,
728
+ method: 'POST'
729
+ });
730
+ },
731
+
732
+ /**
733
+ * Recovers a User's name and sends it to their configured e-mail.
734
+ * @param {User} user - The user object
735
+ */
736
+ recoverUsername: function recoverUsername(user) {
737
+ return apiFetcher("/RecoverUsername", {
738
+ apiUrl: apiUrl,
739
+ body: user,
740
+ method: 'POST'
741
+ });
742
+ },
743
+
744
+ /**
745
+ * Gets the details of a Tenant object.
746
+ * @param tenantName - The name of the tenant
747
+ */
748
+ getTenantConfig: function getTenantConfig(tenantName) {
749
+ return apiFetcher("/Tenant/" + tenantName, {
750
+ apiUrl: apiUrl
751
+ });
752
+ },
753
+
754
+ /**
755
+ * Re-sends the verification code to confirm a pending User registration.
756
+ * @param {User} user - The user object
757
+ */
758
+ resendVerificationCode: function resendVerificationCode(user) {
759
+ return apiFetcher("/ResendVerificationCode", {
760
+ apiUrl: apiUrl,
761
+ body: user,
762
+ method: 'POST'
763
+ });
764
+ },
765
+
766
+ /**
767
+ * Registers a new user.
768
+ * @param {User} user - The user object
769
+ */
770
+ createUser: function createUser(authToken, user) {
771
+ return apiFetcher("/User/" + authToken, {
772
+ apiUrl: apiUrl,
773
+ body: user,
774
+ method: 'POST'
775
+ });
776
+ }
777
+ };
778
+ });
779
+
780
+ var integration = (function (apiUrl) {
781
+ return {
782
+ /**
783
+ * Gets a list of integration objects for a specified Memori object.
784
+ * @param memoriID - The id of the Memori object
785
+ * @param authToken - The login token
786
+ * @returns A list of Integration objects
787
+ */
788
+ getMemoriIntegrationsList: function getMemoriIntegrationsList(authToken, memoriID) {
789
+ return apiFetcher("/Integrations/" + authToken + "/" + memoriID, {
790
+ apiUrl: apiUrl
791
+ });
792
+ },
793
+
794
+ /**
795
+ * Gets a list of integration objects.
796
+ * @param authToken - The login token
797
+ * @returns A list of Integration objects
798
+ */
799
+ getAllIntegrationsList: function getAllIntegrationsList(authToken) {
800
+ return apiFetcher("/AllIntegrations/" + authToken, {
801
+ apiUrl: apiUrl
802
+ });
803
+ },
804
+
805
+ /**
806
+ * Gets the detail of an integration object of the currently logged in User.
807
+ * @param authToken - The login token
808
+ * @param integrationID - The ID of the integration object
809
+ * @returns The Integration object
810
+ */
811
+ getIntegration: function getIntegration(authToken, integrationID) {
812
+ return apiFetcher("/Integration/" + authToken + "/" + integrationID, {
813
+ apiUrl: apiUrl
814
+ });
815
+ },
816
+
817
+ /**
818
+ * Delete an exsisting integration object.
819
+ * @param authToken - The login token
820
+ * @param integrationID - The ID of the integration object
821
+ */
822
+ deleteIntegration: function deleteIntegration(authToken, integrationID) {
823
+ return apiFetcher("/Integration/" + authToken + "/" + integrationID, {
824
+ apiUrl: apiUrl,
825
+ method: 'DELETE'
826
+ });
827
+ },
828
+
829
+ /**
830
+ * Register a new integration object.
831
+ * @param authToken - The login token
832
+ * @param integration - The Integration object
833
+ * @returns The Integration object
834
+ */
835
+ createIntegration: function createIntegration(authToken, integration) {
836
+ return apiFetcher("/Integration/" + authToken, {
837
+ apiUrl: apiUrl,
838
+ method: 'POST',
839
+ body: integration
840
+ });
841
+ },
842
+
843
+ /**
844
+ * Updates the integration object.
845
+ * @param authToken - The login token
846
+ * @param integrationID - The id of the Integration object
847
+ * @param integration - The Integration object
848
+ * @returns The Integration object
849
+ */
850
+ updateIntegration: function updateIntegration(authToken, integrationID, integration) {
851
+ return apiFetcher("/Integration/" + authToken + "/" + integrationID, {
852
+ apiUrl: apiUrl,
853
+ method: 'PATCH',
854
+ body: integration
855
+ });
856
+ }
857
+ };
858
+ });
859
+
860
+ var asset = (function (apiUrl) {
861
+ return {
862
+ /**
863
+ * URL to upload a file creating a new Asset object to access it.
864
+ * @param {string} authToken - The login token
865
+ * @param {string} memoriID - The memori ID
866
+ * @param {string=} memoryID - The memory ID
867
+ * @returns The URL to upload a file
868
+ */
869
+ getUploadAssetURL: function getUploadAssetURL(authToken, memoriID, memoryID) {
870
+ return apiUrl + "/Asset/" + authToken + "/" + memoriID + (memoryID ? "/" + memoryID : '');
871
+ },
872
+
873
+ /**
874
+ * Uploads a file and creates a new Asset object to access it.
875
+ * @param {string} authToken - The login token
876
+ * @param {string} memoriID - The memori ID
877
+ * @param {string=} memoryID - The memory ID
878
+ * @returns Response of an Upload Asset request.
879
+ */
880
+ uploadAsset: function () {
881
+ var _uploadAsset = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(fileName, fileUrl, authToken, memoriID, memoryID) {
882
+ var data, file, fileBlob, upload;
883
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
884
+ while (1) {
885
+ switch (_context.prev = _context.next) {
886
+ case 0:
887
+ data = new FormData();
888
+ _context.next = 3;
889
+ return fetch(fileUrl);
890
+
891
+ case 3:
892
+ file = _context.sent;
893
+ _context.next = 6;
894
+ return file.blob();
895
+
896
+ case 6:
897
+ fileBlob = _context.sent;
898
+ data.append(fileName, fileBlob, fileName);
899
+ _context.next = 10;
900
+ return fetch(apiUrl + "/Asset/" + authToken + "/" + memoriID + (memoryID ? "/" + memoryID : ''), {
901
+ method: 'POST',
902
+ body: data
903
+ });
904
+
905
+ case 10:
906
+ upload = _context.sent;
907
+ _context.next = 13;
908
+ return upload.json();
909
+
910
+ case 13:
911
+ return _context.abrupt("return", _context.sent);
912
+
913
+ case 14:
914
+ case "end":
915
+ return _context.stop();
916
+ }
917
+ }
918
+ }, _callee);
919
+ }));
920
+
921
+ function uploadAsset(_x, _x2, _x3, _x4, _x5) {
922
+ return _uploadAsset.apply(this, arguments);
923
+ }
924
+
925
+ return uploadAsset;
926
+ }(),
927
+
928
+ /**
929
+ * Downloads a file from an Asset object
930
+ * @param {string} fileName - The file name
931
+ * @param {string} sessionID - The session ID
932
+ * @returns The asset file
933
+ */
934
+ getAsset: function getAsset(fileName, sessionID) {
935
+ return apiFetcher("/Asset/" + fileName + "/" + sessionID, {
936
+ apiUrl: apiUrl,
937
+ method: 'GET'
938
+ });
939
+ },
940
+
941
+ /**
942
+ * Updates an Asset object
943
+ * @param {string} authToken - The login token
944
+ * @param {string} assetURL - The asset URL
945
+ * @returns The updated asset object
946
+ */
947
+ updateAsset: function updateAsset(authToken, assetURL, asset) {
948
+ return apiFetcher("/Asset/" + authToken + "/" + assetURL.split('/').reverse()[0], {
949
+ apiUrl: apiUrl,
950
+ method: 'PATCH',
951
+ body: asset
952
+ });
953
+ },
954
+
955
+ /**
956
+ * Deletes an Asset object
957
+ * @param {string} authToken - The login token
958
+ * @param {string} assetURL - The asset URL
959
+ */
960
+ deleteAsset: function deleteAsset(authToken, assetURL) {
961
+ return apiFetcher("/Asset/" + authToken + "/" + assetURL.split('/').reverse()[0], {
962
+ apiUrl: apiUrl,
963
+ method: 'DELETE'
964
+ });
965
+ }
966
+ };
967
+ });
968
+
969
+ var invitation = (function (apiUrl) {
970
+ return {
971
+ /**
972
+ * Gets a list of invitations sent by the currently logged in User.
973
+ * @param {string} authToken - The login token
974
+ * @returns The list of Invitation objects.
975
+ */
976
+ getSentInvitations: function getSentInvitations(authToken) {
977
+ return apiFetcher("/SentInvitations/" + authToken, {
978
+ apiUrl: apiUrl
979
+ });
980
+ },
981
+
982
+ /**
983
+ * Gets a list of invitations received by the currently logged in User.
984
+ * @param {string} authToken - The login token
985
+ * @returns The list of Invitation objects.
986
+ */
987
+ getReceivedInvitations: function getReceivedInvitations(authToken) {
988
+ return apiFetcher("/ReceivedInvitations/" + authToken, {
989
+ apiUrl: apiUrl
990
+ });
991
+ },
992
+
993
+ /**
994
+ * Gets a list of all invitation objects
995
+ * @param {string} authToken - The login token
996
+ * @returns The list of Invitation objects.
997
+ */
998
+ getAllInvitations: function getAllInvitations(authToken) {
999
+ return apiFetcher("/AllInvitations/" + authToken, {
1000
+ apiUrl: apiUrl
1001
+ });
1002
+ },
1003
+
1004
+ /**
1005
+ * Gets the details of an Invitation object of the currently logged in User.
1006
+ * @param {string} authToken - The login token
1007
+ * @param {string} invitationId - The ID of the Invitation object
1008
+ * @returns The Invitation object.
1009
+ */
1010
+ getInvitation: function getInvitation(authToken, invitationId) {
1011
+ return apiFetcher("/Invitation/" + authToken + "/" + invitationId, {
1012
+ apiUrl: apiUrl
1013
+ });
1014
+ },
1015
+
1016
+ /**
1017
+ * Updates an existing Invitation object sent by the currently logged in User.
1018
+ * @param {string} authToken - The login token
1019
+ * @param {Invitation} invitation - The Invitation object
1020
+ * @returns The Invitation object.
1021
+ */
1022
+ updateInvitation: function updateInvitation(authToken, invitation) {
1023
+ return apiFetcher("/Invitation/" + authToken + "/" + invitation.invitationID, {
1024
+ apiUrl: apiUrl,
1025
+ method: 'PATCH',
1026
+ body: invitation
1027
+ });
1028
+ },
1029
+
1030
+ /**
1031
+ * Deletes an existing Invitation object.
1032
+ * @param {string} authToken - The login token
1033
+ * @param {string} invitationId - The ID of the Invitation object
1034
+ * @returns The Invitation object.
1035
+ */
1036
+ deleteInvitation: function deleteInvitation(authToken, invitationId) {
1037
+ return apiFetcher("/Invitation/" + authToken + "/" + invitationId, {
1038
+ apiUrl: apiUrl,
1039
+ method: 'DELETE'
1040
+ });
1041
+ },
1042
+
1043
+ /**
1044
+ * Accepts an Invitation object.
1045
+ * @param {string} authToken - The login token
1046
+ * @param {string} invitationId - The ID of the Invitation object
1047
+ * @returns The Invitation object.
1048
+ */
1049
+ acceptInvitation: function acceptInvitation(authToken, invitationId) {
1050
+ return apiFetcher("/AcceptInvitation/" + authToken + "/" + invitationId, {
1051
+ apiUrl: apiUrl,
1052
+ method: 'POST'
1053
+ });
1054
+ },
1055
+
1056
+ /**
1057
+ * Rejects an Invitation object.
1058
+ * @param {string} authToken - The login token
1059
+ * @param {string} invitationId - The ID of the Invitation object
1060
+ * @returns The Invitation object.
1061
+ */
1062
+ rejectInvitation: function rejectInvitation(authToken, invitationId) {
1063
+ return apiFetcher("/RejectInvitation/" + authToken + "/" + invitationId, {
1064
+ apiUrl: apiUrl,
1065
+ method: 'POST'
1066
+ });
1067
+ },
1068
+
1069
+ /**
1070
+ * Send a new Invitation object
1071
+ * @param {string} authToken - The login token
1072
+ * @param {Invitation} invitation - The Invitation object
1073
+ * @returns The Invitation object.
1074
+ */
1075
+ sendInvitation: function sendInvitation(authToken, invitation) {
1076
+ return apiFetcher("/SendInvitation/" + authToken, {
1077
+ apiUrl: apiUrl,
1078
+ method: 'POST',
1079
+ body: invitation
1080
+ });
1081
+ }
1082
+ };
1083
+ });
1084
+
1085
+ var backendAPI = function backendAPI(apiUrl) {
1086
+ return _extends({
1087
+ asset: asset(apiUrl),
1088
+ memori: memori(apiUrl),
1089
+ user: user(apiUrl),
1090
+ integration: integration(apiUrl),
1091
+ invitation: invitation(apiUrl)
1092
+ }, asset(apiUrl), memori(apiUrl), user(apiUrl), integration(apiUrl), invitation(apiUrl));
1093
+ };
1094
+
1095
+ /****************************
1096
+ * *
1097
+ * CorrelationPairs *
1098
+ * *
1099
+ ****************************/
1100
+
1101
+ var correlationPairs = (function (apiUrl) {
1102
+ return {
1103
+ /**
1104
+ * Lists all Correlation Pair objects.
1105
+ * @param {string} sessionId The session ID
1106
+ */
1107
+ getCorrelationPairs: function () {
1108
+ var _getCorrelationPairs = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(sessionId) {
1109
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
1110
+ while (1) {
1111
+ switch (_context.prev = _context.next) {
1112
+ case 0:
1113
+ return _context.abrupt("return", apiFetcher("/CorrelationPairs/" + sessionId, {
1114
+ method: 'GET',
1115
+ apiUrl: apiUrl
1116
+ }));
1117
+
1118
+ case 1:
1119
+ case "end":
1120
+ return _context.stop();
1121
+ }
1122
+ }
1123
+ }, _callee);
1124
+ }));
1125
+
1126
+ function getCorrelationPairs(_x) {
1127
+ return _getCorrelationPairs.apply(this, arguments);
1128
+ }
1129
+
1130
+ return getCorrelationPairs;
1131
+ }(),
1132
+
1133
+ /**
1134
+ * Removes an existing Correlation Pair object.
1135
+ * @param {string} sessionId The session ID
1136
+ * @param {string} pairId The Correlation Pair object ID
1137
+ */
1138
+ deleteCorrelationPair: function () {
1139
+ var _deleteCorrelationPair = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(sessionId, pairId) {
1140
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
1141
+ while (1) {
1142
+ switch (_context2.prev = _context2.next) {
1143
+ case 0:
1144
+ return _context2.abrupt("return", apiFetcher("/CorrelationPair/" + sessionId + "/" + pairId, {
1145
+ method: 'GET',
1146
+ apiUrl: apiUrl
1147
+ }));
1148
+
1149
+ case 1:
1150
+ case "end":
1151
+ return _context2.stop();
1152
+ }
1153
+ }
1154
+ }, _callee2);
1155
+ }));
1156
+
1157
+ function deleteCorrelationPair(_x2, _x3) {
1158
+ return _deleteCorrelationPair.apply(this, arguments);
1159
+ }
1160
+
1161
+ return deleteCorrelationPair;
1162
+ }()
1163
+ };
1164
+ });
1165
+
1166
+ /******************
1167
+ * *
1168
+ * Dialog *
1169
+ * *
1170
+ ******************/
1171
+
1172
+ var dialog = (function (apiUrl) {
1173
+ return {
1174
+ /**
1175
+ * Submits a Text Entered event to the session's Dialog State Machine.
1176
+ * @param {object} params
1177
+ * @param {string} params.sessionId The session ID
1178
+ * @param {string} params.text The text entered by the user
1179
+ */
1180
+ postTextEnteredEvent: function () {
1181
+ var _postTextEnteredEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
1182
+ var sessionId, text;
1183
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
1184
+ while (1) {
1185
+ switch (_context.prev = _context.next) {
1186
+ case 0:
1187
+ sessionId = _ref.sessionId, text = _ref.text;
1188
+ return _context.abrupt("return", apiFetcher("/TextEnteredEvent/" + sessionId, {
1189
+ method: 'POST',
1190
+ apiUrl: apiUrl,
1191
+ body: {
1192
+ text: text
1193
+ }
1194
+ }));
1195
+
1196
+ case 2:
1197
+ case "end":
1198
+ return _context.stop();
1199
+ }
1200
+ }
1201
+ }, _callee);
1202
+ }));
1203
+
1204
+ function postTextEnteredEvent(_x) {
1205
+ return _postTextEnteredEvent.apply(this, arguments);
1206
+ }
1207
+
1208
+ return postTextEnteredEvent;
1209
+ }(),
1210
+
1211
+ /**
1212
+ * Submits a Place Changed event to the session's Dialog State Machine.
1213
+ * @param {object} params
1214
+ * @param {string} params.sessionId - The session ID
1215
+ * @param {string} params.placeName - The name of the place
1216
+ * @param {number} params.latitude - The latitude of the place
1217
+ * @param {number} params.longitude - The longitude of the place
1218
+ * @param {number} params.uncertaintyKm - The uncertainty of the place in kilometers
1219
+ */
1220
+ postPlaceChangedEvent: function () {
1221
+ var _postPlaceChangedEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref2) {
1222
+ var sessionId, placeName, latitude, longitude, uncertaintyKm;
1223
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
1224
+ while (1) {
1225
+ switch (_context2.prev = _context2.next) {
1226
+ case 0:
1227
+ sessionId = _ref2.sessionId, placeName = _ref2.placeName, latitude = _ref2.latitude, longitude = _ref2.longitude, uncertaintyKm = _ref2.uncertaintyKm;
1228
+ return _context2.abrupt("return", apiFetcher("/PlaceChangedEvent/" + sessionId, {
1229
+ method: 'POST',
1230
+ apiUrl: apiUrl,
1231
+ body: {
1232
+ placeName: placeName,
1233
+ latitude: latitude,
1234
+ longitude: longitude,
1235
+ uncertaintyKm: uncertaintyKm
1236
+ }
1237
+ }));
1238
+
1239
+ case 2:
1240
+ case "end":
1241
+ return _context2.stop();
1242
+ }
1243
+ }
1244
+ }, _callee2);
1245
+ }));
1246
+
1247
+ function postPlaceChangedEvent(_x2) {
1248
+ return _postPlaceChangedEvent.apply(this, arguments);
1249
+ }
1250
+
1251
+ return postPlaceChangedEvent;
1252
+ }(),
1253
+
1254
+ /**
1255
+ * Submits a Date Changed event to the session's Dialog State Machine.
1256
+ * @param {string} sessionId The session ID
1257
+ */
1258
+ postDateChangedEvent: function () {
1259
+ var _postDateChangedEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(sessionId) {
1260
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
1261
+ while (1) {
1262
+ switch (_context3.prev = _context3.next) {
1263
+ case 0:
1264
+ return _context3.abrupt("return", apiFetcher("/DateChangedEvent/" + sessionId, {
1265
+ method: 'POST',
1266
+ apiUrl: apiUrl
1267
+ }));
1268
+
1269
+ case 1:
1270
+ case "end":
1271
+ return _context3.stop();
1272
+ }
1273
+ }
1274
+ }, _callee3);
1275
+ }));
1276
+
1277
+ function postDateChangedEvent(_x3) {
1278
+ return _postDateChangedEvent.apply(this, arguments);
1279
+ }
1280
+
1281
+ return postDateChangedEvent;
1282
+ }(),
1283
+
1284
+ /**
1285
+ * Submits a Tag Changed event to the session's Dialog State Machine.
1286
+ * @param {string} sessionId The session ID
1287
+ * @param {string} tag The tag to set
1288
+ */
1289
+ postTagChangedEvent: function () {
1290
+ var _postTagChangedEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(sessionId, tag) {
1291
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
1292
+ while (1) {
1293
+ switch (_context4.prev = _context4.next) {
1294
+ case 0:
1295
+ return _context4.abrupt("return", apiFetcher("/TagChangedEvent/" + sessionId, {
1296
+ method: 'POST',
1297
+ apiUrl: apiUrl,
1298
+ body: {
1299
+ tag: tag
1300
+ }
1301
+ }));
1302
+
1303
+ case 1:
1304
+ case "end":
1305
+ return _context4.stop();
1306
+ }
1307
+ }
1308
+ }, _callee4);
1309
+ }));
1310
+
1311
+ function postTagChangedEvent(_x4, _x5) {
1312
+ return _postTagChangedEvent.apply(this, arguments);
1313
+ }
1314
+
1315
+ return postTagChangedEvent;
1316
+ }(),
1317
+
1318
+ /**
1319
+ * Submits a Timeout event to the session's Dialog State Machine.
1320
+ * @param {string} sessionId The session ID
1321
+ */
1322
+ postTimeoutEvent: function () {
1323
+ var _postTimeoutEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(sessionId) {
1324
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
1325
+ while (1) {
1326
+ switch (_context5.prev = _context5.next) {
1327
+ case 0:
1328
+ return _context5.abrupt("return", apiFetcher("/TimeoutEvent/" + sessionId, {
1329
+ method: 'POST',
1330
+ apiUrl: apiUrl
1331
+ }));
1332
+
1333
+ case 1:
1334
+ case "end":
1335
+ return _context5.stop();
1336
+ }
1337
+ }
1338
+ }, _callee5);
1339
+ }));
1340
+
1341
+ function postTimeoutEvent(_x6) {
1342
+ return _postTimeoutEvent.apply(this, arguments);
1343
+ }
1344
+
1345
+ return postTimeoutEvent;
1346
+ }(),
1347
+
1348
+ /**
1349
+ * Submits a Medium Selected event to the session's Dialog State Machine.
1350
+ * @param {string} sessionId The session ID
1351
+ * @param {Medium} medium The medium to set
1352
+ */
1353
+ postMediumSelectedEvent: function () {
1354
+ var _postMediumSelectedEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(sessionId, medium) {
1355
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
1356
+ while (1) {
1357
+ switch (_context6.prev = _context6.next) {
1358
+ case 0:
1359
+ return _context6.abrupt("return", apiFetcher("/MediumSelectedEvent/" + sessionId, {
1360
+ method: 'POST',
1361
+ apiUrl: apiUrl,
1362
+ body: {
1363
+ medium: medium
1364
+ }
1365
+ }));
1366
+
1367
+ case 1:
1368
+ case "end":
1369
+ return _context6.stop();
1370
+ }
1371
+ }
1372
+ }, _callee6);
1373
+ }));
1374
+
1375
+ function postMediumSelectedEvent(_x7, _x8) {
1376
+ return _postMediumSelectedEvent.apply(this, arguments);
1377
+ }
1378
+
1379
+ return postMediumSelectedEvent;
1380
+ }(),
1381
+
1382
+ /**
1383
+ * Submits a Date Selected event to the session's Dialog State Machine.
1384
+ * @param {string} sessionId The session ID
1385
+ */
1386
+ postDateSelectedEvent: function () {
1387
+ var _postDateSelectedEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(_ref3) {
1388
+ var sessionId;
1389
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
1390
+ while (1) {
1391
+ switch (_context7.prev = _context7.next) {
1392
+ case 0:
1393
+ sessionId = _ref3.sessionId;
1394
+ return _context7.abrupt("return", apiFetcher("/DateSelectedEvent/" + sessionId, {
1395
+ method: 'GET',
1396
+ apiUrl: apiUrl
1397
+ }));
1398
+
1399
+ case 2:
1400
+ case "end":
1401
+ return _context7.stop();
1402
+ }
1403
+ }
1404
+ }, _callee7);
1405
+ }));
1406
+
1407
+ function postDateSelectedEvent(_x9) {
1408
+ return _postDateSelectedEvent.apply(this, arguments);
1409
+ }
1410
+
1411
+ return postDateSelectedEvent;
1412
+ }(),
1413
+
1414
+ /**
1415
+ * Submits a Place Selected event to the session's Dialog State Machine.
1416
+ * @param {string} sessionId The session ID
1417
+ */
1418
+ postPlaceSelectedEvent: function () {
1419
+ var _postPlaceSelectedEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(_ref4) {
1420
+ var sessionId;
1421
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
1422
+ while (1) {
1423
+ switch (_context8.prev = _context8.next) {
1424
+ case 0:
1425
+ sessionId = _ref4.sessionId;
1426
+ return _context8.abrupt("return", apiFetcher("/PlaceSelectedEvent/" + sessionId, {
1427
+ method: 'GET',
1428
+ apiUrl: apiUrl
1429
+ }));
1430
+
1431
+ case 2:
1432
+ case "end":
1433
+ return _context8.stop();
1434
+ }
1435
+ }
1436
+ }, _callee8);
1437
+ }));
1438
+
1439
+ function postPlaceSelectedEvent(_x10) {
1440
+ return _postPlaceSelectedEvent.apply(this, arguments);
1441
+ }
1442
+
1443
+ return postPlaceSelectedEvent;
1444
+ }(),
1445
+
1446
+ /**
1447
+ * Submits a Tag Selected event to the session's Dialog State Machine.
1448
+ * @param {string} sessionId The session ID
1449
+ */
1450
+ postTagSelectedEvent: function () {
1451
+ var _postTagSelectedEvent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(_ref5) {
1452
+ var sessionId;
1453
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
1454
+ while (1) {
1455
+ switch (_context9.prev = _context9.next) {
1456
+ case 0:
1457
+ sessionId = _ref5.sessionId;
1458
+ return _context9.abrupt("return", apiFetcher("/TagSelectedEvent/" + sessionId, {
1459
+ method: 'GET',
1460
+ apiUrl: apiUrl
1461
+ }));
1462
+
1463
+ case 2:
1464
+ case "end":
1465
+ return _context9.stop();
1466
+ }
1467
+ }
1468
+ }, _callee9);
1469
+ }));
1470
+
1471
+ function postTagSelectedEvent(_x11) {
1472
+ return _postTagSelectedEvent.apply(this, arguments);
1473
+ }
1474
+
1475
+ return postTagSelectedEvent;
1476
+ }()
1477
+ };
1478
+ });
1479
+
1480
+ /************************
1481
+ * *
1482
+ * ImportExport *
1483
+ * *
1484
+ ************************/
1485
+
1486
+ var importExport = (function (apiUrl) {
1487
+ return {
1488
+ /**
1489
+ * Imports memories from a CSV file.
1490
+ * @param {string} sessionId The session ID
1491
+ * @param {ImportExportBody} csvData The CSV content info to import
1492
+ */
1493
+ postImportExport: function () {
1494
+ var _postImportExport = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(sessionId, csvData) {
1495
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
1496
+ while (1) {
1497
+ switch (_context.prev = _context.next) {
1498
+ case 0:
1499
+ return _context.abrupt("return", apiFetcher("/ImportExport/ImportCSV/" + sessionId, {
1500
+ method: 'POST',
1501
+ apiUrl: apiUrl,
1502
+ body: csvData
1503
+ }));
1504
+
1505
+ case 1:
1506
+ case "end":
1507
+ return _context.stop();
1508
+ }
1509
+ }
1510
+ }, _callee);
1511
+ }));
1512
+
1513
+ function postImportExport(_x, _x2) {
1514
+ return _postImportExport.apply(this, arguments);
1515
+ }
1516
+
1517
+ return postImportExport;
1518
+ }()
1519
+ };
1520
+ });
1521
+
1522
+ /*******************
1523
+ * *
1524
+ * Intents *
1525
+ * *
1526
+ *******************/
1527
+
1528
+ var intents = (function (apiUrl) {
1529
+ return {
1530
+ /**
1531
+ * Lists all Intent objects.
1532
+ * @param {string} sessionId The session ID
1533
+ */
1534
+ getIntents: function () {
1535
+ var _getIntents = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(sessionId) {
1536
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
1537
+ while (1) {
1538
+ switch (_context.prev = _context.next) {
1539
+ case 0:
1540
+ return _context.abrupt("return", apiFetcher("/Intents/" + sessionId, {
1541
+ method: 'GET',
1542
+ apiUrl: apiUrl
1543
+ }));
1544
+
1545
+ case 1:
1546
+ case "end":
1547
+ return _context.stop();
1548
+ }
1549
+ }
1550
+ }, _callee);
1551
+ }));
1552
+
1553
+ function getIntents(_x) {
1554
+ return _getIntents.apply(this, arguments);
1555
+ }
1556
+
1557
+ return getIntents;
1558
+ }(),
1559
+
1560
+ /**
1561
+ * Gets the details of an Intent object.
1562
+ * @param {string} sessionId The session ID
1563
+ * @param {string} intentId The Intent object ID
1564
+ */
1565
+ getIntent: function () {
1566
+ var _getIntent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(sessionId, intentId) {
1567
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
1568
+ while (1) {
1569
+ switch (_context2.prev = _context2.next) {
1570
+ case 0:
1571
+ return _context2.abrupt("return", apiFetcher("/Intent/" + sessionId + "/" + intentId, {
1572
+ method: 'GET',
1573
+ apiUrl: apiUrl
1574
+ }));
1575
+
1576
+ case 1:
1577
+ case "end":
1578
+ return _context2.stop();
1579
+ }
1580
+ }
1581
+ }, _callee2);
1582
+ }));
1583
+
1584
+ function getIntent(_x2, _x3) {
1585
+ return _getIntent.apply(this, arguments);
1586
+ }
1587
+
1588
+ return getIntent;
1589
+ }(),
1590
+
1591
+ /**
1592
+ * Updates an existing Intent object.
1593
+ * @param {string} sessionId The session ID
1594
+ * @param {string} intentId The Intent object ID
1595
+ */
1596
+ patchIntent: function () {
1597
+ var _patchIntent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(sessionId, intentId) {
1598
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
1599
+ while (1) {
1600
+ switch (_context3.prev = _context3.next) {
1601
+ case 0:
1602
+ return _context3.abrupt("return", apiFetcher("/Intent/" + sessionId + "/" + intentId, {
1603
+ method: 'GET',
1604
+ apiUrl: apiUrl
1605
+ }));
1606
+
1607
+ case 1:
1608
+ case "end":
1609
+ return _context3.stop();
1610
+ }
1611
+ }
1612
+ }, _callee3);
1613
+ }));
1614
+
1615
+ function patchIntent(_x4, _x5) {
1616
+ return _patchIntent.apply(this, arguments);
1617
+ }
1618
+
1619
+ return patchIntent;
1620
+ }(),
1621
+
1622
+ /**
1623
+ * Removes an existing Intent object.
1624
+ * @param {string} sessionId The session ID
1625
+ * @param {string} intentId The Intent object ID
1626
+ */
1627
+ deleteIntent: function () {
1628
+ var _deleteIntent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(sessionId, intentId) {
1629
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
1630
+ while (1) {
1631
+ switch (_context4.prev = _context4.next) {
1632
+ case 0:
1633
+ return _context4.abrupt("return", apiFetcher("/Intent/" + sessionId + "/" + intentId, {
1634
+ method: 'GET',
1635
+ apiUrl: apiUrl
1636
+ }));
1637
+
1638
+ case 1:
1639
+ case "end":
1640
+ return _context4.stop();
1641
+ }
1642
+ }
1643
+ }, _callee4);
1644
+ }));
1645
+
1646
+ function deleteIntent(_x6, _x7) {
1647
+ return _deleteIntent.apply(this, arguments);
1648
+ }
1649
+
1650
+ return deleteIntent;
1651
+ }(),
1652
+
1653
+ /**
1654
+ * Adds a new Intent object.
1655
+ * @param {string} sessionId The session ID
1656
+ */
1657
+ postIntent: function () {
1658
+ var _postIntent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(sessionId) {
1659
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
1660
+ while (1) {
1661
+ switch (_context5.prev = _context5.next) {
1662
+ case 0:
1663
+ return _context5.abrupt("return", apiFetcher("/Intent/" + sessionId, {
1664
+ method: 'GET',
1665
+ apiUrl: apiUrl
1666
+ }));
1667
+
1668
+ case 1:
1669
+ case "end":
1670
+ return _context5.stop();
1671
+ }
1672
+ }
1673
+ }, _callee5);
1674
+ }));
1675
+
1676
+ function postIntent(_x8) {
1677
+ return _postIntent.apply(this, arguments);
1678
+ }
1679
+
1680
+ return postIntent;
1681
+ }(),
1682
+
1683
+ /**
1684
+ * Lists all Intent Slot objects.
1685
+ * @param {string} sessionId The session ID
1686
+ */
1687
+ getIntentSlots: function () {
1688
+ var _getIntentSlots = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(sessionId) {
1689
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
1690
+ while (1) {
1691
+ switch (_context6.prev = _context6.next) {
1692
+ case 0:
1693
+ return _context6.abrupt("return", apiFetcher("/IntentSlots/" + sessionId, {
1694
+ method: 'GET',
1695
+ apiUrl: apiUrl
1696
+ }));
1697
+
1698
+ case 1:
1699
+ case "end":
1700
+ return _context6.stop();
1701
+ }
1702
+ }
1703
+ }, _callee6);
1704
+ }));
1705
+
1706
+ function getIntentSlots(_x9) {
1707
+ return _getIntentSlots.apply(this, arguments);
1708
+ }
1709
+
1710
+ return getIntentSlots;
1711
+ }(),
1712
+
1713
+ /**
1714
+ * Gets the details of an Intent Slot object.
1715
+ * @param {string} sessionId The session ID
1716
+ * @param {string} slotId The Intent Slot object ID
1717
+ */
1718
+ getIntentSlot: function () {
1719
+ var _getIntentSlot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(sessionId, slotId) {
1720
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
1721
+ while (1) {
1722
+ switch (_context7.prev = _context7.next) {
1723
+ case 0:
1724
+ return _context7.abrupt("return", apiFetcher("/IntentSlot/" + sessionId + "/" + slotId, {
1725
+ method: 'GET',
1726
+ apiUrl: apiUrl
1727
+ }));
1728
+
1729
+ case 1:
1730
+ case "end":
1731
+ return _context7.stop();
1732
+ }
1733
+ }
1734
+ }, _callee7);
1735
+ }));
1736
+
1737
+ function getIntentSlot(_x10, _x11) {
1738
+ return _getIntentSlot.apply(this, arguments);
1739
+ }
1740
+
1741
+ return getIntentSlot;
1742
+ }(),
1743
+
1744
+ /**
1745
+ * Updates an existing Intent Slot object.
1746
+ * @param {string} sessionId The session ID
1747
+ * @param {string} slotId The Intent Slot object ID
1748
+ */
1749
+ patchIntentSlot: function () {
1750
+ var _patchIntentSlot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(sessionId, slotId) {
1751
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
1752
+ while (1) {
1753
+ switch (_context8.prev = _context8.next) {
1754
+ case 0:
1755
+ return _context8.abrupt("return", apiFetcher("/IntentSlot/" + sessionId + "/" + slotId, {
1756
+ method: 'GET',
1757
+ apiUrl: apiUrl
1758
+ }));
1759
+
1760
+ case 1:
1761
+ case "end":
1762
+ return _context8.stop();
1763
+ }
1764
+ }
1765
+ }, _callee8);
1766
+ }));
1767
+
1768
+ function patchIntentSlot(_x12, _x13) {
1769
+ return _patchIntentSlot.apply(this, arguments);
1770
+ }
1771
+
1772
+ return patchIntentSlot;
1773
+ }(),
1774
+
1775
+ /**
1776
+ * Removes an existing Intent Slot object.
1777
+ * @param {string} sessionId The session ID
1778
+ * @param {string} slotId The Intent Slot object ID
1779
+ */
1780
+ deleteIntentSlot: function () {
1781
+ var _deleteIntentSlot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(sessionId, slotId) {
1782
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
1783
+ while (1) {
1784
+ switch (_context9.prev = _context9.next) {
1785
+ case 0:
1786
+ return _context9.abrupt("return", apiFetcher("/IntentSlot/" + sessionId + "/" + slotId, {
1787
+ method: 'GET',
1788
+ apiUrl: apiUrl
1789
+ }));
1790
+
1791
+ case 1:
1792
+ case "end":
1793
+ return _context9.stop();
1794
+ }
1795
+ }
1796
+ }, _callee9);
1797
+ }));
1798
+
1799
+ function deleteIntentSlot(_x14, _x15) {
1800
+ return _deleteIntentSlot.apply(this, arguments);
1801
+ }
1802
+
1803
+ return deleteIntentSlot;
1804
+ }(),
1805
+
1806
+ /**
1807
+ * Adds a new Intent Slot object.
1808
+ * @param {string} sessionId The session ID
1809
+ */
1810
+ postIntentSlot: function () {
1811
+ var _postIntentSlot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(sessionId) {
1812
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
1813
+ while (1) {
1814
+ switch (_context10.prev = _context10.next) {
1815
+ case 0:
1816
+ return _context10.abrupt("return", apiFetcher("/IntentSlot/" + sessionId, {
1817
+ method: 'GET',
1818
+ apiUrl: apiUrl
1819
+ }));
1820
+
1821
+ case 1:
1822
+ case "end":
1823
+ return _context10.stop();
1824
+ }
1825
+ }
1826
+ }, _callee10);
1827
+ }));
1828
+
1829
+ function postIntentSlot(_x16) {
1830
+ return _postIntentSlot.apply(this, arguments);
1831
+ }
1832
+
1833
+ return postIntentSlot;
1834
+ }()
1835
+ };
1836
+ });
1837
+
1838
+ /****************************
1839
+ * *
1840
+ * LocalizationKeys *
1841
+ * *
1842
+ ****************************/
1843
+
1844
+ var localizationKeys = (function (apiUrl) {
1845
+ return {
1846
+ /**
1847
+ * Lists all Localizaiton Keys.
1848
+ * @param {string} sessionId The session ID
1849
+ */
1850
+ getLocalizationKeys: function () {
1851
+ var _getLocalizationKeys = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(sessionId) {
1852
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
1853
+ while (1) {
1854
+ switch (_context.prev = _context.next) {
1855
+ case 0:
1856
+ return _context.abrupt("return", apiFetcher("/LocalizationKeys/" + sessionId, {
1857
+ method: 'GET',
1858
+ apiUrl: apiUrl
1859
+ }));
1860
+
1861
+ case 1:
1862
+ case "end":
1863
+ return _context.stop();
1864
+ }
1865
+ }
1866
+ }, _callee);
1867
+ }));
1868
+
1869
+ function getLocalizationKeys(_x) {
1870
+ return _getLocalizationKeys.apply(this, arguments);
1871
+ }
1872
+
1873
+ return getLocalizationKeys;
1874
+ }(),
1875
+
1876
+ /**
1877
+ * Get an existing Localizaiton Key.
1878
+ * @param {string} sessionId The session ID
1879
+ * @param {string} key The key of the Localization Key
1880
+ */
1881
+ getLocalizationKey: function () {
1882
+ var _getLocalizationKey = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(sessionId, key) {
1883
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
1884
+ while (1) {
1885
+ switch (_context2.prev = _context2.next) {
1886
+ case 0:
1887
+ return _context2.abrupt("return", apiFetcher("/LocalizationKey/" + sessionId + "/" + key, {
1888
+ method: 'GET',
1889
+ apiUrl: apiUrl
1890
+ }));
1891
+
1892
+ case 1:
1893
+ case "end":
1894
+ return _context2.stop();
1895
+ }
1896
+ }
1897
+ }, _callee2);
1898
+ }));
1899
+
1900
+ function getLocalizationKey(_x2, _x3) {
1901
+ return _getLocalizationKey.apply(this, arguments);
1902
+ }
1903
+
1904
+ return getLocalizationKey;
1905
+ }(),
1906
+
1907
+ /**
1908
+ * Removes an existing Localizaiton Key. This is only possible if the key is part of
1909
+ * a key set, where a key set is a set of keys of a common prefix and an index,
1910
+ * e.g.: <code>INPUT_QUIT_1</code>, <code>INPUT_QUIT_2</code> etc.
1911
+ * Any index can be specified, the key set will be reordered appropriately.
1912
+ * @param {string} sessionId The session ID
1913
+ * @param {string} key The key of the Localization Key
1914
+ */
1915
+ deleteLocalizationKey: function () {
1916
+ var _deleteLocalizationKey = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(sessionId, key) {
1917
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
1918
+ while (1) {
1919
+ switch (_context3.prev = _context3.next) {
1920
+ case 0:
1921
+ return _context3.abrupt("return", apiFetcher("/LocalizationKey/" + sessionId + "/" + key, {
1922
+ method: 'DELETE',
1923
+ apiUrl: apiUrl
1924
+ }));
1925
+
1926
+ case 1:
1927
+ case "end":
1928
+ return _context3.stop();
1929
+ }
1930
+ }
1931
+ }, _callee3);
1932
+ }));
1933
+
1934
+ function deleteLocalizationKey(_x4, _x5) {
1935
+ return _deleteLocalizationKey.apply(this, arguments);
1936
+ }
1937
+
1938
+ return deleteLocalizationKey;
1939
+ }(),
1940
+
1941
+ /**
1942
+ * Add an new Localization Key. This is only possible if the key is part of
1943
+ * a key set, where a key set is a set of keys of a common prefix and an index,
1944
+ * e.g.: <code>INPUT_QUIT_1</code>, <code>INPUT_QUIT_2</code> etc.
1945
+ * Any index can be specified, the key set will be reordered appropriately.
1946
+ * @param {string} sessionId The session ID
1947
+ * @param {LocalizaitonKeyContent} localizationKey Localization Key
1948
+ */
1949
+ postLocalizationKey: function () {
1950
+ var _postLocalizationKey = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(sessionId, localizationKey) {
1951
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
1952
+ while (1) {
1953
+ switch (_context4.prev = _context4.next) {
1954
+ case 0:
1955
+ return _context4.abrupt("return", apiFetcher("/LocalizationKey/" + sessionId, {
1956
+ method: 'POST',
1957
+ apiUrl: apiUrl,
1958
+ body: localizationKey
1959
+ }));
1960
+
1961
+ case 1:
1962
+ case "end":
1963
+ return _context4.stop();
1964
+ }
1965
+ }
1966
+ }, _callee4);
1967
+ }));
1968
+
1969
+ function postLocalizationKey(_x6, _x7) {
1970
+ return _postLocalizationKey.apply(this, arguments);
1971
+ }
1972
+
1973
+ return postLocalizationKey;
1974
+ }(),
1975
+
1976
+ /**
1977
+ * Updates an existing Localization Key.
1978
+ * @param {string} sessionId The session ID
1979
+ * @param {LocalizationKey} localizationKey Localization Key
1980
+ */
1981
+ patchLocalizationKey: function () {
1982
+ var _patchLocalizationKey = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(sessionId, localizationKey) {
1983
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
1984
+ while (1) {
1985
+ switch (_context5.prev = _context5.next) {
1986
+ case 0:
1987
+ return _context5.abrupt("return", apiFetcher("/LocalizationKey/" + sessionId, {
1988
+ method: 'PATCH',
1989
+ apiUrl: apiUrl,
1990
+ body: localizationKey
1991
+ }));
1992
+
1993
+ case 1:
1994
+ case "end":
1995
+ return _context5.stop();
1996
+ }
1997
+ }
1998
+ }, _callee5);
1999
+ }));
2000
+
2001
+ function patchLocalizationKey(_x8, _x9) {
2002
+ return _patchLocalizationKey.apply(this, arguments);
2003
+ }
2004
+
2005
+ return patchLocalizationKey;
2006
+ }()
2007
+ };
2008
+ });
2009
+
2010
+ /*****************
2011
+ * *
2012
+ * Media *
2013
+ * *
2014
+ *****************/
2015
+
2016
+ var media = (function (apiUrl) {
2017
+ return {
2018
+ /**
2019
+ * Lists all Medium objects of a Memory.
2020
+ * @param {string} sessionId The session ID
2021
+ * @param {string} memoryId The Memory object ID
2022
+ */
2023
+ getMedia: function () {
2024
+ var _getMedia = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(sessionId, memoryId) {
2025
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
2026
+ while (1) {
2027
+ switch (_context.prev = _context.next) {
2028
+ case 0:
2029
+ return _context.abrupt("return", apiFetcher("/Media/" + sessionId + "/" + memoryId, {
2030
+ method: 'GET',
2031
+ apiUrl: apiUrl
2032
+ }));
2033
+
2034
+ case 1:
2035
+ case "end":
2036
+ return _context.stop();
2037
+ }
2038
+ }
2039
+ }, _callee);
2040
+ }));
2041
+
2042
+ function getMedia(_x, _x2) {
2043
+ return _getMedia.apply(this, arguments);
2044
+ }
2045
+
2046
+ return getMedia;
2047
+ }(),
2048
+
2049
+ /**
2050
+ * Removes all Medium objects from a Memory.
2051
+ * @param {string} sessionId The session ID
2052
+ * @param {string} memoryId The Memory object ID
2053
+ */
2054
+ deleteMedia: function () {
2055
+ var _deleteMedia = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(sessionId, memoryId) {
2056
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
2057
+ while (1) {
2058
+ switch (_context2.prev = _context2.next) {
2059
+ case 0:
2060
+ return _context2.abrupt("return", apiFetcher("/Media/" + sessionId + "/" + memoryId, {
2061
+ method: 'DELETE',
2062
+ apiUrl: apiUrl
2063
+ }));
2064
+
2065
+ case 1:
2066
+ case "end":
2067
+ return _context2.stop();
2068
+ }
2069
+ }
2070
+ }, _callee2);
2071
+ }));
2072
+
2073
+ function deleteMedia(_x3, _x4) {
2074
+ return _deleteMedia.apply(this, arguments);
2075
+ }
2076
+
2077
+ return deleteMedia;
2078
+ }(),
2079
+
2080
+ /**
2081
+ * Gets the details of a Medium object of a Memory.
2082
+ * @param {string} sessionId The session ID
2083
+ * @param {string} memoryId The Memory object ID
2084
+ * @param {string} mediumId The Medium object ID
2085
+ */
2086
+ getMedium: function () {
2087
+ var _getMedium = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(sessionId, memoryId, mediumId) {
2088
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
2089
+ while (1) {
2090
+ switch (_context3.prev = _context3.next) {
2091
+ case 0:
2092
+ return _context3.abrupt("return", apiFetcher("/Medium/" + sessionId + "/" + memoryId + "/" + mediumId, {
2093
+ method: 'GET',
2094
+ apiUrl: apiUrl
2095
+ }));
2096
+
2097
+ case 1:
2098
+ case "end":
2099
+ return _context3.stop();
2100
+ }
2101
+ }
2102
+ }, _callee3);
2103
+ }));
2104
+
2105
+ function getMedium(_x5, _x6, _x7) {
2106
+ return _getMedium.apply(this, arguments);
2107
+ }
2108
+
2109
+ return getMedium;
2110
+ }(),
2111
+
2112
+ /**
2113
+ * Updates an existing Medium object of a Memory.
2114
+ * @param {string} sessionId The session ID
2115
+ * @param {string} memoryId The Memory object ID
2116
+ * @param {string} mediumId The Medium object ID
2117
+ */
2118
+ patchMedium: function () {
2119
+ var _patchMedium = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(sessionId, memoryId, mediumId) {
2120
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
2121
+ while (1) {
2122
+ switch (_context4.prev = _context4.next) {
2123
+ case 0:
2124
+ return _context4.abrupt("return", apiFetcher("/Medium/" + sessionId + "/" + memoryId + "/" + mediumId, {
2125
+ method: 'GET',
2126
+ apiUrl: apiUrl
2127
+ }));
2128
+
2129
+ case 1:
2130
+ case "end":
2131
+ return _context4.stop();
2132
+ }
2133
+ }
2134
+ }, _callee4);
2135
+ }));
2136
+
2137
+ function patchMedium(_x8, _x9, _x10) {
2138
+ return _patchMedium.apply(this, arguments);
2139
+ }
2140
+
2141
+ return patchMedium;
2142
+ }(),
2143
+
2144
+ /**
2145
+ * Removes an existing Medium object from a Memory.
2146
+ * @param {string} sessionId The session ID
2147
+ * @param {string} memoryId The Memory object ID
2148
+ * @param {string} mediumId The Medium object ID
2149
+ */
2150
+ deleteMedium: function deleteMedium(sessionId, memoryId, mediumId) {
2151
+ return apiFetcher("/Medium/" + sessionId + "/" + memoryId + "/" + mediumId, {
2152
+ method: 'GET',
2153
+ apiUrl: apiUrl
2154
+ });
2155
+ },
2156
+
2157
+ /**
2158
+ * Adds a new Medium object to a Memory.
2159
+ * @param {string} sessionId The session ID
2160
+ * @param {string} memoryId The Memory object ID
2161
+ */
2162
+ postMedium: function () {
2163
+ var _postMedium = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(sessionId, memoryId) {
2164
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
2165
+ while (1) {
2166
+ switch (_context5.prev = _context5.next) {
2167
+ case 0:
2168
+ return _context5.abrupt("return", apiFetcher("/Medium/" + sessionId + "/" + memoryId, {
2169
+ method: 'GET',
2170
+ apiUrl: apiUrl
2171
+ }));
2172
+
2173
+ case 1:
2174
+ case "end":
2175
+ return _context5.stop();
2176
+ }
2177
+ }
2178
+ }, _callee5);
2179
+ }));
2180
+
2181
+ function postMedium(_x11, _x12) {
2182
+ return _postMedium.apply(this, arguments);
2183
+ }
2184
+
2185
+ return postMedium;
2186
+ }()
2187
+ };
2188
+ });
2189
+
2190
+ /******************
2191
+ * *
2192
+ * Memori *
2193
+ * *
2194
+ ******************/
2195
+
2196
+ var memori$1 = (function (apiUrl) {
2197
+ return {
2198
+ /**
2199
+ * Registration of a new Memori object.
2200
+ * @param {Memori} memori - The Memori object
2201
+ */
2202
+ postMemori: function () {
2203
+ var _postMemori = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(memori) {
2204
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
2205
+ while (1) {
2206
+ switch (_context.prev = _context.next) {
2207
+ case 0:
2208
+ return _context.abrupt("return", apiFetcher("/Memori", {
2209
+ method: 'POST',
2210
+ apiUrl: apiUrl,
2211
+ body: memori
2212
+ }));
2213
+
2214
+ case 1:
2215
+ case "end":
2216
+ return _context.stop();
2217
+ }
2218
+ }
2219
+ }, _callee);
2220
+ }));
2221
+
2222
+ function postMemori(_x) {
2223
+ return _postMemori.apply(this, arguments);
2224
+ }
2225
+
2226
+ return postMemori;
2227
+ }(),
2228
+
2229
+ /**
2230
+ * Updates an existing Memori object.
2231
+ * @param {Memori} memori - The Memori object
2232
+ */
2233
+ patchMemori: function () {
2234
+ var _patchMemori = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(memori) {
2235
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
2236
+ while (1) {
2237
+ switch (_context2.prev = _context2.next) {
2238
+ case 0:
2239
+ return _context2.abrupt("return", apiFetcher("/Memori/" + memori.memoriID, {
2240
+ method: 'PATCH',
2241
+ apiUrl: apiUrl,
2242
+ body: memori
2243
+ }));
2244
+
2245
+ case 1:
2246
+ case "end":
2247
+ return _context2.stop();
2248
+ }
2249
+ }
2250
+ }, _callee2);
2251
+ }));
2252
+
2253
+ function patchMemori(_x2) {
2254
+ return _patchMemori.apply(this, arguments);
2255
+ }
2256
+
2257
+ return patchMemori;
2258
+ }(),
2259
+
2260
+ /**
2261
+ * Deletes an existing Memori object.
2262
+ * @param {string} memoriId The Memori object ID
2263
+ */
2264
+ deleteMemori: function () {
2265
+ var _deleteMemori = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(memoriId) {
2266
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
2267
+ while (1) {
2268
+ switch (_context3.prev = _context3.next) {
2269
+ case 0:
2270
+ return _context3.abrupt("return", apiFetcher("/Memori/" + memoriId, {
2271
+ method: 'DELETE',
2272
+ apiUrl: apiUrl
2273
+ }));
2274
+
2275
+ case 1:
2276
+ case "end":
2277
+ return _context3.stop();
2278
+ }
2279
+ }
2280
+ }, _callee3);
2281
+ }));
2282
+
2283
+ function deleteMemori(_x3) {
2284
+ return _deleteMemori.apply(this, arguments);
2285
+ }
2286
+
2287
+ return deleteMemori;
2288
+ }(),
2289
+
2290
+ /**
2291
+ * Lists Memori objects, with optional filtering.
2292
+ */
2293
+ postSearchMemori: function () {
2294
+ var _postSearchMemori = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
2295
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
2296
+ while (1) {
2297
+ switch (_context4.prev = _context4.next) {
2298
+ case 0:
2299
+ return _context4.abrupt("return", apiFetcher("/SearchMemori", {
2300
+ method: 'GET',
2301
+ apiUrl: apiUrl
2302
+ }));
2303
+
2304
+ case 1:
2305
+ case "end":
2306
+ return _context4.stop();
2307
+ }
2308
+ }
2309
+ }, _callee4);
2310
+ }));
2311
+
2312
+ function postSearchMemori() {
2313
+ return _postSearchMemori.apply(this, arguments);
2314
+ }
2315
+
2316
+ return postSearchMemori;
2317
+ }()
2318
+ };
2319
+ });
2320
+
2321
+ /********************
2322
+ * *
2323
+ * Memories *
2324
+ * *
2325
+ ********************/
2326
+
2327
+ var memories = (function (apiUrl) {
2328
+ return {
2329
+ /**
2330
+ * Lists all Memory objects.
2331
+ * @param {string} sessionId The session ID
2332
+ */
2333
+ getMemories: function () {
2334
+ var _getMemories = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(sessionId) {
2335
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
2336
+ while (1) {
2337
+ switch (_context.prev = _context.next) {
2338
+ case 0:
2339
+ return _context.abrupt("return", apiFetcher("/Memories/" + sessionId, {
2340
+ method: 'GET',
2341
+ apiUrl: apiUrl
2342
+ }));
2343
+
2344
+ case 1:
2345
+ case "end":
2346
+ return _context.stop();
2347
+ }
2348
+ }
2349
+ }, _callee);
2350
+ }));
2351
+
2352
+ function getMemories(_x) {
2353
+ return _getMemories.apply(this, arguments);
2354
+ }
2355
+
2356
+ return getMemories;
2357
+ }(),
2358
+
2359
+ /**
2360
+ * Gets the details of a Memory object.
2361
+ * @param {string} sessionId The session ID
2362
+ * @param {string} memoryId The Memory object ID
2363
+ */
2364
+ getMemory: function () {
2365
+ var _getMemory = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(sessionId, memoryId) {
2366
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
2367
+ while (1) {
2368
+ switch (_context2.prev = _context2.next) {
2369
+ case 0:
2370
+ return _context2.abrupt("return", apiFetcher("/Memory/" + sessionId + "/" + memoryId, {
2371
+ method: 'GET',
2372
+ apiUrl: apiUrl
2373
+ }));
2374
+
2375
+ case 1:
2376
+ case "end":
2377
+ return _context2.stop();
2378
+ }
2379
+ }
2380
+ }, _callee2);
2381
+ }));
2382
+
2383
+ function getMemory(_x2, _x3) {
2384
+ return _getMemory.apply(this, arguments);
2385
+ }
2386
+
2387
+ return getMemory;
2388
+ }(),
2389
+
2390
+ /**
2391
+ * Updates an existing Memory object.
2392
+ * @param {string} sessionId The session ID
2393
+ * @param {Memory} memory The Memory object
2394
+ */
2395
+ patchMemory: function () {
2396
+ var _patchMemory = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(sessionId, memory) {
2397
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
2398
+ while (1) {
2399
+ switch (_context3.prev = _context3.next) {
2400
+ case 0:
2401
+ return _context3.abrupt("return", apiFetcher("/Memory/" + sessionId + "/" + memory.memoryID, {
2402
+ method: 'PATCH',
2403
+ apiUrl: apiUrl,
2404
+ body: memory
2405
+ }));
2406
+
2407
+ case 1:
2408
+ case "end":
2409
+ return _context3.stop();
2410
+ }
2411
+ }
2412
+ }, _callee3);
2413
+ }));
2414
+
2415
+ function patchMemory(_x4, _x5) {
2416
+ return _patchMemory.apply(this, arguments);
2417
+ }
2418
+
2419
+ return patchMemory;
2420
+ }(),
2421
+
2422
+ /**
2423
+ * Removes an existing Memory object.
2424
+ * @param {string} sessionId The session ID
2425
+ * @param {string} memoryId The Memory object ID
2426
+ */
2427
+ deleteMemory: function () {
2428
+ var _deleteMemory = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(sessionId, memoryId) {
2429
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
2430
+ while (1) {
2431
+ switch (_context4.prev = _context4.next) {
2432
+ case 0:
2433
+ return _context4.abrupt("return", apiFetcher("/Memory/" + sessionId + "/" + memoryId, {
2434
+ method: 'DELETE',
2435
+ apiUrl: apiUrl
2436
+ }));
2437
+
2438
+ case 1:
2439
+ case "end":
2440
+ return _context4.stop();
2441
+ }
2442
+ }
2443
+ }, _callee4);
2444
+ }));
2445
+
2446
+ function deleteMemory(_x6, _x7) {
2447
+ return _deleteMemory.apply(this, arguments);
2448
+ }
2449
+
2450
+ return deleteMemory;
2451
+ }(),
2452
+
2453
+ /**
2454
+ * Adds a new Memory object.
2455
+ * @param {string} sessionId The session ID
2456
+ * @param {Memory} memory The Memory object
2457
+ */
2458
+ postMemory: function () {
2459
+ var _postMemory = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(sessionId, memory) {
2460
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
2461
+ while (1) {
2462
+ switch (_context5.prev = _context5.next) {
2463
+ case 0:
2464
+ return _context5.abrupt("return", apiFetcher("/Memory/" + sessionId, {
2465
+ method: 'POST',
2466
+ apiUrl: apiUrl,
2467
+ body: memory
2468
+ }));
2469
+
2470
+ case 1:
2471
+ case "end":
2472
+ return _context5.stop();
2473
+ }
2474
+ }
2475
+ }, _callee5);
2476
+ }));
2477
+
2478
+ function postMemory(_x8, _x9) {
2479
+ return _postMemory.apply(this, arguments);
2480
+ }
2481
+
2482
+ return postMemory;
2483
+ }(),
2484
+
2485
+ /**
2486
+ * Checks if a Memory object is accessible from the specified session.
2487
+ * @param {string} sessionId The session ID
2488
+ * @param {string} memoryId The Memory object ID
2489
+ */
2490
+ getMemoryAccess: function () {
2491
+ var _getMemoryAccess = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(sessionId, memoryId) {
2492
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
2493
+ while (1) {
2494
+ switch (_context6.prev = _context6.next) {
2495
+ case 0:
2496
+ return _context6.abrupt("return", apiFetcher("/MemoryAccess/" + sessionId + "/" + memoryId, {
2497
+ method: 'GET',
2498
+ apiUrl: apiUrl
2499
+ }));
2500
+
2501
+ case 1:
2502
+ case "end":
2503
+ return _context6.stop();
2504
+ }
2505
+ }
2506
+ }, _callee6);
2507
+ }));
2508
+
2509
+ function getMemoryAccess(_x10, _x11) {
2510
+ return _getMemoryAccess.apply(this, arguments);
2511
+ }
2512
+
2513
+ return getMemoryAccess;
2514
+ }()
2515
+ };
2516
+ });
2517
+
2518
+ /***************
2519
+ * *
2520
+ * NLP *
2521
+ * *
2522
+ ***************/
2523
+
2524
+ var nlp = (function (apiUrl) {
2525
+ return {
2526
+ /**
2527
+ * Looks up the vector definition for a word.
2528
+ * @param {string} sessionId The session ID
2529
+ * @param {string} word Word to be looked up
2530
+ */
2531
+ getWordVector: function () {
2532
+ var _getWordVector = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(sessionId, word) {
2533
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
2534
+ while (1) {
2535
+ switch (_context.prev = _context.next) {
2536
+ case 0:
2537
+ return _context.abrupt("return", apiFetcher("/WordVector/" + sessionId + "/" + word, {
2538
+ method: 'GET',
2539
+ apiUrl: apiUrl
2540
+ }));
2541
+
2542
+ case 1:
2543
+ case "end":
2544
+ return _context.stop();
2545
+ }
2546
+ }
2547
+ }, _callee);
2548
+ }));
2549
+
2550
+ function getWordVector(_x, _x2) {
2551
+ return _getWordVector.apply(this, arguments);
2552
+ }
2553
+
2554
+ return getWordVector;
2555
+ }(),
2556
+
2557
+ /**
2558
+ * Tries to guess the language of a sentence by analyzing key word occurrences.
2559
+ * @param {string} sessionId The session ID
2560
+ * @param {string} text Text to be used for guessing the language.
2561
+ */
2562
+ guessLanguage: function () {
2563
+ var _guessLanguage = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(sessionId, text) {
2564
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
2565
+ while (1) {
2566
+ switch (_context2.prev = _context2.next) {
2567
+ case 0:
2568
+ return _context2.abrupt("return", apiFetcher("/GuessLanguage/" + sessionId, {
2569
+ method: 'POST',
2570
+ apiUrl: apiUrl,
2571
+ body: {
2572
+ text: text
2573
+ }
2574
+ }));
2575
+
2576
+ case 1:
2577
+ case "end":
2578
+ return _context2.stop();
2579
+ }
2580
+ }
2581
+ }, _callee2);
2582
+ }));
2583
+
2584
+ function guessLanguage(_x3, _x4) {
2585
+ return _guessLanguage.apply(this, arguments);
2586
+ }
2587
+
2588
+ return guessLanguage;
2589
+ }()
2590
+ };
2591
+ });
2592
+
2593
+ /******************
2594
+ * *
2595
+ * People *
2596
+ * *
2597
+ ******************/
2598
+
2599
+ var people = (function (apiUrl) {
2600
+ return {
2601
+ /**
2602
+ * Lists all Person objects.
2603
+ * @param {string} sessionId The session ID
2604
+ */
2605
+ getPeople: function () {
2606
+ var _getPeople = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(sessionId) {
2607
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
2608
+ while (1) {
2609
+ switch (_context.prev = _context.next) {
2610
+ case 0:
2611
+ return _context.abrupt("return", apiFetcher("/People/" + sessionId, {
2612
+ method: 'GET',
2613
+ apiUrl: apiUrl
2614
+ }));
2615
+
2616
+ case 1:
2617
+ case "end":
2618
+ return _context.stop();
2619
+ }
2620
+ }
2621
+ }, _callee);
2622
+ }));
2623
+
2624
+ function getPeople(_x) {
2625
+ return _getPeople.apply(this, arguments);
2626
+ }
2627
+
2628
+ return getPeople;
2629
+ }(),
2630
+
2631
+ /**
2632
+ * Gets the details of a Person object.
2633
+ * @param {string} sessionId The session ID
2634
+ * @param {string} personId The Person object ID
2635
+ */
2636
+ getPerson: function () {
2637
+ var _getPerson = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(sessionId, personId) {
2638
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
2639
+ while (1) {
2640
+ switch (_context2.prev = _context2.next) {
2641
+ case 0:
2642
+ return _context2.abrupt("return", apiFetcher("/Person/" + sessionId + "/" + personId, {
2643
+ method: 'GET',
2644
+ apiUrl: apiUrl
2645
+ }));
2646
+
2647
+ case 1:
2648
+ case "end":
2649
+ return _context2.stop();
2650
+ }
2651
+ }
2652
+ }, _callee2);
2653
+ }));
2654
+
2655
+ function getPerson(_x2, _x3) {
2656
+ return _getPerson.apply(this, arguments);
2657
+ }
2658
+
2659
+ return getPerson;
2660
+ }(),
2661
+
2662
+ /**
2663
+ * Updates an existing Person object.
2664
+ * @param {string} sessionId The session ID
2665
+ * @param {Person} person The Person object
2666
+ */
2667
+ patchPerson: function () {
2668
+ var _patchPerson = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(sessionId, person) {
2669
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
2670
+ while (1) {
2671
+ switch (_context3.prev = _context3.next) {
2672
+ case 0:
2673
+ return _context3.abrupt("return", apiFetcher("/Person/" + sessionId + "/" + person.personID, {
2674
+ method: 'PATCH',
2675
+ body: person,
2676
+ apiUrl: apiUrl
2677
+ }));
2678
+
2679
+ case 1:
2680
+ case "end":
2681
+ return _context3.stop();
2682
+ }
2683
+ }
2684
+ }, _callee3);
2685
+ }));
2686
+
2687
+ function patchPerson(_x4, _x5) {
2688
+ return _patchPerson.apply(this, arguments);
2689
+ }
2690
+
2691
+ return patchPerson;
2692
+ }(),
2693
+
2694
+ /**
2695
+ * Removes an existing Person object.
2696
+ * @param {string} sessionId The session ID
2697
+ * @param {string} personId The Person object ID
2698
+ */
2699
+ deletePerson: function () {
2700
+ var _deletePerson = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(sessionId, personId) {
2701
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
2702
+ while (1) {
2703
+ switch (_context4.prev = _context4.next) {
2704
+ case 0:
2705
+ return _context4.abrupt("return", apiFetcher("/Person/" + sessionId + "/" + personId, {
2706
+ method: 'DELETE',
2707
+ apiUrl: apiUrl
2708
+ }));
2709
+
2710
+ case 1:
2711
+ case "end":
2712
+ return _context4.stop();
2713
+ }
2714
+ }
2715
+ }, _callee4);
2716
+ }));
2717
+
2718
+ function deletePerson(_x6, _x7) {
2719
+ return _deletePerson.apply(this, arguments);
2720
+ }
2721
+
2722
+ return deletePerson;
2723
+ }(),
2724
+
2725
+ /**
2726
+ * Adds a new Person object.
2727
+ * @param {string} sessionId - The session ID
2728
+ * @param {Person} person - The Person object
2729
+ */
2730
+ postPerson: function () {
2731
+ var _postPerson = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(sessionId, person) {
2732
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
2733
+ while (1) {
2734
+ switch (_context5.prev = _context5.next) {
2735
+ case 0:
2736
+ return _context5.abrupt("return", apiFetcher("/Person/" + sessionId, {
2737
+ method: 'POST',
2738
+ body: person,
2739
+ apiUrl: apiUrl
2740
+ }));
2741
+
2742
+ case 1:
2743
+ case "end":
2744
+ return _context5.stop();
2745
+ }
2746
+ }
2747
+ }, _callee5);
2748
+ }));
2749
+
2750
+ function postPerson(_x8, _x9) {
2751
+ return _postPerson.apply(this, arguments);
2752
+ }
2753
+
2754
+ return postPerson;
2755
+ }()
2756
+ };
2757
+ });
2758
+
2759
+ /*****************************
2760
+ * *
2761
+ * PromptedQuestions *
2762
+ * *
2763
+ *****************************/
2764
+
2765
+ var promptedQuestions = (function (apiUrl) {
2766
+ return {
2767
+ /**
2768
+ * Lists all Prompted Question objects.
2769
+ * @param {string} sessionId The session ID
2770
+ */
2771
+ getPromptedQuestions: function () {
2772
+ var _getPromptedQuestions = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(sessionId) {
2773
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
2774
+ while (1) {
2775
+ switch (_context.prev = _context.next) {
2776
+ case 0:
2777
+ return _context.abrupt("return", apiFetcher("/PromptedQuestions/" + sessionId, {
2778
+ method: 'GET',
2779
+ apiUrl: apiUrl
2780
+ }));
2781
+
2782
+ case 1:
2783
+ case "end":
2784
+ return _context.stop();
2785
+ }
2786
+ }
2787
+ }, _callee);
2788
+ }));
2789
+
2790
+ function getPromptedQuestions(_x) {
2791
+ return _getPromptedQuestions.apply(this, arguments);
2792
+ }
2793
+
2794
+ return getPromptedQuestions;
2795
+ }(),
2796
+
2797
+ /**
2798
+ * Gets the details of a Prompted Question object.
2799
+ * @param {string} sessionId The session ID
2800
+ * @param {string} promptId The Prompted Question object ID
2801
+ */
2802
+ getPromptedQuestion: function () {
2803
+ var _getPromptedQuestion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(sessionId, promptId) {
2804
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
2805
+ while (1) {
2806
+ switch (_context2.prev = _context2.next) {
2807
+ case 0:
2808
+ return _context2.abrupt("return", apiFetcher("/PromptedQuestion/" + sessionId + "/" + promptId, {
2809
+ method: 'GET',
2810
+ apiUrl: apiUrl
2811
+ }));
2812
+
2813
+ case 1:
2814
+ case "end":
2815
+ return _context2.stop();
2816
+ }
2817
+ }
2818
+ }, _callee2);
2819
+ }));
2820
+
2821
+ function getPromptedQuestion(_x2, _x3) {
2822
+ return _getPromptedQuestion.apply(this, arguments);
2823
+ }
2824
+
2825
+ return getPromptedQuestion;
2826
+ }(),
2827
+
2828
+ /**
2829
+ * Updates an existing Prompted Question object.
2830
+ * @param {string} sessionId The session ID
2831
+ * @param {string} promptId The Prompted Question object ID
2832
+ */
2833
+ patchPromptedQuestion: function () {
2834
+ var _patchPromptedQuestion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(sessionId, promptId) {
2835
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
2836
+ while (1) {
2837
+ switch (_context3.prev = _context3.next) {
2838
+ case 0:
2839
+ return _context3.abrupt("return", apiFetcher("/PromptedQuestion/" + sessionId + "/" + promptId, {
2840
+ method: 'GET',
2841
+ apiUrl: apiUrl
2842
+ }));
2843
+
2844
+ case 1:
2845
+ case "end":
2846
+ return _context3.stop();
2847
+ }
2848
+ }
2849
+ }, _callee3);
2850
+ }));
2851
+
2852
+ function patchPromptedQuestion(_x4, _x5) {
2853
+ return _patchPromptedQuestion.apply(this, arguments);
2854
+ }
2855
+
2856
+ return patchPromptedQuestion;
2857
+ }(),
2858
+
2859
+ /**
2860
+ * Removes an existing Prompted Question object.
2861
+ * @param {string} sessionId The session ID
2862
+ * @param {string} promptId The Prompted Question object ID
2863
+ */
2864
+ deletePromptedQuestion: function () {
2865
+ var _deletePromptedQuestion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(sessionId, promptId) {
2866
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
2867
+ while (1) {
2868
+ switch (_context4.prev = _context4.next) {
2869
+ case 0:
2870
+ return _context4.abrupt("return", apiFetcher("/PromptedQuestion/" + sessionId + "/" + promptId, {
2871
+ method: 'GET',
2872
+ apiUrl: apiUrl
2873
+ }));
2874
+
2875
+ case 1:
2876
+ case "end":
2877
+ return _context4.stop();
2878
+ }
2879
+ }
2880
+ }, _callee4);
2881
+ }));
2882
+
2883
+ function deletePromptedQuestion(_x6, _x7) {
2884
+ return _deletePromptedQuestion.apply(this, arguments);
2885
+ }
2886
+
2887
+ return deletePromptedQuestion;
2888
+ }(),
2889
+
2890
+ /**
2891
+ * Adds a new Prompted Question object.
2892
+ * @param {string} sessionId The session ID
2893
+ */
2894
+ postPromptedQuestion: function () {
2895
+ var _postPromptedQuestion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(sessionId) {
2896
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
2897
+ while (1) {
2898
+ switch (_context5.prev = _context5.next) {
2899
+ case 0:
2900
+ return _context5.abrupt("return", apiFetcher("/PromptedQuestion/" + sessionId, {
2901
+ method: 'GET',
2902
+ apiUrl: apiUrl
2903
+ }));
2904
+
2905
+ case 1:
2906
+ case "end":
2907
+ return _context5.stop();
2908
+ }
2909
+ }
2910
+ }, _callee5);
2911
+ }));
2912
+
2913
+ function postPromptedQuestion(_x8) {
2914
+ return _postPromptedQuestion.apply(this, arguments);
2915
+ }
2916
+
2917
+ return postPromptedQuestion;
2918
+ }()
2919
+ };
2920
+ });
2921
+
2922
+ /******************
2923
+ * *
2924
+ * Search *
2925
+ * *
2926
+ ******************/
2927
+
2928
+ var search = (function (apiUrl) {
2929
+ return {
2930
+ /**
2931
+ * Searches for matching Memory objects using the same algorithm employed in the Text Entered event of the R1 state of the Dialog State Machine.
2932
+ * @param {string} sessionId The session ID
2933
+ * @param {SearchQuery} query Search query params
2934
+ */
2935
+ searchMemory: function () {
2936
+ var _searchMemory = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(sessionId, query) {
2937
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
2938
+ while (1) {
2939
+ switch (_context.prev = _context.next) {
2940
+ case 0:
2941
+ return _context.abrupt("return", apiFetcher("/Search/" + sessionId, {
2942
+ method: 'POST',
2943
+ body: query,
2944
+ apiUrl: apiUrl
2945
+ }));
2946
+
2947
+ case 1:
2948
+ case "end":
2949
+ return _context.stop();
2950
+ }
2951
+ }
2952
+ }, _callee);
2953
+ }));
2954
+
2955
+ function searchMemory(_x, _x2) {
2956
+ return _searchMemory.apply(this, arguments);
2957
+ }
2958
+
2959
+ return searchMemory;
2960
+ }(),
2961
+
2962
+ /**
2963
+ * Picks up to 5 random Memory objects using the same algorithm employed in the
2964
+ * Timeout event of the R1 state of the Dialog State Machine.
2965
+ * @param {string} sessionId The session ID
2966
+ */
2967
+ postRandom: function () {
2968
+ var _postRandom = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(sessionId) {
2969
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
2970
+ while (1) {
2971
+ switch (_context2.prev = _context2.next) {
2972
+ case 0:
2973
+ return _context2.abrupt("return", apiFetcher("/Random/" + sessionId, {
2974
+ method: 'POST',
2975
+ apiUrl: apiUrl
2976
+ }));
2977
+
2978
+ case 1:
2979
+ case "end":
2980
+ return _context2.stop();
2981
+ }
2982
+ }
2983
+ }, _callee2);
2984
+ }));
2985
+
2986
+ function postRandom(_x3) {
2987
+ return _postRandom.apply(this, arguments);
2988
+ }
2989
+
2990
+ return postRandom;
2991
+ }(),
2992
+
2993
+ /**
2994
+ * Picks up to 20 Memory Hint objects, obtained by searching for Story objects with a date or place set,
2995
+ * and clustering dates and places within an uncertainty of at least 1 year or at least 100 km.
2996
+ * Each Memory Hint may either suggest a date or a place, but not both.
2997
+ * @param {string} sessionId The session ID
2998
+ */
2999
+ postHints: function () {
3000
+ var _postHints = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(sessionId) {
3001
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
3002
+ while (1) {
3003
+ switch (_context3.prev = _context3.next) {
3004
+ case 0:
3005
+ return _context3.abrupt("return", apiFetcher("/Hints/" + sessionId, {
3006
+ method: 'GET',
3007
+ apiUrl: apiUrl
3008
+ }));
3009
+
3010
+ case 1:
3011
+ case "end":
3012
+ return _context3.stop();
3013
+ }
3014
+ }
3015
+ }, _callee3);
3016
+ }));
3017
+
3018
+ function postHints(_x4) {
3019
+ return _postHints.apply(this, arguments);
3020
+ }
3021
+
3022
+ return postHints;
3023
+ }()
3024
+ };
3025
+ });
3026
+
3027
+ /*******************
3028
+ * *
3029
+ * Session *
3030
+ * *
3031
+ *******************/
3032
+
3033
+ var session = (function (apiUrl) {
3034
+ return {
3035
+ /**
3036
+ * Initializes a new Dialog State Machine session for an existing Memori.
3037
+ */
3038
+ initSession: function () {
3039
+ var _initSession = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(params) {
3040
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
3041
+ while (1) {
3042
+ switch (_context.prev = _context.next) {
3043
+ case 0:
3044
+ return _context.abrupt("return", apiFetcher("/Session", {
3045
+ method: 'POST',
3046
+ body: params,
3047
+ apiUrl: apiUrl
3048
+ }));
3049
+
3050
+ case 1:
3051
+ case "end":
3052
+ return _context.stop();
3053
+ }
3054
+ }
3055
+ }, _callee);
3056
+ }));
3057
+
3058
+ function initSession(_x) {
3059
+ return _initSession.apply(this, arguments);
3060
+ }
3061
+
3062
+ return initSession;
3063
+ }(),
3064
+
3065
+ /**
3066
+ * Returns the current state of a session's Dialog State Machine.
3067
+ * @param {string} sessionId The session ID
3068
+ */
3069
+ getSession: function () {
3070
+ var _getSession = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(sessionId) {
3071
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
3072
+ while (1) {
3073
+ switch (_context2.prev = _context2.next) {
3074
+ case 0:
3075
+ return _context2.abrupt("return", apiFetcher("/Session/" + sessionId, {
3076
+ method: 'GET',
3077
+ apiUrl: apiUrl
3078
+ }));
3079
+
3080
+ case 1:
3081
+ case "end":
3082
+ return _context2.stop();
3083
+ }
3084
+ }
3085
+ }, _callee2);
3086
+ }));
3087
+
3088
+ function getSession(_x2) {
3089
+ return _getSession.apply(this, arguments);
3090
+ }
3091
+
3092
+ return getSession;
3093
+ }(),
3094
+
3095
+ /**
3096
+ * Closes the session and disposes of its Dialog State Machine.
3097
+ * @param {string} sessionId The session ID
3098
+ */
3099
+ deleteSession: function () {
3100
+ var _deleteSession = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(sessionId) {
3101
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
3102
+ while (1) {
3103
+ switch (_context3.prev = _context3.next) {
3104
+ case 0:
3105
+ return _context3.abrupt("return", apiFetcher("/Session/" + sessionId, {
3106
+ method: 'DELETE',
3107
+ apiUrl: apiUrl
3108
+ }));
3109
+
3110
+ case 1:
3111
+ case "end":
3112
+ return _context3.stop();
3113
+ }
3114
+ }
3115
+ }, _callee3);
3116
+ }));
3117
+
3118
+ function deleteSession(_x3) {
3119
+ return _deleteSession.apply(this, arguments);
3120
+ }
3121
+
3122
+ return deleteSession;
3123
+ }()
3124
+ };
3125
+ });
3126
+
3127
+ /*****************
3128
+ * *
3129
+ * Stats *
3130
+ * *
3131
+ *****************/
3132
+
3133
+ var stats = (function (apiUrl) {
3134
+ return {
3135
+ /**
3136
+ * Computes usage statistics for the Memori of the current session.
3137
+ * @param {string} sessionId The session ID
3138
+ */
3139
+ getStatistics: function () {
3140
+ var _getStatistics = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(sessionId) {
3141
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
3142
+ while (1) {
3143
+ switch (_context.prev = _context.next) {
3144
+ case 0:
3145
+ return _context.abrupt("return", apiFetcher("/Statistics/" + sessionId, {
3146
+ method: 'GET',
3147
+ apiUrl: apiUrl
3148
+ }));
3149
+
3150
+ case 1:
3151
+ case "end":
3152
+ return _context.stop();
3153
+ }
3154
+ }
3155
+ }, _callee);
3156
+ }));
3157
+
3158
+ function getStatistics(_x) {
3159
+ return _getStatistics.apply(this, arguments);
3160
+ }
3161
+
3162
+ return getStatistics;
3163
+ }(),
3164
+
3165
+ /**
3166
+ * Get the Event Log objects for the Memori of the current session in a specific date interval
3167
+ * @param {string} sessionId The session ID
3168
+ * @param {string} strDateFrom The optional begin of the date interval, in UTC time, in the format yyyyMMddHHmmssfff
3169
+ * @param {string} strDateTo The optional end of the date interval, in UTC time, in the format yyyyMMddHHmmssfff
3170
+ */
3171
+ getEventLogs: function () {
3172
+ var _getEventLogs = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(sessionId, strDateFrom, strDateTo) {
3173
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
3174
+ while (1) {
3175
+ switch (_context2.prev = _context2.next) {
3176
+ case 0:
3177
+ return _context2.abrupt("return", apiFetcher("/EventLogs/" + sessionId + "/" + strDateFrom + "/" + strDateTo, {
3178
+ method: 'GET',
3179
+ apiUrl: apiUrl
3180
+ }));
3181
+
3182
+ case 1:
3183
+ case "end":
3184
+ return _context2.stop();
3185
+ }
3186
+ }
3187
+ }, _callee2);
3188
+ }));
3189
+
3190
+ function getEventLogs(_x2, _x3, _x4) {
3191
+ return _getEventLogs.apply(this, arguments);
3192
+ }
3193
+
3194
+ return getEventLogs;
3195
+ }()
3196
+ };
3197
+ });
3198
+
3199
+ /*******************************
3200
+ * *
3201
+ * UnansweredQuestions *
3202
+ * *
3203
+ *******************************/
3204
+
3205
+ var unansweredQuestions = (function (apiUrl) {
3206
+ return {
3207
+ /**
3208
+ * Lists all Unanswered Question objects.
3209
+ * @param {string} sessionId The session ID
3210
+ */
3211
+ getUnansweredQuestions: function () {
3212
+ var _getUnansweredQuestions = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(sessionId) {
3213
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
3214
+ while (1) {
3215
+ switch (_context.prev = _context.next) {
3216
+ case 0:
3217
+ return _context.abrupt("return", apiFetcher("/UnansweredQuestions/" + sessionId, {
3218
+ method: 'GET',
3219
+ apiUrl: apiUrl
3220
+ }));
3221
+
3222
+ case 1:
3223
+ case "end":
3224
+ return _context.stop();
3225
+ }
3226
+ }
3227
+ }, _callee);
3228
+ }));
3229
+
3230
+ function getUnansweredQuestions(_x) {
3231
+ return _getUnansweredQuestions.apply(this, arguments);
3232
+ }
3233
+
3234
+ return getUnansweredQuestions;
3235
+ }(),
3236
+
3237
+ /**
3238
+ * Removes an existing Unanswered Question object.
3239
+ * @param {string} sessionId The session ID
3240
+ * @param {string} unansweredQuestionId The Unanswered Question object ID
3241
+ */
3242
+ deleteUnansweredQuestion: function () {
3243
+ var _deleteUnansweredQuestion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(sessionId, unansweredQuestionId) {
3244
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
3245
+ while (1) {
3246
+ switch (_context2.prev = _context2.next) {
3247
+ case 0:
3248
+ return _context2.abrupt("return", apiFetcher("/UnansweredQuestion/" + sessionId + "/" + unansweredQuestionId, {
3249
+ method: 'DELETE',
3250
+ apiUrl: apiUrl
3251
+ }));
3252
+
3253
+ case 1:
3254
+ case "end":
3255
+ return _context2.stop();
3256
+ }
3257
+ }
3258
+ }, _callee2);
3259
+ }));
3260
+
3261
+ function deleteUnansweredQuestion(_x2, _x3) {
3262
+ return _deleteUnansweredQuestion.apply(this, arguments);
3263
+ }
3264
+
3265
+ return deleteUnansweredQuestion;
3266
+ }()
3267
+ };
3268
+ });
3269
+
3270
+ /********************
3271
+ * *
3272
+ * WebHooks *
3273
+ * *
3274
+ ********************/
3275
+
3276
+ var webhooks = (function (apiUrl) {
3277
+ return {
3278
+ /**
3279
+ * Returns test slot values. Currently available test slots are:<ul><li><code>number</code>: integer numbers between 1 and 10</li><li><code>letter</code>: uppercase letters between A and Z</li><li><code>greek_letter</code>: capitalized Greek letters between Alpha and Omega</li></ul>
3280
+ */
3281
+ postTestSlot: function () {
3282
+ var _postTestSlot = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
3283
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
3284
+ while (1) {
3285
+ switch (_context.prev = _context.next) {
3286
+ case 0:
3287
+ return _context.abrupt("return", apiFetcher("/TestSlot", {
3288
+ method: 'GET',
3289
+ apiUrl: apiUrl
3290
+ }));
3291
+
3292
+ case 1:
3293
+ case "end":
3294
+ return _context.stop();
3295
+ }
3296
+ }
3297
+ }, _callee);
3298
+ }));
3299
+
3300
+ function postTestSlot() {
3301
+ return _postTestSlot.apply(this, arguments);
3302
+ }
3303
+
3304
+ return postTestSlot;
3305
+ }(),
3306
+
3307
+ /**
3308
+ * Returns test intent results. Currently available test intents are:<ul><li><code>ECHO</code>: emits the intent utterance as-is.</li><li><code>COMBINE_LETTER_AND_NUMBER</code>: requires a letter slot and a number slot,
3309
+ emits the content of the two slots in justaxposition, e.g. "A10".</li><li><code>DATE_RANGE</code>: requires a date slot, emits the date range indicated
3310
+ by the date slot in the format "yyyy/MM/dd - yyyy/MM/dd".</li><li><code>AUTOINCREMENT</code>: returns a progressive number that increments by 1
3311
+ each time the intent is called.</li><li><code>FIBONACCI</code>: returns the next element of the Fibonacci series, using
3312
+ context variables to store the series progression.</li></ul>
3313
+ */
3314
+ postTestIntent: function () {
3315
+ var _postTestIntent = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
3316
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
3317
+ while (1) {
3318
+ switch (_context2.prev = _context2.next) {
3319
+ case 0:
3320
+ return _context2.abrupt("return", apiFetcher("/TestIntent", {
3321
+ method: 'GET',
3322
+ apiUrl: apiUrl
3323
+ }));
3324
+
3325
+ case 1:
3326
+ case "end":
3327
+ return _context2.stop();
3328
+ }
3329
+ }
3330
+ }, _callee2);
3331
+ }));
3332
+
3333
+ function postTestIntent() {
3334
+ return _postTestIntent.apply(this, arguments);
3335
+ }
3336
+
3337
+ return postTestIntent;
3338
+ }()
3339
+ };
3340
+ });
3341
+
3342
+ var engine = (function (apiUrl) {
3343
+ return _extends({
3344
+ correlationPairs: correlationPairs(apiUrl)
3345
+ }, correlationPairs(apiUrl), {
3346
+ dialog: dialog(apiUrl)
3347
+ }, dialog(apiUrl), {
3348
+ importExport: importExport(apiUrl)
3349
+ }, importExport(apiUrl), {
3350
+ intents: intents(apiUrl)
3351
+ }, intents(apiUrl), {
3352
+ localizationKeys: localizationKeys(apiUrl)
3353
+ }, localizationKeys(apiUrl), {
3354
+ media: media(apiUrl)
3355
+ }, media(apiUrl), {
3356
+ memori: memori$1(apiUrl)
3357
+ }, memori$1(apiUrl), {
3358
+ memories: memories(apiUrl)
3359
+ }, memories(apiUrl), {
3360
+ nlp: nlp(apiUrl)
3361
+ }, nlp(apiUrl), {
3362
+ people: people(apiUrl)
3363
+ }, people(apiUrl), {
3364
+ promptedQuestions: promptedQuestions(apiUrl)
3365
+ }, promptedQuestions(apiUrl), {
3366
+ search: search(apiUrl)
3367
+ }, search(apiUrl), {
3368
+ session: session(apiUrl)
3369
+ }, session(apiUrl), {
3370
+ stats: stats(apiUrl)
3371
+ }, stats(apiUrl), {
3372
+ unansweredQuestions: unansweredQuestions(apiUrl)
3373
+ }, unansweredQuestions(apiUrl), {
3374
+ webhooks: webhooks(apiUrl)
3375
+ }, webhooks(apiUrl));
3376
+ });
3377
+
3378
+ var allowedMediaTypes = ['image/jpeg', 'image/png', 'image/jpg', 'image/gif', 'text/plain', 'application/msword', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/vnd.ms-excel', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/pdf', 'video/mp4', 'video/avi', 'audio/mpeg3', 'audio/wav', 'audio/mpeg', 'video/mpeg', 'model/gltf-binary'];
3379
+ var anonTag = '👤';
3380
+
3381
+ var constants = {
3382
+ __proto__: null,
3383
+ allowedMediaTypes: allowedMediaTypes,
3384
+ anonTag: anonTag
3385
+ };
3386
+
3387
+ var getTTSVoice = function getTTSVoice(lang, voiceType) {
3388
+ var voice = '';
3389
+ var voiceLang = lang.toUpperCase();
3390
+
3391
+ switch (voiceLang) {
3392
+ case 'IT':
3393
+ voice = "" + (voiceType === 'MALE' ? 'it-IT-DiegoNeural' : 'it-IT-ElsaNeural');
3394
+ break;
3395
+
3396
+ case 'DE':
3397
+ voice = "" + (voiceType === 'MALE' ? 'de-DE-ConradNeural' : 'de-DE-KatjaNeural');
3398
+ break;
3399
+
3400
+ case 'EN':
3401
+ voice = "" + (voiceType === 'MALE' ? 'en-GB-RyanNeural' : 'en-GB-SoniaNeural');
3402
+ break;
3403
+
3404
+ case 'ES':
3405
+ voice = "" + (voiceType === 'MALE' ? 'es-ES-AlvaroNeural' : 'es-ES-ElviraNeural');
3406
+ break;
3407
+
3408
+ case 'FR':
3409
+ voice = "" + (voiceType === 'MALE' ? 'fr-FR-HenriNeural' : 'fr-FR-DeniseNeural');
3410
+ break;
3411
+
3412
+ case 'PT':
3413
+ voice = "" + (voiceType === 'MALE' ? 'pt-PT-DuarteNeural' : 'pt-PT-RaquelNeural');
3414
+ break;
3415
+
3416
+ default:
3417
+ voice = "" + (voiceType === 'MALE' ? 'it-IT-DiegoNeural' : 'it-IT-IsabellaNeural');
3418
+ break;
3419
+ }
3420
+
3421
+ return voice;
3422
+ };
3423
+
3424
+ var getCultureCodeByLanguage = function getCultureCodeByLanguage(lang) {
3425
+ var voice = '';
3426
+ var voiceLang = lang.toUpperCase();
3427
+
3428
+ switch (voiceLang) {
3429
+ case 'IT':
3430
+ voice = 'it-IT';
3431
+ break;
3432
+
3433
+ case 'DE':
3434
+ voice = 'de-DE';
3435
+ break;
3436
+
3437
+ case 'EN':
3438
+ voice = 'en-US';
3439
+ break;
3440
+
3441
+ case 'ES':
3442
+ voice = 'es-ES';
3443
+ break;
3444
+
3445
+ case 'FR':
3446
+ voice = 'fr-FR';
3447
+ break;
3448
+
3449
+ case 'PT':
3450
+ voice = 'pt-PT';
3451
+ break;
3452
+
3453
+ default:
3454
+ voice = 'it-IT';
3455
+ break;
3456
+ }
3457
+
3458
+ return voice;
3459
+ };
3460
+
3461
+ var speech = function speech(AZURE_COGNITIVE_SERVICES_TTS_KEY, DEBUG) {
3462
+ if (DEBUG === void 0) {
3463
+ DEBUG = false;
3464
+ }
3465
+
3466
+ return function (lang, voiceType) {
3467
+ speechSdk.Recognizer.enableTelemetry(false);
3468
+ var speechConfig = speechSdk.SpeechConfig.fromSubscription(AZURE_COGNITIVE_SERVICES_TTS_KEY, 'eastus');
3469
+ var speechSynthesizer;
3470
+ var audioDestination;
3471
+ audioDestination = new speechSdk.SpeakerAudioDestination();
3472
+ var audioOutputConfig = speechSdk.AudioConfig.fromSpeakerOutput(audioDestination); // https://docs.microsoft.com/it-it/azure/cognitive-services/speech-service/language-support#text-to-speech
3473
+
3474
+ speechConfig.speechSynthesisVoiceName = getTTSVoice(lang, voiceType);
3475
+ var langCultureCode = getCultureCodeByLanguage(lang);
3476
+ speechConfig.speechSynthesisLanguage = langCultureCode;
3477
+ speechConfig.speechRecognitionLanguage = langCultureCode;
3478
+ /**
3479
+ * speak
3480
+ * @description Speaks the text using the speech synthesizer. (TTS)
3481
+ * @param {string} text - The text to be synthesized.
3482
+ * @param {func=} onAudioEnd - The callback to be invoked when the synthesized audio is finished.
3483
+ */
3484
+
3485
+ var speak = function speak(text, onAudioEnd) {
3486
+ stopSpeaking();
3487
+ speechSynthesizer = new speechSdk.SpeechSynthesizer(speechConfig, audioOutputConfig);
3488
+ if (onAudioEnd) audioDestination.onAudioEnd = onAudioEnd;
3489
+ speechSynthesizer.speakTextAsync(text, function (result) {
3490
+ if (result) {
3491
+ try {
3492
+ if (DEBUG) console.log('speak result', result);
3493
+
3494
+ if (speechSynthesizer) {
3495
+ speechSynthesizer.close();
3496
+ speechSynthesizer = null;
3497
+ }
3498
+ } catch (e) {
3499
+ console.error('speak error: ', e);
3500
+ window.speechSynthesis.speak(new SpeechSynthesisUtterance(text));
3501
+ }
3502
+ } else if (DEBUG) {
3503
+ console.log('speak no result', result);
3504
+ }
3505
+ }, function (error) {
3506
+ console.error('speak:', error);
3507
+ window.speechSynthesis.speak(new SpeechSynthesisUtterance(text));
3508
+ });
3509
+ };
3510
+ /**
3511
+ * isSpeaking
3512
+ * @description Returns true if the synthesizer is speaking.
3513
+ * @returns {boolean}
3514
+ */
3515
+
3516
+
3517
+ var isSpeaking = function isSpeaking() {
3518
+ return !!speechSynthesizer;
3519
+ };
3520
+ /**
3521
+ * stopSpeaking
3522
+ * @description Stops the speech synthesizer if it is synthesizing.
3523
+ */
3524
+
3525
+
3526
+ var stopSpeaking = function stopSpeaking() {
3527
+ if (audioDestination) audioDestination.pause();
3528
+
3529
+ if (speechSynthesizer) {
3530
+ speechSynthesizer.close();
3531
+ speechSynthesizer = null;
3532
+ }
3533
+ };
3534
+
3535
+ var audioInputConfig = speechSdk.AudioConfig.fromDefaultMicrophoneInput();
3536
+ var recognizer;
3537
+ /**
3538
+ * recognize
3539
+ * @description Starts the speech recognition.
3540
+ * @param {func=} onRecognized - Callback method invoked when the speech is recognized with the text.
3541
+ */
3542
+
3543
+ var recognize = function recognize(onRecognized) {
3544
+ recognizer = new speechSdk.SpeechRecognizer(speechConfig, audioInputConfig);
3545
+
3546
+ recognizer.recognizing = function (_s, e) {
3547
+ if (DEBUG) console.log("RECOGNIZING: Text=" + e.result.text);
3548
+ };
3549
+
3550
+ recognizer.recognized = function (_s, e) {
3551
+ if (e.result.reason === speechSdk.ResultReason.RecognizedSpeech) {
3552
+ var _e$result$text;
3553
+
3554
+ if (DEBUG) console.log("RECOGNIZED: Text=" + e.result.text);
3555
+ onRecognized((_e$result$text = e.result.text) != null ? _e$result$text : '');
3556
+ } else if (e.result.reason === speechSdk.ResultReason.NoMatch && DEBUG) {
3557
+ console.log('NOMATCH: Speech could not be recognized.');
3558
+ }
3559
+ };
3560
+
3561
+ recognizer.canceled = function (_s, e) {
3562
+ if (DEBUG) console.log("CANCELED: Reason=" + e.reason);
3563
+
3564
+ if (e.reason === speechSdk.CancellationReason.Error && DEBUG) {
3565
+ console.log("\"CANCELED: ErrorCode=" + e.errorCode);
3566
+ console.log("\"CANCELED: ErrorDetails=" + e.errorDetails);
3567
+ console.log('CANCELED: Did you set the speech resource key and region values?');
3568
+ }
3569
+
3570
+ stopRecognizing();
3571
+ };
3572
+
3573
+ recognizer.sessionStopped = function (_s, _e) {
3574
+ if (DEBUG) console.log('\n Session stopped event.');
3575
+ if (recognizer) recognizer.stopContinuousRecognitionAsync();
3576
+ };
3577
+
3578
+ recognizer.startContinuousRecognitionAsync();
3579
+ };
3580
+ /**
3581
+ * isRecognizing
3582
+ * @description Returns true if the recognizer is recognizing.
3583
+ * @returns {boolean}
3584
+ */
3585
+
3586
+
3587
+ var isRecognizing = function isRecognizing() {
3588
+ return !!recognizer;
3589
+ };
3590
+ /**
3591
+ * stopRecognizing
3592
+ * @description Stops the speech recognizer if it is recognizing.
3593
+ * @param {func=} onStop - (optional) The callback to be invoked when the speech recognition is stopped.
3594
+ */
3595
+
3596
+
3597
+ var stopRecognizing = function stopRecognizing(onStop) {
3598
+ if (recognizer) {
3599
+ recognizer.stopContinuousRecognitionAsync();
3600
+ recognizer.close();
3601
+ recognizer = null;
3602
+ if (onStop) onStop();
3603
+ }
3604
+ };
3605
+
3606
+ return {
3607
+ speak: speak,
3608
+ isSpeaking: isSpeaking,
3609
+ stopSpeaking: stopSpeaking,
3610
+ recognize: recognize,
3611
+ isRecognizing: isRecognizing,
3612
+ stopRecognizing: stopRecognizing
3613
+ };
3614
+ };
3615
+ };
3616
+
3617
+ var asset$1 = (function (apiUrl) {
3618
+ return {
3619
+ /**
3620
+ * getResourceUrl
3621
+ * @description Returns the correct URL of a resource from the DB.
3622
+ * @param {obj} params
3623
+ * @param {string=} params.type - wheather is the avatar or the cover
3624
+ * @param {string=} params.resourceURI - the resource URI
3625
+ * @param {string=} params.sessionID - the session ID, required for memory media attachments
3626
+ * @param {string=} params.baseURL - the base URL for default static assets (defaults to https://app.twincreator.com)
3627
+ * @returns {string}
3628
+ */
3629
+ getResourceUrl: function getResourceUrl(_ref) {
3630
+ var type = _ref.type,
3631
+ resourceURI = _ref.resourceURI,
3632
+ sessionID = _ref.sessionID,
3633
+ _ref$baseURL = _ref.baseURL,
3634
+ baseURL = _ref$baseURL === void 0 ? 'https://app.twincreator.com' : _ref$baseURL;
3635
+ var defaultUri = type === 'cover' ? baseURL + "/images/memoriCover.png" : baseURL + "/images/memoriAvatar.png";
3636
+
3637
+ if (!resourceURI || resourceURI.length === 0) {
3638
+ return defaultUri;
3639
+ } else if (resourceURI.includes('memoriai/memory')) {
3640
+ return resourceURI + "?memori-ai-session-id=" + sessionID;
3641
+ } else if (resourceURI.startsWith('https://') || resourceURI.startsWith('http://')) {
3642
+ return "" + resourceURI + (sessionID ? "/" + sessionID : '');
3643
+ } else if (resourceURI.startsWith('cloud://')) {
3644
+ return apiUrl.replace(/v2/, 'v1') + "/CloudAsset/" + resourceURI.replace('cloud://', '');
3645
+ } else if (resourceURI.startsWith('guid://')) {
3646
+ return apiUrl.replace(/v2/, 'v1') + "/GuidAsset/" + resourceURI.replace('guid://', '');
3647
+ } else {
3648
+ return defaultUri;
3649
+ }
3650
+ }
3651
+ };
3652
+ });
3653
+
3654
+ var api = function api(hostname) {
3655
+ var apiUrl = getApiUrl(hostname);
3656
+ return _extends({
3657
+ backend: backendAPI(apiUrl + "/api/v2")
3658
+ }, engine(apiUrl + "/memori/v2"), {
3659
+ speech: speech,
3660
+ constants: constants,
3661
+ asset: asset$1(apiUrl + "/api/v2")
3662
+ });
3663
+ };
3664
+
3665
+ exports.default = api;
3666
+ //# sourceMappingURL=memori-api-client.cjs.development.js.map