fal 0.11.1__py3-none-any.whl → 0.11.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 (58) hide show
  1. fal/api.py +51 -19
  2. fal/auth/__init__.py +1 -2
  3. fal/auth/auth0.py +2 -5
  4. fal/cli.py +92 -108
  5. fal/rest_client.py +1 -0
  6. fal/sdk.py +49 -129
  7. fal/sync.py +3 -2
  8. fal/toolkit/file/file.py +6 -5
  9. fal/toolkit/file/providers/gcp.py +4 -1
  10. fal/toolkit/file/providers/r2.py +83 -0
  11. fal/toolkit/file/types.py +1 -1
  12. fal/toolkit/image/image.py +2 -2
  13. fal/toolkit/utils/download_utils.py +1 -1
  14. {fal-0.11.1.dist-info → fal-0.11.3.dist-info}/METADATA +40 -3
  15. {fal-0.11.1.dist-info → fal-0.11.3.dist-info}/RECORD +58 -44
  16. openapi_fal_rest/api/admin/get_usage_per_user.py +199 -0
  17. openapi_fal_rest/api/admin/handle_user_lock.py +6 -2
  18. openapi_fal_rest/api/applications/get_status_applications_app_user_id_app_alias_or_id_status_get.py +6 -2
  19. openapi_fal_rest/api/billing/delete_payment_method.py +9 -3
  20. openapi_fal_rest/api/billing/get_setup_intent_key.py +6 -2
  21. openapi_fal_rest/api/billing/get_user_price.py +6 -2
  22. openapi_fal_rest/api/billing/get_user_spending.py +6 -2
  23. openapi_fal_rest/api/billing/handle_stripe_webhook.py +21 -7
  24. openapi_fal_rest/api/billing/upcoming_invoice.py +6 -2
  25. openapi_fal_rest/api/billing/update_customer_budget.py +6 -2
  26. openapi_fal_rest/api/files/check_dir_hash.py +9 -3
  27. openapi_fal_rest/api/files/delete.py +6 -2
  28. openapi_fal_rest/api/files/download.py +6 -2
  29. openapi_fal_rest/api/files/file_exists.py +6 -2
  30. openapi_fal_rest/api/files/upload_from_url.py +6 -2
  31. openapi_fal_rest/api/files/upload_local_file.py +9 -3
  32. openapi_fal_rest/api/keys/create_key.py +6 -2
  33. openapi_fal_rest/api/keys/delete_key.py +6 -2
  34. openapi_fal_rest/api/{usage/get_request_stats_by_time.py → requests/requests.py} +33 -18
  35. openapi_fal_rest/api/storage/get_file_link.py +200 -0
  36. openapi_fal_rest/api/storage/initiate_upload.py +172 -0
  37. openapi_fal_rest/api/tokens/__init__.py +0 -0
  38. openapi_fal_rest/api/{application/get_status_application_status_user_id_alias_get.py → tokens/create_token.py} +41 -48
  39. openapi_fal_rest/api/usage/get_gateway_request_stats.py +49 -1
  40. openapi_fal_rest/api/usage/get_gateway_request_stats_by_time.py +270 -0
  41. openapi_fal_rest/api/usage/per_machine_usage_details.py +3 -1
  42. openapi_fal_rest/models/__init__.py +18 -0
  43. openapi_fal_rest/models/body_create_token.py +68 -0
  44. openapi_fal_rest/models/body_upload_file.py +4 -1
  45. openapi_fal_rest/models/body_upload_local_file.py +4 -1
  46. openapi_fal_rest/models/gateway_stats_by_time.py +27 -27
  47. openapi_fal_rest/models/gateway_usage_stats.py +58 -31
  48. openapi_fal_rest/models/get_gateway_request_stats_by_time_response_get_gateway_request_stats_by_time.py +80 -0
  49. openapi_fal_rest/models/initiate_upload_info.py +64 -0
  50. openapi_fal_rest/models/presigned_upload_url.py +64 -0
  51. openapi_fal_rest/models/request_io.py +112 -0
  52. openapi_fal_rest/models/request_io_json_input.py +43 -0
  53. openapi_fal_rest/models/request_io_json_output.py +43 -0
  54. openapi_fal_rest/models/stats_timeframe.py +1 -0
  55. openapi_fal_rest/models/usage_per_user.py +71 -0
  56. {fal-0.11.1.dist-info → fal-0.11.3.dist-info}/WHEEL +0 -0
  57. {fal-0.11.1.dist-info → fal-0.11.3.dist-info}/entry_points.txt +0 -0
  58. /openapi_fal_rest/api/{application → requests}/__init__.py +0 -0
