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