fal 0.12.1__py3-none-any.whl → 0.12.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of fal might be problematic. Click here for more details.

Files changed (116) hide show
  1. fal/__init__.py +12 -3
  2. fal/_serialization.py +18 -0
  3. fal/api.py +140 -59
  4. fal/app.py +309 -86
  5. fal/apps.py +92 -8
  6. fal/auth/__init__.py +20 -1
  7. fal/auth/auth0.py +32 -22
  8. fal/cli.py +34 -52
  9. fal/env.py +0 -4
  10. fal/exceptions/handlers.py +3 -2
  11. fal/flags.py +5 -0
  12. fal/logging/__init__.py +0 -2
  13. fal/logging/trace.py +8 -1
  14. fal/logging/user.py +2 -1
  15. fal/rest_client.py +2 -2
  16. fal/sdk.py +46 -31
  17. fal/sync.py +3 -3
  18. fal/toolkit/__init__.py +18 -1
  19. fal/toolkit/file/file.py +98 -11
  20. fal/toolkit/file/providers/fal.py +43 -2
  21. fal/toolkit/file/types.py +1 -1
  22. fal/toolkit/image/image.py +26 -4
  23. fal/toolkit/optimize.py +50 -0
  24. fal/toolkit/utils/download_utils.py +59 -13
  25. {fal-0.12.1.dist-info → fal-0.12.3.dist-info}/METADATA +7 -7
  26. fal-0.12.3.dist-info/RECORD +66 -0
  27. openapi_fal_rest/models/__init__.py +2 -70
  28. openapi_fal_rest/models/customer_details.py +26 -0
  29. openapi_fal_rest/models/lock_reason.py +16 -0
  30. fal/logging/datadog.py +0 -77
  31. fal-0.12.1.dist-info/RECORD +0 -147
  32. openapi_fal_rest/api/admin/get_invoice_users.py +0 -142
  33. openapi_fal_rest/api/admin/get_usage_per_user.py +0 -199
  34. openapi_fal_rest/api/admin/handle_user_lock.py +0 -191
  35. openapi_fal_rest/api/admin/set_billing_type.py +0 -186
  36. openapi_fal_rest/api/applications/get_status_applications_app_user_id_app_alias_or_id_status_get.py +0 -179
  37. openapi_fal_rest/api/billing/delete_payment_method.py +0 -162
  38. openapi_fal_rest/api/billing/get_checkout_page.py +0 -198
  39. openapi_fal_rest/api/billing/get_setup_intent_key.py +0 -141
  40. openapi_fal_rest/api/billing/get_user_invoices.py +0 -152
  41. openapi_fal_rest/api/billing/get_user_payment_methods.py +0 -152
  42. openapi_fal_rest/api/billing/get_user_price.py +0 -186
  43. openapi_fal_rest/api/billing/get_user_spending.py +0 -192
  44. openapi_fal_rest/api/billing/handle_stripe_webhook.py +0 -173
  45. openapi_fal_rest/api/billing/upcoming_invoice.py +0 -143
  46. openapi_fal_rest/api/billing/update_customer_budget.py +0 -183
  47. openapi_fal_rest/api/files/delete.py +0 -162
  48. openapi_fal_rest/api/files/download.py +0 -162
  49. openapi_fal_rest/api/files/file_exists.py +0 -183
  50. openapi_fal_rest/api/files/list_directory.py +0 -173
  51. openapi_fal_rest/api/files/list_root.py +0 -152
  52. openapi_fal_rest/api/files/upload_from_url.py +0 -179
  53. openapi_fal_rest/api/health/__init__.py +0 -0
  54. openapi_fal_rest/api/health/check.py +0 -136
  55. openapi_fal_rest/api/keys/__init__.py +0 -0
  56. openapi_fal_rest/api/keys/create_key.py +0 -188
  57. openapi_fal_rest/api/keys/delete_key.py +0 -162
  58. openapi_fal_rest/api/keys/list_keys.py +0 -152
  59. openapi_fal_rest/api/logs/__init__.py +0 -0
  60. openapi_fal_rest/api/logs/list_since.py +0 -224
  61. openapi_fal_rest/api/requests/__init__.py +0 -0
  62. openapi_fal_rest/api/requests/requests.py +0 -247
  63. openapi_fal_rest/api/storage/__init__.py +0 -0
  64. openapi_fal_rest/api/storage/get_file_link.py +0 -200
  65. openapi_fal_rest/api/storage/initiate_upload.py +0 -172
  66. openapi_fal_rest/api/storage/upload_file.py +0 -172
  67. openapi_fal_rest/api/tokens/__init__.py +0 -0
  68. openapi_fal_rest/api/tokens/create_token.py +0 -166
  69. openapi_fal_rest/api/usage/__init__.py +0 -0
  70. openapi_fal_rest/api/usage/get_custom_usage_per_machine.py +0 -203
  71. openapi_fal_rest/api/usage/get_gateway_request_stats.py +0 -247
  72. openapi_fal_rest/api/usage/get_gateway_request_stats_by_time.py +0 -236
  73. openapi_fal_rest/api/usage/get_gateway_stats_for_yesterday.py +0 -152
  74. openapi_fal_rest/api/usage/get_shared_usage_per_app.py +0 -203
  75. openapi_fal_rest/api/usage/get_usage_records.py +0 -253
  76. openapi_fal_rest/api/usage/per_machine_usage.py +0 -218
  77. openapi_fal_rest/api/usage/per_machine_usage_details.py +0 -173
  78. openapi_fal_rest/api/users/__init__.py +0 -0
  79. openapi_fal_rest/api/users/handle_user_registration.py +0 -228
  80. openapi_fal_rest/models/billing_type.py +0 -9
  81. openapi_fal_rest/models/body_create_token.py +0 -68
  82. openapi_fal_rest/models/body_upload_file.py +0 -75
  83. openapi_fal_rest/models/file_spec.py +0 -110
  84. openapi_fal_rest/models/gateway_stats_by_time.py +0 -115
  85. openapi_fal_rest/models/gateway_usage_stats.py +0 -147
  86. openapi_fal_rest/models/get_gateway_request_stats_by_time_response_get_gateway_request_stats_by_time.py +0 -70
  87. openapi_fal_rest/models/grouped_usage_detail.py +0 -85
  88. openapi_fal_rest/models/handle_stripe_webhook_response_handle_stripe_webhook.py +0 -43
  89. openapi_fal_rest/models/initiate_upload_info.py +0 -64
  90. openapi_fal_rest/models/invoice.py +0 -129
  91. openapi_fal_rest/models/invoice_item.py +0 -85
  92. openapi_fal_rest/models/key_scope.py +0 -9
  93. openapi_fal_rest/models/log_entry.py +0 -104
  94. openapi_fal_rest/models/log_entry_labels.py +0 -43
  95. openapi_fal_rest/models/new_user_key.py +0 -64
  96. openapi_fal_rest/models/payment_method.py +0 -96
  97. openapi_fal_rest/models/per_app_usage_detail.py +0 -88
  98. openapi_fal_rest/models/persisted_usage_record.py +0 -118
  99. openapi_fal_rest/models/persisted_usage_record_meta.py +0 -43
  100. openapi_fal_rest/models/presigned_upload_url.py +0 -64
  101. openapi_fal_rest/models/request_io.py +0 -112
  102. openapi_fal_rest/models/request_io_json_input.py +0 -43
  103. openapi_fal_rest/models/request_io_json_output.py +0 -43
  104. openapi_fal_rest/models/run_type.py +0 -9
  105. openapi_fal_rest/models/stats_timeframe.py +0 -12
  106. openapi_fal_rest/models/status.py +0 -82
  107. openapi_fal_rest/models/status_health.py +0 -10
  108. openapi_fal_rest/models/uploaded_file_result.py +0 -64
  109. openapi_fal_rest/models/url_file_upload.py +0 -57
  110. openapi_fal_rest/models/usage_per_machine_type.py +0 -115
  111. openapi_fal_rest/models/usage_per_user.py +0 -71
  112. openapi_fal_rest/models/usage_run_detail.py +0 -73
  113. openapi_fal_rest/models/user_key_info.py +0 -84
  114. /openapi_fal_rest/api/admin/__init__.py → /fal/py.typed +0 -0
  115. {fal-0.12.1.dist-info → fal-0.12.3.dist-info}/WHEEL +0 -0
  116. {fal-0.12.1.dist-info → fal-0.12.3.dist-info}/entry_points.txt +0 -0
