* bump Signed-off-by: Jess Frazelle <github@jessfraz.com> * some fixes Signed-off-by: Jess Frazelle <github@jessfraz.com> * YOYO NEW API SPEC! * reformat Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * fixups Signed-off-by: Jess Frazelle <github@jessfraz.com> * for now force true Signed-off-by: Jess Frazelle <github@jessfraz.com> * run the tests on generations Signed-off-by: Jess Frazelle <github@jessfraz.com> * add tests Signed-off-by: Jess Frazelle <github@jessfraz.com> * update Signed-off-by: Jess Frazelle <github@jessfraz.com> * update Signed-off-by: Jess Frazelle <github@jessfraz.com> * update Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * update Signed-off-by: Jess Frazelle <github@jessfraz.com> * fix some types Signed-off-by: Jess Frazelle <github@jessfraz.com> * float to top Signed-off-by: Jess Frazelle <github@jessfraz.com> * fix mypy Signed-off-by: Jess Frazelle <github@jessfraz.com> * more noqa Signed-off-by: Jess Frazelle <github@jessfraz.com> * fixups Signed-off-by: Jess Frazelle <github@jessfraz.com> * ruff pass Signed-off-by: Jess Frazelle <github@jessfraz.com> * add docs Signed-off-by: Jess Frazelle <github@jessfraz.com> * fix Signed-off-by: Jess Frazelle <github@jessfraz.com> * fix Signed-off-by: Jess Frazelle <github@jessfraz.com> * fix Signed-off-by: Jess Frazelle <github@jessfraz.com> * fixes Signed-off-by: Jess Frazelle <github@jessfraz.com> * even less mypy errors Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * add test Signed-off-by: Jess Frazelle <github@jessfraz.com> * fixes Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * fixes Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * fixups Signed-off-by: Jess Frazelle <github@jessfraz.com> * fixes Signed-off-by: Jess Frazelle <github@jessfraz.com> * cleanup Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * fix Signed-off-by: Jess Frazelle <github@jessfraz.com> * updates Signed-off-by: Jess Frazelle <github@jessfraz.com> * fix Signed-off-by: Jess Frazelle <github@jessfraz.com> * new path Signed-off-by: Jess Frazelle <github@jessfraz.com> * fixes for mypy Signed-off-by: Jess Frazelle <github@jessfraz.com> * skip tests Signed-off-by: Jess Frazelle <github@jessfraz.com> --------- Signed-off-by: Jess Frazelle <github@jessfraz.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
98 lines
2.8 KiB
Python
98 lines
2.8 KiB
Python
from typing import Any, Dict, List, Type, TypeVar, Union
|
|
|
|
import attr
|
|
|
|
from ..models.currency import Currency
|
|
from ..types import UNSET, Unset
|
|
|
|
P = TypeVar("P", bound="InvoiceLineItem")
|
|
|
|
|
|
@attr.s(auto_attribs=True)
|
|
class InvoiceLineItem:
|
|
"""An invoice line item.""" # noqa: E501
|
|
|
|
amount: Union[Unset, float] = UNSET
|
|
currency: Union[Unset, Currency] = UNSET
|
|
description: Union[Unset, str] = UNSET
|
|
id: Union[Unset, str] = UNSET
|
|
invoice_item: Union[Unset, str] = UNSET
|
|
metadata: Union[Unset, Any] = UNSET
|
|
|
|
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
|
|
|
|
def to_dict(self) -> Dict[str, Any]:
|
|
amount = self.amount
|
|
if not isinstance(self.currency, Unset):
|
|
currency = self.currency
|
|
description = self.description
|
|
id = self.id
|
|
invoice_item = self.invoice_item
|
|
metadata = self.metadata
|
|
|
|
field_dict: Dict[str, Any] = {}
|
|
field_dict.update(self.additional_properties)
|
|
field_dict.update({})
|
|
if amount is not UNSET:
|
|
field_dict["amount"] = amount
|
|
if currency is not UNSET:
|
|
field_dict["currency"] = currency
|
|
if description is not UNSET:
|
|
field_dict["description"] = description
|
|
if id is not UNSET:
|
|
field_dict["id"] = id
|
|
if invoice_item is not UNSET:
|
|
field_dict["invoice_item"] = invoice_item
|
|
if metadata is not UNSET:
|
|
field_dict["metadata"] = metadata
|
|
|
|
return field_dict
|
|
|
|
@classmethod
|
|
def from_dict(cls: Type[P], src_dict: Dict[str, Any]) -> P:
|
|
d = src_dict.copy()
|
|
amount = d.pop("amount", UNSET)
|
|
|
|
_currency = d.pop("currency", UNSET)
|
|
currency: Union[Unset, Currency]
|
|
if isinstance(_currency, Unset):
|
|
currency = UNSET
|
|
else:
|
|
currency = Currency(_currency)
|
|
|
|
description = d.pop("description", UNSET)
|
|
|
|
id = d.pop("id", UNSET)
|
|
|
|
invoice_item = d.pop("invoice_item", UNSET)
|
|
|
|
metadata = d.pop("metadata", UNSET)
|
|
|
|
invoice_line_item = cls(
|
|
amount=amount,
|
|
currency=currency,
|
|
description=description,
|
|
id=id,
|
|
invoice_item=invoice_item,
|
|
metadata=metadata,
|
|
)
|
|
|
|
invoice_line_item.additional_properties = d
|
|
return invoice_line_item
|
|
|
|
@property
|
|
def additional_keys(self) -> List[str]:
|
|
return list(self.additional_properties.keys())
|
|
|
|
def __getitem__(self, key: str) -> Any:
|
|
return self.additional_properties[key]
|
|
|
|
def __setitem__(self, key: str, value: Any) -> None:
|
|
self.additional_properties[key] = value
|
|
|
|
def __delitem__(self, key: str) -> None:
|
|
del self.additional_properties[key]
|
|
|
|
def __contains__(self, key: str) -> bool:
|
|
return key in self.additional_properties
|