tevrocsdk 0.1.48 → 0.1.49
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/package.json +1 -1
- package/tevroc-sdk.cjs.js +471 -184
- package/tevroc-sdk.cjs.js.map +4 -4
- package/tevroc-sdk.esm.js +11 -0
- package/tevroc-sdk.esm.js.map +4 -4
- package/tevroc-sdk.min.js +31 -31
- package/tevroc-sdk.umd.js +11 -0
package/tevroc-sdk.umd.js
CHANGED
|
@@ -26677,6 +26677,7 @@ var Tevroc = (() => {
|
|
|
26677
26677
|
__export(index_exports, {
|
|
26678
26678
|
TevrocClient: () => TevrocClient,
|
|
26679
26679
|
TevrocError: () => TevrocError,
|
|
26680
|
+
createChatbotClient: () => createChatbotClient,
|
|
26680
26681
|
createClient: () => createClient
|
|
26681
26682
|
});
|
|
26682
26683
|
|
|
@@ -41534,6 +41535,16 @@ var Tevroc = (() => {
|
|
|
41534
41535
|
function createClient(options = {}) {
|
|
41535
41536
|
return new TevrocClient(options);
|
|
41536
41537
|
}
|
|
41538
|
+
function createChatbotClient(options = {}) {
|
|
41539
|
+
if (!options.apiKey) throw new TevrocError("apiKey is required to create a chatbot client");
|
|
41540
|
+
const client = new TevrocClient({ ...options, appId: void 0, token: null, headers: { ...options.headers || {}, "x-api-key": options.apiKey } });
|
|
41541
|
+
const request = (path, requestOptions = {}) => client.request(path, { ...requestOptions, auth: false });
|
|
41542
|
+
return {
|
|
41543
|
+
getConfig: () => request("/chatbot/config"),
|
|
41544
|
+
createConversation: (input = {}) => request("/chatbot/conversations", { method: "POST", body: input }),
|
|
41545
|
+
sendMessage: (conversationId, input) => request(`/chatbot/conversations/${encodeURIComponent(conversationId)}/messages`, { method: "POST", body: input })
|
|
41546
|
+
};
|
|
41547
|
+
}
|
|
41537
41548
|
var TevrocClient = class {
|
|
41538
41549
|
constructor(options = {}) {
|
|
41539
41550
|
const baseUrl = options.baseUrl ?? options.url;
|