Flush the internal buffer with chunks by making appropriate API calls.
(self, chunks: Optional[Sequence[Union[Dict, Chunk]]] = None, **kwargs)
| 223 | return response |
| 224 | |
| 225 | async def _flush_buffer(self, chunks: Optional[Sequence[Union[Dict, Chunk]]] = None, **kwargs) -> AsyncSlackResponse: |
| 226 | """Flush the internal buffer with chunks by making appropriate API calls.""" |
| 227 | chunks_to_flush: List[Union[Dict, Chunk]] = [] |
| 228 | if len(self._buffer) != 0: |
| 229 | chunks_to_flush.append(MarkdownTextChunk(text=self._buffer)) |
| 230 | if chunks is not None: |
| 231 | chunks_to_flush.extend(chunks) |
| 232 | if not self._stream_ts: |
| 233 | response = await self._client.chat_startStream( |
| 234 | **self._stream_args, |
| 235 | token=self._token, |
| 236 | **kwargs, |
| 237 | chunks=chunks_to_flush, |
| 238 | ) |
| 239 | self._stream_ts = response.get("ts") |
| 240 | self._state = "in_progress" |
| 241 | else: |
| 242 | response = await self._client.chat_appendStream( |
| 243 | token=self._token, |
| 244 | channel=self._stream_args["channel"], |
| 245 | ts=self._stream_ts, |
| 246 | **kwargs, |
| 247 | chunks=chunks_to_flush, |
| 248 | ) |
| 249 | self._buffer = "" |
| 250 | return response |
no test coverage detected