Skip to content

Commit 3ce3c4d

Browse files
Merge branch 'main' into docs-audit
2 parents c2217d4 + be8be5e commit 3ce3c4d

7 files changed

Lines changed: 80 additions & 11 deletions

File tree

docs/reference/models/blocks/block_elements.html

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3392,7 +3392,7 @@ <h3>Inherited members</h3>
33923392

33933393
@property
33943394
def attributes(self) -&gt; Set[str]: # type: ignore[override]
3395-
return super().attributes.union({&#34;timestamp&#34;, &#34;format&#34;, &#34;url&#34;, &#34;fallback&#34;})
3395+
return super().attributes.union({&#34;timestamp&#34;, &#34;format&#34;, &#34;url&#34;, &#34;fallback&#34;, &#34;style&#34;})
33963396

33973397
def __init__(
33983398
self,
@@ -3401,6 +3401,7 @@ <h3>Inherited members</h3>
34013401
format: str,
34023402
url: Optional[str] = None,
34033403
fallback: Optional[str] = None,
3404+
style: Optional[Union[dict, &#34;RichTextElementParts.TextStyle&#34;]] = None,
34043405
**others: dict,
34053406
):
34063407
super().__init__(type=self.type)
@@ -3409,40 +3410,45 @@ <h3>Inherited members</h3>
34093410
self.format = format
34103411
self.url = url
34113412
self.fallback = fallback
3413+
self.style = style
34123414

34133415
class Broadcast(RichTextElement):
34143416
type = &#34;broadcast&#34;
34153417

34163418
@property
34173419
def attributes(self) -&gt; Set[str]: # type: ignore[override]
3418-
return super().attributes.union({&#34;range&#34;})
3420+
return super().attributes.union({&#34;range&#34;, &#34;style&#34;})
34193421

34203422
def __init__(
34213423
self,
34223424
*,
34233425
range: str, # channel, here, ..
3426+
style: Optional[Union[dict, &#34;RichTextElementParts.TextStyle&#34;]] = None,
34243427
**others: dict,
34253428
):
34263429
super().__init__(type=self.type)
34273430
show_unknown_key_warning(self, others)
34283431
self.range = range
3432+
self.style = style
34293433

34303434
class Color(RichTextElement):
34313435
type = &#34;color&#34;
34323436

34333437
@property
34343438
def attributes(self) -&gt; Set[str]: # type: ignore[override]
3435-
return super().attributes.union({&#34;value&#34;})
3439+
return super().attributes.union({&#34;value&#34;, &#34;style&#34;})
34363440

34373441
def __init__(
34383442
self,
34393443
*,
34403444
value: str,
3445+
style: Optional[Union[dict, &#34;RichTextElementParts.TextStyle&#34;]] = None,
34413446
**others: dict,
34423447
):
34433448
super().__init__(type=self.type)
34443449
show_unknown_key_warning(self, others)
3445-
self.value = value</code></pre>
3450+
self.value = value
3451+
self.style = style</code></pre>
34463452
</details>
34473453
<div class="desc"></div>
34483454
<h3>Class variables</h3>

docs/reference/models/blocks/index.html

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6410,7 +6410,7 @@ <h3>Inherited members</h3>
64106410

64116411
@property
64126412
def attributes(self) -&gt; Set[str]: # type: ignore[override]
6413-
return super().attributes.union({&#34;timestamp&#34;, &#34;format&#34;, &#34;url&#34;, &#34;fallback&#34;})
6413+
return super().attributes.union({&#34;timestamp&#34;, &#34;format&#34;, &#34;url&#34;, &#34;fallback&#34;, &#34;style&#34;})
64146414

64156415
def __init__(
64166416
self,
@@ -6419,6 +6419,7 @@ <h3>Inherited members</h3>
64196419
format: str,
64206420
url: Optional[str] = None,
64216421
fallback: Optional[str] = None,
6422+
style: Optional[Union[dict, &#34;RichTextElementParts.TextStyle&#34;]] = None,
64226423
**others: dict,
64236424
):
64246425
super().__init__(type=self.type)
@@ -6427,40 +6428,45 @@ <h3>Inherited members</h3>
64276428
self.format = format
64286429
self.url = url
64296430
self.fallback = fallback
6431+
self.style = style
64306432

64316433
class Broadcast(RichTextElement):
64326434
type = &#34;broadcast&#34;
64336435

64346436
@property
64356437
def attributes(self) -&gt; Set[str]: # type: ignore[override]
6436-
return super().attributes.union({&#34;range&#34;})
6438+
return super().attributes.union({&#34;range&#34;, &#34;style&#34;})
64376439

64386440
def __init__(
64396441
self,
64406442
*,
64416443
range: str, # channel, here, ..
6444+
style: Optional[Union[dict, &#34;RichTextElementParts.TextStyle&#34;]] = None,
64426445
**others: dict,
64436446
):
64446447
super().__init__(type=self.type)
64456448
show_unknown_key_warning(self, others)
64466449
self.range = range
6450+
self.style = style
64476451

64486452
class Color(RichTextElement):
64496453
type = &#34;color&#34;
64506454

64516455
@property
64526456
def attributes(self) -&gt; Set[str]: # type: ignore[override]
6453-
return super().attributes.union({&#34;value&#34;})
6457+
return super().attributes.union({&#34;value&#34;, &#34;style&#34;})
64546458

64556459
def __init__(
64566460
self,
64576461
*,
64586462
value: str,
6463+
style: Optional[Union[dict, &#34;RichTextElementParts.TextStyle&#34;]] = None,
64596464
**others: dict,
64606465
):
64616466
super().__init__(type=self.type)
64626467
show_unknown_key_warning(self, others)
6463-
self.value = value</code></pre>
6468+
self.value = value
6469+
self.style = style</code></pre>
64646470
</details>
64656471
<div class="desc"></div>
64666472
<h3>Class variables</h3>

slack_sdk/models/blocks/block_elements.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2234,7 +2234,7 @@ class Date(RichTextElement):
22342234

22352235
@property
22362236
def attributes(self) -> Set[str]: # type: ignore[override]
2237-
return super().attributes.union({"timestamp", "format", "url", "fallback"})
2237+
return super().attributes.union({"timestamp", "format", "url", "fallback", "style"})
22382238

22392239
def __init__(
22402240
self,
@@ -2243,6 +2243,7 @@ def __init__(
22432243
format: str,
22442244
url: Optional[str] = None,
22452245
fallback: Optional[str] = None,
2246+
style: Optional[Union[dict, "RichTextElementParts.TextStyle"]] = None,
22462247
**others: dict,
22472248
):
22482249
super().__init__(type=self.type)
@@ -2251,37 +2252,42 @@ def __init__(
22512252
self.format = format
22522253
self.url = url
22532254
self.fallback = fallback
2255+
self.style = style
22542256

22552257
class Broadcast(RichTextElement):
22562258
type = "broadcast"
22572259

22582260
@property
22592261
def attributes(self) -> Set[str]: # type: ignore[override]
2260-
return super().attributes.union({"range"})
2262+
return super().attributes.union({"range", "style"})
22612263

22622264
def __init__(
22632265
self,
22642266
*,
22652267
range: str, # channel, here, ..
2268+
style: Optional[Union[dict, "RichTextElementParts.TextStyle"]] = None,
22662269
**others: dict,
22672270
):
22682271
super().__init__(type=self.type)
22692272
show_unknown_key_warning(self, others)
22702273
self.range = range
2274+
self.style = style
22712275

22722276
class Color(RichTextElement):
22732277
type = "color"
22742278

22752279
@property
22762280
def attributes(self) -> Set[str]: # type: ignore[override]
2277-
return super().attributes.union({"value"})
2281+
return super().attributes.union({"value", "style"})
22782282

22792283
def __init__(
22802284
self,
22812285
*,
22822286
value: str,
2287+
style: Optional[Union[dict, "RichTextElementParts.TextStyle"]] = None,
22832288
**others: dict,
22842289
):
22852290
super().__init__(type=self.type)
22862291
show_unknown_key_warning(self, others)
22872292
self.value = value
2293+
self.style = style

slack_sdk/web/async_chat_stream.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,15 @@ def __init__(
8686
self._stream_ts: Optional[str] = None
8787
self._buffer_size = buffer_size
8888

89+
@property
90+
def ts(self) -> Optional[str]:
91+
"""The message timestamp of the stream.
92+
93+
Returns None until the first flush (when chat.startStream is called).
94+
Can be used with chat.update as a fallback if the stream expires server-side.
95+
"""
96+
return self._stream_ts
97+
8998
async def append(
9099
self,
91100
*,

slack_sdk/web/chat_stream.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,15 @@ def __init__(
7676
self._stream_ts: Optional[str] = None
7777
self._buffer_size = buffer_size
7878

79+
@property
80+
def ts(self) -> Optional[str]:
81+
"""The message timestamp of the stream.
82+
83+
Returns None until the first flush (when chat.startStream is called).
84+
Can be used with chat.update as a fallback if the stream expires server-side.
85+
"""
86+
return self._stream_ts
87+
7988
def append(
8089
self,
8190
*,

tests/slack_sdk/web/test_chat_stream.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,22 @@ def test_streams_with_authorship_args(self):
262262
self.assertEqual(start_request.get("icon_emoji"), "abacus")
263263
self.assertNotIn("icon_url", start_request)
264264

265+
def test_ts_property_is_none_before_flush_and_set_after(self):
266+
streamer = self.client.chat_stream(
267+
buffer_size=5,
268+
channel="C0123456789",
269+
thread_ts="123.000",
270+
recipient_team_id="T0123456789",
271+
recipient_user_id="U0123456789",
272+
)
273+
self.assertIsNone(streamer.ts)
274+
275+
streamer.append(markdown_text="hello!")
276+
self.assertEqual(streamer.ts, "123.123")
277+
278+
streamer.stop()
279+
self.assertEqual(streamer.ts, "123.123")
280+
265281
def test_streams_errors_when_appending_to_an_unstarted_stream(self):
266282
streamer = self.client.chat_stream(
267283
channel="C0123456789",

tests/slack_sdk_async/web/test_async_chat_stream.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,23 @@ async def test_streams_a_chunk_message(self):
244244
'[{"text": "\\n", "type": "markdown_text"}, {"text": ":space_invader:", "type": "markdown_text"}]',
245245
)
246246

247+
@async_test
248+
async def test_ts_property_is_none_before_flush_and_set_after(self):
249+
streamer = await self.client.chat_stream(
250+
buffer_size=5,
251+
channel="C0123456789",
252+
thread_ts="123.000",
253+
recipient_team_id="T0123456789",
254+
recipient_user_id="U0123456789",
255+
)
256+
self.assertIsNone(streamer.ts)
257+
258+
await streamer.append(markdown_text="hello!")
259+
self.assertEqual(streamer.ts, "123.123")
260+
261+
await streamer.stop()
262+
self.assertEqual(streamer.ts, "123.123")
263+
247264
@async_test
248265
async def test_streams_errors_when_appending_to_an_unstarted_stream(self):
249266
streamer = await self.client.chat_stream(

0 commit comments

Comments
 (0)