from .. import constants,exceptions 
class AccountMan:
    def __init__(self,client):
        self._client = client
    async def fetch_me(self):
        """
        Fetch the current user information from the ChattedRooms API.
        This method is used to get the current user's information.
        Returns:
            dict: The current user's information.
        """
        async with self._client.session.get(f"{self._client.base_url}api/v1/users/whoami?403OnUnauth=true", headers=self._client.headers) as response:
            if response.status == 200:
                return await response.json()
            elif response.status == 403:
                raise exceptions.Unauthorized("Invalid current token. Maybe you have forgot to run self.authenticate()?")
            else:
                raise Exception(f"Failed to fetch user information: {response.status}")