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