@@ -0,0 +1,270 @@
1
+ import datetime
2
+ from http import HTTPStatus
3
+ from typing import Any, Dict, List, Optional, Union
4
+
5
+ import httpx
6
+
7
+ from ... import errors
8
+ from ...client import Client
9
+ from ...models.get_gateway_request_stats_by_time_response_get_gateway_request_stats_by_time import (
10
+ GetGatewayRequestStatsByTimeResponseGetGatewayRequestStatsByTime,
11
+ )
12
+ from ...models.http_validation_error import HTTPValidationError
13
+ from ...models.stats_timeframe import StatsTimeframe
14
+ from ...types import UNSET, Response, Unset
15
+
16
+
17
+ def _get_kwargs(
18
+ *,
19
+ client: Client,
20
+ start_time: datetime.datetime,
21
+ end_time: datetime.datetime,
22
+ timeframe: StatsTimeframe,
23
+ app_aliases: Union[Unset, None, List[str]] = UNSET,
24
+ ) -> Dict[str, Any]:
25
+ url = "{}/usage/stats/app/time".format(client.base_url)
26
+
27
+ headers: Dict[str, str] = client.get_headers()
28
+ cookies: Dict[str, Any] = client.get_cookies()
29
+
30
+ params: Dict[str, Any] = {}
31
+ json_start_time = start_time.isoformat()
32
+
33
+ params["start_time"] = json_start_time
34
+
35
+ json_end_time = end_time.isoformat()
36
+
37
+ params["end_time"] = json_end_time
38
+
39
+ json_timeframe = timeframe.value
40
+
41
+ params["timeframe"] = json_timeframe
42
+
43
+ json_app_aliases: Union[Unset, None, List[str]] = UNSET
44
+ if not isinstance(app_aliases, Unset):
45
+ if app_aliases is None:
46
+ json_app_aliases = None
47
+ else:
48
+ json_app_aliases = app_aliases
49
+
50
+ params["app_aliases"] = json_app_aliases
51
+
52
+ params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
53
+
54
+ return {
55
+ "method": "get",
56
+ "url": url,
57
+ "headers": headers,
58
+ "cookies": cookies,
59
+ "timeout": client.get_timeout(),
60
+ "follow_redirects": client.follow_redirects,
61
+ "params": params,
62
+ }
63
+
64
+
65
+ def _parse_response(
66
+ *, client: Client, response: httpx.Response
67
+ ) -> Optional[
68
+ Union[
69
+ GetGatewayRequestStatsByTimeResponseGetGatewayRequestStatsByTime,
70
+ HTTPValidationError,
71
+ ]
72
+ ]:
73
+ if response.status_code == HTTPStatus.OK:
74
+ response_200 = (
75
+ GetGatewayRequestStatsByTimeResponseGetGatewayRequestStatsByTime.from_dict(
76
+ response.json()
77
+ )
78
+ )
79
+
80
+ return response_200
81
+ if response.status_code == HTTPStatus.UNPROCESSABLE_ENTITY:
82
+ response_422 = HTTPValidationError.from_dict(response.json())
83
+
84
+ return response_422
85
+ if client.raise_on_unexpected_status:
86
+ raise errors.UnexpectedStatus(response.status_code, response.content)
87
+ else:
88
+ return None
89
+
90
+
91
+ def _build_response(
92
+ *, client: Client, response: httpx.Response
93
+ ) -> Response[
94
+ Union[
95
+ GetGatewayRequestStatsByTimeResponseGetGatewayRequestStatsByTime,
96
+ HTTPValidationError,
97
+ ]
98
+ ]:
99
+ return Response(
100
+ status_code=HTTPStatus(response.status_code),
101
+ content=response.content,
102
+ headers=response.headers,
103
+ parsed=_parse_response(client=client, response=response),
104
+ )
105
+
106
+
107
+ def sync_detailed(
108
+ *,
109
+ client: Client,
110
+ start_time: datetime.datetime,
111
+ end_time: datetime.datetime,
112
+ timeframe: StatsTimeframe,
113
+ app_aliases: Union[Unset, None, List[str]] = UNSET,
114
+ ) -> Response[
115
+ Union[
116
+ GetGatewayRequestStatsByTimeResponseGetGatewayRequestStatsByTime,
117
+ HTTPValidationError,
118
+ ]
119
+ ]:
120
+ """Get Gateway Request Stats By Time
121
+
122
+ Args:
123
+ start_time (datetime.datetime):
124
+ end_time (datetime.datetime):
125
+ timeframe (StatsTimeframe): An enumeration.
126
+ app_aliases (Union[Unset, None, List[str]]):
127
+
128
+ Raises:
129
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
130
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
131
+
132
+ Returns:
133
+ Response[Union[GetGatewayRequestStatsByTimeResponseGetGatewayRequestStatsByTime, HTTPValidationError]]
134
+ """
135
+
136
+ kwargs = _get_kwargs(
137
+ client=client,
138
+ start_time=start_time,
139
+ end_time=end_time,
140
+ timeframe=timeframe,
141
+ app_aliases=app_aliases,
142
+ )
143
+
144
+ response = httpx.request(
145
+ verify=client.verify_ssl,
146
+ **kwargs,
147
+ )
148
+
149
+ return _build_response(client=client, response=response)
150
+
151
+
152
+ def sync(
153
+ *,
154
+ client: Client,
155
+ start_time: datetime.datetime,
156
+ end_time: datetime.datetime,
157
+ timeframe: StatsTimeframe,
158
+ app_aliases: Union[Unset, None, List[str]] = UNSET,
159
+ ) -> Optional[
160
+ Union[
161
+ GetGatewayRequestStatsByTimeResponseGetGatewayRequestStatsByTime,
162
+ HTTPValidationError,
163
+ ]
164
+ ]:
165
+ """Get Gateway Request Stats By Time
166
+
167
+ Args:
168
+ start_time (datetime.datetime):
169
+ end_time (datetime.datetime):
170
+ timeframe (StatsTimeframe): An enumeration.
171
+ app_aliases (Union[Unset, None, List[str]]):
172
+
173
+ Raises:
174
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
175
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
176
+
177
+ Returns:
178
+ Union[GetGatewayRequestStatsByTimeResponseGetGatewayRequestStatsByTime, HTTPValidationError]
179
+ """
180
+
181
+ return sync_detailed(
182
+ client=client,
183
+ start_time=start_time,
184
+ end_time=end_time,
185
+ timeframe=timeframe,
186
+ app_aliases=app_aliases,
187
+ ).parsed
188
+
189
+
190
+ async def asyncio_detailed(
191
+ *,
192
+ client: Client,
193
+ start_time: datetime.datetime,
194
+ end_time: datetime.datetime,
195
+ timeframe: StatsTimeframe,
196
+ app_aliases: Union[Unset, None, List[str]] = UNSET,
197
+ ) -> Response[
198
+ Union[
199
+ GetGatewayRequestStatsByTimeResponseGetGatewayRequestStatsByTime,
200
+ HTTPValidationError,
201
+ ]
202
+ ]:
203
+ """Get Gateway Request Stats By Time
204
+
205
+ Args:
206
+ start_time (datetime.datetime):
207
+ end_time (datetime.datetime):
208
+ timeframe (StatsTimeframe): An enumeration.
209
+ app_aliases (Union[Unset, None, List[str]]):
210
+
211
+ Raises:
212
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
213
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
214
+
215
+ Returns:
216
+ Response[Union[GetGatewayRequestStatsByTimeResponseGetGatewayRequestStatsByTime, HTTPValidationError]]
217
+ """
218
+
219
+ kwargs = _get_kwargs(
220
+ client=client,
221
+ start_time=start_time,
222
+ end_time=end_time,
223
+ timeframe=timeframe,
224
+ app_aliases=app_aliases,
225
+ )
226
+
227
+ async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
228
+ response = await _client.request(**kwargs)
229
+
230
+ return _build_response(client=client, response=response)
231
+
232
+
233
+ async def asyncio(
234
+ *,
235
+ client: Client,
236
+ start_time: datetime.datetime,
237
+ end_time: datetime.datetime,
238
+ timeframe: StatsTimeframe,
239
+ app_aliases: Union[Unset, None, List[str]] = UNSET,
240
+ ) -> Optional[
241
+ Union[
242
+ GetGatewayRequestStatsByTimeResponseGetGatewayRequestStatsByTime,
243
+ HTTPValidationError,
244
+ ]
245
+ ]:
246
+ """Get Gateway Request Stats By Time
247
+
248
+ Args:
249
+ start_time (datetime.datetime):
250
+ end_time (datetime.datetime):
251
+ timeframe (StatsTimeframe): An enumeration.
252
+ app_aliases (Union[Unset, None, List[str]]):
253
+
254
+ Raises:
255
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
256
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
257
+
258
+ Returns:
259
+ Union[GetGatewayRequestStatsByTimeResponseGetGatewayRequestStatsByTime, HTTPValidationError]
260
+ """
261
+
262
+ return (
263
+ await asyncio_detailed(
264
+ client=client,
265
+ start_time=start_time,
266
+ end_time=end_time,
267
+ timeframe=timeframe,
268
+ app_aliases=app_aliases,
269
+ )
270
+ ).parsed
@@ -15,7 +15,9 @@ def _get_kwargs(
15
15
  *,
16
16
  client: Client,
17
17
  ) -> Dict[str, Any]:
