Skip to content

Commit ef08a9e

Browse files
author
Eviee Py
committed
Merge branch 'dev/3.0' of https://github.com/PythonistaGuild/Twitchio into dev/3.0
2 parents 569a276 + c6f1451 commit ef08a9e

File tree

2 files changed

+308
-110
lines changed

2 files changed

+308
-110
lines changed

twitchio/client.py

Lines changed: 75 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -292,7 +292,9 @@ async def __aexit__(self, *_: Any) -> None:
292292
await self.close()
293293

294294
async def start(self, token: str | None = None, *, with_adapter: bool = True) -> None:
295-
"""Method to login and run the `Client` asynchronously on an already running event loop.
295+
"""|coro|
296+
297+
Method to login and run the `Client` asynchronously on an already running event loop.
296298
297299
You should not call :meth:`~Client.login` if you are using this method as it is called internally
298300
for you.
@@ -481,7 +483,9 @@ async def predicate(payload: twitchio.ChatMessage) -> bool:
481483
return await waiter.wait()
482484

483485
async def add_token(self, token: str, refresh: str) -> None:
484-
"""Adds a token and refresh-token pair to the client to be automatically managed.
486+
"""|coro|
487+
488+
Adds a token and refresh-token pair to the client to be automatically managed.
485489
486490
After successfully adding a token to the client, the token will be automatically revalidated and refreshed both when
487491
required and periodically.
@@ -524,7 +528,9 @@ async def add_token(self, token: str, refresh: str) -> None:
524528
await self._http.add_token(token, refresh)
525529

526530
async def remove_token(self, user_id: str, /) -> TokenMappingData | None:
527-
"""Removes a token for the specified `user-ID` from the `Client`.
531+
"""|coro|
532+
533+
Removes a token for the specified `user-ID` from the `Client`.
528534
529535
Removing a token will ensure the client stops managing the token.
530536
@@ -547,7 +553,9 @@ async def remove_token(self, user_id: str, /) -> TokenMappingData | None:
547553
return self._http.remove_token(user_id)
548554

549555
async def load_tokens(self, path: str | None = None, /) -> None:
550-
"""Method used to load tokens when the :class:`~Client` starts.
556+
"""|coro|
557+
558+
Method used to load tokens when the :class:`~Client` starts.
551559
552560
.. note::
553561
@@ -586,7 +594,9 @@ async def load_tokens(self, path: str | None = None) -> None:
586594
await self._http.load_tokens(name=path)
587595

588596
async def dump_tokens(self, path: str | None = None, /) -> None:
589-
"""Method which dumps all the added OAuth tokens currently managed by this Client.
597+
"""|coro|
598+
599+
Method which dumps all the added OAuth tokens currently managed by this Client.
590600
591601
.. note::
592602
@@ -651,7 +661,9 @@ def create_partialuser(self, user_id: str | int, user_login: str | None = None)
651661
return PartialUser(user_id, user_login, http=self._http)
652662

