diff options
author | Trygve Aaberge <trygveaa@gmail.com> | 2024-02-18 12:43:43 +0100 |
---|---|---|
committer | Trygve Aaberge <trygveaa@gmail.com> | 2024-02-18 12:55:39 +0100 |
commit | 24e21c91a03f32b43af9178e15df0574256c9ce7 (patch) | |
tree | 02a41eae7786a64c115e5149cc756be8bf79296c /typings/slack_api | |
parent | c847e56d0b10499a7dc761f04ddfd0d860fd7788 (diff) | |
download | wee-slack-24e21c91a03f32b43af9178e15df0574256c9ce7.tar.gz |
Post users.profile.set as a JSON body
It's better to post nested objects as JSON rather than url encoding
them, and this fixes some type errors.
Diffstat (limited to 'typings/slack_api')
-rw-r--r-- | typings/slack_api/slack_profile.pyi | 84 | ||||
-rw-r--r-- | typings/slack_api/slack_users_info.pyi | 74 |
2 files changed, 86 insertions, 72 deletions
diff --git a/typings/slack_api/slack_profile.pyi b/typings/slack_api/slack_profile.pyi new file mode 100644 index 0000000..e02d44e --- /dev/null +++ b/typings/slack_api/slack_profile.pyi @@ -0,0 +1,84 @@ +from __future__ import annotations + +from typing import Dict, List, Optional + +from slack_api.slack_common import SlackErrorResponse +from typing_extensions import Literal, NotRequired, TypedDict, final + +@final +class SlackProfileField(TypedDict): + value: str + alt: str + +@final +class SlackProfileStatusEmojiDisplayInfo(TypedDict): + emoji_name: str + display_url: str + unicode: str + +class SlackProfileCommon(TypedDict): + title: NotRequired[Optional[str]] + phone: NotRequired[Optional[str]] + skype: NotRequired[Optional[str]] + first_name: NotRequired[Optional[str]] + last_name: NotRequired[Optional[str]] + real_name: NotRequired[Optional[str]] + real_name_normalized: NotRequired[Optional[str]] + display_name: NotRequired[Optional[str]] + display_name_normalized: NotRequired[Optional[str]] + fields: NotRequired[Optional[Dict[str, SlackProfileField]]] + status_text: NotRequired[Optional[str]] + status_emoji: NotRequired[Optional[str]] + status_emoji_display_info: NotRequired[ + Optional[List[SlackProfileStatusEmojiDisplayInfo]] + ] + status_expiration: NotRequired[Optional[int]] + avatar_hash: NotRequired[Optional[str]] + image_original: NotRequired[str] + is_custom_image: NotRequired[Optional[bool]] + huddle_state: NotRequired[Optional[str]] + huddle_state_expiration_ts: NotRequired[Optional[int]] + image_24: NotRequired[str] + image_32: NotRequired[str] + image_48: NotRequired[str] + image_72: NotRequired[str] + image_192: NotRequired[str] + image_512: NotRequired[str] + image_1024: NotRequired[str] + status_text_canonical: NotRequired[Optional[str]] + team: str + +@final +class SlackProfilePerson(SlackProfileCommon): + email: NotRequired[Optional[str]] + +@final +class SlackProfileBot(SlackProfileCommon): + api_app_id: NotRequired[Optional[str]] + always_active: NotRequired[Optional[bool]] + bot_id: NotRequired[Optional[str]] + image_1024: str + +SlackProfile = SlackProfilePerson | SlackProfileBot + +@final +class SlackSetProfile(TypedDict): + display_name: NotRequired[Optional[str]] + email: NotRequired[Optional[str]] + first_name: NotRequired[Optional[str]] + last_name: NotRequired[Optional[str]] + phone: NotRequired[Optional[str]] + pronouns: NotRequired[Optional[str]] + real_name: NotRequired[Optional[str]] + start_date: NotRequired[Optional[str]] + title: NotRequired[Optional[str]] + status_emoji: NotRequired[Optional[str]] + status_expiration: NotRequired[Optional[int]] + status_text: NotRequired[Optional[str]] + +@final +class SlackUsersProfileSetSuccessResponse(TypedDict): + ok: Literal[True] + profile: SlackProfilePerson + +SlackUsersProfileSetResponse = SlackUsersProfileSetSuccessResponse | SlackErrorResponse diff --git a/typings/slack_api/slack_users_info.pyi b/typings/slack_api/slack_users_info.pyi index a5f1409..776e334 100644 --- a/typings/slack_api/slack_users_info.pyi +++ b/typings/slack_api/slack_users_info.pyi @@ -1,84 +1,14 @@ from __future__ import annotations -from typing import Dict, Generic, List, Optional, TypeVar +from typing import Generic, List, TypeVar from slack_api.slack_common import SlackErrorResponse +from slack_api.slack_profile import SlackProfileBot, SlackProfilePerson from typing_extensions import Literal, NotRequired, TypedDict, final T = TypeVar("T") @final -class SlackProfileField(TypedDict): - value: str - alt: str - -@final -class SlackSetProfile(TypedDict): - display_name: NotRequired[Optional[str]] - email: NotRequired[Optional[str]] - first_name: NotRequired[Optional[str]] - last_name: NotRequired[Optional[str]] - phone: NotRequired[Optional[str]] - pronouns: NotRequired[Optional[str]] - real_name: NotRequired[Optional[str]] - start_date: NotRequired[Optional[str]] - title: NotRequired[Optional[str]] - status_emoji: NotRequired[Optional[str]] - status_expiration: NotRequired[Optional[int]] - status_text: NotRequired[Optional[str]] - -@final -class SlackProfileStatusEmojiDisplayInfo(TypedDict): - emoji_name: str - display_url: str - unicode: str - -class SlackProfileCommon(TypedDict): - title: NotRequired[Optional[str]] - phone: NotRequired[Optional[str]] - skype: NotRequired[Optional[str]] - first_name: NotRequired[Optional[str]] - last_name: NotRequired[Optional[str]] - real_name: NotRequired[Optional[str]] - real_name_normalized: NotRequired[Optional[str]] - display_name: NotRequired[Optional[str]] - display_name_normalized: NotRequired[Optional[str]] - fields: NotRequired[Optional[Dict[str, SlackProfileField]]] - status_text: NotRequired[Optional[str]] - status_emoji: NotRequired[Optional[str]] - status_emoji_display_info: NotRequired[ - Optional[List[SlackProfileStatusEmojiDisplayInfo]] - ] - status_expiration: NotRequired[Optional[int]] - avatar_hash: NotRequired[Optional[str]] - image_original: NotRequired[str] - is_custom_image: NotRequired[Optional[bool]] - huddle_state: NotRequired[Optional[str]] - huddle_state_expiration_ts: NotRequired[Optional[int]] - image_24: NotRequired[str] - image_32: NotRequired[str] - image_48: NotRequired[str] - image_72: NotRequired[str] - image_192: NotRequired[str] - image_512: NotRequired[str] - image_1024: NotRequired[str] - status_text_canonical: NotRequired[Optional[str]] - team: str - -@final -class SlackProfilePerson(SlackProfileCommon): - email: NotRequired[Optional[str]] - -@final -class SlackProfileBot(SlackProfileCommon): - api_app_id: NotRequired[Optional[str]] - always_active: NotRequired[Optional[bool]] - bot_id: NotRequired[Optional[str]] - image_1024: str - -SlackProfile = SlackProfilePerson | SlackProfileBot - -@final class SlackEnterpriseUser(TypedDict): id: str enterprise_id: str |