18
- url = "{}/usage/machine_type/{machine_type}".format(client.base_url, machine_type=machine_type)
18
+ url = "{}/usage/machine_type/{machine_type}".format(
19
+ client.base_url, machine_type=machine_type
20
+ )
19
21
 
20
22
  headers: Dict[str, str] = client.get_headers()
21
23
  cookies: Dict[str, Any] = client.get_cookies()
@@ -1,16 +1,21 @@
1
1
  """ Contains all the data models used in inputs/outputs """
2
2
 
3
3
  from .app_metadata_response_app_metadata import AppMetadataResponseAppMetadata
4
+ from .body_create_token import BodyCreateToken
4
5
  from .body_upload_file import BodyUploadFile
5
6
  from .body_upload_local_file import BodyUploadLocalFile
6
7
  from .customer_details import CustomerDetails
7
8
  from .file_spec import FileSpec
8
9
  from .gateway_stats_by_time import GatewayStatsByTime
9
10
  from .gateway_usage_stats import GatewayUsageStats
11
+ from .get_gateway_request_stats_by_time_response_get_gateway_request_stats_by_time import (
12
+ GetGatewayRequestStatsByTimeResponseGetGatewayRequestStatsByTime,
13
+ )
10
14
  from .grouped_usage_detail import GroupedUsageDetail
