Skip to content

Commit 66f20fb

Browse files
committed
Add dome docs to OAuth HTTP class
1 parent 247265d commit 66f20fb

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

twitchio/authentication/oauth.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,27 @@ def __init__(
7272
self.scopes = scopes
7373

7474
async def validate_token(self, token: str, /) -> ValidateTokenPayload:
75+
"""|coro|
76+
77+
Method which validates the provided token.
78+
79+
Parameters
80+
----------
81+
token: :class:`str`
82+
The token to attempt to validate.
83+
84+
Returns
85+
-------
86+
ValidateTokenPayload
87+
The payload received from Twitch if no HTTPException was raised.
88+
89+
Raises
90+
------
91+
HTTPException
92+
An error occurred during a request to Twitch.
93+
HTTPException
94+
Bad or invalid token provided.
95+
"""
7596
token = token.removeprefix("Bearer ").removeprefix("OAuth ")
7697

7798
headers: dict[str, str] = {"Authorization": f"OAuth {token}"}
@@ -114,6 +135,20 @@ async def user_access_token(self, code: str, /, *, redirect_uri: str | None = No
114135
return UserTokenPayload(data)
115136

116137
async def revoke_token(self, token: str, /) -> None:
138+
"""|coro|
139+
140+
Method to revoke the authorization of a provided token.
141+
142+
Parameters
143+
----------
144+
token: :class:`str`
145+
The token to revoke authorization from. The token will be invalid and cannot be used after revocation.
146+
147+
Raises
148+
------
149+
HTTPException
150+
An error occurred during a request to Twitch.
151+
"""
117152
params = self._create_params({"token": token})
118153

119154
route: Route = Route("POST", "/oauth2/revoke", use_id=True, headers=self.CONTENT_TYPE_HEADER, params=params)

0 commit comments

Comments
 (0)