Skip to content

Commit

Permalink
feat: Upgrade users.current to v2
Browse files Browse the repository at this point in the history
  • Loading branch information
bahlo committed Sep 12, 2024
1 parent 3ee7584 commit 8418dd1
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/axiom_py/users.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
from typing import List
from .util import Util
from dataclasses import dataclass
from requests import Session


@dataclass
class Role:
id: str
name: str


@dataclass
class User:
"""An authenticated axiom user."""

id: str
name: str
emails: List[str]
email: str
role: Role


class UsersClient:
Expand All @@ -25,6 +31,6 @@ def current(self) -> User:
See https://axiom.co/docs/restapi/endpoints/getCurrentUser
"""
res = self.session.get("/v1/user")
res = self.session.get("/v2/user")
user = Util.from_dict(User, res.json())
return user

0 comments on commit 8418dd1

Please sign in to comment.