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
@@ -16,7 +16,9 @@ def _get_kwargs(
16
16
  client: Client,
17
17
  json_body: HashCheck,
18
18
  ) -> Dict[str, Any]:
19
- url = "{}/files/dir/check_hash/{target_path}".format(client.base_url, target_path=target_path)
19
+ url = "{}/files/dir/check_hash/{target_path}".format(
20
+ client.base_url, target_path=target_path
21
+ )
20
22
 
21
23
  headers: Dict[str, str] = client.get_headers()
22
24
  cookies: Dict[str, Any] = client.get_cookies()
@@ -34,7 +36,9 @@ def _get_kwargs(
34
36
  }
35
37
 
36
38
 
37
- def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[HTTPValidationError, bool]]:
39
+ def _parse_response(
40
+ *, client: Client, response: httpx.Response
41
+ ) -> Optional[Union[HTTPValidationError, bool]]:
38
42
  if response.status_code == HTTPStatus.OK:
39
43
  response_200 = cast(bool, response.json())
40
44
  return response_200
@@ -48,7 +52,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni
48
52
  return None
49
53
 
50
54
 
51
- def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[HTTPValidationError, bool]]:
55
+ def _build_response(
56
+ *, client: Client, response: httpx.Response
57
+ ) -> Response[Union[HTTPValidationError, bool]]:
52
58
  return Response(
53
59
  status_code=HTTPStatus(response.status_code),
54
60
  content=response.content,
@@ -29,7 +29,9 @@ def _get_kwargs(
29
29
  }
30
30
 
31
31
 
32
- def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[HTTPValidationError, bool]]:
32
+ def _parse_response(
33
+ *, client: Client, response: httpx.Response
34
+ ) -> Optional[Union[HTTPValidationError, bool]]:
33
35
  if response.status_code == HTTPStatus.OK:
34
36
  response_200 = cast(bool, response.json())
35
37
  return response_200
@@ -43,7 +45,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni
43
45
  return None
44
46
 
45
47
 
46
- def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[HTTPValidationError, bool]]:
48
+ def _build_response(
49
+ *, client: Client, response: httpx.Response
50
+ ) -> Response[Union[HTTPValidationError, bool]]:
47
51
  return Response(
48
52
  status_code=HTTPStatus(response.status_code),
49
53
  content=response.content,
@@ -29,7 +29,9 @@ def _get_kwargs(
29
29
  }
30
30
 
31
31
 
32
- def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, HTTPValidationError]]:
32
+ def _parse_response(
33
+ *, client: Client, response: httpx.Response
34
+ ) -> Optional[Union[Any, HTTPValidationError]]:
33
35
  if response.status_code == HTTPStatus.OK:
34
36
  response_200 = cast(Any, response.json())
35
37
  return response_200
@@ -43,7 +45,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni
43
45
  return None
44
46
 
45
47
 
46
- def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, HTTPValidationError]]:
48
+ def _build_response(
49
+ *, client: Client, response: httpx.Response
50
+ ) -> Response[Union[Any, HTTPValidationError]]:
47
51
  return Response(
48
52
  status_code=HTTPStatus(response.status_code),
49
53
  content=response.content,
@@ -37,7 +37,9 @@ def _get_kwargs(
37
37
  }
38
38
 
39
39
 
40
- def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[FileSpec, HTTPValidationError]]:
40
+ def _parse_response(
41
+ *, client: Client, response: httpx.Response
42
+ ) -> Optional[Union[FileSpec, HTTPValidationError]]:
41
43
  if response.status_code == HTTPStatus.OK:
42
44
  response_200 = FileSpec.from_dict(response.json())
43
45
 
@@ -52,7 +54,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni
52
54
  return None
53
55
 
54
56
 
55
- def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[FileSpec, HTTPValidationError]]:
57
+ def _build_response(
58
+ *, client: Client, response: httpx.Response
59
+ ) -> Response[Union[FileSpec, HTTPValidationError]]:
56
60
  return Response(
57
61
  status_code=HTTPStatus(response.status_code),
58
62
  content=response.content,
@@ -34,7 +34,9 @@ def _get_kwargs(
34
34
  }
35
35
 
36
36
 
37
- def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[HTTPValidationError, bool]]:
37
+ def _parse_response(
38
+ *, client: Client, response: httpx.Response
39
+ ) -> Optional[Union[HTTPValidationError, bool]]:
38
40
  if response.status_code == HTTPStatus.OK:
39
41
  response_200 = cast(bool, response.json())
