From 13e5d326ea146a5dbee8e93a378e983bfd281c33 Mon Sep 17 00:00:00 2001 From: Zev Averbach Date: Sat, 23 Apr 2022 18:38:02 +0200 Subject: [PATCH] better reprs --- avt_fresh/invoice.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/avt_fresh/invoice.py b/avt_fresh/invoice.py index bcd243a..4106807 100644 --- a/avt_fresh/invoice.py +++ b/avt_fresh/invoice.py @@ -54,6 +54,14 @@ 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 + class FreshbooksInvoice(typing.NamedTuple): lines: list[FreshbooksLine] @@ -107,6 +115,16 @@ 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 get_all_draft_invoices(*, get_func: typing.Callable) -> list[FreshbooksInvoice]: return _get(get_func=get_func, status="draft")