Skip to content

schemas

Monzo API 'pots' related schemas.

MonzoPot

Bases: BaseModel

API schema for a 'pot' object.

Note

Monzo API docs: https://docs.monzo.com/#pots

Attributes:

Name Type Description
id str

The ID of the pot.

name str

Pot name.

style str

The pot background image.

balance int

Pot balance.

currency str

Pot currency.

created datetime

When this pot was created.

updated datetime

When this pot was last updated.

deleted bool

Whether this pot is deleted. The API will be updated soon to not return deleted pots.

goal_amount Optional[int]

Pot goal account.

type Optional[str]

Pot type.

product_id Optional[str]

Product ID

current_account_id Optional[str]

Current account ID.

cover_image_url Optional[str]

Cover image URL.

isa_wrapper Optional[str]

ISA wrapper.

round_up Optional[bool]

Whether to use transfer money from rounding up transactions to the pot. You can only switch on round ups for one pot at a time.

round_up_multiplier Optional[int]

Rounding up multiplier.

is_tax_pot Optional[bool]

Whether the pot is taxed.

locked Optional[bool]

Whether the pot is locked.

available_for_bills Optional[bool]

Whether the pot is available for bills.

has_virtual_cards Optional[bool]

Whether the pot has linked virtual cards.

Source code in pymonzo/pots/schemas.py
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
class MonzoPot(BaseModel):
    """API schema for a 'pot' object.

    Note:
        Monzo API docs: https://docs.monzo.com/#pots

    Attributes:
        id: The ID of the pot.
        name: Pot name.
        style: The pot background image.
        balance: Pot balance.
        currency: Pot currency.
        created: When this pot was created.
        updated: When this pot was last updated.
        deleted: Whether this pot is deleted. The API will be updated soon to not
            return deleted pots.
        goal_amount: Pot goal account.
        type: Pot type.
        product_id: Product ID
        current_account_id: Current account ID.
        cover_image_url: Cover image URL.
        isa_wrapper: ISA wrapper.
        round_up: Whether to use transfer money from rounding up transactions to
            the pot. You can only switch on round ups for one pot at a time.
        round_up_multiplier: Rounding up multiplier.
        is_tax_pot: Whether the pot is taxed.
        locked: Whether the pot is locked.
        available_for_bills: Whether the pot is available for bills.
        has_virtual_cards: Whether the pot has linked virtual cards.
    """

    model_config = ConfigDict(extra="allow")

    id: str
    name: str
    style: str
    balance: int
    currency: str
    created: datetime
    updated: datetime
    deleted: bool

    # Undocumented in Monzo API docs
    goal_amount: Optional[int] = None
    type: Optional[str] = None
    product_id: Optional[str] = None
    current_account_id: Optional[str] = None
    cover_image_url: Optional[str] = None
    isa_wrapper: Optional[str] = None
    round_up: Optional[bool] = None
    round_up_multiplier: Optional[int] = None
    is_tax_pot: Optional[bool] = None
    locked: Optional[bool] = None
    available_for_bills: Optional[bool] = None
    has_virtual_cards: Optional[bool] = None

    if RICH_AVAILABLE:

        def __rich__(self) -> Table:
            """Pretty printing support for `rich`."""
            balance = format_currency(self.balance / 100, self.currency)

            grid = Table.grid(padding=(0, 5))
            grid.title = f"Pot '{self.name}' | {balance}"
            grid.title_style = "bold green"
            grid.add_column(style="bold cyan")
            grid.add_column(style="" if not self.deleted else "dim")
            grid.add_row("ID:", self.id)
            grid.add_row("Name:", self.name)
            grid.add_row("Balance:", balance)
            if self.goal_amount:
                goal_amount = format_currency(self.goal_amount / 100, self.currency)
                grid.add_row("Goal:", goal_amount)
            grid.add_row("Currency:", self.currency)
            if self.type:
                grid.add_row("Type:", self.type)
            grid.add_row("Deleted:", "Yes" if self.deleted else "No")
            if self.round_up:
                grid.add_row("Round up:", "Yes" if self.round_up else "No")
            if self.round_up_multiplier:
                grid.add_row("Round up multiplier:", str(self.round_up_multiplier))
            if self.locked:
                grid.add_row("Locked:", "Yes" if self.locked else "No")
            grid.add_row("Created:", format_datetime(self.created))
            grid.add_row("Updated:", format_datetime(self.updated))

            return grid

__rich__()

Pretty printing support for rich.

Source code in pymonzo/pots/schemas.py
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
def __rich__(self) -> Table:
    """Pretty printing support for `rich`."""
    balance = format_currency(self.balance / 100, self.currency)

    grid = Table.grid(padding=(0, 5))
    grid.title = f"Pot '{self.name}' | {balance}"
    grid.title_style = "bold green"
    grid.add_column(style="bold cyan")
    grid.add_column(style="" if not self.deleted else "dim")
    grid.add_row("ID:", self.id)
    grid.add_row("Name:", self.name)
    grid.add_row("Balance:", balance)
    if self.goal_amount:
        goal_amount = format_currency(self.goal_amount / 100, self.currency)
        grid.add_row("Goal:", goal_amount)
    grid.add_row("Currency:", self.currency)
    if self.type:
        grid.add_row("Type:", self.type)
    grid.add_row("Deleted:", "Yes" if self.deleted else "No")
    if self.round_up:
        grid.add_row("Round up:", "Yes" if self.round_up else "No")
    if self.round_up_multiplier:
        grid.add_row("Round up multiplier:", str(self.round_up_multiplier))
    if self.locked:
        grid.add_row("Locked:", "Yes" if self.locked else "No")
    grid.add_row("Created:", format_datetime(self.created))
    grid.add_row("Updated:", format_datetime(self.updated))

    return grid