Skip to content

Auth (V1)

Service for authentication info.

Source code in affinity/services/v1_only.py
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
class AuthService:
    """Service for authentication info."""

    def __init__(self, client: HTTPClient):
        self._client = client

    def whoami(self) -> WhoAmI:
        """Get info about current user and API key."""
        # V2 also has this endpoint
        data = self._client.get("/auth/whoami")
        return WhoAmI.model_validate(data)

whoami() -> WhoAmI

Get info about current user and API key.

Source code in affinity/services/v1_only.py
1363
1364
1365
1366
1367
def whoami(self) -> WhoAmI:
    """Get info about current user and API key."""
    # V2 also has this endpoint
    data = self._client.get("/auth/whoami")
    return WhoAmI.model_validate(data)