653663
async def fetch_badges(self, *, token_for: str | PartialUser | None = None) -> list[ChatBadge]:
654-
"""Fetches Twitch's list of global chat badges, which users may use in any channel's chat room.
664+
"""|coro|
665+
666+
Fetches Twitch's list of global chat badges, which users may use in any channel's chat room.
655667
656668
Parameters
657669
----------
@@ -672,7 +684,9 @@ async def fetch_badges(self, *, token_for: str | PartialUser | None = None) -> l
672684
async def fetch_emote_sets(
673685
self, emote_set_ids: list[str], *, token_for: str | PartialUser | None = None
674686
) -> list[EmoteSet]:
675-
"""Fetches emotes for one or more specified emote sets.
687+
"""|coro|
688+
689+
Fetches emotes for one or more specified emote sets.
676690
677691
.. note::
678692
@@ -712,7 +726,9 @@ async def fetch_chatters_color(
712726
*,
713727
token_for: str | PartialUser | None = None,
714728
) -> list[ChatterColor]:
715-
"""Fetches the color of a chatter.
729+
"""|coro|
730+
731+
Fetches the color of a chatter.
716732
717733
.. versionchanged:: 3.0
718734
@@ -742,7 +758,9 @@ async def fetch_channels(
742758
*,
743759
token_for: str | PartialUser | None = None,
744760
) -> list[ChannelInfo]:
745-
"""Retrieve channel information from the API.
761+
"""|coro|
762+
763+
Retrieve channel information from the API.
746764
747765
Parameters
748766
----------
@@ -769,7 +787,9 @@ async def fetch_cheermotes(
769787
broadcaster_id: int | str | None = None,
770788
token_for: str | PartialUser | None = None,
771789
) -> list[Cheermote]:
772-
"""Fetches a list of Cheermotes that users can use to cheer Bits in any Bits-enabled channel's chat room.
790+
"""|coro|
791+
792+
Fetches a list of Cheermotes that users can use to cheer Bits in any Bits-enabled channel's chat room.
773793
774794
Cheermotes are animated emotes that viewers can assign Bits to.
775795
If a `broadcaster_id` is not specified then only global cheermotes will be returned.
@@ -796,7 +816,9 @@ async def fetch_classifications(
796816
self, locale: str = "en-US", *, token_for: str | PartialUser | None = None
797817
) -> list[ContentClassificationLabel]:
798818
# TODO: Docs need more info...
799-
"""Fetches information about Twitch content classification labels.
819+
"""|coro|
820+
821+
Fetches information about Twitch content classification labels.
800822
801823
Parameters
802824
-----------
@@ -933,7 +955,9 @@ def fetch_extension_transactions(
933955
)
934956

