You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -516,7 +516,7 @@ export class WebClient extends Methods {
516
516
* @description The "chatStream" method starts a new chat stream in a coversation that can be appended to. After appending an entire message, the stream can be stopped with concluding arguments such as "blocks" for gathering feedback.
517
517
*
518
518
* @example
519
-
* const streamer = await client.chatStream({
519
+
* const streamer = client.chatStream({
520
520
* channel: "C0123456789",
521
521
* thread_ts: "1700000001.123456",
522
522
* recipient_team_id: "T0123456789",
@@ -534,10 +534,12 @@ export class WebClient extends Methods {
* @description The length of markdown_text to buffer in-memory before calling a method. Increasing this value decreases the number of method calls made for the same amount of text, which is useful to avoid rate limits.
@@ -20,13 +34,14 @@ export default class ChatStreamer {
20
34
* @description The "constructor" method creates a unique {@link ChatStreamer} instance that keeps track of one chat stream. The stream must be started.
21
35
* @example
22
36
* const client = new WebClient(process.env.SLACK_BOT_TOKEN);
* @description The "start" method starts a new chat stream unique to a {@link ChatStreamer} being used. This method can be called once. If the chat stream was created with the {@link WebClient#chatStream} method this method should not be called because the stream is started already.
47
-
* @example
48
-
* const streamer = await client.chatStream({
49
-
* channel: "C0123456789",
50
-
* thread_ts: "1700000001.123456",
51
-
* recipient_team_id: "T0123456789",
52
-
* recipient_user_id: "U0123456789",
53
-
* });
54
-
* await streamer.append({
55
-
* markdown_text: "**hello world!**",
56
-
* });
57
-
* await streamer.stop();
58
-
* @example
59
-
* const client = new WebClient(process.env.SLACK_BOT_TOKEN);
thrownewError(`failed to start stream: stream state is ${this.state}`);
76
-
}
77
-
if(params.token){
78
-
this.token=params.token;
79
-
}
80
-
constresponse=awaitthis.client.chat.startStream({
81
-
token: this.token,
82
-
...params,
83
-
});
84
-
if(!response.ts){
85
-
thrownewError(`failed to start stream: ${response.error}`);
86
-
}
87
-
this.channel=params.channel;
88
-
this.state='in_progress';
89
-
this.streamTs=response.ts;
90
-
returnresponse;
91
-
}
92
-
93
63
/**
94
64
* Append to a stream.
95
65
*
96
66
* @description The "append" method appends to the chat stream being used. This method can be called multiple times. After the stream is stopped this method cannot be called.
97
67
* @example
98
-
* const streamer = await client.stream({
68
+
* const streamer = client.startStream({
99
69
* channel: "C0123456789",
100
70
* thread_ts: "1700000001.123456",
101
71
* recipient_team_id: "T0123456789",
@@ -111,27 +81,28 @@ export default class ChatStreamer {
this.logger.debug(`ChatStreamer appended to buffer: ${JSON.stringify(details)}`);
105
+
returnnull;
135
106
}
136
107
137
108
/**
@@ -140,7 +111,7 @@ export default class ChatStreamer {
140
111
* @description The "stop" method stops the chat stream being used. This method can be called once to end the stream. Additional "blocks" and "metadata" can be provided.
141
112
*
142
113
* @example
143
-
* const streamer = await client.stream({
114
+
* const streamer = client.startStream({
144
115
* channel: "C0123456789",
145
116
* thread_ts: "1700000001.123456",
146
117
* recipient_team_id: "T0123456789",
@@ -152,26 +123,58 @@ export default class ChatStreamer {
0 commit comments