diff --git a/docs/source/user.rst b/docs/source/user.rst index ecddfd4..7662744 100644 --- a/docs/source/user.rst +++ b/docs/source/user.rst @@ -19,30 +19,48 @@ User The user's ID + The ``openid`` scope is required if authorized via `OAuth2 `__. + :type: int .. attribute:: username The user's username. This will always be ``None``, unless it is from :doc:`oauth2` + The ``openid`` and ``profile`` scopes are required if authorized via `OAuth2 `__. + :type: Optional[str] .. attribute:: display_name The user's display name. This will always be ``None``, unless it is from :doc:`oauth2` + The ``openid`` and ``profile`` scopes are required if authorized via `OAuth2 `__. + + :type: Optional[str] + + .. attribute:: headshot_uri + + The URI of the user's avatar headshot. This will always be ``None``, unless it is from :doc:`oauth2` + + The ``openid`` and ``profile`` scopes are required if authorized via `OAuth2 `__. + :type: Optional[str] .. attribute:: created_at The time when user's account was created. This will always be ``None``, unless it is from :doc:`oauth2` + The ``openid`` and ``profile`` scopes are required if authorized via `OAuth2 `__. + :type: datetime.datetime .. attribute:: profile_uri A link to the user's profile. + The ``openid`` scope is required if authorized via `OAuth2 `__. + :type: str .. method:: upload_asset(file, asset_type, name, description, expected_robux_price=0) diff --git a/rblxopencloud/__init__.py b/rblxopencloud/__init__.py index 1852842..26a9f06 100644 --- a/rblxopencloud/__init__.py +++ b/rblxopencloud/__init__.py @@ -1,8 +1,8 @@ from typing import Literal import requests -VERSION: str = "1.5.1" -VERSION_INFO: Literal['alpha', 'beta', 'final'] = "alpha" +VERSION: str = "1.5.0" +VERSION_INFO: Literal['alpha', 'beta', 'final'] = "final" user_agent: str = f"rblx-open-cloud/{VERSION} (https://github.com/treeben77/rblx-open-cloud)" diff --git a/rblxopencloud/oauth2.py b/rblxopencloud/oauth2.py index 70fbbde..deaa8b9 100644 --- a/rblxopencloud/oauth2.py +++ b/rblxopencloud/oauth2.py @@ -71,6 +71,7 @@ def fetch_userinfo(self) -> User: user = User(response.json().get("id") or response.json().get("sub"), f"Bearer {self.token}") user.username: str = response.json().get("preferred_username") user.display_name: str = response.json().get("nickname") + user.headshot_uri: str = response.json().get("picture") user.created_at: datetime.datetime = datetime.datetime.fromtimestamp(response.json()["created_at"]) if response.json().get("created_at") else None if response.ok: return user @@ -158,6 +159,7 @@ def __init__(self, app, payload, id_token) -> None: self.user: Optional[User] = User(id_token.get("id") or id_token.get("sub"), f"Bearer {self.token}") self.user.username: str = id_token.get("preferred_username") self.user.display_name: str = id_token.get("nickname") + self.user.headshot_uri: Optional[str] = id_token.get("picture") self.user.created_at: datetime.datetime = datetime.datetime.fromtimestamp(id_token["created_at"]) if id_token.get("created_at") else None else: self.user: Optional[User] = None diff --git a/rblxopencloud/user.py b/rblxopencloud/user.py index ae32df6..fa82da3 100644 --- a/rblxopencloud/user.py +++ b/rblxopencloud/user.py @@ -18,6 +18,7 @@ def __init__(self, id: int, api_key: str) -> None: self.id: int = id self.display_name: Optional[str] = None self.profile_uri: str = f"https://roblox.com/users/{self.id}/profile" + self.headshot_uri: Optional[str] = None self.created_at: Optional[datetime.datetime] = None self.__api_key = api_key