40
42
  return response_200
@@ -48,7 +50,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni
48
50
  return None
49
51
 
50
52
 
51
- def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[HTTPValidationError, bool]]:
53
+ def _build_response(
54
+ *, client: Client, response: httpx.Response
55
+ ) -> Response[Union[HTTPValidationError, bool]]:
52
56
  return Response(
53
57
  status_code=HTTPStatus(response.status_code),
54
58
  content=response.content,
@@ -17,7 +17,9 @@ def _get_kwargs(
17
17
  multipart_data: BodyUploadLocalFile,
18
18
  unzip: Union[Unset, None, bool] = False,
19
19
  ) -> Dict[str, Any]:
20
- url = "{}/files/file/local/{target_path}".format(client.base_url, target_path=target_path)
20
+ url = "{}/files/file/local/{target_path}".format(
21
+ client.base_url, target_path=target_path
22
+ )
21
23
 
22
24
  headers: Dict[str, str] = client.get_headers()
23
25
  cookies: Dict[str, Any] = client.get_cookies()
@@ -41,7 +43,9 @@ def _get_kwargs(
41
43
  }
42
44
 
43
45
 
44
- def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[HTTPValidationError, bool]]:
46
+ def _parse_response(
47
+ *, client: Client, response: httpx.Response
48
+ ) -> Optional[Union[HTTPValidationError, bool]]:
45
49
  if response.status_code == HTTPStatus.OK:
46
50
  response_200 = cast(bool, response.json())
47
51
  return response_200
@@ -55,7 +59,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni
55
59
  return None
56
60
 
57
61
 
58
- def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[HTTPValidationError, bool]]:
62
+ def _build_response(
63
+ *, client: Client, response: httpx.Response
64
+ ) -> Response[Union[HTTPValidationError, bool]]:
59
65
  return Response(
60
66
  status_code=HTTPStatus(response.status_code),
61
67
  content=response.content,
@@ -42,7 +42,9 @@ def _get_kwargs(
42
42
  }
43
43
 
44
44
 
45
- def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[HTTPValidationError, NewUserKey]]:
45
+ def _parse_response(
46
+ *, client: Client, response: httpx.Response
47
+ ) -> Optional[Union[HTTPValidationError, NewUserKey]]:
46
48
  if response.status_code == HTTPStatus.CREATED:
47
49
  response_201 = NewUserKey.from_dict(response.json())
48
50
 
@@ -57,7 +59,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni
57
59
  return None
58
60
 
59
61
 
60
- def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[HTTPValidationError, NewUserKey]]:
62
+ def _build_response(
63
+ *, client: Client, response: httpx.Response
64
+ ) -> Response[Union[HTTPValidationError, NewUserKey]]:
61
65
  return Response(
62
66
  status_code=HTTPStatus(response.status_code),
63
67
  content=response.content,
@@ -29,7 +29,9 @@ def _get_kwargs(
29
29
  }
30
30
 
31
31
 
32
- def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[Any, HTTPValidationError]]:
32
+ def _parse_response(
33
+ *, client: Client, response: httpx.Response
34
+ ) -> Optional[Union[Any, HTTPValidationError]]:
33
35
  if response.status_code == HTTPStatus.NO_CONTENT:
34
36
  response_204 = cast(Any, None)
35
37
  return response_204
@@ -43,7 +45,9 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni
43
45
  return None
44
46
 
45
47
 
