Skip to content

Commit

Permalink
Add author_subname to attachment models (#1366)
Browse files Browse the repository at this point in the history
  • Loading branch information
seratch authored May 17, 2023
1 parent dfc6b79 commit 94a00d2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
7 changes: 7 additions & 0 deletions slack_sdk/models/attachments/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,7 @@ class Attachment(JsonObject):
"author_icon",
"author_link",
"author_name",
"author_subname",
"color",
"fallback",
"fields",
Expand Down Expand Up @@ -298,6 +299,7 @@ def __init__(
title_link: Optional[str] = None,
pretext: Optional[str] = None,
author_name: Optional[str] = None,
author_subname: Optional[str] = None,
author_link: Optional[str] = None,
author_icon: Optional[str] = None,
image_url: Optional[str] = None,
Expand Down Expand Up @@ -333,6 +335,7 @@ def __init__(
be formatted as plain text, or with markdown by including it in the
markdown_in parameter.
author_name: Small text used to display the author's name.
author_subname: Small text used to display the author's sub name.
author_link: A valid URL that will hyperlink the author_name text.
Will only work if author_name is present.
author_icon: A valid URL that displays a small 16px by 16px image to
Expand Down Expand Up @@ -371,6 +374,7 @@ def __init__(
self.title_link = title_link
self.color = color
self.author_name = author_name
self.author_subname = author_subname
self.author_link = author_link
self.author_icon = author_icon
self.image_url = image_url
Expand Down Expand Up @@ -484,6 +488,7 @@ def __init__(
title_link: Optional[str] = None,
pretext: Optional[str] = None,
author_name: Optional[str] = None,
author_subname: Optional[str] = None,
author_link: Optional[str] = None,
author_icon: Optional[str] = None,
image_url: Optional[str] = None,
Expand Down Expand Up @@ -525,6 +530,7 @@ def __init__(
be formatted as plain text, or with markdown by including it in the
markdown_in parameter.
author_name: Small text used to display the author's name.
author_subname: Small text used to display the author's sub name.
author_link: A valid URL that will hyperlink the author_name text.
Will only work if author_name is present.
author_icon: A valid URL that displays a small 16px by 16px image to
Expand Down Expand Up @@ -565,6 +571,7 @@ def __init__(
title_link=title_link,
color=color,
author_name=author_name,
author_subname=author_subname,
author_link=author_link,
author_icon=author_icon,
image_url=image_url,
Expand Down
4 changes: 4 additions & 0 deletions tests/slack_sdk/models/test_attachments.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def test_basic_json(self):
fields=[AttachmentField(title=f"field_{i}_title", value=f"field_{i}_value") for i in range(5)],
color="#FFFF00",
author_name="John Doe",
author_subname="@jd",
author_link="http://johndoeisthebest.com",
author_icon="http://johndoeisthebest.com/avatar.jpg",
thumb_url="thumbnail URL",
Expand All @@ -49,6 +50,7 @@ def test_basic_json(self):
{
"text": "attachment text",
"author_name": "John Doe",
"author_subname": "@jd",
"author_link": "http://johndoeisthebest.com",
"author_icon": "http://johndoeisthebest.com/avatar.jpg",
"footer": "and a footer",
Expand Down Expand Up @@ -155,6 +157,7 @@ def test_basic_json(self):
fields=[AttachmentField(title=f"field_{i}_title", value=f"field_{i}_value") for i in range(5)],
color="#FFFF00",
author_name="John Doe",
author_subname="@jd",
author_link="http://johndoeisthebest.com",
author_icon="http://johndoeisthebest.com/avatar.jpg",
thumb_url="thumbnail URL",
Expand All @@ -168,6 +171,7 @@ def test_basic_json(self):
"callback_id": "cb_123",
"actions": [a.to_dict() for a in actions],
"author_name": "John Doe",
"author_subname": "@jd",
"author_link": "http://johndoeisthebest.com",
"author_icon": "http://johndoeisthebest.com/avatar.jpg",
"footer": "and a footer",
Expand Down

0 comments on commit 94a00d2

Please sign in to comment.