@@ -1,64 +0,0 @@
1
- from typing import Any, Dict, List, Type, TypeVar
2
-
3
- import attr
4
-
5
- T = TypeVar("T", bound="InitiateUploadInfo")
6
-
7
-
8
- @attr.s(auto_attribs=True)
9
- class InitiateUploadInfo:
10
- """
11
- Attributes:
12
- file_name (str):
13
- content_type (str):
14
- """
15
-
16
- file_name: str
17
- content_type: str
18
- additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
19
-
20
- def to_dict(self) -> Dict[str, Any]:
21
- file_name = self.file_name
22
- content_type = self.content_type
23
-
24
- field_dict: Dict[str, Any] = {}
25
- field_dict.update(self.additional_properties)
26
- field_dict.update(
27
- {
28
- "file_name": file_name,
29
- "content_type": content_type,
30
- }
31
- )
32
-
33
- return field_dict
34
-
35
- @classmethod
36
- def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
37
- d = src_dict.copy()
38
- file_name = d.pop("file_name")
39
-
40
- content_type = d.pop("content_type")
41
-
42
- initiate_upload_info = cls(
43
- file_name=file_name,
44
- content_type=content_type,
45
- )
46
-
47
- initiate_upload_info.additional_properties = d
48
- return initiate_upload_info
49
-
50
- @property
51
- def additional_keys(self) -> List[str]:
52
- return list(self.additional_properties.keys())
53
-
54
- def __getitem__(self, key: str) -> Any:
55
- return self.additional_properties[key]
56
-
57
- def __setitem__(self, key: str, value: Any) -> None:
58
- self.additional_properties[key] = value
59
-
60
- def __delitem__(self, key: str) -> None:
61
- del self.additional_properties[key]
62
-
63
- def __contains__(self, key: str) -> bool:
64
- return key in self.additional_properties
@@ -1,129 +0,0 @@
1
- from typing import TYPE_CHECKING, Any, Dict, List, Type, TypeVar
2
-
3
- import attr
4
-
5
- if TYPE_CHECKING:
6
- from ..models.invoice_item import InvoiceItem
7
-
8
-
9
- T = TypeVar("T", bound="Invoice")
10
-
11
-
12
- @attr.s(auto_attribs=True)
13
- class Invoice:
14
- """
15
- Attributes:
16
- amount_due (int):
17
- period_start (int):
18
- period_end (int):
19
- subtotal (int):
20
- total (int):
21
- items (List['InvoiceItem']):
22
- url (str):
23
- starting_balance (int):
24
- status (str):
25
- """
26
-
27
- amount_due: int
28
- period_start: int
29
- period_end: int
30
- subtotal: int
31
- total: int
32
- items: List["InvoiceItem"]
33
- url: str
34
- starting_balance: int
35
- status: str
36
- additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
37
-
38
- def to_dict(self) -> Dict[str, Any]:
39
- amount_due = self.amount_due
40
- period_start = self.period_start
41
- period_end = self.period_end
42
- subtotal = self.subtotal
43
- total = self.total
44
- items = []
45
- for items_item_data in self.items:
46
- items_item = items_item_data.to_dict()
47
-
48
- items.append(items_item)
49
-
50
- url = self.url
51
- starting_balance = self.starting_balance
52
- status = self.status
53
-
54
- field_dict: Dict[str, Any] = {}
55
- field_dict.update(self.additional_properties)
56
- field_dict.update(
57
- {
58
- "amount_due": amount_due,
59
- "period_start": period_start,
60
- "period_end": period_end,
61
- "subtotal": subtotal,
62
- "total": total,
63
- "items": items,
64
- "url": url,
65
- "starting_balance": starting_balance,
66
- "status": status,
67
- }
68
- )
69
-
70
- return field_dict
71
-
72
- @classmethod
73
- def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
74
- from ..models.invoice_item import InvoiceItem
75
-
76
- d = src_dict.copy()
77
- amount_due = d.pop("amount_due")
78
-
79
- period_start = d.pop("period_start")
80
-
81
- period_end = d.pop("period_end")
82
-
83
- subtotal = d.pop("subtotal")
84
-
85
- total = d.pop("total")
86
-
87
- items = []
88
- _items = d.pop("items")
89
- for items_item_data in _items:
90
- items_item = InvoiceItem.from_dict(items_item_data)
91
-
92
- items.append(items_item)
93
-
94
- url = d.pop("url")
95
-
96
- starting_balance = d.pop("starting_balance")
97
-
98
- status = d.pop("status")
99
-
100
- invoice = cls(
101
- amount_due=amount_due,
102
- period_start=period_start,
103
- period_end=period_end,
104
- subtotal=subtotal,
105
- total=total,
106
- items=items,
107
- url=url,
108
- starting_balance=starting_balance,
109
- status=status,
110
- )
111
-
112
- invoice.additional_properties = d
113
- return invoice
114
-
115
- @property
116
- def additional_keys(self) -> List[str]:
117
- return list(self.additional_properties.keys())
118
-
119
- def __getitem__(self, key: str) -> Any:
120
- return self.additional_properties[key]
121
-
122
- def __setitem__(self, key: str, value: Any) -> None:
123
- self.additional_properties[key] = value
124
-
125
- def __delitem__(self, key: str) -> None:
126
- del self.additional_properties[key]
127
-
128
- def __contains__(self, key: str) -> bool:
129
- return key in self.additional_properties
@@ -1,85 +0,0 @@
1
- from typing import Any, Dict, List, Type, TypeVar
2
-
3
- import attr
4
-
5
- T = TypeVar("T", bound="InvoiceItem")
6
-
7
-
8
- @attr.s(auto_attribs=True)
9
- class InvoiceItem:
10
- """
11
- Attributes:
12
- name (str):
13
- amount (int):
14
- quantity (int):
15
- machine_type (str):
16
- run_type (str):
17
- """
18
-
19
- name: str
20
- amount: int
21
- quantity: int
22
- machine_type: str
23
- run_type: str
24
- additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
25
-
26
- def to_dict(self) -> Dict[str, Any]:
27
- name = self.name
28
- amount = self.amount
29
- quantity = self.quantity
30
- machine_type = self.machine_type
31
- run_type = self.run_type
32
-
33
- field_dict: Dict[str, Any] = {}
34
- field_dict.update(self.additional_properties)
35
- field_dict.update(
36
- {
37
- "name": name,
38
- "amount": amount,
39
- "quantity": quantity,
40
- "machine_type": machine_type,
41
- "run_type": run_type,
42
- }
43
- )
44
-
45
- return field_dict
46
-
47
- @classmethod
48
- def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
49
- d = src_dict.copy()
50
- name = d.pop("name")
51
-
52
- amount = d.pop("amount")
53
-
54
- quantity = d.pop("quantity")
55
-
56
- machine_type = d.pop("machine_type")
57
-
58
- run_type = d.pop("run_type")
59
-
60
- invoice_item = cls(
61
- name=name,
62
- amount=amount,
63
- quantity=quantity,
64
- machine_type=machine_type,
65
- run_type=run_type,
66
- )
67
-
68
- invoice_item.additional_properties = d
69
- return invoice_item
70
-
71
- @property
72
- def additional_keys(self) -> List[str]:
73
- return list(self.additional_properties.keys())
74
-
75
- def __getitem__(self, key: str) -> Any:
76
- return self.additional_properties[key]
77
-
78
- def __setitem__(self, key: str, value: Any) -> None:
79
- self.additional_properties[key] = value
80
-
81
- def __delitem__(self, key: str) -> None:
82
- del self.additional_properties[key]
83
-
84
- def __contains__(self, key: str) -> bool:
85
- return key in self.additional_properties
@@ -1,9 +0,0 @@
1
- from enum import Enum
2
-
3
-
4
- class KeyScope(str, Enum):
5
- ADMIN = "ADMIN"
6
- API = "API"
7
-
8
- def __str__(self) -> str:
9
- return str(self.value)
@@ -1,104 +0,0 @@
1
- import datetime
2
- from typing import TYPE_CHECKING, Any, Dict, List, Type, TypeVar, Union
3
-
4
- import attr
5
- from dateutil.parser import isoparse
6
-
7
- from ..types import UNSET, Unset
8
-
9
- if TYPE_CHECKING:
10
- from ..models.log_entry_labels import LogEntryLabels
11
-
12
-
13
- T = TypeVar("T", bound="LogEntry")
14
-
15
-
16
- @attr.s(auto_attribs=True)
17
- class LogEntry:
18
- """
19
- Attributes:
20
- timestamp (datetime.datetime):
21
- level (str):
22
- message (str):
23
- app (str):
24
- labels (Union[Unset, LogEntryLabels]):
25
- """
26
-
27
- timestamp: datetime.datetime
28
- level: str
29
- message: str
30
- app: str
31
- labels: Union[Unset, "LogEntryLabels"] = UNSET
32
- additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
33
-
34
- def to_dict(self) -> Dict[str, Any]:
35
- timestamp = self.timestamp.isoformat()
36
-
37
- level = self.level
38
- message = self.message
39
- app = self.app
40
- labels: Union[Unset, Dict[str, Any]] = UNSET
41
- if not isinstance(self.labels, Unset):
42
- labels = self.labels.to_dict()
43
-
44
- field_dict: Dict[str, Any] = {}
45
- field_dict.update(self.additional_properties)
46
- field_dict.update(
47
- {
48
- "timestamp": timestamp,
49
- "level": level,
50
- "message": message,
51
- "app": app,
52
- }
53
- )
54
- if labels is not UNSET:
55
- field_dict["labels"] = labels
56
-
57
- return field_dict
58
-
59
- @classmethod
60
- def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
61
- from ..models.log_entry_labels import LogEntryLabels
62
-
63
- d = src_dict.copy()
64
- timestamp = isoparse(d.pop("timestamp"))
65
-
66
- level = d.pop("level")
67
-
68
- message = d.pop("message")
69
-
70
- app = d.pop("app")
71
-
72
- _labels = d.pop("labels", UNSET)
73
- labels: Union[Unset, LogEntryLabels]
74
- if isinstance(_labels, Unset):
75
- labels = UNSET
76
- else:
77
- labels = LogEntryLabels.from_dict(_labels)
78
-
79
- log_entry = cls(
80
- timestamp=timestamp,
81
- level=level,
82
- message=message,
83
- app=app,
84
- labels=labels,
85
- )
86
-
87
- log_entry.additional_properties = d
88
- return log_entry
89
-
90
- @property
91
- def additional_keys(self) -> List[str]:
92
- return list(self.additional_properties.keys())
93
-
94
- def __getitem__(self, key: str) -> Any:
95
- return self.additional_properties[key]
96
-
97
- def __setitem__(self, key: str, value: Any) -> None:
98
- self.additional_properties[key] = value
99
-
100
- def __delitem__(self, key: str) -> None:
101
- del self.additional_properties[key]
102
-
103
- def __contains__(self, key: str) -> bool:
104
- return key in self.additional_properties
@@ -1,43 +0,0 @@
1
- from typing import Any, Dict, List, Type, TypeVar
2
-
3
- import attr
4
-
5
- T = TypeVar("T", bound="LogEntryLabels")
6
-
7
-
8
- @attr.s(auto_attribs=True)
9
- class LogEntryLabels:
10
- """ """
11
-
12
- additional_properties: Dict[str, str] = attr.ib(init=False, factory=dict)
13
-
14
- def to_dict(self) -> Dict[str, Any]:
15
- field_dict: Dict[str, Any] = {}
16
- field_dict.update(self.additional_properties)
17
- field_dict.update({})
18
-
19
- return field_dict
20
-
21
- @classmethod
22
- def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
23
- d = src_dict.copy()
24
- log_entry_labels = cls()
25
-
26
- log_entry_labels.additional_properties = d
27
- return log_entry_labels
28
-
29
- @property
30
- def additional_keys(self) -> List[str]:
31
- return list(self.additional_properties.keys())
32
-
33
- def __getitem__(self, key: str) -> str:
34
- return self.additional_properties[key]
35
-
36
- def __setitem__(self, key: str, value: str) -> None:
37
- self.additional_properties[key] = value
38
-
39
- def __delitem__(self, key: str) -> None:
40
- del self.additional_properties[key]
41
-
42
- def __contains__(self, key: str) -> bool:
43
- return key in self.additional_properties
@@ -1,64 +0,0 @@
1
- from typing import Any, Dict, List, Type, TypeVar
2
-
3
- import attr
4
-
5
- T = TypeVar("T", bound="NewUserKey")
6
-
7
-
8
- @attr.s(auto_attribs=True)
9
- class NewUserKey:
10
- """
11
- Attributes:
12
- key_id (str):
13
- key_secret (str):
14
- """
15
-
16
- key_id: str
17
- key_secret: str
18
- additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
19
-
20
- def to_dict(self) -> Dict[str, Any]:
21
- key_id = self.key_id
22
- key_secret = self.key_secret
23
-
24
- field_dict: Dict[str, Any] = {}
25
- field_dict.update(self.additional_properties)
26
- field_dict.update(
27
- {
28
- "key_id": key_id,
29
- "key_secret": key_secret,
30
- }
31
- )
32
-
33
- return field_dict
34
-
35
- @classmethod
36
- def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
37
- d = src_dict.copy()
38
- key_id = d.pop("key_id")
39
-
40
- key_secret = d.pop("key_secret")
41
-
42
- new_user_key = cls(
43
- key_id=key_id,
44
- key_secret=key_secret,
45
- )
46
-
47
- new_user_key.additional_properties = d
48
- return new_user_key
49
-
50
- @property
51
- def additional_keys(self) -> List[str]:
52
- return list(self.additional_properties.keys())
53
-
54
- def __getitem__(self, key: str) -> Any:
55
- return self.additional_properties[key]
56
-
57
- def __setitem__(self, key: str, value: Any) -> None:
58
- self.additional_properties[key] = value
59
-
60
- def __delitem__(self, key: str) -> None:
61
- del self.additional_properties[key]
62
-
63
- def __contains__(self, key: str) -> bool:
64
- return key in self.additional_properties
@@ -1,96 +0,0 @@
1
- from typing import Any, Dict, List, Type, TypeVar, Union
2
-
3
- import attr
4
-
5
- from ..types import UNSET, Unset
6
-
7
- T = TypeVar("T", bound="PaymentMethod")
8
-
9
-
10
- @attr.s(auto_attribs=True)
11
- class PaymentMethod:
12
- """
13
- Attributes:
14
- id (str):
15
- type (str):
16
- last4 (str):
17
- brand (str):
18
- exp_month (Union[Unset, int]):
19
- exp_year (Union[Unset, int]):
20
- """
21
-
22
- id: str
23
- type: str
24
- last4: str
25
- brand: str
26
- exp_month: Union[Unset, int] = UNSET
27
- exp_year: Union[Unset, int] = UNSET
28
- additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
29
-
30
- def to_dict(self) -> Dict[str, Any]:
31
- id = self.id
32
- type = self.type
33
- last4 = self.last4
34
- brand = self.brand
35
- exp_month = self.exp_month
36
- exp_year = self.exp_year
37
-
38
- field_dict: Dict[str, Any] = {}
39
- field_dict.update(self.additional_properties)
40
- field_dict.update(
41
- {
42
- "id": id,
43
- "type": type,
44
- "last4": last4,
45
- "brand": brand,
46
- }
47
- )
48
- if exp_month is not UNSET:
49
- field_dict["exp_month"] = exp_month
50
- if exp_year is not UNSET:
51
- field_dict["exp_year"] = exp_year
52
-
53
- return field_dict
54
-
55
- @classmethod
56
- def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
57
- d = src_dict.copy()
58
- id = d.pop("id")
59
-
60
- type = d.pop("type")
61
-
62
- last4 = d.pop("last4")
63
-
64
- brand = d.pop("brand")
65
-
66
- exp_month = d.pop("exp_month", UNSET)
67
-
68
- exp_year = d.pop("exp_year", UNSET)
69
-
70
- payment_method = cls(
71
- id=id,
72
- type=type,
73
- last4=last4,
74
- brand=brand,
75
- exp_month=exp_month,
76
- exp_year=exp_year,
77
- )
78
-
79
- payment_method.additional_properties = d
80
- return payment_method
81
-
82
- @property
83
- def additional_keys(self) -> List[str]:
84
- return list(self.additional_properties.keys())
85
-
86
- def __getitem__(self, key: str) -> Any:
87
- return self.additional_properties[key]
88
-
89
- def __setitem__(self, key: str, value: Any) -> None:
90
- self.additional_properties[key] = value
91
-
92
- def __delitem__(self, key: str) -> None:
93
- del self.additional_properties[key]
94
-
95
- def __contains__(self, key: str) -> bool:
96
- return key in self.additional_properties
@@ -1,88 +0,0 @@
1
- import datetime
2
- from typing import Any, Dict, List, Type, TypeVar
3
-
4
- import attr
5
- from dateutil.parser import isoparse
6
-
7
- T = TypeVar("T", bound="PerAppUsageDetail")
8
-
9
-
10
- @attr.s(auto_attribs=True)
11
- class PerAppUsageDetail:
12
- """
13
- Attributes:
14
- date (datetime.datetime):
15
- machine_type (str):
16
- request_count (int):
17
- application_alias (str):
18
- total_billable_duration (int):
19
- """
20
-
21
- date: datetime.datetime
22
- machine_type: str
23
- request_count: int
24
- application_alias: str
25
- total_billable_duration: int
26
- additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
27
-
28
- def to_dict(self) -> Dict[str, Any]:
29
- date = self.date.isoformat()
30
-
31
- machine_type = self.machine_type
32
- request_count = self.request_count
33
- application_alias = self.application_alias
34
- total_billable_duration = self.total_billable_duration
35
-
36
- field_dict: Dict[str, Any] = {}
37
- field_dict.update(self.additional_properties)
38
- field_dict.update(
39
- {
40
- "date": date,
41
- "machine_type": machine_type,
42
- "request_count": request_count,
43
- "application_alias": application_alias,
44
- "total_billable_duration": total_billable_duration,
45
- }
46
- )
47
-
48
- return field_dict
49
-
50
- @classmethod
51
- def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
52
- d = src_dict.copy()
53
- date = isoparse(d.pop("date"))
54
-
55
- machine_type = d.pop("machine_type")
56
-
57
- request_count = d.pop("request_count")
58
-
59
- application_alias = d.pop("application_alias")
60
-
61
- total_billable_duration = d.pop("total_billable_duration")
62
-
63
- per_app_usage_detail = cls(
64
- date=date,
65
- machine_type=machine_type,
66
- request_count=request_count,
67
- application_alias=application_alias,
68
- total_billable_duration=total_billable_duration,
69
- )
70
-
71
- per_app_usage_detail.additional_properties = d
72
- return per_app_usage_detail
73
-
74
- @property
75
- def additional_keys(self) -> List[str]:
76
- return list(self.additional_properties.keys())
77
-
78
- def __getitem__(self, key: str) -> Any:
79
- return self.additional_properties[key]
80
-
81
- def __setitem__(self, key: str, value: Any) -> None:
82
- self.additional_properties[key] = value
83
-
84
- def __delitem__(self, key: str) -> None:
85
- del self.additional_properties[key]
86
-
87
- def __contains__(self, key: str) -> bool:
88
- return key in self.additional_properties