Skip to content

Commit fcbce94

Browse files
committed
refactor: rename internal stream arguments to streamArgs
1 parent c320a80 commit fcbce94

1 file changed

Lines changed: 11 additions & 11 deletions

File tree

packages/web-api/src/chat-stream.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ export interface ChatStreamerOptions {
1212
}
1313

1414
export class ChatStreamer {
15-
private args: ChatStartStreamArguments;
16-
1715
private buffer = '';
1816

1917
private client: WebClient;
@@ -24,6 +22,8 @@ export class ChatStreamer {
2422

2523
private state: 'starting' | 'in_progress' | 'completed';
2624

25+
private streamArgs: ChatStartStreamArguments;
26+
2727
private streamTs: string | undefined;
2828

2929
private token: string | undefined;
@@ -51,13 +51,13 @@ export class ChatStreamer {
5151
* @see {@link https://docs.slack.dev/reference/methods/chat.stopStream}
5252
*/
5353
constructor(client: WebClient, logger: Logger, args: ChatStartStreamArguments, options: ChatStreamerOptions) {
54-
this.args = args;
5554
this.client = client;
5655
this.logger = logger;
5756
this.options = {
5857
buffer_size: options.buffer_size ?? 256,
5958
};
6059
this.state = 'starting';
60+
this.streamArgs = args;
6161
}
6262

6363
/**
@@ -96,10 +96,10 @@ export class ChatStreamer {
9696
const details = {
9797
bufferLength: this.buffer.length,
9898
bufferSize: this.options.buffer_size,
99-
channel: this.args.channel,
100-
recipientTeamId: this.args.recipient_team_id,
101-
recipientUserId: this.args.recipient_user_id,
102-
threadTs: this.args.thread_ts,
99+
channel: this.streamArgs.channel,
100+
recipientTeamId: this.streamArgs.recipient_team_id,
101+
recipientUserId: this.streamArgs.recipient_user_id,
102+
threadTs: this.streamArgs.thread_ts,
103103
};
104104
this.logger.debug(`ChatStreamer appended to buffer: ${JSON.stringify(details)}`);
105105
return null;
@@ -132,7 +132,7 @@ export class ChatStreamer {
132132
}
133133
if (!this.streamTs) {
134134
const response = await this.client.chat.startStream({
135-
...this.args,
135+
...this.streamArgs,
136136
token: this.token,
137137
});
138138
if (!response.ts) {
@@ -143,7 +143,7 @@ export class ChatStreamer {
143143
}
144144
const response = await this.client.chat.stopStream({
145145
token: this.token,
146-
channel: this.args.channel,
146+
channel: this.streamArgs.channel,
147147
ts: this.streamTs,
148148
...params,
149149
markdown_text: this.buffer + (params?.markdown_text ?? ''),
@@ -157,7 +157,7 @@ export class ChatStreamer {
157157
): Promise<ChatStartStreamResponse | ChatAppendStreamResponse> {
158158
if (!this.streamTs) {
159159
const response = await this.client.chat.startStream({
160-
...this.args,
160+
...this.streamArgs,
161161
token: this.token,
162162
...params,
163163
markdown_text: this.buffer,
@@ -169,7 +169,7 @@ export class ChatStreamer {
169169
}
170170
const response = await this.client.chat.appendStream({
171171
token: this.token,
172-
channel: this.args.channel,
172+
channel: this.streamArgs.channel,
173173
ts: this.streamTs,
174174
...params,
175175
markdown_text: this.buffer,

0 commit comments

Comments
 (0)