935957
async def fetch_extensions(self, *, token_for: str | PartialUser) -> list[Extension]:
936-
"""Fetch a list of all extensions (both active and inactive) that the broadcaster has installed.
958+
"""|coro|
959+
960+
Fetch a list of all extensions (both active and inactive) that the broadcaster has installed.
937961
938962
The user ID in the access token identifies the broadcaster.
939963
@@ -962,7 +986,9 @@ async def fetch_extensions(self, *, token_for: str | PartialUser) -> list[Extens
962986
async def update_extensions(
963987
self, *, user_extensions: ActiveExtensions, token_for: str | PartialUser
964988
) -> ActiveExtensions:
965-
"""Update an installed extension's information for a specific broadcaster.
989+
"""|coro|
990+
991+
Update an installed extension's information for a specific broadcaster.
966992
967993
You can update the extension's activation `state`, `ID`, and `version number`.
968994
The User-ID passed to `token_for` identifies the broadcaster whose extensions you are updating.
@@ -996,7 +1022,9 @@ async def update_extensions(
9961022
return ActiveExtensions(data["data"])
9971023

9981024
async def fetch_emotes(self, *, token_for: str | PartialUser | None = None) -> list[GlobalEmote]:
999-
"""Fetches global emotes from the Twitch API.
1025+
"""|coro|
1026+
1027+
Fetches global emotes from the Twitch API.
10001028
10011029
.. note::
10021030
If you wish to fetch a specific broadcaster's chat emotes use :meth:`~twitchio.PartialUser.fetch_channel_emotes`.
@@ -1085,7 +1113,9 @@ async def fetch_team(
10851113
team_id: str | None = None,
10861114
token_for: str | PartialUser | None = None,
10871115
) -> Team:
1088-
"""Fetches information about a specific Twitch team.
1116+
"""|coro|
1117+
1118+
Fetches information about a specific Twitch team.
10891119
10901120
You must provide one of either `team_name` or `team_id`.
10911121
@@ -1161,7 +1191,9 @@ async def fetch_games(
11611191
token_for: str | PartialUser | None = None,
11621192
) -> list[Game]:
11631193
# TODO: Docs??? More info...
1164-
"""Fetches information about multiple games on Twitch.
1194+
"""|coro|
1195+
1196+
Fetches information about multiple games on Twitch.
11651197
11661198
Parameters
11671199
-----------
@@ -1197,7 +1229,9 @@ async def fetch_game(
11971229
igdb_id: str | None = None,
11981230
token_for: str | PartialUser | None = None,
11991231
) -> Game | None:
1200-
"""Fetch a :class:`~twitchio.Game` object with the provided `name`, `id`, or `igdb_id`.
1232+
"""|coro|
1233+
1234+
Fetch a :class:`~twitchio.Game` object with the provided `name`, `id`, or `igdb_id`.
12011235
12021236
One of `name`, `id`, or `igdb_id` must be provided.
12031237
If more than one is provided or no parameters are provided, a `ValueError` will be raised.
@@ -1253,7 +1287,9 @@ async def fetch_users(
12531287
logins: list[str] | None = None,
12541288
token_for: str | PartialUser | None = None,
12551289
) -> list[User]:
1256-
"""Fetch information about one or more users.
1290+
"""|coro|
1291+
1292+
Fetch information about one or more users.
12571293
12581294
.. note::
12591295
@@ -1408,10 +1444,6 @@ def fetch_videos(
14081444
max_results: int | None = None,
14091445
token_for: str | PartialUser | None = None,
14101446
) -> HTTPAsyncIterator[Video]:
1411-
# TODO: Docs??? langauge...
1412-
# TODO: Docs??? period...
1413-
# TODO: Docs??? sort...
1414-
# TODO: Docs??? type...
14151447
"""|aiter|
14161448
14171449
Fetch a list of :class:`~twitchio.Video` objects with the provided `ids`, `user_id` or `game_id`.
@@ -1534,7 +1566,9 @@ def fetch_videos(
15341566
)
15351567

15361568
async def delete_videos(self, *, ids: list[str | int], token_for: str | PartialUser) -> list[str]:
1537-
"""Deletes one or more videos for a specific broadcaster.
1569+
"""|coro|
1570+
1571+
Deletes one or more videos for a specific broadcaster.
15381572
15391573
.. note::
15401574
@@ -1725,7 +1759,9 @@ async def update_entitlements(
17251759
fulfillment_status: Literal["CLAIMED", "FULFILLED"] | None = None,
17261760
token_for: str | PartialUser | None = None,
17271761
) -> list[EntitlementStatus]:
1728-
"""Updates a Drop entitlement's fulfillment status.
1762+
"""|coro|
1763+
1764+
Updates a Drop entitlement's fulfillment status.
17291765
17301766
.. note::
17311767
@@ -1803,7 +1839,9 @@ async def subscribe_websocket(
18031839
socket_id: str | None = None,
18041840
) -> SubscriptionResponse | None:
18051841
# TODO: Complete docs...
1806-
"""Subscribe to an EventSub Event via Websockets.
1842+
"""|coro|
1843+
1844+
Subscribe to an EventSub Event via Websockets.
18071845
18081846
.. note::
18091847
@@ -1925,7 +1963,9 @@ async def subscribe_webhook(
19251963
eventsub_secret: str | None = None,
19261964
) -> SubscriptionResponse | None:
19271965
# TODO: Complete docs...
1928-
"""Subscribe to an EventSub Event via Webhook.
1966+
"""|coro|
1967+
1968+
Subscribe to an EventSub Event via Webhook.
19291969
19301970
.. note::
19311971
@@ -2055,7 +2095,9 @@ async def fetch_eventsub_subscriptions(
20552095
| None = None,
20562096
max_results: int | None = None,
20572097
) -> EventsubSubscriptions:
2058-
"""Fetches Eventsub Subscriptions for either webhook or websocket.
2098+
"""|coro|
2099+
2100+
Fetches Eventsub Subscriptions for either webhook or websocket.
20592101
20602102
.. note::
20612103
type, status and user_id are mutually exclusive and only one can be passed, otherwise ValueError will be raised.
@@ -2138,7 +2180,9 @@ async def fetch_eventsub_subscriptions(
21382180
)
21392181

21402182
async def delete_eventsub_subscription(self, id: str, *, token_for: str | PartialUser | None = None) -> None:
2141-
"""Delete an eventsub subscription.
2183+
"""|coro|
2184+
2185+
Delete an eventsub subscription.
21422186
21432187
Parameters
21442188
----------
@@ -2151,7 +2195,9 @@ async def delete_eventsub_subscription(self, id: str, *, token_for: str | Partia
21512195
await self._http.delete_eventsub_subscription(id, token_for=token_for)
21522196

21532197
async def delete_all_eventsub_subscriptions(self, *, token_for: str | PartialUser | None = None) -> None:
2154-
"""Delete all eventsub subscriptions.
2198+
"""|coro|
2199+
2200+
Delete all eventsub subscriptions.
21552201
21562202
Parameters
21572203
----------

0 commit comments

Comments
 (0)