11
15
  from .handle_stripe_webhook_response_handle_stripe_webhook import HandleStripeWebhookResponseHandleStripeWebhook
12
16
  from .hash_check import HashCheck
13
17
  from .http_validation_error import HTTPValidationError
18
+ from .initiate_upload_info import InitiateUploadInfo
14
19
  from .invoice import Invoice
15
20
  from .invoice_item import InvoiceItem
16
21
  from .key_scope import KeyScope
@@ -20,6 +25,10 @@ from .new_user_key import NewUserKey
20
25
  from .payment_method import PaymentMethod
21
26
  from .persisted_usage_record import PersistedUsageRecord
22
27
  from .persisted_usage_record_meta import PersistedUsageRecordMeta
28
+ from .presigned_upload_url import PresignedUploadUrl
29
+ from .request_io import RequestIO
30
+ from .request_io_json_input import RequestIOJsonInput
31
+ from .request_io_json_output import RequestIOJsonOutput
23
32
  from .run_type import RunType
24
33
  from .stats_timeframe import StatsTimeframe
25
34
  from .status import Status
@@ -27,22 +36,26 @@ from .status_health import StatusHealth
27
36
  from .uploaded_file_result import UploadedFileResult
28
37
  from .url_file_upload import UrlFileUpload
29
38
  from .usage_per_machine_type import UsagePerMachineType
39
+ from .usage_per_user import UsagePerUser
30
40
  from .usage_run_detail import UsageRunDetail
31
41
  from .user_key_info import UserKeyInfo
32
42
  from .validation_error import ValidationError
33
43
 
