Skip to content

Commit 03566bd

Browse files
committed
feat: remove legacy implementation
1 parent 64f4b14 commit 03566bd

3 files changed

Lines changed: 3 additions & 222 deletions

File tree

docs/reference/web/legacy_client.html

Lines changed: 0 additions & 163 deletions
Original file line numberDiff line numberDiff line change
@@ -2925,64 +2925,6 @@ <h2 class="section-title" id="header-classes">Classes</h2>
29252925
kwargs = _remove_none_values(kwargs)
29262926
return self.api_call(&#34;chat.startStream&#34;, json=kwargs)
29272927

2928-
def chat_stream(
2929-
self,
2930-
*,
2931-
buffer_size: int = 256,
2932-
channel: str,
2933-
thread_ts: str,
2934-
recipient_team_id: Optional[str] = None,
2935-
recipient_user_id: Optional[str] = None,
2936-
unfurl_links: Optional[bool] = None,
2937-
unfurl_media: Optional[bool] = None,
2938-
**kwargs,
2939-
) -&gt; ChatStream:
2940-
&#34;&#34;&#34;Stream markdown text into a conversation.
2941-
2942-
This method provides an easy way to stream markdown text using the following endpoints:
2943-
- chat.startStream: Starts a new streaming conversation
2944-
- chat.appendStream: Appends text to an existing streaming conversation
2945-
- chat.stopStream: Stops a streaming conversation
2946-
2947-
Args:
2948-
buffer_size: Size of the internal buffer before automatically flushing (default: 256)
2949-
channel: Channel to stream to
2950-
thread_ts: Thread timestamp to stream to (required)
2951-
recipient_team_id: Team ID of the recipient (for Slack Connect)
2952-
recipient_user_id: User ID of the recipient (for Slack Connect)
2953-
unfurl_links: Whether to unfurl links
2954-
unfurl_media: Whether to unfurl media
2955-
**kwargs: Additional arguments passed to the underlying API calls
2956-
2957-
Returns:
2958-
ChatStreamer instance for managing the stream
2959-
2960-
Example:
2961-
```python
2962-
streamer = client.chat_stream(
2963-
channel=&#34;C0123456789&#34;,
2964-
thread_ts=&#34;1700000001.123456&#34;,
2965-
recipient_team_id=&#34;T0123456789&#34;,
2966-
recipient_user_id=&#34;U0123456789&#34;,
2967-
)
2968-
streamer.append(markdown_text=&#34;**hello wo&#34;)
2969-
streamer.append(markdown_text=&#34;rld!**&#34;)
2970-
streamer.stop()
2971-
```
2972-
&#34;&#34;&#34;
2973-
return ChatStream(
2974-
self,
2975-
logger=self._logger,
2976-
channel=channel,
2977-
thread_ts=thread_ts,
2978-
recipient_team_id=recipient_team_id,
2979-
recipient_user_id=recipient_user_id,
2980-
unfurl_links=unfurl_links,
2981-
unfurl_media=unfurl_media,
2982-
buffer_size=buffer_size,
2983-
**kwargs,
2984-
)
2985-
29862928
def chat_stopStream(
29872929
self,
29882930
*,
@@ -10299,110 +10241,6 @@ <h3>Methods</h3>
1029910241
<div class="desc"><p>Stops a streaming conversation.
1030010242
<a href="https://api.slack.com/methods/chat.stopStream">https://api.slack.com/methods/chat.stopStream</a></p></div>
1030110243
</dd>
10302-
<dt id="slack_sdk.web.legacy_client.LegacyWebClient.chat_stream"><code class="name flex">
10303-
<span>def <span class="ident">chat_stream</span></span>(<span>self,<br>*,<br>buffer_size: int = 256,<br>channel: str,<br>thread_ts: str,<br>recipient_team_id: str | None = None,<br>recipient_user_id: str | None = None,<br>unfurl_links: bool | None = None,<br>unfurl_media: bool | None = None,<br>**kwargs) ‑> <a title="slack_sdk.web.chat_stream.ChatStream" href="chat_stream.html#slack_sdk.web.chat_stream.ChatStream">ChatStream</a></span>
10304-
</code></dt>
10305-
<dd>
10306-
<details class="source">
10307-
<summary>
10308-
<span>Expand source code</span>
10309-
</summary>
10310-
<pre><code class="python">def chat_stream(
10311-
self,
10312-
*,
10313-
buffer_size: int = 256,
10314-
channel: str,
10315-
thread_ts: str,
10316-
recipient_team_id: Optional[str] = None,
10317-
recipient_user_id: Optional[str] = None,
10318-
unfurl_links: Optional[bool] = None,
10319-
unfurl_media: Optional[bool] = None,
10320-
**kwargs,
10321-
) -&gt; ChatStream:
10322-
&#34;&#34;&#34;Stream markdown text into a conversation.
10323-
10324-
This method provides an easy way to stream markdown text using the following endpoints:
10325-
- chat.startStream: Starts a new streaming conversation
10326-
- chat.appendStream: Appends text to an existing streaming conversation
10327-
- chat.stopStream: Stops a streaming conversation
10328-
10329-
Args:
10330-
buffer_size: Size of the internal buffer before automatically flushing (default: 256)
10331-
channel: Channel to stream to
10332-
thread_ts: Thread timestamp to stream to (required)
10333-
recipient_team_id: Team ID of the recipient (for Slack Connect)
10334-
recipient_user_id: User ID of the recipient (for Slack Connect)
10335-
unfurl_links: Whether to unfurl links
10336-
unfurl_media: Whether to unfurl media
10337-
**kwargs: Additional arguments passed to the underlying API calls
10338-
10339-
Returns:
10340-
ChatStreamer instance for managing the stream
10341-
10342-
Example:
10343-
```python
10344-
streamer = client.chat_stream(
10345-
channel=&#34;C0123456789&#34;,
10346-
thread_ts=&#34;1700000001.123456&#34;,
10347-
recipient_team_id=&#34;T0123456789&#34;,
10348-
recipient_user_id=&#34;U0123456789&#34;,
10349-
)
10350-
streamer.append(markdown_text=&#34;**hello wo&#34;)
10351-
streamer.append(markdown_text=&#34;rld!**&#34;)
10352-
streamer.stop()
10353-
```
10354-
&#34;&#34;&#34;
10355-
return ChatStream(
10356-
self,
10357-
logger=self._logger,
10358-
channel=channel,
10359-
thread_ts=thread_ts,
10360-
recipient_team_id=recipient_team_id,
10361-
recipient_user_id=recipient_user_id,
10362-
unfurl_links=unfurl_links,
10363-
unfurl_media=unfurl_media,
10364-
buffer_size=buffer_size,
10365-
**kwargs,
10366-
)</code></pre>
10367-
</details>
10368-
<div class="desc"><p>Stream markdown text into a conversation.</p>
10369-
<p>This method provides an easy way to stream markdown text using the following endpoints:
10370-
- chat.startStream: Starts a new streaming conversation
10371-
- chat.appendStream: Appends text to an existing streaming conversation
10372-
- chat.stopStream: Stops a streaming conversation</p>
10373-
<h2 id="args">Args</h2>
10374-
<dl>
10375-
<dt><strong><code>buffer_size</code></strong></dt>
10376-
<dd>Size of the internal buffer before automatically flushing (default: 256)</dd>
10377-
<dt><strong><code>channel</code></strong></dt>
10378-
<dd>Channel to stream to</dd>
10379-
<dt><strong><code>thread_ts</code></strong></dt>
10380-
<dd>Thread timestamp to stream to (required)</dd>
10381-
<dt><strong><code>recipient_team_id</code></strong></dt>
10382-
<dd>Team ID of the recipient (for Slack Connect)</dd>
10383-
<dt><strong><code>recipient_user_id</code></strong></dt>
10384-
<dd>User ID of the recipient (for Slack Connect)</dd>
10385-
<dt><strong><code>unfurl_links</code></strong></dt>
10386-
<dd>Whether to unfurl links</dd>
10387-
<dt><strong><code>unfurl_media</code></strong></dt>
10388-
<dd>Whether to unfurl media</dd>
10389-
<dt><strong><code>**kwargs</code></strong></dt>
10390-
<dd>Additional arguments passed to the underlying API calls</dd>
10391-
</dl>
10392-
<h2 id="returns">Returns</h2>
10393-
<p>ChatStreamer instance for managing the stream</p>
10394-
<h2 id="example">Example</h2>
10395-
<pre><code class="language-python">streamer = client.chat_stream(
10396-
channel=&quot;C0123456789&quot;,
10397-
thread_ts=&quot;1700000001.123456&quot;,
10398-
recipient_team_id=&quot;T0123456789&quot;,
10399-
recipient_user_id=&quot;U0123456789&quot;,
10400-
)
10401-
streamer.append(markdown_text=&quot;**hello wo&quot;)
10402-
streamer.append(markdown_text=&quot;rld!**&quot;)
10403-
streamer.stop()
10404-
</code></pre></div>
10405-
</dd>
1040610244
<dt id="slack_sdk.web.legacy_client.LegacyWebClient.chat_unfurl"><code class="name flex">
1040710245
<span>def <span class="ident">chat_unfurl</span></span>(<span>self,<br>*,<br>channel: str | None = None,<br>ts: str | None = None,<br>source: str | None = None,<br>unfurl_id: str | None = None,<br>unfurls: Dict[str, Dict] | None = None,<br>user_auth_blocks: str | Sequence[Dict | <a title="slack_sdk.models.blocks.blocks.Block" href="../models/blocks/blocks.html#slack_sdk.models.blocks.blocks.Block">Block</a>] | None = None,<br>user_auth_message: str | None = None,<br>user_auth_required: bool | None = None,<br>user_auth_url: str | None = None,<br>**kwargs) ‑> _asyncio.Future | <a title="slack_sdk.web.legacy_slack_response.LegacySlackResponse" href="legacy_slack_response.html#slack_sdk.web.legacy_slack_response.LegacySlackResponse">LegacySlackResponse</a></span>
1040810246
</code></dt>
@@ -14918,7 +14756,6 @@ <h4><code><a title="slack_sdk.web.legacy_client.LegacyWebClient" href="#slack_sd
1491814756
<li><code><a title="slack_sdk.web.legacy_client.LegacyWebClient.chat_scheduledMessages_list" href="#slack_sdk.web.legacy_client.LegacyWebClient.chat_scheduledMessages_list">chat_scheduledMessages_list</a></code></li>
1491914757
<li><code><a title="slack_sdk.web.legacy_client.LegacyWebClient.chat_startStream" href="#slack_sdk.web.legacy_client.LegacyWebClient.chat_startStream">chat_startStream</a></code></li>
1492014758
<li><code><a title="slack_sdk.web.legacy_client.LegacyWebClient.chat_stopStream" href="#slack_sdk.web.legacy_client.LegacyWebClient.chat_stopStream">chat_stopStream</a></code></li>
14921-
<li><code><a title="slack_sdk.web.legacy_client.LegacyWebClient.chat_stream" href="#slack_sdk.web.legacy_client.LegacyWebClient.chat_stream">chat_stream</a></code></li>
1492214759
<li><code><a title="slack_sdk.web.legacy_client.LegacyWebClient.chat_unfurl" href="#slack_sdk.web.legacy_client.LegacyWebClient.chat_unfurl">chat_unfurl</a></code></li>
1492314760
<li><code><a title="slack_sdk.web.legacy_client.LegacyWebClient.chat_update" href="#slack_sdk.web.legacy_client.LegacyWebClient.chat_update">chat_update</a></code></li>
1492414761
<li><code><a title="slack_sdk.web.legacy_client.LegacyWebClient.conversations_acceptSharedInvite" href="#slack_sdk.web.legacy_client.LegacyWebClient.conversations_acceptSharedInvite">conversations_acceptSharedInvite</a></code></li>

scripts/codegen.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,8 @@
119119
legacy_source,
120120
)
121121
legacy_source = re.sub(r"= WebClient\(", "= LegacyWebClient(", legacy_source)
122+
legacy_source = re.sub(r"from slack_sdk.web.chat_stream import ChatStream", "", legacy_source)
123+
legacy_source = re.sub(r"(?s)def chat_stream.*?(?=def\s+chat_stopStream\()", "", legacy_source)
122124
with open(f"{args.path}/slack_sdk/web/legacy_client.py", "w") as output:
123125
output.write(legacy_source)
124126

slack_sdk/web/legacy_client.py

Lines changed: 1 addition & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
import slack_sdk.errors as e
2222
from slack_sdk.models.views import View
23-
from slack_sdk.web.chat_stream import ChatStream
23+
2424

2525
from ..models.attachments import Attachment
2626
from ..models.blocks import Block
@@ -2907,64 +2907,6 @@ def chat_startStream(
29072907
kwargs = _remove_none_values(kwargs)
29082908
return self.api_call("chat.startStream", json=kwargs)
29092909

2910-
def chat_stream(
2911-
self,
2912-
*,
2913-
buffer_size: int = 256,
2914-
channel: str,
2915-
thread_ts: str,
2916-
recipient_team_id: Optional[str] = None,
2917-
recipient_user_id: Optional[str] = None,
2918-
unfurl_links: Optional[bool] = None,
2919-
unfurl_media: Optional[bool] = None,
2920-
**kwargs,
2921-
) -> ChatStream:
2922-
"""Stream markdown text into a conversation.
2923-
2924-
This method provides an easy way to stream markdown text using the following endpoints:
2925-
- chat.startStream: Starts a new streaming conversation
2926-
- chat.appendStream: Appends text to an existing streaming conversation
2927-
- chat.stopStream: Stops a streaming conversation
2928-
2929-
Args:
2930-
buffer_size: Size of the internal buffer before automatically flushing (default: 256)
2931-
channel: Channel to stream to
2932-
thread_ts: Thread timestamp to stream to (required)
2933-
recipient_team_id: Team ID of the recipient (for Slack Connect)
2934-
recipient_user_id: User ID of the recipient (for Slack Connect)
2935-
unfurl_links: Whether to unfurl links
2936-
unfurl_media: Whether to unfurl media
2937-
**kwargs: Additional arguments passed to the underlying API calls
2938-
2939-
Returns:
2940-
ChatStreamer instance for managing the stream
2941-
2942-
Example:
2943-
```python
2944-
streamer = client.chat_stream(
2945-
channel="C0123456789",
2946-
thread_ts="1700000001.123456",
2947-
recipient_team_id="T0123456789",
2948-
recipient_user_id="U0123456789",
2949-
)
2950-
streamer.append(markdown_text="**hello wo")
2951-
streamer.append(markdown_text="rld!**")
2952-
streamer.stop()
2953-
```
2954-
"""
2955-
return ChatStream(
2956-
self,
2957-
logger=self._logger,
2958-
channel=channel,
2959-
thread_ts=thread_ts,
2960-
recipient_team_id=recipient_team_id,
2961-
recipient_user_id=recipient_user_id,
2962-
unfurl_links=unfurl_links,
2963-
unfurl_media=unfurl_media,
2964-
buffer_size=buffer_size,
2965-
**kwargs,
2966-
)
2967-
29682910
def chat_stopStream(
29692911
self,
29702912
*,

0 commit comments

Comments
 (0)