Skip to content

Auth

whoami uses V2 (GET /v2/auth/whoami).

Service for authentication info.

Source code in affinity/services/v1_only.py
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
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
2512
2513
2514
2515
2516
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)