Repository: slackapi/python-slack-sdk
Pull request #1366 (2023-05-09 00:49:30)

Add author_subname to attachment models
## Summary

This pull request adds author_subname to attachment model classes. See https://github.com/slackapi/node-slack-sdk/pull/1621 for the context.

### Category (place an `x` in each of the `[ ]`)

- [ ] **slack_sdk.web.WebClient (sync/async)** (Web API client)
- [ ] **slack_sdk.webhook.WebhookClient (sync/async)** (Incoming Webhook, response_url sender)
- [ ] **slack_sdk.socket_mode** (Socket Mode client)
- [ ] **slack_sdk.signature** (Request Signature Verifier)
- [ ] **slack_sdk.oauth** (OAuth Flow Utilities)
- [x] **slack_sdk.models** (UI component builders)
- [ ] **slack_sdk.scim** (SCIM API client)
- [ ] **slack_sdk.audit_logs** (Audit Logs API client)
- [ ] **slack_sdk.rtm_v2** (RTM client)
- [ ] `/docs-src` (Documents, have you run `./scripts/docs.sh`?)
- [ ] `/docs-src-v2` (Documents, have you run `./scripts/docs-v2.sh`?)
- [ ] `/tutorial` (PythOnBoardingBot tutorial)
- [x] `tests`/`integration_tests` (Automated tests for this library)

## Requirements (place an `x` in each `[ ]`)

- [x] I've read and understood the [Contributing Guidelines](https://github.com/slackapi/python-slack-sdk/blob/main/.github/contributing.md) and have done my best effort to follow them.
- [x] I've read and agree to the [Code of Conduct](https://slackhq.github.io/code-of-conduct).
- [x] I've run `python3 -m venv .venv && source .venv/bin/activate && ./scripts/run_validation.sh` after making the changes.


