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,152 +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.invoice import Invoice
|
|
10
|
-
from ...types import Response
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
def _get_kwargs(
|
|
14
|
-
*,
|
|
15
|
-
client: Client,
|
|
16
|
-
) -> Dict[str, Any]:
|
|
17
|
-
url = "{}/billing/invoices".format(client.base_url)
|
|
18
|
-
|
|
19
|
-
headers: Dict[str, str] = client.get_headers()
|
|
20
|
-
cookies: Dict[str, Any] = client.get_cookies()
|
|
21
|
-
|
|
22
|
-
return {
|
|
23
|
-
"method": "get",
|
|
24
|
-
"url": url,
|
|
25
|
-
"headers": headers,
|
|
26
|
-
"cookies": cookies,
|
|
27
|
-
"timeout": client.get_timeout(),
|
|
28
|
-
"follow_redirects": client.follow_redirects,
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
def _parse_response(
|
|
33
|
-
*, client: Client, response: httpx.Response
|
|
34
|
-
) -> Optional[Union[HTTPValidationError, List["Invoice"]]]:
|
|
35
|
-
if response.status_code == HTTPStatus.OK:
|
|
36
|
-
response_200 = []
|
|
37
|
-
_response_200 = response.json()
|
|
38
|
-
for response_200_item_data in _response_200:
|
|
39
|
-
response_200_item = Invoice.from_dict(response_200_item_data)
|
|
40
|
-
|
|
41
|
-
response_200.append(response_200_item)
|
|
42
|
-
|
|
43
|
-
return response_200
|
|
44
|
-
if response.status_code == HTTPStatus.UNPROCESSABLE_ENTITY:
|
|
45
|
-
response_422 = HTTPValidationError.from_dict(response.json())
|
|
46
|
-
|
|
47
|
-
return response_422
|
|
48
|
-
if client.raise_on_unexpected_status:
|
|
49
|
-
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
50
|
-
else:
|
|
51
|
-
return None
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
def _build_response(
|
|
55
|
-
*, client: Client, response: httpx.Response
|
|
56
|
-
) -> Response[Union[HTTPValidationError, List["Invoice"]]]:
|
|
57
|
-
return Response(
|
|
58
|
-
status_code=HTTPStatus(response.status_code),
|
|
59
|
-
content=response.content,
|
|
60
|
-
headers=response.headers,
|
|
61
|
-
parsed=_parse_response(client=client, response=response),
|
|
62
|
-
)
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
def sync_detailed(
|
|
66
|
-
*,
|
|
67
|
-
client: Client,
|
|
68
|
-
) -> Response[Union[HTTPValidationError, List["Invoice"]]]:
|
|
69
|
-
"""Get Invoices
|
|
70
|
-
|
|
71
|
-
Raises:
|
|
72
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
73
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
74
|
-
|
|
75
|
-
Returns:
|
|
76
|
-
Response[Union[HTTPValidationError, List['Invoice']]]
|
|
77
|
-
"""
|
|
78
|
-
|
|
79
|
-
kwargs = _get_kwargs(
|
|
80
|
-
client=client,
|
|
81
|
-
)
|
|
82
|
-
|
|
83
|
-
response = httpx.request(
|
|
84
|
-
verify=client.verify_ssl,
|
|
85
|
-
**kwargs,
|
|
86
|
-
)
|
|
87
|
-
|
|
88
|
-
return _build_response(client=client, response=response)
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
def sync(
|
|
92
|
-
*,
|
|
93
|
-
client: Client,
|
|
94
|
-
) -> Optional[Union[HTTPValidationError, List["Invoice"]]]:
|
|
95
|
-
"""Get Invoices
|
|
96
|
-
|
|
97
|
-
Raises:
|
|
98
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
99
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
100
|
-
|
|
101
|
-
Returns:
|
|
102
|
-
Union[HTTPValidationError, List['Invoice']]
|
|
103
|
-
"""
|
|
104
|
-
|
|
105
|
-
return sync_detailed(
|
|
106
|
-
client=client,
|
|
107
|
-
).parsed
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
async def asyncio_detailed(
|
|
111
|
-
*,
|
|
112
|
-
client: Client,
|
|
113
|
-
) -> Response[Union[HTTPValidationError, List["Invoice"]]]:
|
|
114
|
-
"""Get Invoices
|
|
115
|
-
|
|
116
|
-
Raises:
|
|
117
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
118
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
119
|
-
|
|
120
|
-
Returns:
|
|
121
|
-
Response[Union[HTTPValidationError, List['Invoice']]]
|
|
122
|
-
"""
|
|
123
|
-
|
|
124
|
-
kwargs = _get_kwargs(
|
|
125
|
-
client=client,
|
|
126
|
-
)
|
|
127
|
-
|
|
128
|
-
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
|
129
|
-
response = await _client.request(**kwargs)
|
|
130
|
-
|
|
131
|
-
return _build_response(client=client, response=response)
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
async def asyncio(
|
|
135
|
-
*,
|
|
136
|
-
client: Client,
|
|
137
|
-
) -> Optional[Union[HTTPValidationError, List["Invoice"]]]:
|
|
138
|
-
"""Get Invoices
|
|
139
|
-
|
|
140
|
-
Raises:
|
|
141
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
142
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
143
|
-
|
|
144
|
-
Returns:
|
|
145
|
-
Union[HTTPValidationError, List['Invoice']]
|
|
146
|
-
"""
|
|
147
|
-
|
|
148
|
-
return (
|
|
149
|
-
await asyncio_detailed(
|
|
150
|
-
client=client,
|
|
151
|
-
)
|
|
152
|
-
).parsed
|
|
@@ -1,152 +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.payment_method import PaymentMethod
|
|
10
|
-
from ...types import Response
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
def _get_kwargs(
|
|
14
|
-
*,
|
|
15
|
-
client: Client,
|
|
16
|
-
) -> Dict[str, Any]:
|
|
17
|
-
url = "{}/billing/payment_methods".format(client.base_url)
|
|
18
|
-
|
|
19
|
-
headers: Dict[str, str] = client.get_headers()
|
|
20
|
-
cookies: Dict[str, Any] = client.get_cookies()
|
|
21
|
-
|
|
22
|
-
return {
|
|
23
|
-
"method": "get",
|
|
24
|
-
"url": url,
|
|
25
|
-
"headers": headers,
|
|
26
|
-
"cookies": cookies,
|
|
27
|
-
"timeout": client.get_timeout(),
|
|
28
|
-
"follow_redirects": client.follow_redirects,
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
def _parse_response(
|
|
33
|
-
*, client: Client, response: httpx.Response
|
|
34
|
-
) -> Optional[Union[HTTPValidationError, List["PaymentMethod"]]]:
|
|
35
|
-
if response.status_code == HTTPStatus.OK:
|
|
36
|
-
response_200 = []
|
|
37
|
-
_response_200 = response.json()
|
|
38
|
-
for response_200_item_data in _response_200:
|
|
39
|
-
response_200_item = PaymentMethod.from_dict(response_200_item_data)
|
|
40
|
-
|
|
41
|
-
response_200.append(response_200_item)
|
|
42
|
-
|
|
43
|
-
return response_200
|
|
44
|
-
if response.status_code == HTTPStatus.UNPROCESSABLE_ENTITY:
|
|
45
|
-
response_422 = HTTPValidationError.from_dict(response.json())
|
|
46
|
-
|
|
47
|
-
return response_422
|
|
48
|
-
if client.raise_on_unexpected_status:
|
|
49
|
-
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
50
|
-
else:
|
|
51
|
-
return None
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
def _build_response(
|
|
55
|
-
*, client: Client, response: httpx.Response
|
|
56
|
-
) -> Response[Union[HTTPValidationError, List["PaymentMethod"]]]:
|
|
57
|
-
return Response(
|
|
58
|
-
status_code=HTTPStatus(response.status_code),
|
|
59
|
-
content=response.content,
|
|
60
|
-
headers=response.headers,
|
|
61
|
-
parsed=_parse_response(client=client, response=response),
|
|
62
|
-
)
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
def sync_detailed(
|
|
66
|
-
*,
|
|
67
|
-
client: Client,
|
|
68
|
-
) -> Response[Union[HTTPValidationError, List["PaymentMethod"]]]:
|
|
69
|
-
"""Get Payment Methods
|
|
70
|
-
|
|
71
|
-
Raises:
|
|
72
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
73
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
74
|
-
|
|
75
|
-
Returns:
|
|
76
|
-
Response[Union[HTTPValidationError, List['PaymentMethod']]]
|
|
77
|
-
"""
|
|
78
|
-
|
|
79
|
-
kwargs = _get_kwargs(
|
|
80
|
-
client=client,
|
|
81
|
-
)
|
|
82
|
-
|
|
83
|
-
response = httpx.request(
|
|
84
|
-
verify=client.verify_ssl,
|
|
85
|
-
**kwargs,
|
|
86
|
-
)
|
|
87
|
-
|
|
88
|
-
return _build_response(client=client, response=response)
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
def sync(
|
|
92
|
-
*,
|
|
93
|
-
client: Client,
|
|
94
|
-
) -> Optional[Union[HTTPValidationError, List["PaymentMethod"]]]:
|
|
95
|
-
"""Get Payment Methods
|
|
96
|
-
|
|
97
|
-
Raises:
|
|
98
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
99
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
100
|
-
|
|
101
|
-
Returns:
|
|
102
|
-
Union[HTTPValidationError, List['PaymentMethod']]
|
|
103
|
-
"""
|
|
104
|
-
|
|
105
|
-
return sync_detailed(
|
|
106
|
-
client=client,
|
|
107
|
-
).parsed
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
async def asyncio_detailed(
|
|
111
|
-
*,
|
|
112
|
-
client: Client,
|
|
113
|
-
) -> Response[Union[HTTPValidationError, List["PaymentMethod"]]]:
|
|
114
|
-
"""Get Payment Methods
|
|
115
|
-
|
|
116
|
-
Raises:
|
|
117
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
118
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
119
|
-
|
|
120
|
-
Returns:
|
|
121
|
-
Response[Union[HTTPValidationError, List['PaymentMethod']]]
|
|
122
|
-
"""
|
|
123
|
-
|
|
124
|
-
kwargs = _get_kwargs(
|
|
125
|
-
client=client,
|
|
126
|
-
)
|
|
127
|
-
|
|
128
|
-
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
|
129
|
-
response = await _client.request(**kwargs)
|
|
130
|
-
|
|
131
|
-
return _build_response(client=client, response=response)
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
async def asyncio(
|
|
135
|
-
*,
|
|
136
|
-
client: Client,
|
|
137
|
-
) -> Optional[Union[HTTPValidationError, List["PaymentMethod"]]]:
|
|
138
|
-
"""Get Payment Methods
|
|
139
|
-
|
|
140
|
-
Raises:
|
|
141
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
142
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
143
|
-
|
|
144
|
-
Returns:
|
|
145
|
-
Union[HTTPValidationError, List['PaymentMethod']]
|
|
146
|
-
"""
|
|
147
|
-
|
|
148
|
-
return (
|
|
149
|
-
await asyncio_detailed(
|
|
150
|
-
client=client,
|
|
151
|
-
)
|
|
152
|
-
).parsed
|
|
@@ -1,186 +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 ...models.run_type import RunType
|
|
10
|
-
from ...types import UNSET, Response
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
def _get_kwargs(
|
|
14
|
-
*,
|
|
15
|
-
client: Client,
|
|
16
|
-
run_type: RunType,
|
|
17
|
-
machine_type: str,
|
|
18
|
-
) -> Dict[str, Any]:
|
|
19
|
-
url = "{}/billing/user_price".format(client.base_url)
|
|
20
|
-
|
|
21
|
-
headers: Dict[str, str] = client.get_headers()
|
|
22
|
-
cookies: Dict[str, Any] = client.get_cookies()
|
|
23
|
-
|
|
24
|
-
params: Dict[str, Any] = {}
|
|
25
|
-
json_run_type = run_type.value
|
|
26
|
-
|
|
27
|
-
params["run_type"] = json_run_type
|
|
28
|
-
|
|
29
|
-
params["machine_type"] = machine_type
|
|
30
|
-
|
|
31
|
-
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
|
32
|
-
|
|
33
|
-
return {
|
|
34
|
-
"method": "get",
|
|
35
|
-
"url": url,
|
|
36
|
-
"headers": headers,
|
|
37
|
-
"cookies": cookies,
|
|
38
|
-
"timeout": client.get_timeout(),
|
|
39
|
-
"follow_redirects": client.follow_redirects,
|
|
40
|
-
"params": params,
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[HTTPValidationError, float]]:
|
|
45
|
-
if response.status_code == HTTPStatus.OK:
|
|
46
|
-
response_200 = cast(float, response.json())
|
|
47
|
-
return response_200
|
|
48
|
-
if response.status_code == HTTPStatus.UNPROCESSABLE_ENTITY:
|
|
49
|
-
response_422 = HTTPValidationError.from_dict(response.json())
|
|
50
|
-
|
|
51
|
-
return response_422
|
|
52
|
-
if client.raise_on_unexpected_status:
|
|
53
|
-
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
54
|
-
else:
|
|
55
|
-
return None
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[HTTPValidationError, float]]:
|
|
59
|
-
return Response(
|
|
60
|
-
status_code=HTTPStatus(response.status_code),
|
|
61
|
-
content=response.content,
|
|
62
|
-
headers=response.headers,
|
|
63
|
-
parsed=_parse_response(client=client, response=response),
|
|
64
|
-
)
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
def sync_detailed(
|
|
68
|
-
*,
|
|
69
|
-
client: Client,
|
|
70
|
-
run_type: RunType,
|
|
71
|
-
machine_type: str,
|
|
72
|
-
) -> Response[Union[HTTPValidationError, float]]:
|
|
73
|
-
"""Get User Price
|
|
74
|
-
|
|
75
|
-
Args:
|
|
76
|
-
run_type (RunType): An enumeration.
|
|
77
|
-
machine_type (str):
|
|
78
|
-
|
|
79
|
-
Raises:
|
|
80
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
81
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
82
|
-
|
|
83
|
-
Returns:
|
|
84
|
-
Response[Union[HTTPValidationError, float]]
|
|
85
|
-
"""
|
|
86
|
-
|
|
87
|
-
kwargs = _get_kwargs(
|
|
88
|
-
client=client,
|
|
89
|
-
run_type=run_type,
|
|
90
|
-
machine_type=machine_type,
|
|
91
|
-
)
|
|
92
|
-
|
|
93
|
-
response = httpx.request(
|
|
94
|
-
verify=client.verify_ssl,
|
|
95
|
-
**kwargs,
|
|
96
|
-
)
|
|
97
|
-
|
|
98
|
-
return _build_response(client=client, response=response)
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
def sync(
|
|
102
|
-
*,
|
|
103
|
-
client: Client,
|
|
104
|
-
run_type: RunType,
|
|
105
|
-
machine_type: str,
|
|
106
|
-
) -> Optional[Union[HTTPValidationError, float]]:
|
|
107
|
-
"""Get User Price
|
|
108
|
-
|
|
109
|
-
Args:
|
|
110
|
-
run_type (RunType): An enumeration.
|
|
111
|
-
machine_type (str):
|
|
112
|
-
|
|
113
|
-
Raises:
|
|
114
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
115
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
116
|
-
|
|
117
|
-
Returns:
|
|
118
|
-
Union[HTTPValidationError, float]
|
|
119
|
-
"""
|
|
120
|
-
|
|
121
|
-
return sync_detailed(
|
|
122
|
-
client=client,
|
|
123
|
-
run_type=run_type,
|
|
124
|
-
machine_type=machine_type,
|
|
125
|
-
).parsed
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
async def asyncio_detailed(
|
|
129
|
-
*,
|
|
130
|
-
client: Client,
|
|
131
|
-
run_type: RunType,
|
|
132
|
-
machine_type: str,
|
|
133
|
-
) -> Response[Union[HTTPValidationError, float]]:
|
|
134
|
-
"""Get User Price
|
|
135
|
-
|
|
136
|
-
Args:
|
|
137
|
-
run_type (RunType): An enumeration.
|
|
138
|
-
machine_type (str):
|
|
139
|
-
|
|
140
|
-
Raises:
|
|
141
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
142
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
143
|
-
|
|
144
|
-
Returns:
|
|
145
|
-
Response[Union[HTTPValidationError, float]]
|
|
146
|
-
"""
|
|
147
|
-
|
|
148
|
-
kwargs = _get_kwargs(
|
|
149
|
-
client=client,
|
|
150
|
-
run_type=run_type,
|
|
151
|
-
machine_type=machine_type,
|
|
152
|
-
)
|
|
153
|
-
|
|
154
|
-
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
|
155
|
-
response = await _client.request(**kwargs)
|
|
156
|
-
|
|
157
|
-
return _build_response(client=client, response=response)
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
async def asyncio(
|
|
161
|
-
*,
|
|
162
|
-
client: Client,
|
|
163
|
-
run_type: RunType,
|
|
164
|
-
machine_type: str,
|
|
165
|
-
) -> Optional[Union[HTTPValidationError, float]]:
|
|
166
|
-
"""Get User Price
|
|
167
|
-
|
|
168
|
-
Args:
|
|
169
|
-
run_type (RunType): An enumeration.
|
|
170
|
-
machine_type (str):
|
|
171
|
-
|
|
172
|
-
Raises:
|
|
173
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
174
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
175
|
-
|
|
176
|
-
Returns:
|
|
177
|
-
Union[HTTPValidationError, float]
|
|
178
|
-
"""
|
|
179
|
-
|
|
180
|
-
return (
|
|
181
|
-
await asyncio_detailed(
|
|
182
|
-
client=client,
|
|
183
|
-
run_type=run_type,
|
|
184
|
-
machine_type=machine_type,
|
|
185
|
-
)
|
|
186
|
-
).parsed
|
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
import datetime
|
|
2
|
-
from http import HTTPStatus
|
|
3
|
-
from typing import Any, Dict, Optional, Union, cast
|
|
4
|
-
|
|
5
|
-
import httpx
|
|
6
|
-
|
|
7
|
-
from ... import errors
|
|
8
|
-
from ...client import Client
|
|
9
|
-
from ...models.http_validation_error import HTTPValidationError
|
|
10
|
-
from ...types import UNSET, Response, Unset
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
def _get_kwargs(
|
|
14
|
-
*,
|
|
15
|
-
client: Client,
|
|
16
|
-
start_date: Union[Unset, None, datetime.date] = UNSET,
|
|
17
|
-
end_date: Union[Unset, None, datetime.date] = UNSET,
|
|
18
|
-
) -> Dict[str, Any]:
|
|
19
|
-
url = "{}/billing/user_spending".format(client.base_url)
|
|
20
|
-
|
|
21
|
-
headers: Dict[str, str] = client.get_headers()
|
|
22
|
-
cookies: Dict[str, Any] = client.get_cookies()
|
|
23
|
-
|
|
24
|
-
params: Dict[str, Any] = {}
|
|
25
|
-
json_start_date: Union[Unset, None, str] = UNSET
|
|
26
|
-
if not isinstance(start_date, Unset):
|
|
27
|
-
json_start_date = start_date.isoformat() if start_date else None
|
|
28
|
-
|
|
29
|
-
params["start_date"] = json_start_date
|
|
30
|
-
|
|
31
|
-
json_end_date: Union[Unset, None, str] = UNSET
|
|
32
|
-
if not isinstance(end_date, Unset):
|
|
33
|
-
json_end_date = end_date.isoformat() if end_date else None
|
|
34
|
-
|
|
35
|
-
params["end_date"] = json_end_date
|
|
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": "get",
|
|
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, float]]:
|
|
51
|
-
if response.status_code == HTTPStatus.OK:
|
|
52
|
-
response_200 = cast(float, 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, float]]:
|
|
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
|
-
start_date: Union[Unset, None, datetime.date] = UNSET,
|
|
77
|
-
end_date: Union[Unset, None, datetime.date] = UNSET,
|
|
78
|
-
) -> Response[Union[HTTPValidationError, float]]:
|
|
79
|
-
"""Get User Spending
|
|
80
|
-
|
|
81
|
-
Args:
|
|
82
|
-
start_date (Union[Unset, None, datetime.date]):
|
|
83
|
-
end_date (Union[Unset, None, datetime.date]):
|
|
84
|
-
|
|
85
|
-
Raises:
|
|
86
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
87
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
88
|
-
|
|
89
|
-
Returns:
|
|
90
|
-
Response[Union[HTTPValidationError, float]]
|
|
91
|
-
"""
|
|
92
|
-
|
|
93
|
-
kwargs = _get_kwargs(
|
|
94
|
-
client=client,
|
|
95
|
-
start_date=start_date,
|
|
96
|
-
end_date=end_date,
|
|
97
|
-
)
|
|
98
|
-
|
|
99
|
-
response = httpx.request(
|
|
100
|
-
verify=client.verify_ssl,
|
|
101
|
-
**kwargs,
|
|
102
|
-
)
|
|
103
|
-
|
|
104
|
-
return _build_response(client=client, response=response)
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
def sync(
|
|
108
|
-
*,
|
|
109
|
-
client: Client,
|
|
110
|
-
start_date: Union[Unset, None, datetime.date] = UNSET,
|
|
111
|
-
end_date: Union[Unset, None, datetime.date] = UNSET,
|
|
112
|
-
) -> Optional[Union[HTTPValidationError, float]]:
|
|
113
|
-
"""Get User Spending
|
|
114
|
-
|
|
115
|
-
Args:
|
|
116
|
-
start_date (Union[Unset, None, datetime.date]):
|
|
117
|
-
end_date (Union[Unset, None, datetime.date]):
|
|
118
|
-
|
|
119
|
-
Raises:
|
|
120
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
121
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
122
|
-
|
|
123
|
-
Returns:
|
|
124
|
-
Union[HTTPValidationError, float]
|
|
125
|
-
"""
|
|
126
|
-
|
|
127
|
-
return sync_detailed(
|
|
128
|
-
client=client,
|
|
129
|
-
start_date=start_date,
|
|
130
|
-
end_date=end_date,
|
|
131
|
-
).parsed
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
async def asyncio_detailed(
|
|
135
|
-
*,
|
|
136
|
-
client: Client,
|
|
137
|
-
start_date: Union[Unset, None, datetime.date] = UNSET,
|
|
138
|
-
end_date: Union[Unset, None, datetime.date] = UNSET,
|
|
139
|
-
) -> Response[Union[HTTPValidationError, float]]:
|
|
140
|
-
"""Get User Spending
|
|
141
|
-
|
|
142
|
-
Args:
|
|
143
|
-
start_date (Union[Unset, None, datetime.date]):
|
|
144
|
-
end_date (Union[Unset, None, datetime.date]):
|
|
145
|
-
|
|
146
|
-
Raises:
|
|
147
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
148
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
149
|
-
|
|
150
|
-
Returns:
|
|
151
|
-
Response[Union[HTTPValidationError, float]]
|
|
152
|
-
"""
|
|
153
|
-
|
|
154
|
-
kwargs = _get_kwargs(
|
|
155
|
-
client=client,
|
|
156
|
-
start_date=start_date,
|
|
157
|
-
end_date=end_date,
|
|
158
|
-
)
|
|
159
|
-
|
|
160
|
-
async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
|
|
161
|
-
response = await _client.request(**kwargs)
|
|
162
|
-
|
|
163
|
-
return _build_response(client=client, response=response)
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
async def asyncio(
|
|
167
|
-
*,
|
|
168
|
-
client: Client,
|
|
169
|
-
start_date: Union[Unset, None, datetime.date] = UNSET,
|
|
170
|
-
end_date: Union[Unset, None, datetime.date] = UNSET,
|
|
171
|
-
) -> Optional[Union[HTTPValidationError, float]]:
|
|
172
|
-
"""Get User Spending
|
|
173
|
-
|
|
174
|
-
Args:
|
|
175
|
-
start_date (Union[Unset, None, datetime.date]):
|
|
176
|
-
end_date (Union[Unset, None, datetime.date]):
|
|
177
|
-
|
|
178
|
-
Raises:
|
|
179
|
-
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
180
|
-
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
181
|
-
|
|
182
|
-
Returns:
|
|
183
|
-
Union[HTTPValidationError, float]
|
|
184
|
-
"""
|
|
185
|
-
|
|
186
|
-
return (
|
|
187
|
-
await asyncio_detailed(
|
|
188
|
-
client=client,
|
|
189
|
-
start_date=start_date,
|
|
190
|
-
end_date=end_date,
|
|
191
|
-
)
|
|
192
|
-
).parsed
|