Skip to content

schemas

Monzo API 'whoami' related schemas.

MonzoWhoAmI

Bases: BaseModel

API schema for a 'whoami' object.

Note

Monzo API docs: https://docs.monzo.com/#authenticating-requests

Attributes:

Name Type Description
authenticated bool

Whether the user is authenticated.

client_id str

Client ID.

user_id str

User ID.

Source code in pymonzo/whoami/schemas.py
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
class MonzoWhoAmI(BaseModel):
    """API schema for a 'whoami' object.

    Note:
        Monzo API docs: https://docs.monzo.com/#authenticating-requests

    Attributes:
        authenticated: Whether the user is authenticated.
        client_id: Client ID.
        user_id: User ID.
    """

    model_config = ConfigDict(extra="allow")

    authenticated: bool
    client_id: str
    user_id: str

    if RICH_AVAILABLE:

        def __rich__(self) -> Table:
            """Pretty printing support for `rich`."""
            grid = Table.grid(padding=(0, 5))
            grid.add_column(style="bold yellow")
            grid.add_column()
            grid.add_row("Authenticated:", "Yes" if self.authenticated else "No")
            grid.add_row("Client ID:", self.client_id)
            grid.add_row("User ID:", self.user_id)

            return grid

__rich__()

Pretty printing support for rich.

Source code in pymonzo/whoami/schemas.py
34
35
36
37
38
39
40
41
42
43
def __rich__(self) -> Table:
    """Pretty printing support for `rich`."""
    grid = Table.grid(padding=(0, 5))
    grid.add_column(style="bold yellow")
    grid.add_column()
    grid.add_row("Authenticated:", "Yes" if self.authenticated else "No")
    grid.add_row("Client ID:", self.client_id)
    grid.add_row("User ID:", self.user_id)

    return grid