bkper-js 1.35.3 → 1.35.4
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/lib/index.d.ts
CHANGED
|
@@ -2139,6 +2139,10 @@ export declare class Message {
|
|
|
2139
2139
|
* @returns The Agent response Message, with the created Message as its parent
|
|
2140
2140
|
*/
|
|
2141
2141
|
create(): Promise<Message>;
|
|
2142
|
+
/**
|
|
2143
|
+
* Streams the Message to the Bkper API.
|
|
2144
|
+
*/
|
|
2145
|
+
stream(): Promise<void>;
|
|
2142
2146
|
}
|
|
2143
2147
|
|
|
2144
2148
|
/**
|
package/lib/model/Message.js
CHANGED
|
@@ -171,5 +171,17 @@ export class Message {
|
|
|
171
171
|
return this;
|
|
172
172
|
});
|
|
173
173
|
}
|
|
174
|
+
/**
|
|
175
|
+
* Streams the Message to the Bkper API.
|
|
176
|
+
*/
|
|
177
|
+
stream() {
|
|
178
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
179
|
+
const conversationId = this.conversation.getId();
|
|
180
|
+
if (!conversationId) {
|
|
181
|
+
throw new Error('Conversation id null!');
|
|
182
|
+
}
|
|
183
|
+
ConversationService.streamMessage(conversationId, this.payload);
|
|
184
|
+
});
|
|
185
|
+
}
|
|
174
186
|
}
|
|
175
187
|
//# sourceMappingURL=Message.js.map
|
|
@@ -34,4 +34,9 @@ export function createMessage(conversationId, message) {
|
|
|
34
34
|
return response.data;
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
|
+
export function streamMessage(conversationId, message) {
|
|
38
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
+
new HttpApiRequest(`v5/apps/conversations/${conversationId}/stream`).setMethod('POST').setPayload(message).fetch();
|
|
40
|
+
});
|
|
41
|
+
}
|
|
37
42
|
//# sourceMappingURL=conversation-service.js.map
|