Skip to content

Commit 92c93e0

Browse files
committed
fix: support explicit json values as chunk objects
1 parent a6bb951 commit 92c93e0

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

slack_sdk/web/chat_stream.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def append(
6767
self,
6868
*,
6969
markdown_text: Optional[str] = None,
70-
chunks: Optional[Sequence[Chunk]] = None,
70+
chunks: Optional[Sequence[Union[Dict, Chunk]]] = None,
7171
**kwargs,
7272
) -> Optional[SlackResponse]:
7373
"""Append to the stream.
@@ -123,7 +123,7 @@ def stop(
123123
self,
124124
*,
125125
markdown_text: Optional[str] = None,
126-
chunks: Optional[Sequence[Chunk]] = None,
126+
chunks: Optional[Sequence[Union[Dict, Chunk]]] = None,
127127
blocks: Optional[Union[str, Sequence[Union[Dict, Block]]]] = None,
128128
metadata: Optional[Union[Dict, Metadata]] = None,
129129
**kwargs,
@@ -173,7 +173,7 @@ def stop(
173173
raise e.SlackRequestError("Failed to stop stream: stream not started")
174174
self._stream_ts = str(response["ts"])
175175
self._state = "in_progress"
176-
flushings: List[Chunk] = []
176+
flushings: List[Union[Dict, Chunk]] = []
177177
if len(self._buffer) != 0:
178178
flushings.append(MarkdownTextChunk(text=self._buffer))
179179
if chunks is not None:
@@ -190,9 +190,9 @@ def stop(
190190
self._state = "completed"
191191
return response
192192

193-
def _flush_buffer(self, chunks: Optional[Sequence[Chunk]] = None, **kwargs) -> SlackResponse:
193+
def _flush_buffer(self, chunks: Optional[Sequence[Union[Dict, Chunk]]] = None, **kwargs) -> SlackResponse:
194194
"""Flush the internal buffer with chunks by making appropriate API calls."""
195-
flushings: List[Chunk] = []
195+
flushings: List[Union[Dict, Chunk]] = []
196196
if len(self._buffer) != 0:
197197
flushings.append(MarkdownTextChunk(text=self._buffer))
198198
if chunks is not None:

0 commit comments

Comments
 (0)