2022-04-06 20:35:34 -07:00
|
|
|
import datetime
|
2023-05-04 00:58:06 -07:00
|
|
|
from typing import Any, Dict, List, Type, TypeVar, Union
|
2022-04-06 20:35:34 -07:00
|
|
|
|
|
|
|
import attr
|
|
|
|
from dateutil.parser import isoparse
|
|
|
|
|
|
|
|
from ..models.method import Method
|
|
|
|
from ..types import UNSET, Unset
|
|
|
|
|
2023-05-04 00:58:06 -07:00
|
|
|
S = TypeVar("S", bound="ApiCallWithPrice")
|
2022-04-06 20:35:34 -07:00
|
|
|
|
2022-04-06 21:14:32 -07:00
|
|
|
|
2022-04-06 20:35:34 -07:00
|
|
|
@attr.s(auto_attribs=True)
|
|
|
|
class ApiCallWithPrice:
|
2023-05-04 00:58:06 -07:00
|
|
|
"""An API call with the price.
|
|
|
|
|
|
|
|
This is a join of the `ApiCall` and `ApiCallPrice` tables.""" # noqa: E501
|
|
|
|
|
2022-04-06 21:14:32 -07:00
|
|
|
completed_at: Union[Unset, datetime.datetime] = UNSET
|
|
|
|
created_at: Union[Unset, datetime.datetime] = UNSET
|
2022-07-08 00:56:43 +00:00
|
|
|
duration: Union[Unset, int] = UNSET
|
2022-04-06 21:14:32 -07:00
|
|
|
email: Union[Unset, str] = UNSET
|
|
|
|
endpoint: Union[Unset, str] = UNSET
|
2022-06-15 18:18:19 -07:00
|
|
|
id: Union[Unset, str] = UNSET
|
2022-07-08 00:56:43 +00:00
|
|
|
ip_address: Union[Unset, str] = UNSET
|
2022-08-10 19:41:56 +00:00
|
|
|
litterbox: Union[Unset, bool] = False
|
2022-04-06 21:14:32 -07:00
|
|
|
method: Union[Unset, Method] = UNSET
|
|
|
|
minutes: Union[Unset, int] = UNSET
|
|
|
|
origin: Union[Unset, str] = UNSET
|
|
|
|
price: Union[Unset, float] = UNSET
|
|
|
|
request_body: Union[Unset, str] = UNSET
|
|
|
|
request_query_params: Union[Unset, str] = UNSET
|
|
|
|
response_body: Union[Unset, str] = UNSET
|
|
|
|
started_at: Union[Unset, datetime.datetime] = UNSET
|
2022-07-08 00:56:43 +00:00
|
|
|
status_code: Union[Unset, int] = UNSET
|
2022-04-06 21:14:32 -07:00
|
|
|
stripe_invoice_item_id: Union[Unset, str] = UNSET
|
2022-06-15 18:18:19 -07:00
|
|
|
token: Union[Unset, str] = UNSET
|
2022-04-06 21:14:32 -07:00
|
|
|
updated_at: Union[Unset, datetime.datetime] = UNSET
|
|
|
|
user_agent: Union[Unset, str] = UNSET
|
|
|
|
user_id: Union[Unset, str] = UNSET
|
|
|
|
|
|
|
|
additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
|
|
|
|
|
|
|
|
def to_dict(self) -> Dict[str, Any]:
|
|
|
|
completed_at: Union[Unset, str] = UNSET
|
|
|
|
if not isinstance(self.completed_at, Unset):
|
|
|
|
completed_at = self.completed_at.isoformat()
|
|
|
|
created_at: Union[Unset, str] = UNSET
|
|
|
|
if not isinstance(self.created_at, Unset):
|
|
|
|
created_at = self.created_at.isoformat()
|
2022-07-08 00:56:43 +00:00
|
|
|
duration = self.duration
|
2022-04-06 21:14:32 -07:00
|
|
|
email = self.email
|
|
|
|
endpoint = self.endpoint
|
2022-06-15 18:18:19 -07:00
|
|
|
id = self.id
|
2022-07-08 00:56:43 +00:00
|
|
|
ip_address = self.ip_address
|
2022-08-10 19:41:56 +00:00
|
|
|
litterbox = self.litterbox
|
2022-04-06 21:14:32 -07:00
|
|
|
if not isinstance(self.method, Unset):
|
2023-05-04 00:58:06 -07:00
|
|
|
method = self.method
|
2022-04-06 21:14:32 -07:00
|
|
|
minutes = self.minutes
|
|
|
|
origin = self.origin
|
|
|
|
price = self.price
|
|
|
|
request_body = self.request_body
|
|
|
|
request_query_params = self.request_query_params
|
|
|
|
response_body = self.response_body
|
|
|
|
started_at: Union[Unset, str] = UNSET
|
|
|
|
if not isinstance(self.started_at, Unset):
|
|
|
|
started_at = self.started_at.isoformat()
|
2022-07-08 00:56:43 +00:00
|
|
|
status_code = self.status_code
|
2022-04-06 21:14:32 -07:00
|
|
|
stripe_invoice_item_id = self.stripe_invoice_item_id
|
2022-06-15 18:18:19 -07:00
|
|
|
token = self.token
|
2022-04-06 21:14:32 -07:00
|
|
|
updated_at: Union[Unset, str] = UNSET
|
|
|
|
if not isinstance(self.updated_at, Unset):
|
|
|
|
updated_at = self.updated_at.isoformat()
|
|
|
|
user_agent = self.user_agent
|
|
|
|
user_id = self.user_id
|
|
|
|
|
|
|
|
field_dict: Dict[str, Any] = {}
|
|
|
|
field_dict.update(self.additional_properties)
|
|
|
|
field_dict.update({})
|
|
|
|
if completed_at is not UNSET:
|
2023-05-04 00:58:06 -07:00
|
|
|
field_dict["completed_at"] = completed_at
|
2022-04-06 21:14:32 -07:00
|
|
|
if created_at is not UNSET:
|
2023-05-04 00:58:06 -07:00
|
|
|
field_dict["created_at"] = created_at
|
2022-04-06 21:14:32 -07:00
|
|
|
if duration is not UNSET:
|
2023-05-04 00:58:06 -07:00
|
|
|
field_dict["duration"] = duration
|
2022-04-06 21:14:32 -07:00
|
|
|
if email is not UNSET:
|
2023-05-04 00:58:06 -07:00
|
|
|
field_dict["email"] = email
|
2022-04-06 21:14:32 -07:00
|
|
|
if endpoint is not UNSET:
|
2023-05-04 00:58:06 -07:00
|
|
|
field_dict["endpoint"] = endpoint
|
2022-04-06 21:14:32 -07:00
|
|
|
if id is not UNSET:
|
2023-05-04 00:58:06 -07:00
|
|
|
field_dict["id"] = id
|
2022-04-06 21:14:32 -07:00
|
|
|
if ip_address is not UNSET:
|
2023-05-04 00:58:06 -07:00
|
|
|
field_dict["ip_address"] = ip_address
|
2022-08-10 19:41:56 +00:00
|
|
|
if litterbox is not UNSET:
|
2023-05-04 00:58:06 -07:00
|
|
|
field_dict["litterbox"] = litterbox
|
2022-04-06 21:14:32 -07:00
|
|
|
if method is not UNSET:
|
2023-05-04 00:58:06 -07:00
|
|
|
field_dict["method"] = method
|
2022-04-06 21:14:32 -07:00
|
|
|
if minutes is not UNSET:
|
2023-05-04 00:58:06 -07:00
|
|
|
field_dict["minutes"] = minutes
|
2022-04-06 21:14:32 -07:00
|
|
|
if origin is not UNSET:
|
2023-05-04 00:58:06 -07:00
|
|
|
field_dict["origin"] = origin
|
2022-04-06 21:14:32 -07:00
|
|
|
if price is not UNSET:
|
2023-05-04 00:58:06 -07:00
|
|
|
field_dict["price"] = price
|
2022-04-06 21:14:32 -07:00
|
|
|
if request_body is not UNSET:
|
2023-05-04 00:58:06 -07:00
|
|
|
field_dict["request_body"] = request_body
|
2022-04-06 21:14:32 -07:00
|
|
|
if request_query_params is not UNSET:
|
2023-05-04 00:58:06 -07:00
|
|
|
field_dict["request_query_params"] = request_query_params
|
2022-04-06 21:14:32 -07:00
|
|
|
if response_body is not UNSET:
|
2023-05-04 00:58:06 -07:00
|
|
|
field_dict["response_body"] = response_body
|
2022-04-06 21:14:32 -07:00
|
|
|
if started_at is not UNSET:
|
2023-05-04 00:58:06 -07:00
|
|
|
field_dict["started_at"] = started_at
|
2022-04-06 21:14:32 -07:00
|
|
|
if status_code is not UNSET:
|
2023-05-04 00:58:06 -07:00
|
|
|
field_dict["status_code"] = status_code
|
2022-04-06 21:14:32 -07:00
|
|
|
if stripe_invoice_item_id is not UNSET:
|
2023-05-04 00:58:06 -07:00
|
|
|
field_dict["stripe_invoice_item_id"] = stripe_invoice_item_id
|
2022-04-06 21:14:32 -07:00
|
|
|
if token is not UNSET:
|
2023-05-04 00:58:06 -07:00
|
|
|
field_dict["token"] = token
|
2022-04-06 21:14:32 -07:00
|
|
|
if updated_at is not UNSET:
|
2023-05-04 00:58:06 -07:00
|
|
|
field_dict["updated_at"] = updated_at
|
2022-04-06 21:14:32 -07:00
|
|
|
if user_agent is not UNSET:
|
2023-05-04 00:58:06 -07:00
|
|
|
field_dict["user_agent"] = user_agent
|
2022-04-06 21:14:32 -07:00
|
|
|
if user_id is not UNSET:
|
2023-05-04 00:58:06 -07:00
|
|
|
field_dict["user_id"] = user_id
|
2022-04-06 21:14:32 -07:00
|
|
|
|
|
|
|
return field_dict
|
|
|
|
|
|
|
|
@classmethod
|
2023-05-04 00:58:06 -07:00
|
|
|
def from_dict(cls: Type[S], src_dict: Dict[str, Any]) -> S:
|
2022-04-06 21:14:32 -07:00
|
|
|
d = src_dict.copy()
|
|
|
|
_completed_at = d.pop("completed_at", UNSET)
|
|
|
|
completed_at: Union[Unset, datetime.datetime]
|
|
|
|
if isinstance(_completed_at, Unset):
|
|
|
|
completed_at = UNSET
|
|
|
|
else:
|
|
|
|
completed_at = isoparse(_completed_at)
|
|
|
|
|
|
|
|
_created_at = d.pop("created_at", UNSET)
|
|
|
|
created_at: Union[Unset, datetime.datetime]
|
|
|
|
if isinstance(_created_at, Unset):
|
|
|
|
created_at = UNSET
|
|
|
|
else:
|
|
|
|
created_at = isoparse(_created_at)
|
|
|
|
|
2022-07-08 00:56:43 +00:00
|
|
|
duration = d.pop("duration", UNSET)
|
2022-04-06 21:14:32 -07:00
|
|
|
|
|
|
|
email = d.pop("email", UNSET)
|
|
|
|
|
|
|
|
endpoint = d.pop("endpoint", UNSET)
|
|
|
|
|
2022-06-15 18:18:19 -07:00
|
|
|
id = d.pop("id", UNSET)
|
2022-04-06 21:14:32 -07:00
|
|
|
|
2022-07-08 00:56:43 +00:00
|
|
|
ip_address = d.pop("ip_address", UNSET)
|
2022-04-06 21:14:32 -07:00
|
|
|
|
2022-08-10 19:41:56 +00:00
|
|
|
litterbox = d.pop("litterbox", UNSET)
|
|
|
|
|
2022-04-06 21:14:32 -07:00
|
|
|
_method = d.pop("method", UNSET)
|
|
|
|
method: Union[Unset, Method]
|
|
|
|
if isinstance(_method, Unset):
|
|
|
|
method = UNSET
|
|
|
|
else:
|
|
|
|
method = Method(_method)
|
|
|
|
|
|
|
|
minutes = d.pop("minutes", UNSET)
|
|
|
|
|
|
|
|
origin = d.pop("origin", UNSET)
|
|
|
|
|
|
|
|
price = d.pop("price", UNSET)
|
|
|
|
|
|
|
|
request_body = d.pop("request_body", UNSET)
|
|
|
|
|
|
|
|
request_query_params = d.pop("request_query_params", UNSET)
|
|
|
|
|
|
|
|
response_body = d.pop("response_body", UNSET)
|
|
|
|
|
|
|
|
_started_at = d.pop("started_at", UNSET)
|
|
|
|
started_at: Union[Unset, datetime.datetime]
|
|
|
|
if isinstance(_started_at, Unset):
|
|
|
|
started_at = UNSET
|
|
|
|
else:
|
|
|
|
started_at = isoparse(_started_at)
|
|
|
|
|
2022-07-08 00:56:43 +00:00
|
|
|
status_code = d.pop("status_code", UNSET)
|
2022-04-06 21:14:32 -07:00
|
|
|
|
|
|
|
stripe_invoice_item_id = d.pop("stripe_invoice_item_id", UNSET)
|
|
|
|
|
2022-06-15 18:18:19 -07:00
|
|
|
token = d.pop("token", UNSET)
|
2022-04-06 21:14:32 -07:00
|
|
|
|
|
|
|
_updated_at = d.pop("updated_at", UNSET)
|
|
|
|
updated_at: Union[Unset, datetime.datetime]
|
|
|
|
if isinstance(_updated_at, Unset):
|
|
|
|
updated_at = UNSET
|
|
|
|
else:
|
|
|
|
updated_at = isoparse(_updated_at)
|
|
|
|
|
|
|
|
user_agent = d.pop("user_agent", UNSET)
|
|
|
|
|
|
|
|
user_id = d.pop("user_id", UNSET)
|
|
|
|
|
|
|
|
api_call_with_price = cls(
|
|
|
|
completed_at=completed_at,
|
|
|
|
created_at=created_at,
|
|
|
|
duration=duration,
|
|
|
|
email=email,
|
|
|
|
endpoint=endpoint,
|
|
|
|
id=id,
|
|
|
|
ip_address=ip_address,
|
2022-08-10 19:41:56 +00:00
|
|
|
litterbox=litterbox,
|
2022-04-06 21:14:32 -07:00
|
|
|
method=method,
|
|
|
|
minutes=minutes,
|
|
|
|
origin=origin,
|
|
|
|
price=price,
|
|
|
|
request_body=request_body,
|
|
|
|
request_query_params=request_query_params,
|
|
|
|
response_body=response_body,
|
|
|
|
started_at=started_at,
|
|
|
|
status_code=status_code,
|
|
|
|
stripe_invoice_item_id=stripe_invoice_item_id,
|
|
|
|
token=token,
|
|
|
|
updated_at=updated_at,
|
|
|
|
user_agent=user_agent,
|
|
|
|
user_id=user_id,
|
|
|
|
)
|
|
|
|
|
|
|
|
api_call_with_price.additional_properties = d
|
|
|
|
return api_call_with_price
|
|
|
|
|
|
|
|
@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
|