diff --git a/avt_fresh/client.py b/avt_fresh/client.py index 476f92f..d55c2c1 100644 --- a/avt_fresh/client.py +++ b/avt_fresh/client.py @@ -1,11 +1,8 @@ import typing -import rich.repr - WHAT = "client" -@rich.repr.auto class FreshbooksContact(typing.NamedTuple): contact_id: int first_name: str @@ -23,9 +20,13 @@ class FreshbooksContact(typing.NamedTuple): "fname": self.first_name, "lname": self.last_name, } + def __rich_repr__(self): + yield "contact_id", self.contact_id + yield "first_name", self.first_name + yield "last_name", self.last_name + yield "email", self.email -@rich.repr.auto class FreshbooksClient(typing.NamedTuple): client_id: int email: str @@ -57,6 +58,14 @@ class FreshbooksClient(typing.NamedTuple): email_contact_id_lookup=email_contact_id_lookup, ) + def __rich_repr__(self): + yield "client_id", self.client_id + yield "email", self.email + yield "organization", self.organization + yield "first_name", self.first_name + yield "last_name", self.last_name + yield "contacts", self.contacts + class NoResult(Exception): pass diff --git a/avt_fresh/invoice.py b/avt_fresh/invoice.py index 479de9c..6fa5113 100644 --- a/avt_fresh/invoice.py +++ b/avt_fresh/invoice.py @@ -3,8 +3,6 @@ import decimal import functools import typing -import rich.repr - WHAT = "invoice" @@ -25,7 +23,6 @@ class InvalidField(Exception): pass -@rich.repr.auto class FreshbooksLine(typing.NamedTuple): invoice_id: int client_id: int @@ -58,16 +55,15 @@ class FreshbooksLine(typing.NamedTuple): "quantity": str(self.quantity), } - # def __rich_repr__(self): - # yield "line_id", self.line_id - # yield "description", self.description - # yield "amount", self.amount - # yield "quantity", self.quantity - # yield "rate", self.rate - # yield "name", self.name + def __rich_repr__(self): + yield "line_id", self.line_id + yield "description", self.description + yield "amount", self.amount + yield "quantity", self.quantity + yield "rate", self.rate + yield "name", self.name -@rich.repr.auto class FreshbooksInvoice(typing.NamedTuple): lines: list[FreshbooksLine] notes: str @@ -120,15 +116,15 @@ class FreshbooksInvoice(typing.NamedTuple): status=kwargs["v3_status"], ) - # def __rich_repr__(self): - # yield "invoice_id", self.invoice_id - # yield "organization", self.organization - # yield "date", self.date - # yield "status", self.status - # yield "amount", self.amount - # yield "lines", self.lines - # yield "contacts", self.contacts - # yield "invoice_number", self.number + def __rich_repr__(self): + yield "invoice_id", self.invoice_id + yield "invoice_number", self.number + yield "organization", self.organization + yield "date", self.date + yield "status", self.status + yield "amount", self.amount + yield "lines", self.lines + yield "contacts", self.contacts def get_all_draft_invoices(*, get_func: typing.Callable) -> list[FreshbooksInvoice]: