Skip to content

Commit e85abcb

Browse files
committed
Merge remote-tracking branch 'origin/main' into composition-object-examples
2 parents b98200a + b845df9 commit e85abcb

6 files changed

Lines changed: 77 additions & 3 deletions

File tree

‎ai/slackbot-mcp-client/no-auth/requirements.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
httpx2==2.12.0
2-
mcp==2.0.0
2+
mcp==2.1.0
33
mypy==2.3.1
44
pytest==9.1.1
55
ruff==0.16.4

‎ai/slackbot-mcp-client/rich-responses/mcp-apps/requirements.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
httpx2==2.12.0
2-
mcp==2.0.0
2+
mcp==2.1.0
33
mypy==2.3.1
44
pytest==9.1.1
55
ruff==0.16.4

‎ai/slackbot-mcp-client/slack-identity/requirements.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
httpx2==2.12.0
2-
mcp==2.0.0
2+
mcp==2.1.0
33
mypy==2.3.1
44
pytest==9.1.1
55
ruff==0.16.4

‎block-kit/README.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ Read the [docs](https://docs.slack.dev/block-kit/) to learn concepts behind thes
1010

1111
- **[Actions](https://docs.slack.dev/reference/block-kit/blocks/actions-block)**: Holds multiple interactive elements. [Implementation](./src/blocks/actions.py).
1212
- **[Alert](https://docs.slack.dev/reference/block-kit/blocks/alert-block)**: Displays alerts, warnings, and informational messages. [Implementation](./src/blocks/alert.py).
13+
- **[Card](https://docs.slack.dev/reference/block-kit/blocks/card-block)**: Displays content in a card. [Implementation](./src/blocks/card.py).
1314
- **[Context](https://docs.slack.dev/reference/block-kit/blocks/context-block)**: Provides contextual info, which can include both images and text. [Implementation](./src/blocks/context.py).
1415
- **[Context actions](https://docs.slack.dev/reference/block-kit/blocks/context-actions-block)**: Displays actions as contextual info, which can include both feedback buttons and icon buttons. [Implementation](./src/blocks/context_actions.py).
1516
- **[Divider](https://docs.slack.dev/reference/block-kit/blocks/divider-block)**: Visually separates pieces of info inside of a message. [Implementation](./src/blocks/divider.py).

‎block-kit/src/blocks/card.py‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
from slack_sdk.models.blocks import CardBlock
2+
from slack_sdk.models.blocks.basic_components import MarkdownTextObject, PlainTextObject
3+
from slack_sdk.models.blocks.block_elements import ButtonElement, ImageElement
4+
5+
6+
def example01() -> CardBlock:
7+
"""
8+
Displays content in a card.
9+
https://docs.slack.dev/reference/block-kit/blocks/card-block/
10+
11+
A card with icon, title, subtitle, hero image, body, and an action button.
12+
"""
13+
block = CardBlock(
14+
icon=ImageElement(image_url="https://picsum.photos/36/36", alt_text="Icon"),
15+
title=MarkdownTextObject(text="Lumon Industries"),
16+
subtitle=MarkdownTextObject(text="Committed to work-life balance"),
17+
hero_image=ImageElement(
18+
image_url="https://picsum.photos/400/300", alt_text="Sample hero image"
19+
),
20+
body=MarkdownTextObject(text="Please enjoy each card equally."),
21+
actions=[
22+
ButtonElement(
23+
text=PlainTextObject(text="Action Button", emoji=False),
24+
action_id="button_action",
25+
),
26+
],
27+
)
28+
return block
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import json
2+
3+
from src.blocks import card
4+
5+
6+
def test_example01():
7+
block = card.example01()
8+
actual = block.to_dict()
9+
expected = {
10+
"type": "card",
11+
"icon": {
12+
"type": "image",
13+
"image_url": "https://picsum.photos/36/36",
14+
"alt_text": "Icon",
15+
},
16+
"title": {
17+
"type": "mrkdwn",
18+
"text": "Lumon Industries",
19+
},
20+
"subtitle": {
21+
"type": "mrkdwn",
22+
"text": "Committed to work-life balance",
23+
},
24+
"hero_image": {
25+
"type": "image",
26+
"image_url": "https://picsum.photos/400/300",
27+
"alt_text": "Sample hero image",
28+
},
29+
"body": {
30+
"type": "mrkdwn",
31+
"text": "Please enjoy each card equally.",
32+
},
33+
"actions": [
34+
{
35+
"type": "button",
36+
"text": {
37+
"type": "plain_text",
38+
"text": "Action Button",
39+
"emoji": False,
40+
},
41+
"action_id": "button_action",
42+
},
43+
],
44+
}
45+
assert json.dumps(actual, sort_keys=True) == json.dumps(expected, sort_keys=True)

0 commit comments

Comments
 (0)