46
- def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[Any, HTTPValidationError]]:
48
+ def _build_response(
49
+ *, client: Client, response: httpx.Response
50
+ ) -> Response[Union[Any, HTTPValidationError]]:
47
51
  return Response(
48
52
  status_code=HTTPStatus(response.status_code),
49
53
  content=response.content,
@@ -6,10 +6,10 @@ import httpx
6
6
 
7
7
  from ... import errors
8
8
  from ...client import Client
9
- from ...models.gateway_stats_by_time import GatewayStatsByTime
10
9
  from ...models.http_validation_error import HTTPValidationError
10
+ from ...models.request_io import RequestIO
11
11
  from ...models.stats_timeframe import StatsTimeframe
12
- from ...types import UNSET, Response
12
+ from ...types import UNSET, Response, Unset
13
13
 
14
14
 
15
15
  def _get_kwargs(
@@ -19,8 +19,9 @@ def _get_kwargs(
19
19
  end_time: datetime.datetime,
20
20
  app_alias: str,
21
21
  timeframe: StatsTimeframe,
22
+ limit: Union[Unset, None, int] = 100,
22
23
  ) -> Dict[str, Any]:
23
- url = "{}/usage/stats/by_time".format(client.base_url)
24
+ url = "{}/requests/".format(client.base_url)
24
25
 
25
26
  headers: Dict[str, str] = client.get_headers()
26
27
  cookies: Dict[str, Any] = client.get_cookies()
@@ -40,6 +41,8 @@ def _get_kwargs(
40
41
 
41
42
  params["timeframe"] = json_timeframe
42
43
 
44
+ params["limit"] = limit
45
+
43
46
  params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
44
47
 
45
48
  return {
@@ -55,12 +58,12 @@ def _get_kwargs(
55
58
 
56
59
  def _parse_response(
57
60
  *, client: Client, response: httpx.Response
58
- ) -> Optional[Union[HTTPValidationError, List["GatewayStatsByTime"]]]:
61
+ ) -> Optional[Union[HTTPValidationError, List["RequestIO"]]]:
59
62
  if response.status_code == HTTPStatus.OK:
60
63
  response_200 = []
61
64
  _response_200 = response.json()
62
65
  for response_200_item_data in _response_200:
63
- response_200_item = GatewayStatsByTime.from_dict(response_200_item_data)
66
+ response_200_item = RequestIO.from_dict(response_200_item_data)
64
67
 
65
68
  response_200.append(response_200_item)
66
69
 
@@ -77,7 +80,7 @@ def _parse_response(
77
80
 
78
81
  def _build_response(
79
82
  *, client: Client, response: httpx.Response
80
- ) -> Response[Union[HTTPValidationError, List["GatewayStatsByTime"]]]:
83
+ ) -> Response[Union[HTTPValidationError, List["RequestIO"]]]:
81
84
  return Response(
82
85
  status_code=HTTPStatus(response.status_code),
83
86
  content=response.content,
@@ -93,21 +96,23 @@ def sync_detailed(
93
96
  end_time: datetime.datetime,
94
97
  app_alias: str,
95
98
  timeframe: StatsTimeframe,
96
- ) -> Response[Union[HTTPValidationError, List["GatewayStatsByTime"]]]:
97
- """Get Request Stats By Time
99
+ limit: Union[Unset, None, int] = 100,
100
+ ) -> Response[Union[HTTPValidationError, List["RequestIO"]]]:
101
+ """Per Machine Usage
98
102
 
99
103
  Args:
100
104
  start_time (datetime.datetime):
101
105
  end_time (datetime.datetime):
102
106
  app_alias (str):
103
107
  timeframe (StatsTimeframe): An enumeration.
108
+ limit (Union[Unset, None, int]): Default: 100.
104
109
 
105
110
  Raises:
106
111
  errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
107
112
  httpx.TimeoutException: If the request takes longer than Client.timeout.
108
113
 
109
114
  Returns:
110
- Response[Union[HTTPValidationError, List['GatewayStatsByTime']]]
115
+ Response[Union[HTTPValidationError, List['RequestIO']]]
111
116
  """
112
117
 
113
118
  kwargs = _get_kwargs(
@@ -116,6 +121,7 @@ def sync_detailed(
116
121
  end_time=end_time,
117
122
  app_alias=app_alias,
118
123
  timeframe=timeframe,
124
+ limit=limit,
119
125
  )
120
126
 
121
127
  response = httpx.request(
@@ -133,21 +139,23 @@ def sync(
133
139
  end_time: datetime.datetime,
134
140
  app_alias: str,
135
141
  timeframe: StatsTimeframe,
136
- ) -> Optional[Union[HTTPValidationError, List["GatewayStatsByTime"]]]:
137
- """Get Request Stats By Time
142
+ limit: Union[Unset, None, int] = 100,
143
+ ) -> Optional[Union[HTTPValidationError, List["RequestIO"]]]:
144
+ """Per Machine Usage
138
145
 
139
146
  Args:
140
147
  start_time (datetime.datetime):
141
148
  end_time (datetime.datetime):
142
149
  app_alias (str):
143
150
  timeframe (StatsTimeframe): An enumeration.
151
+ limit (Union[Unset, None, int]): Default: 100.
144
152
 
145
153
  Raises:
146
154
  errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
147
155
  httpx.TimeoutException: If the request takes longer than Client.timeout.
148
156
 
149
157
  Returns:
150
- Union[HTTPValidationError, List['GatewayStatsByTime']]
158
+ Union[HTTPValidationError, List['RequestIO']]
151
159
  """
152
160
 
153
161
  return sync_detailed(
@@ -156,6 +164,7 @@ def sync(
156
164
  end_time=end_time,
157
165
  app_alias=app_alias,
158
166
  timeframe=timeframe,
167
+ limit=limit,
159
168
  ).parsed
160
169
 
161
170
 
@@ -166,21 +175,23 @@ async def asyncio_detailed(
166
175
  end_time: datetime.datetime,
167
176
  app_alias: str,
168
177
  timeframe: StatsTimeframe,
169
- ) -> Response[Union[HTTPValidationError, List["GatewayStatsByTime"]]]:
170
- """Get Request Stats By Time
178
+ limit: Union[Unset, None, int] = 100,
179
+ ) -> Response[Union[HTTPValidationError, List["RequestIO"]]]:
180
+ """Per Machine Usage
171
181
 
172
182
  Args:
173
183
  start_time (datetime.datetime):
174
184
  end_time (datetime.datetime):
175
185
  app_alias (str):
176
186
  timeframe (StatsTimeframe): An enumeration.
187
+ limit (Union[Unset, None, int]): Default: 100.
177
188
 
178
189
  Raises:
179
190
  errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
180
191
  httpx.TimeoutException: If the request takes longer than Client.timeout.
181
192
 
182
193
  Returns:
183
- Response[Union[HTTPValidationError, List['GatewayStatsByTime']]]
194
+ Response[Union[HTTPValidationError, List['RequestIO']]]
184
195
  """
185
196
 
186
197
  kwargs = _get_kwargs(
@@ -189,6 +200,7 @@ async def asyncio_detailed(
189
200
  end_time=end_time,
190
201
  app_alias=app_alias,
191
202
  timeframe=timeframe,
203
+ limit=limit,
192
204
  )
193
205
 
194
206
  async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
@@ -204,21 +216,23 @@ async def asyncio(
204
216
  end_time: datetime.datetime,
205
217
  app_alias: str,
206
218
  timeframe: StatsTimeframe,
207
- ) -> Optional[Union[HTTPValidationError, List["GatewayStatsByTime"]]]:
208
- """Get Request Stats By Time
219
+ limit: Union[Unset, None, int] = 100,
220
+ ) -> Optional[Union[HTTPValidationError, List["RequestIO"]]]:
221
+ """Per Machine Usage
209
222
 
210
223
  Args:
211
224
  start_time (datetime.datetime):
212
225
  end_time (datetime.datetime):
213
226
  app_alias (str):
214
227
  timeframe (StatsTimeframe): An enumeration.
228
+ limit (Union[Unset, None, int]): Default: 100.
215
229
 
216
230
  Raises:
217
231
  errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
218
232
  httpx.TimeoutException: If the request takes longer than Client.timeout.
219
233
 
220
234
  Returns:
221
- Union[HTTPValidationError, List['GatewayStatsByTime']]
235
+ Union[HTTPValidationError, List['RequestIO']]
222
236
  """
223
237
 
224
238
  return (
@@ -228,5 +242,6 @@ async def asyncio(
228
242
  end_time=end_time,
229
243
  app_alias=app_alias,
230
244
  timeframe=timeframe,
245
+ limit=limit,
231
246
  )
232
247
  ).parsed
@@ -0,0 +1,200 @@
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.uploaded_file_result import UploadedFileResult
10
+ from ...types import Response
11
+
12
+
13
+ def _get_kwargs(
14
+ full_path: str,
15
+ *,
16
+ client: Client,
17
+ ) -> Dict[str, Any]:
18
+ url = "{}/storage/link/{full_path}".format(client.base_url, full_path=full_path)
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, UploadedFileResult]]:
36
+ if response.status_code == HTTPStatus.OK:
37
+ response_200 = UploadedFileResult.from_dict(response.json())
38
+
39
+ return response_200
40
+ if response.status_code == HTTPStatus.UNPROCESSABLE_ENTITY:
41
+ response_422 = HTTPValidationError.from_dict(response.json())
42
+
43
+ return response_422
44
+ if client.raise_on_unexpected_status:
45
+ raise errors.UnexpectedStatus(response.status_code, response.content)
46
+ else:
47
+ return None
48
+
49
+
50
+ def _build_response(
51
+ *, client: Client, response: httpx.Response
52
+ ) -> Response[Union[HTTPValidationError, UploadedFileResult]]:
53
+ return Response(
54
+ status_code=HTTPStatus(response.status_code),
55
+ content=response.content,
56
+ headers=response.headers,
57
+ parsed=_parse_response(client=client, response=response),
58
+ )
59
+
60
+
61
+ def sync_detailed(
62
+ full_path: str,
63
+ *,
64
+ client: Client,
65
+ ) -> Response[Union[HTTPValidationError, UploadedFileResult]]:
66
+ """Get Signed Link From Shared Storage
67
+
68
+ Sign a link to a file in the shared storage bucket.
69
+ These can be from the upload_to_shared_storage endpoint
70
+ Or from a model upload.
71
+
72
+ Examples:
73
+ - /{PROJECT_ID}_toolkit_bucket/github_2745502/fal_ai_sdxl_1690489104504.png
74
+ - /fal_file_storage/d0bdd5b7c2c6495cb4d763547bdd8fde.png
75
+
76
+ Args:
77
+ full_path (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, UploadedFileResult]]
85
+ """
86
+
87
+ kwargs = _get_kwargs(
88
+ full_path=full_path,
89
+ client=client,
90
+ )
91
+
92
+ response = httpx.request(
93
+ verify=client.verify_ssl,
94
+ **kwargs,
95
+ )
96
+
97
+ return _build_response(client=client, response=response)
98
+
99
+
100
+ def sync(
101
+ full_path: str,
102
+ *,
103
+ client: Client,
104
+ ) -> Optional[Union[HTTPValidationError, UploadedFileResult]]:
105
+ """Get Signed Link From Shared Storage
106
+
107
+ Sign a link to a file in the shared storage bucket.
108
+ These can be from the upload_to_shared_storage endpoint
109
+ Or from a model upload.
110
+
111
+ Examples:
112
+ - /{PROJECT_ID}_toolkit_bucket/github_2745502/fal_ai_sdxl_1690489104504.png
113
+ - /fal_file_storage/d0bdd5b7c2c6495cb4d763547bdd8fde.png
114
+
115
+ Args:
116
+ full_path (str):
117
+
118
+ Raises:
119
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
120
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
121
+
122
+ Returns:
123
+ Union[HTTPValidationError, UploadedFileResult]
124
+ """
125
+
126
+ return sync_detailed(
127
+ full_path=full_path,
128
+ client=client,
129
+ ).parsed
130
+
131
+
132
+ async def asyncio_detailed(
133
+ full_path: str,
134
+ *,
135
+ client: Client,
136
+ ) -> Response[Union[HTTPValidationError, UploadedFileResult]]:
137
+ """Get Signed Link From Shared Storage
138
+
139
+ Sign a link to a file in the shared storage bucket.
140
+ These can be from the upload_to_shared_storage endpoint
141
+ Or from a model upload.
142
+
143
+ Examples:
144
+ - /{PROJECT_ID}_toolkit_bucket/github_2745502/fal_ai_sdxl_1690489104504.png
145
+ - /fal_file_storage/d0bdd5b7c2c6495cb4d763547bdd8fde.png
146
+
147
+ Args:
148
+ full_path (str):
149
+
150
+ Raises:
151
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
152
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
153
+
154
+ Returns:
155
+ Response[Union[HTTPValidationError, UploadedFileResult]]
156
+ """
157
+
158
+ kwargs = _get_kwargs(
159
+ full_path=full_path,
160
+ client=client,
161
+ )
162
+
163
+ async with httpx.AsyncClient(verify=client.verify_ssl) as _client:
164
+ response = await _client.request(**kwargs)
165
+
166
+ return _build_response(client=client, response=response)
167
+
168
+
169
+ async def asyncio(
170
+ full_path: str,
171
+ *,
172
+ client: Client,
173
+ ) -> Optional[Union[HTTPValidationError, UploadedFileResult]]:
174
+ """Get Signed Link From Shared Storage
175
+
176
+ Sign a link to a file in the shared storage bucket.
177
+ These can be from the upload_to_shared_storage endpoint
178
+ Or from a model upload.
179
+
180
+ Examples:
181
+ - /{PROJECT_ID}_toolkit_bucket/github_2745502/fal_ai_sdxl_1690489104504.png
182
+ - /fal_file_storage/d0bdd5b7c2c6495cb4d763547bdd8fde.png
183
+
184
+ Args:
185
+ full_path (str):
186
+
187
+ Raises:
188
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
189
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
190
+
191
+ Returns:
192
+ Union[HTTPValidationError, UploadedFileResult]
193
+ """
194
+
195
+ return (
196
+ await asyncio_detailed(
197
+ full_path=full_path,
198
+ client=client,
199
+ )
200
+ ).parsed