34
44
  __all__ = (
35
45
  "AppMetadataResponseAppMetadata",
46
+ "BodyCreateToken",
36
47
  "BodyUploadFile",
37
48
  "BodyUploadLocalFile",
38
49
  "CustomerDetails",
39
50
  "FileSpec",
40
51
  "GatewayStatsByTime",
41
52
  "GatewayUsageStats",
53
+ "GetGatewayRequestStatsByTimeResponseGetGatewayRequestStatsByTime",
42
54
  "GroupedUsageDetail",
43
55
  "HandleStripeWebhookResponseHandleStripeWebhook",
44
56
  "HashCheck",
45
57
  "HTTPValidationError",
58
+ "InitiateUploadInfo",
46
59
  "Invoice",
47
60
  "InvoiceItem",
48
61
  "KeyScope",
@@ -52,6 +65,10 @@ __all__ = (
52
65
  "PaymentMethod",
53
66
  "PersistedUsageRecord",
54
67
  "PersistedUsageRecordMeta",
68
+ "PresignedUploadUrl",
69
+ "RequestIO",
70
+ "RequestIOJsonInput",
71
+ "RequestIOJsonOutput",
55
72
  "RunType",
56
73
  "StatsTimeframe",
57
74
  "Status",
@@ -59,6 +76,7 @@ __all__ = (
59
76
  "UploadedFileResult",
60
77
  "UrlFileUpload",
61
78
  "UsagePerMachineType",
79
+ "UsagePerUser",
62
80
  "UsageRunDetail",
63
81
  "UserKeyInfo",
64
82
  "ValidationError",
@@ -0,0 +1,68 @@
1
+ from typing import Any, Dict, List, Type, TypeVar, Union, cast
2
+
3
+ import attr
4
+
5
+ from ..types import UNSET, Unset
6
+
7
+ T = TypeVar("T", bound="BodyCreateToken")
8
+
9
+
10
+ @attr.s(auto_attribs=True)
11
+ class BodyCreateToken:
12
+ """
13
+ Attributes:
14
+ allowed_apps (List[str]):
15
+ token_expiration (Union[Unset, int]): Default: 300.
16
+ """
17
+
18
+ allowed_apps: List[str]
19
+ token_expiration: Union[Unset, int] = 300
20
+ additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
21
+
22
+ def to_dict(self) -> Dict[str, Any]:
23
+ allowed_apps = self.allowed_apps
24
+
25
+ token_expiration = self.token_expiration
26
+
27
+ field_dict: Dict[str, Any] = {}
28
+ field_dict.update(self.additional_properties)
29
+ field_dict.update(
30
+ {
31
+ "allowed_apps": allowed_apps,
32
+ }
33
+ )
34
+ if token_expiration is not UNSET:
35
+ field_dict["token_expiration"] = token_expiration
36
+
37
+ return field_dict
38
+
39
+ @classmethod
40
+ def from_dict(cls: Type[T], src_dict: Dict[str, Any]) -> T:
41
+ d = src_dict.copy()
42
+ allowed_apps = cast(List[str], d.pop("allowed_apps"))
43
+
44
+ token_expiration = d.pop("token_expiration", UNSET)
45
+
46
+ body_create_token = cls(
47
+ allowed_apps=allowed_apps,
48
+ token_expiration=token_expiration,
49
+ )
50
+
51
+ body_create_token.additional_properties = d
52
+ return body_create_token
53
+
54
+ @property
55
+ def additional_keys(self) -> List[str]:
56
+ return list(self.additional_properties.keys())
57
+
58
+ def __getitem__(self, key: str) -> Any:
59
+ return self.additional_properties[key]
60
+
61
+ def __setitem__(self, key: str, value: Any) -> None:
62
+ self.additional_properties[key] = value
63
+
64
+ def __delitem__(self, key: str) -> None:
65
+ del self.additional_properties[key]
66
+
67
+ def __contains__(self, key: str) -> bool:
68
+ return key in self.additional_properties
@@ -36,7 +36,10 @@ class BodyUploadFile:
36
36
 
37
37
  field_dict: Dict[str, Any] = {}
38
38
  field_dict.update(
39
- {key: (None, str(value).encode(), "text/plain") for key, value in self.additional_properties.items()}
39
+ {
40
+ key: (None, str(value).encode(), "text/plain")
41
+ for key, value in self.additional_properties.items()
42
+ }
40
43
  )
41
44
  field_dict.update(
42
45
  {
@@ -36,7 +36,10 @@ class BodyUploadLocalFile:
36
36
 
37
37
  field_dict: Dict[str, Any] = {}
38
38
  field_dict.update(
39
- {key: (None, str(value).encode(), "text/plain") for key, value in self.additional_properties.items()}
39
+ {
40
+ key: (None, str(value).encode(), "text/plain")
41
+ for key, value in self.additional_properties.items()
42
+ }
40
43
  )
41
44
  field_dict.update(
42
45
  {
@@ -1,9 +1,11 @@
1
1
  import datetime
2
- from typing import Any, Dict, List, Type, TypeVar
2
+ from typing import Any, Dict, List, Type, TypeVar, Union
3
3
 
4
4
  import attr
5
5
  from dateutil.parser import isoparse
6
6
 
7
+ from ..types import UNSET, Unset
8
+
7
9
  T = TypeVar("T", bound="GatewayStatsByTime")
8
10
 
9
11
 
@@ -14,35 +16,33 @@ class GatewayStatsByTime:
14
16
  request_count (int):
15
17
  success_count (int):
16
18
  error_count (int):
17
- total_billable_duration (int):
18
- p25_duration (float):
19
- p50_duration (float):
20
- p75_duration (float):
21
- p90_duration (float):
22
19
  datetime_ (datetime.datetime):
20
+ p25_duration (Union[Unset, None, float]):
21
+ p50_duration (Union[Unset, None, float]):
22
+ p75_duration (Union[Unset, None, float]):
23
+ p90_duration (Union[Unset, None, float]):
23
24
  """
24
25
 
25
26
  request_count: int
26
27
  success_count: int
27
28
  error_count: int
28
- total_billable_duration: int
29
- p25_duration: float
30
- p50_duration: float
31
- p75_duration: float
32
- p90_duration: float
33
29
  datetime_: datetime.datetime
30
+ p25_duration: Union[Unset, None, float] = UNSET
31
+ p50_duration: Union[Unset, None, float] = UNSET
32
+ p75_duration: Union[Unset, None, float] = UNSET
33
+ p90_duration: Union[Unset, None, float] = UNSET
34
34
  additional_properties: Dict[str, Any] = attr.ib(init=False, factory=dict)
35
35
 
36
36
  def to_dict(self) -> Dict[str, Any]:
37
37
  request_count = self.request_count
38
38
  success_count = self.success_count
39
39
  error_count = self.error_count
40
- total_billable_duration = self.total_billable_duration
40
+ datetime_ = self.datetime_.isoformat()
41
+
41
42
  p25_duration = self.p25_duration
42
43
  p50_duration = self.p50_duration
43
44
  p75_duration = self.p75_duration
44
45
  p90_duration = self.p90_duration
45
- datetime_ = self.datetime_.isoformat()
46
46
 
47
47
  field_dict: Dict[str, Any] = {}
48
48
  field_dict.update(self.additional_properties)
@@ -51,14 +51,17 @@ class GatewayStatsByTime:
51
51
  "request_count": request_count,
52
52
  "success_count": success_count,
53
53
  "error_count": error_count,
54
- "total_billable_duration": total_billable_duration,
55
- "p25_duration": p25_duration,
56
- "p50_duration": p50_duration,
57
- "p75_duration": p75_duration,
58
- "p90_duration": p90_duration,
59
54
  "datetime": datetime_,
60
55
  }
61
56
  )
57
+ if p25_duration is not UNSET:
58
+ field_dict["p25_duration"] = p25_duration
59
+ if p50_duration is not UNSET:
60
+ field_dict["p50_duration"] = p50_duration
61
+ if p75_duration is not UNSET:
62
+ field_dict["p75_duration"] = p75_duration
63
+ if p90_duration is not UNSET:
64
+ field_dict["p90_duration"] = p90_duration
62
65
 
63
66
  return field_dict
64
67
 
@@ -71,28 +74,25 @@ class GatewayStatsByTime:
71
74
 
72
75
  error_count = d.pop("error_count")
73
76
 
74
- total_billable_duration = d.pop("total_billable_duration")
75
-
76
- p25_duration = d.pop("p25_duration")
77
+ datetime_ = isoparse(d.pop("datetime"))
77
78
 
78
- p50_duration = d.pop("p50_duration")
79
+ p25_duration = d.pop("p25_duration", UNSET)
79
80
 
80
- p75_duration = d.pop("p75_duration")
81
+ p50_duration = d.pop("p50_duration", UNSET)
81
82
 
82
- p90_duration = d.pop("p90_duration")
83
+ p75_duration = d.pop("p75_duration", UNSET)
83
84
 
84
- datetime_ = isoparse(d.pop("datetime"))
85
+ p90_duration = d.pop("p90_duration", UNSET)
85
86
 
86
87
  gateway_stats_by_time = cls(
87
88
  request_count=request_count,
88
89
  success_count=success_count,
89
90
  error_count=error_count,
90
- total_billable_duration=total_billable_duration,
91
+ datetime_=datetime_,
91
92
  p25_duration=p25_duration,
92
93
  p50_duration=p50_duration,
93
94
  p75_duration=p75_duration,
94
95
  p90_duration=p90_duration,
95
- datetime_=datetime_,
96
96
  )
97
97
 
98
98
  gateway_stats_by_time.additional_properties = d