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.
- fal/__init__.py +12 -3
- fal/_serialization.py +18 -0
- fal/api.py +140 -59
- fal/app.py +309 -86
- fal/apps.py +92 -8
- fal/auth/__init__.py +20 -1
- fal/auth/auth0.py +32 -22
- fal/cli.py +34 -52
- fal/env.py +0 -4
- fal/exceptions/handlers.py +3 -2
- fal/flags.py +5 -0
- fal/logging/__init__.py +0 -2
- fal/logging/trace.py +8 -1
- fal/logging/user.py +2 -1
- fal/rest_client.py +2 -2
- fal/sdk.py +46 -31
- fal/sync.py +3 -3
- fal/toolkit/__init__.py +18 -1
- fal/toolkit/file/file.py +98 -11
- fal/toolkit/file/providers/fal.py +43 -2
- fal/toolkit/file/types.py +1 -1
- fal/toolkit/image/image.py +26 -4
- fal/toolkit/optimize.py +50 -0
- fal/toolkit/utils/download_utils.py +59 -13
- {fal-0.12.1.dist-info → fal-0.12.3.dist-info}/METADATA +7 -7
- fal-0.12.3.dist-info/RECORD +66 -0
- openapi_fal_rest/models/__init__.py +2 -70
- openapi_fal_rest/models/customer_details.py +26 -0
- openapi_fal_rest/models/lock_reason.py +16 -0
- fal/logging/datadog.py +0 -77
- fal-0.12.1.dist-info/RECORD +0 -147
- openapi_fal_rest/api/admin/get_invoice_users.py +0 -142
- openapi_fal_rest/api/admin/get_usage_per_user.py +0 -199
- openapi_fal_rest/api/admin/handle_user_lock.py +0 -191
- openapi_fal_rest/api/admin/set_billing_type.py +0 -186
- openapi_fal_rest/api/applications/get_status_applications_app_user_id_app_alias_or_id_status_get.py +0 -179
- openapi_fal_rest/api/billing/delete_payment_method.py +0 -162
- openapi_fal_rest/api/billing/get_checkout_page.py +0 -198
- openapi_fal_rest/api/billing/get_setup_intent_key.py +0 -141
- openapi_fal_rest/api/billing/get_user_invoices.py +0 -152
- openapi_fal_rest/api/billing/get_user_payment_methods.py +0 -152
- openapi_fal_rest/api/billing/get_user_price.py +0 -186
- openapi_fal_rest/api/billing/get_user_spending.py +0 -192
- openapi_fal_rest/api/billing/handle_stripe_webhook.py +0 -173
- openapi_fal_rest/api/billing/upcoming_invoice.py +0 -143
- openapi_fal_rest/api/billing/update_customer_budget.py +0 -183
- openapi_fal_rest/api/files/delete.py +0 -162
- openapi_fal_rest/api/files/download.py +0 -162
- openapi_fal_rest/api/files/file_exists.py +0 -183
- openapi_fal_rest/api/files/list_directory.py +0 -173
- openapi_fal_rest/api/files/list_root.py +0 -152
- openapi_fal_rest/api/files/upload_from_url.py +0 -179
- openapi_fal_rest/api/health/__init__.py +0 -0
- openapi_fal_rest/api/health/check.py +0 -136
- openapi_fal_rest/api/keys/__init__.py +0 -0
- openapi_fal_rest/api/keys/create_key.py +0 -188
- openapi_fal_rest/api/keys/delete_key.py +0 -162
- openapi_fal_rest/api/keys/list_keys.py +0 -152
- openapi_fal_rest/api/logs/__init__.py +0 -0
- openapi_fal_rest/api/logs/list_since.py +0 -224
- openapi_fal_rest/api/requests/__init__.py +0 -0
- openapi_fal_rest/api/requests/requests.py +0 -247
- openapi_fal_rest/api/storage/__init__.py +0 -0
- openapi_fal_rest/api/storage/get_file_link.py +0 -200
- openapi_fal_rest/api/storage/initiate_upload.py +0 -172
- openapi_fal_rest/api/storage/upload_file.py +0 -172
- openapi_fal_rest/api/tokens/__init__.py +0 -0
- openapi_fal_rest/api/tokens/create_token.py +0 -166
- openapi_fal_rest/api/usage/__init__.py +0 -0
- openapi_fal_rest/api/usage/get_custom_usage_per_machine.py +0 -203
- openapi_fal_rest/api/usage/get_gateway_request_stats.py +0 -247
- openapi_fal_rest/api/usage/get_gateway_request_stats_by_time.py +0 -236
- openapi_fal_rest/api/usage/get_gateway_stats_for_yesterday.py +0 -152
- openapi_fal_rest/api/usage/get_shared_usage_per_app.py +0 -203
- openapi_fal_rest/api/usage/get_usage_records.py +0 -253
- openapi_fal_rest/api/usage/per_machine_usage.py +0 -218
- openapi_fal_rest/api/usage/per_machine_usage_details.py +0 -173
- openapi_fal_rest/api/users/__init__.py +0 -0
- openapi_fal_rest/api/users/handle_user_registration.py +0 -228
- openapi_fal_rest/models/billing_type.py +0 -9
- openapi_fal_rest/models/body_create_token.py +0 -68
- openapi_fal_rest/models/body_upload_file.py +0 -75
- openapi_fal_rest/models/file_spec.py +0 -110
- openapi_fal_rest/models/gateway_stats_by_time.py +0 -115
- openapi_fal_rest/models/gateway_usage_stats.py +0 -147
- openapi_fal_rest/models/get_gateway_request_stats_by_time_response_get_gateway_request_stats_by_time.py +0 -70
- openapi_fal_rest/models/grouped_usage_detail.py +0 -85
- openapi_fal_rest/models/handle_stripe_webhook_response_handle_stripe_webhook.py +0 -43
- openapi_fal_rest/models/initiate_upload_info.py +0 -64
- openapi_fal_rest/models/invoice.py +0 -129
- openapi_fal_rest/models/invoice_item.py +0 -85
- openapi_fal_rest/models/key_scope.py +0 -9
- openapi_fal_rest/models/log_entry.py +0 -104
- openapi_fal_rest/models/log_entry_labels.py +0 -43
- openapi_fal_rest/models/new_user_key.py +0 -64
- openapi_fal_rest/models/payment_method.py +0 -96
- openapi_fal_rest/models/per_app_usage_detail.py +0 -88
- openapi_fal_rest/models/persisted_usage_record.py +0 -118
- openapi_fal_rest/models/persisted_usage_record_meta.py +0 -43
- openapi_fal_rest/models/presigned_upload_url.py +0 -64
- openapi_fal_rest/models/request_io.py +0 -112
- openapi_fal_rest/models/request_io_json_input.py +0 -43
- openapi_fal_rest/models/request_io_json_output.py +0 -43
- openapi_fal_rest/models/run_type.py +0 -9
- openapi_fal_rest/models/stats_timeframe.py +0 -12
- openapi_fal_rest/models/status.py +0 -82
- openapi_fal_rest/models/status_health.py +0 -10
- openapi_fal_rest/models/uploaded_file_result.py +0 -64
- openapi_fal_rest/models/url_file_upload.py +0 -57
- openapi_fal_rest/models/usage_per_machine_type.py +0 -115
- openapi_fal_rest/models/usage_per_user.py +0 -71
- openapi_fal_rest/models/usage_run_detail.py +0 -73
- openapi_fal_rest/models/user_key_info.py +0 -84
- /openapi_fal_rest/api/admin/__init__.py → /fal/py.typed +0 -0
- {fal-0.12.1.dist-info → fal-0.12.3.dist-info}/WHEEL +0 -0
- {fal-0.12.1.dist-info → fal-0.12.3.dist-info}/entry_points.txt +0 -0
|
@@ -1,218 +0,0 @@
|
|
|
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.http_validation_error import HTTPValidationError
|
|
10
|
-
from ...models.usage_per_machine_type import UsagePerMachineType
|
|
11
|
-
from ...types import UNSET, Response, Unset
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
def _get_kwargs(
|
|
15
|
-
*,
|
|
16
|
-
client: Client,
|
|
17
|
-
per_day: Union[Unset, None, bool] = False,
|
|
18
|
-
start_date: Union[Unset, None, datetime.date] = UNSET,
|
|
19
|
-
end_date: Union[Unset, None, datetime.date] = UNSET,
|
|
20
|
-
) -> Dict[str, Any]:
|
|
21
|
-
url = "{}/usage/machine_type".format(client.base_url)
|
|
22
|
-
|
|
23
|
-
headers: Dict[str, str] = client.get_headers()
|
|
24
|
-
cookies: Dict[str, Any] = client.get_cookies()
|
|
25
|
-
|
|
26
|
-
params: Dict[str, Any] = {}
|
|
27
|
-
params["per_day"] = per_day
|
|
28
|
-
|
|
29
|
-
json_start_date: Union[Unset, None, str] = UNSET
|
|
30
|
-
if not isinstance(start_date, Unset):
|
|
31
|
-
json_start_date = start_date.isoformat() if start_date else None
|
|
32
|
-
|
|
33
|
-
params["start_date"] = json_start_date
|
|
34
|
-
|
|
35
|
-
json_end_date: Union[Unset, None, str] = UNSET
|
|
36
|
-
if not isinstance(end_date, Unset):
|
|
37
|
-
json_end_date = end_date.isoformat() if end_date else None
|
|
38
|
-
|
|
39
|
-
params["end_date"] = json_end_date
|
|
40
|
-
|
|
41
|
-
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
|
42
|
-
|
|
43
|
-
return {
|
|
44
|
-
"method": "get",
|
|
45
|
-
"url": url,
|
|
46
|
-
"headers": headers,
|
|
47
|
-
"cookies": cookies,
|
|
48
|
-
"timeout": client.get_timeout(),
|
|
49
|
-
"follow_redirects": client.follow_redirects,
|
|
50
|
-
"params": params,
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
def _parse_response(
|
|
55
|
-
*, client: Client, response: httpx.Response
|
|
56
|
-
) -> Optional[Union[HTTPValidationError, List["UsagePerMachineType"]]]:
|
|
57
|
-
if response.status_code == HTTPStatus.OK:
|
|
58
|
-
response_200 = []
|
|
59
|
-
_response_200 = response.json()
|
|
60
|
-
for response_200_item_data in _response_200:
|
|
61
|
-
response_200_item = UsagePerMachineType.from_dict(response_200_item_data)
|
|
62
|
-
|
|
63
|
-
response_200.append(response_200_item)
|
|
64
|
-
|
|
65
|
-
return response_200
|
|
66
|
-
if response.status_code == HTTPStatus.UNPROCESSABLE_ENTITY:
|
|
67
|
-
response_422 = HTTPValidationError.from_dict(response.json())
|
|
68
|
-
|
|
69
|
-
return response_422
|
|
70
|
-
if client.raise_on_unexpected_status:
|
|
71
|
-
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
72
|
-
else:
|
|
73
|
-
return None
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
def _build_response(
|
|
77
|
-
*, client: Client, response: httpx.Response
|
|
78
|
-
) -> Response[Union[HTTPValidationError, List["UsagePerMachineType"]]]:
|
|
79
|
-
return Response(
|
|
80
|
-
status_code=HTTPStatus(response.status_code),
|
|
81
|
-
content=response.content,
|
|
82
|
-
headers=response.headers,
|
|
83
|
-
parsed=_parse_response(client=client, response=response),
|
|
84
|
-
)
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
def sync_detailed(
|
|
88
|
-
*,
|
|
89
|
-
client: Client,
|
|
90
|
-
per_day: Union[Unset, None, bool] = False,
|
|
91
|
-
start_date: Union[Unset, None, datetime.date] = UNSET,
|
|
92
|
-
end_date: Union[Unset, None, datetime.date] = UNSET,
|
|
93
|
-
) -> Response[Union[HTTPValidationError, List["UsagePerMachineType"]]]:
|
|
94
|
-
"""Per Machine Usage
|
|
95
|
-
|
|
96
|
-
Args:
|
|
97
|
-
per_day (Union[Unset, None, bool]):
|
|
98
|
-
start_date (Union[Unset, None, datetime.date]):
|
|
99
|
-
end_date (Union[Unset, None, datetime.date]):
|
|
100
|
-
|
|
101
|
-
Raises:
|
|
102
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
103
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
104
|
-
|
|
105
|
-
Returns:
|
|
106
|
-
Response[Union[HTTPValidationError, List['UsagePerMachineType']]]
|
|
107
|
-
"""
|
|
108
|
-
|
|
109
|
-
kwargs = _get_kwargs(
|
|
110
|
-
client=client,
|
|
111
|
-
per_day=per_day,
|
|
112
|
-
start_date=start_date,
|
|
113
|
-
end_date=end_date,
|
|
114
|
-
)
|
|
115
|
-
|
|
116
|
-
response = httpx.request(
|
|
117
|
-
verify=client.verify_ssl,
|
|
118
|
-
**kwargs,
|
|
119
|
-
)
|
|
120
|
-
|
|
121
|
-
return _build_response(client=client, response=response)
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
def sync(
|
|
125
|
-
*,
|
|
126
|
-
client: Client,
|
|
127
|
-
per_day: Union[Unset, None, bool] = False,
|
|
128
|
-
start_date: Union[Unset, None, datetime.date] = UNSET,
|
|
129
|
-
end_date: Union[Unset, None, datetime.date] = UNSET,
|
|
130
|
-
) -> Optional[Union[HTTPValidationError, List["UsagePerMachineType"]]]:
|
|
131
|
-
"""Per Machine Usage
|
|
132
|
-
|
|
133
|
-
Args:
|
|
134
|
-
per_day (Union[Unset, None, bool]):
|
|
135
|
-
start_date (Union[Unset, None, datetime.date]):
|
|
136
|
-
end_date (Union[Unset, None, datetime.date]):
|
|
137
|
-
|
|
138
|
-
Raises:
|
|
139
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
140
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
141
|
-
|
|
142
|
-
Returns:
|
|
143
|
-
Union[HTTPValidationError, List['UsagePerMachineType']]
|
|
144
|
-
"""
|
|
145
|
-
|
|
146
|
-
return sync_detailed(
|
|
147
|
-
client=client,
|
|
148
|
-
per_day=per_day,
|
|
149
|
-
start_date=start_date,
|
|
150
|
-
end_date=end_date,
|
|
151
|
-
).parsed
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
async def asyncio_detailed(
|
|
155
|
-
*,
|
|
156
|
-
client: Client,
|
|
157
|
-
per_day: Union[Unset, None, bool] = False,
|
|
158
|
-
start_date: Union[Unset, None, datetime.date] = UNSET,
|
|
159
|
-
end_date: Union[Unset, None, datetime.date] = UNSET,
|
|
160
|
-
) -> Response[Union[HTTPValidationError, List["UsagePerMachineType"]]]:
|
|
161
|
-
"""Per Machine Usage
|
|
162
|
-
|
|
163
|
-
Args:
|
|
164
|
-
per_day (Union[Unset, None, bool]):
|
|
165
|
-
start_date (Union[Unset, None, datetime.date]):
|
|
166
|
-
end_date (Union[Unset, None, datetime.date]):
|
|
167
|
-
|
|
168
|
-
Raises:
|
|
169
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
170
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
171
|
-
|
|
172
|
-
Returns:
|
|
173
|
-
Response[Union[HTTPValidationError, List['UsagePerMachineType']]]
|
|
174
|
-
"""
|
|
175
|
-
|
|
176
|
-
kwargs = _get_kwargs(
|
|
177
|
-
client=client,
|
|
178
|
-
per_day=per_day,
|
|
179
|
-
start_date=start_date,
|
|
180
|
-
end_date=end_date,
|
|
181
|
-
)
|
|
182
|
-
|
|
183
|
-
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
|
184
|
-
response = await _client.request(**kwargs)
|
|
185
|
-
|
|
186
|
-
return _build_response(client=client, response=response)
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
async def asyncio(
|
|
190
|
-
*,
|
|
191
|
-
client: Client,
|
|
192
|
-
per_day: Union[Unset, None, bool] = False,
|
|
193
|
-
start_date: Union[Unset, None, datetime.date] = UNSET,
|
|
194
|
-
end_date: Union[Unset, None, datetime.date] = UNSET,
|
|
195
|
-
) -> Optional[Union[HTTPValidationError, List["UsagePerMachineType"]]]:
|
|
196
|
-
"""Per Machine Usage
|
|
197
|
-
|
|
198
|
-
Args:
|
|
199
|
-
per_day (Union[Unset, None, bool]):
|
|
200
|
-
start_date (Union[Unset, None, datetime.date]):
|
|
201
|
-
end_date (Union[Unset, None, datetime.date]):
|
|
202
|
-
|
|
203
|
-
Raises:
|
|
204
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
205
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
206
|
-
|
|
207
|
-
Returns:
|
|
208
|
-
Union[HTTPValidationError, List['UsagePerMachineType']]
|
|
209
|
-
"""
|
|
210
|
-
|
|
211
|
-
return (
|
|
212
|
-
await asyncio_detailed(
|
|
213
|
-
client=client,
|
|
214
|
-
per_day=per_day,
|
|
215
|
-
start_date=start_date,
|
|
216
|
-
end_date=end_date,
|
|
217
|
-
)
|
|
218
|
-
).parsed
|
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
from http import HTTPStatus
|
|
2
|
-
from typing import Any, Dict, List, Optional, Union
|
|
3
|
-
|
|
4
|
-
import httpx
|
|
5
|
-
|
|
6
|
-
from ... import errors
|
|
7
|
-
from ...client import Client
|
|
8
|
-
from ...models.http_validation_error import HTTPValidationError
|
|
9
|
-
from ...models.usage_run_detail import UsageRunDetail
|
|
10
|
-
from ...types import Response
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
def _get_kwargs(
|
|
14
|
-
machine_type: str,
|
|
15
|
-
*,
|
|
16
|
-
client: Client,
|
|
17
|
-
) -> Dict[str, Any]:
|
|
18
|
-
url = "{}/usage/machine_type/{machine_type}".format(client.base_url, machine_type=machine_type)
|
|
19
|
-
|
|
20
|
-
headers: Dict[str, str] = client.get_headers()
|
|
21
|
-
cookies: Dict[str, Any] = client.get_cookies()
|
|
22
|
-
|
|
23
|
-
return {
|
|
24
|
-
"method": "get",
|
|
25
|
-
"url": url,
|
|
26
|
-
"headers": headers,
|
|
27
|
-
"cookies": cookies,
|
|
28
|
-
"timeout": client.get_timeout(),
|
|
29
|
-
"follow_redirects": client.follow_redirects,
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
def _parse_response(
|
|
34
|
-
*, client: Client, response: httpx.Response
|
|
35
|
-
) -> Optional[Union[HTTPValidationError, List["UsageRunDetail"]]]:
|
|
36
|
-
if response.status_code == HTTPStatus.OK:
|
|
37
|
-
response_200 = []
|
|
38
|
-
_response_200 = response.json()
|
|
39
|
-
for response_200_item_data in _response_200:
|
|
40
|
-
response_200_item = UsageRunDetail.from_dict(response_200_item_data)
|
|
41
|
-
|
|
42
|
-
response_200.append(response_200_item)
|
|
43
|
-
|
|
44
|
-
return response_200
|
|
45
|
-
if response.status_code == HTTPStatus.UNPROCESSABLE_ENTITY:
|
|
46
|
-
response_422 = HTTPValidationError.from_dict(response.json())
|
|
47
|
-
|
|
48
|
-
return response_422
|
|
49
|
-
if client.raise_on_unexpected_status:
|
|
50
|
-
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
51
|
-
else:
|
|
52
|
-
return None
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
def _build_response(
|
|
56
|
-
*, client: Client, response: httpx.Response
|
|
57
|
-
) -> Response[Union[HTTPValidationError, List["UsageRunDetail"]]]:
|
|
58
|
-
return Response(
|
|
59
|
-
status_code=HTTPStatus(response.status_code),
|
|
60
|
-
content=response.content,
|
|
61
|
-
headers=response.headers,
|
|
62
|
-
parsed=_parse_response(client=client, response=response),
|
|
63
|
-
)
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
def sync_detailed(
|
|
67
|
-
machine_type: str,
|
|
68
|
-
*,
|
|
69
|
-
client: Client,
|
|
70
|
-
) -> Response[Union[HTTPValidationError, List["UsageRunDetail"]]]:
|
|
71
|
-
"""Per Machine Usage Details
|
|
72
|
-
|
|
73
|
-
Args:
|
|
74
|
-
machine_type (str):
|
|
75
|
-
|
|
76
|
-
Raises:
|
|
77
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
78
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
79
|
-
|
|
80
|
-
Returns:
|
|
81
|
-
Response[Union[HTTPValidationError, List['UsageRunDetail']]]
|
|
82
|
-
"""
|
|
83
|
-
|
|
84
|
-
kwargs = _get_kwargs(
|
|
85
|
-
machine_type=machine_type,
|
|
86
|
-
client=client,
|
|
87
|
-
)
|
|
88
|
-
|
|
89
|
-
response = httpx.request(
|
|
90
|
-
verify=client.verify_ssl,
|
|
91
|
-
**kwargs,
|
|
92
|
-
)
|
|
93
|
-
|
|
94
|
-
return _build_response(client=client, response=response)
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
def sync(
|
|
98
|
-
machine_type: str,
|
|
99
|
-
*,
|
|
100
|
-
client: Client,
|
|
101
|
-
) -> Optional[Union[HTTPValidationError, List["UsageRunDetail"]]]:
|
|
102
|
-
"""Per Machine Usage Details
|
|
103
|
-
|
|
104
|
-
Args:
|
|
105
|
-
machine_type (str):
|
|
106
|
-
|
|
107
|
-
Raises:
|
|
108
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
109
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
110
|
-
|
|
111
|
-
Returns:
|
|
112
|
-
Union[HTTPValidationError, List['UsageRunDetail']]
|
|
113
|
-
"""
|
|
114
|
-
|
|
115
|
-
return sync_detailed(
|
|
116
|
-
machine_type=machine_type,
|
|
117
|
-
client=client,
|
|
118
|
-
).parsed
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
async def asyncio_detailed(
|
|
122
|
-
machine_type: str,
|
|
123
|
-
*,
|
|
124
|
-
client: Client,
|
|
125
|
-
) -> Response[Union[HTTPValidationError, List["UsageRunDetail"]]]:
|
|
126
|
-
"""Per Machine Usage Details
|
|
127
|
-
|
|
128
|
-
Args:
|
|
129
|
-
machine_type (str):
|
|
130
|
-
|
|
131
|
-
Raises:
|
|
132
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
133
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
134
|
-
|
|
135
|
-
Returns:
|
|
136
|
-
Response[Union[HTTPValidationError, List['UsageRunDetail']]]
|
|
137
|
-
"""
|
|
138
|
-
|
|
139
|
-
kwargs = _get_kwargs(
|
|
140
|
-
machine_type=machine_type,
|
|
141
|
-
client=client,
|
|
142
|
-
)
|
|
143
|
-
|
|
144
|
-
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
|
145
|
-
response = await _client.request(**kwargs)
|
|
146
|
-
|
|
147
|
-
return _build_response(client=client, response=response)
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
async def asyncio(
|
|
151
|
-
machine_type: str,
|
|
152
|
-
*,
|
|
153
|
-
client: Client,
|
|
154
|
-
) -> Optional[Union[HTTPValidationError, List["UsageRunDetail"]]]:
|
|
155
|
-
"""Per Machine Usage Details
|
|
156
|
-
|
|
157
|
-
Args:
|
|
158
|
-
machine_type (str):
|
|
159
|
-
|
|
160
|
-
Raises:
|
|
161
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
162
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
163
|
-
|
|
164
|
-
Returns:
|
|
165
|
-
Union[HTTPValidationError, List['UsageRunDetail']]
|
|
166
|
-
"""
|
|
167
|
-
|
|
168
|
-
return (
|
|
169
|
-
await asyncio_detailed(
|
|
170
|
-
machine_type=machine_type,
|
|
171
|
-
client=client,
|
|
172
|
-
)
|
|
173
|
-
).parsed
|
|
File without changes
|
|
@@ -1,228 +0,0 @@
|
|
|
1
|
-
from http import HTTPStatus
|
|
2
|
-
from typing import Any, Dict, Optional, Union, cast
|
|
3
|
-
|
|
4
|
-
import httpx
|
|
5
|
-
|
|
6
|
-
from ... import errors
|
|
7
|
-
from ...client import Client
|
|
8
|
-
from ...models.http_validation_error import HTTPValidationError
|
|
9
|
-
from ...types import UNSET, Response
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
def _get_kwargs(
|
|
13
|
-
*,
|
|
14
|
-
client: Client,
|
|
15
|
-
user_id: str,
|
|
16
|
-
user_nickname: str,
|
|
17
|
-
user_email: str,
|
|
18
|
-
user_name: str,
|
|
19
|
-
secret: str,
|
|
20
|
-
) -> Dict[str, Any]:
|
|
21
|
-
url = "{}/users/register".format(client.base_url)
|
|
22
|
-
|
|
23
|
-
headers: Dict[str, str] = client.get_headers()
|
|
24
|
-
cookies: Dict[str, Any] = client.get_cookies()
|
|
25
|
-
|
|
26
|
-
params: Dict[str, Any] = {}
|
|
27
|
-
params["user_id"] = user_id
|
|
28
|
-
|
|
29
|
-
params["user_nickname"] = user_nickname
|
|
30
|
-
|
|
31
|
-
params["user_email"] = user_email
|
|
32
|
-
|
|
33
|
-
params["user_name"] = user_name
|
|
34
|
-
|
|
35
|
-
params["secret"] = secret
|
|
36
|
-
|
|
37
|
-
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
|
38
|
-
|
|
39
|
-
return {
|
|
40
|
-
"method": "post",
|
|
41
|
-
"url": url,
|
|
42
|
-
"headers": headers,
|
|
43
|
-
"cookies": cookies,
|
|
44
|
-
"timeout": client.get_timeout(),
|
|
45
|
-
"follow_redirects": client.follow_redirects,
|
|
46
|
-
"params": params,
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[HTTPValidationError, str]]:
|
|
51
|
-
if response.status_code == HTTPStatus.OK:
|
|
52
|
-
response_200 = cast(str, response.json())
|
|
53
|
-
return response_200
|
|
54
|
-
if response.status_code == HTTPStatus.UNPROCESSABLE_ENTITY:
|
|
55
|
-
response_422 = HTTPValidationError.from_dict(response.json())
|
|
56
|
-
|
|
57
|
-
return response_422
|
|
58
|
-
if client.raise_on_unexpected_status:
|
|
59
|
-
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
60
|
-
else:
|
|
61
|
-
return None
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[HTTPValidationError, str]]:
|
|
65
|
-
return Response(
|
|
66
|
-
status_code=HTTPStatus(response.status_code),
|
|
67
|
-
content=response.content,
|
|
68
|
-
headers=response.headers,
|
|
69
|
-
parsed=_parse_response(client=client, response=response),
|
|
70
|
-
)
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
def sync_detailed(
|
|
74
|
-
*,
|
|
75
|
-
client: Client,
|
|
76
|
-
user_id: str,
|
|
77
|
-
user_nickname: str,
|
|
78
|
-
user_email: str,
|
|
79
|
-
user_name: str,
|
|
80
|
-
secret: str,
|
|
81
|
-
) -> Response[Union[HTTPValidationError, str]]:
|
|
82
|
-
"""Handle User Registration
|
|
83
|
-
|
|
84
|
-
Args:
|
|
85
|
-
user_id (str):
|
|
86
|
-
user_nickname (str):
|
|
87
|
-
user_email (str):
|
|
88
|
-
user_name (str):
|
|
89
|
-
secret (str):
|
|
90
|
-
|
|
91
|
-
Raises:
|
|
92
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
93
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
94
|
-
|
|
95
|
-
Returns:
|
|
96
|
-
Response[Union[HTTPValidationError, str]]
|
|
97
|
-
"""
|
|
98
|
-
|
|
99
|
-
kwargs = _get_kwargs(
|
|
100
|
-
client=client,
|
|
101
|
-
user_id=user_id,
|
|
102
|
-
user_nickname=user_nickname,
|
|
103
|
-
user_email=user_email,
|
|
104
|
-
user_name=user_name,
|
|
105
|
-
secret=secret,
|
|
106
|
-
)
|
|
107
|
-
|
|
108
|
-
response = httpx.request(
|
|
109
|
-
verify=client.verify_ssl,
|
|
110
|
-
**kwargs,
|
|
111
|
-
)
|
|
112
|
-
|
|
113
|
-
return _build_response(client=client, response=response)
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
def sync(
|
|
117
|
-
*,
|
|
118
|
-
client: Client,
|
|
119
|
-
user_id: str,
|
|
120
|
-
user_nickname: str,
|
|
121
|
-
user_email: str,
|
|
122
|
-
user_name: str,
|
|
123
|
-
secret: str,
|
|
124
|
-
) -> Optional[Union[HTTPValidationError, str]]:
|
|
125
|
-
"""Handle User Registration
|
|
126
|
-
|
|
127
|
-
Args:
|
|
128
|
-
user_id (str):
|
|
129
|
-
user_nickname (str):
|
|
130
|
-
user_email (str):
|
|
131
|
-
user_name (str):
|
|
132
|
-
secret (str):
|
|
133
|
-
|
|
134
|
-
Raises:
|
|
135
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
136
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
137
|
-
|
|
138
|
-
Returns:
|
|
139
|
-
Union[HTTPValidationError, str]
|
|
140
|
-
"""
|
|
141
|
-
|
|
142
|
-
return sync_detailed(
|
|
143
|
-
client=client,
|
|
144
|
-
user_id=user_id,
|
|
145
|
-
user_nickname=user_nickname,
|
|
146
|
-
user_email=user_email,
|
|
147
|
-
user_name=user_name,
|
|
148
|
-
secret=secret,
|
|
149
|
-
).parsed
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
async def asyncio_detailed(
|
|
153
|
-
*,
|
|
154
|
-
client: Client,
|
|
155
|
-
user_id: str,
|
|
156
|
-
user_nickname: str,
|
|
157
|
-
user_email: str,
|
|
158
|
-
user_name: str,
|
|
159
|
-
secret: str,
|
|
160
|
-
) -> Response[Union[HTTPValidationError, str]]:
|
|
161
|
-
"""Handle User Registration
|
|
162
|
-
|
|
163
|
-
Args:
|
|
164
|
-
user_id (str):
|
|
165
|
-
user_nickname (str):
|
|
166
|
-
user_email (str):
|
|
167
|
-
user_name (str):
|
|
168
|
-
secret (str):
|
|
169
|
-
|
|
170
|
-
Raises:
|
|
171
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
172
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
173
|
-
|
|
174
|
-
Returns:
|
|
175
|
-
Response[Union[HTTPValidationError, str]]
|
|
176
|
-
"""
|
|
177
|
-
|
|
178
|
-
kwargs = _get_kwargs(
|
|
179
|
-
client=client,
|
|
180
|
-
user_id=user_id,
|
|
181
|
-
user_nickname=user_nickname,
|
|
182
|
-
user_email=user_email,
|
|
183
|
-
user_name=user_name,
|
|
184
|
-
secret=secret,
|
|
185
|
-
)
|
|
186
|
-
|
|
187
|
-
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
|
188
|
-
response = await _client.request(**kwargs)
|
|
189
|
-
|
|
190
|
-
return _build_response(client=client, response=response)
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
async def asyncio(
|
|
194
|
-
*,
|
|
195
|
-
client: Client,
|
|
196
|
-
user_id: str,
|
|
197
|
-
user_nickname: str,
|
|
198
|
-
user_email: str,
|
|
199
|
-
user_name: str,
|
|
200
|
-
secret: str,
|
|
201
|
-
) -> Optional[Union[HTTPValidationError, str]]:
|
|
202
|
-
"""Handle User Registration
|
|
203
|
-
|
|
204
|
-
Args:
|
|
205
|
-
user_id (str):
|
|
206
|
-
user_nickname (str):
|
|
207
|
-
user_email (str):
|
|
208
|
-
user_name (str):
|
|
209
|
-
secret (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
|
-
Union[HTTPValidationError, str]
|
|
217
|
-
"""
|
|
218
|
-
|
|
219
|
-
return (
|
|
220
|
-
await asyncio_detailed(
|
|
221
|
-
client=client,
|
|
222
|
-
user_id=user_id,
|
|
223
|
-
user_nickname=user_nickname,
|
|
224
|
-
user_email=user_email,
|
|
225
|
-
user_name=user_name,
|
|
226
|
-
secret=secret,
|
|
227
|
-
)
|
|
228
|
-
).parsed
|
|
@@ -1,68 +0,0 @@
|
|
|
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
|