Skip to content

Commit 0f852cd

Browse files
committed
refactor: rename method params to args argument
1 parent fcbce94 commit 0f852cd

1 file changed

Lines changed: 13 additions & 13 deletions

File tree

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

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -81,17 +81,17 @@ export class ChatStreamer {
8181
* @see {@link https://docs.slack.dev/reference/methods/chat.appendStream}
8282
*/
8383
async append(
84-
params: Omit<ChatAppendStreamArguments, 'channel' | 'ts'>,
84+
args: Omit<ChatAppendStreamArguments, 'channel' | 'ts'>,
8585
): Promise<ChatStartStreamResponse | ChatAppendStreamResponse | null> {
8686
if (this.state === 'completed') {
8787
throw new Error(`failed to append stream: stream state is ${this.state}`);
8888
}
89-
if (params.token) {
90-
this.token = params.token;
89+
if (args.token) {
90+
this.token = args.token;
9191
}
92-
this.buffer += params.markdown_text;
92+
this.buffer += args.markdown_text;
9393
if (this.buffer.length >= this.options.buffer_size) {
94-
return await this.flushBuffer(params);
94+
return await this.flushBuffer(args);
9595
}
9696
const details = {
9797
bufferLength: this.buffer.length,
@@ -123,12 +123,12 @@ export class ChatStreamer {
123123
* await streamer.stop();
124124
* @see {@link https://docs.slack.dev/reference/methods/chat.stopStream}
125125
*/
126-
async stop(params?: Omit<ChatStopStreamArguments, 'channel' | 'ts'>): Promise<ChatStopStreamResponse> {
126+
async stop(args?: Omit<ChatStopStreamArguments, 'channel' | 'ts'>): Promise<ChatStopStreamResponse> {
127127
if (this.state === 'completed') {
128128
throw new Error(`failed to stop stream: stream state is ${this.state}`);
129129
}
130-
if (params?.token) {
131-
this.token = params.token;
130+
if (args?.token) {
131+
this.token = args.token;
132132
}
133133
if (!this.streamTs) {
134134
const response = await this.client.chat.startStream({
@@ -145,21 +145,21 @@ export class ChatStreamer {
145145
token: this.token,
146146
channel: this.streamArgs.channel,
147147
ts: this.streamTs,
148-
...params,
149-
markdown_text: this.buffer + (params?.markdown_text ?? ''),
148+
...args,
149+
markdown_text: this.buffer + (args?.markdown_text ?? ''),
150150
});
151151
this.state = 'completed';
152152
return response;
153153
}
154154

155155
private async flushBuffer(
156-
params: Omit<ChatStartStreamArguments | ChatAppendStreamArguments, 'channel' | 'ts'>,
156+
args: Omit<ChatStartStreamArguments | ChatAppendStreamArguments, 'channel' | 'ts'>,
157157
): Promise<ChatStartStreamResponse | ChatAppendStreamResponse> {
158158
if (!this.streamTs) {
159159
const response = await this.client.chat.startStream({
160160
...this.streamArgs,
161161
token: this.token,
162-
...params,
162+
...args,
163163
markdown_text: this.buffer,
164164
});
165165
this.buffer = '';
@@ -171,7 +171,7 @@ export class ChatStreamer {
171171
token: this.token,
172172
channel: this.streamArgs.channel,
173173
ts: this.streamTs,
174-
...params,
174+
...args,
175175
markdown_text: this.buffer,
176176
});
177177
this.buffer = '';

0 commit comments

Comments
 (0)