codecov[bot]: ## [Codecov](https://app.codecov.io/gh/slackapi/python-slack-sdk/pull/1366?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=slackapi) Report
> Merging [#1366](https://app.codecov.io/gh/slackapi/python-slack-sdk/pull/1366?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=slackapi) (89ac6e4) into [main](https://app.codecov.io/gh/slackapi/python-slack-sdk/commit/7eec685f630e0b9ffdeda11ff5e91998d4203055?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=slackapi) (7eec685) will **increase** coverage by `0.00%`.
> The diff coverage is `100.00%`.

> :exclamation: Current head 89ac6e4 differs from pull request most recent head ffa4057. Consider uploading reports for the commit ffa4057 to get more accurate results

```diff
@@           Coverage Diff           @@
##             main    #1366   +/-   ##
=======================================
  Coverage   85.58%   85.59%           
=======================================
  Files         111      111           
  Lines       11559    11560    +1     
=======================================
+ Hits         9893     9895    +2     
+ Misses       1666     1665    -1     
```


| [Impacted Files](https://app.codecov.io/gh/slackapi/python-slack-sdk/pull/1366?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=slackapi) | Coverage Δ | |
|---|---|---|
| [slack\_sdk/models/attachments/\_\_init\_\_.py](https://app.codecov.io/gh/slackapi/python-slack-sdk/pull/1366?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=slackapi#diff-c2xhY2tfc2RrL21vZGVscy9hdHRhY2htZW50cy9fX2luaXRfXy5weQ==) | `99.41% <100.00%> (+<0.01%)` | :arrow_up: |

... and [2 files with indirect coverage changes](https://app.codecov.io/gh/slackapi/python-slack-sdk/pull/1366/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=slackapi)

:mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=slackapi)


Patch:
diff --git a/slack_sdk/models/attachments/__init__.py b/slack_sdk/models/attachments/__init__.py
index fbcac21..c4ffe79 100644
--- a/slack_sdk/models/attachments/__init__.py
+++ b/slack_sdk/models/attachments/__init__.py
@@ -266,6 +266,7 @@ class Attachment(JsonObject):
         "author_icon",
         "author_link",
         "author_name",
+        "author_subname",
         "color",
         "fallback",
         "fields",
@@ -298,6 +299,7 @@ class Attachment(JsonObject):
         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,
@@ -333,6 +335,7 @@ class Attachment(JsonObject):
                 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
@@ -371,6 +374,7 @@ class Attachment(JsonObject):
         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
@@ -484,6 +488,7 @@ class InteractiveAttachment(Attachment):
         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,
@@ -525,6 +530,7 @@ class InteractiveAttachment(Attachment):
                 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
@@ -565,6 +571,7 @@ class InteractiveAttachment(Attachment):
             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,
diff --git a/slack_sdk/web/async_client.py b/slack_sdk/web/async_client.py
index caf45c4..4ed813d 100644
--- a/slack_sdk/web/async_client.py
+++ b/slack_sdk/web/async_client.py
@@ -4170,6 +4170,8 @@ class AsyncWebClient(AsyncBaseClient):
         count: Optional[Union[int, str]] = None,
         page: Optional[Union[int, str]] = None,
         team_id: Optional[str] = None,
+        cursor: Optional[str] = None,
+        limit: Optional[int] = None,
         **kwargs,
     ) -> AsyncSlackResponse:
         """Gets the access logs for the current team.
@@ -4181,6 +4183,8 @@ class AsyncWebClient(AsyncBaseClient):
                 "count": count,
                 "page": page,
                 "team_id": team_id,
+                "cursor": cursor,
+                "limit": limit,
             }
         )
         return await self.api_call("team.accessLogs", http_verb="GET", params=kwargs)
diff --git a/slack_sdk/web/client.py b/slack_sdk/web/client.py
index b0200f6..3964381 100644
--- a/slack_sdk/web/client.py
+++ b/slack_sdk/web/client.py
@@ -4161,6 +4161,8 @@ class WebClient(BaseClient):
         count: Optional[Union[int, str]] = None,
         page: Optional[Union[int, str]] = None,
         team_id: Optional[str] = None,
+        cursor: Optional[str] = None,
+        limit: Optional[int] = None,
         **kwargs,
     ) -> SlackResponse:
         """Gets the access logs for the current team.
@@ -4172,6 +4174,8 @@ class WebClient(BaseClient):
                 "count": count,
                 "page": page,
                 "team_id": team_id,
+                "cursor": cursor,
+                "limit": limit,
             }
         )
         return self.api_call("team.accessLogs", http_verb="GET", params=kwargs)
diff --git a/slack_sdk/web/legacy_client.py b/slack_sdk/web/legacy_client.py
index 6c8dd59..c61b5f4 100644
--- a/slack_sdk/web/legacy_client.py
+++ b/slack_sdk/web/legacy_client.py
@@ -4172,6 +4172,8 @@ class LegacyWebClient(LegacyBaseClient):
         count: Optional[Union[int, str]] = None,
         page: Optional[Union[int, str]] = None,
         team_id: Optional[str] = None,
+        cursor: Optional[str] = None,
+        limit: Optional[int] = None,
         **kwargs,
     ) -> Union[Future, SlackResponse]:
         """Gets the access logs for the current team.
@@ -4183,6 +4185,8 @@ class LegacyWebClient(LegacyBaseClient):
                 "count": count,
                 "page": page,
                 "team_id": team_id,
+                "cursor": cursor,
+                "limit": limit,
             }
         )
         return self.api_call("team.accessLogs", http_verb="GET", params=kwargs)


Test patch:
diff --git a/tests/slack_sdk/models/test_attachments.py b/tests/slack_sdk/models/test_attachments.py
index 875302d..7fbce0e 100644
--- a/tests/slack_sdk/models/test_attachments.py
+++ b/tests/slack_sdk/models/test_attachments.py
@@ -38,6 +38,7 @@ class AttachmentTests(unittest.TestCase):
                 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",
@@ -49,6 +50,7 @@ class AttachmentTests(unittest.TestCase):
             {
                 "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",
@@ -155,6 +157,7 @@ class InteractiveAttachmentTests(unittest.TestCase):
                 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",
@@ -168,6 +171,7 @@ class InteractiveAttachmentTests(unittest.TestCase):
                 "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",