blaxel 0.1.9rc37__py3-none-any.whl → 0.1.10rc39__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.
Files changed (48) hide show
  1. blaxel/authentication/__init__.py +11 -2
  2. blaxel/common/autoload.py +1 -0
  3. blaxel/common/internal.py +5 -5
  4. blaxel/sandbox/base.py +68 -0
  5. blaxel/sandbox/client/__init__.py +8 -0
  6. blaxel/sandbox/client/api/__init__.py +1 -0
  7. blaxel/sandbox/client/api/filesystem/__init__.py +0 -0
  8. blaxel/sandbox/client/api/filesystem/delete_filesystem_path.py +184 -0
  9. blaxel/sandbox/client/api/filesystem/get_filesystem_path.py +184 -0
  10. blaxel/sandbox/client/api/filesystem/put_filesystem_path.py +189 -0
  11. blaxel/sandbox/client/api/network/__init__.py +0 -0
  12. blaxel/sandbox/client/api/network/delete_network_process_pid_monitor.py +169 -0
  13. blaxel/sandbox/client/api/network/get_network_process_pid_ports.py +169 -0
  14. blaxel/sandbox/client/api/network/post_network_process_pid_monitor.py +195 -0
  15. blaxel/sandbox/client/api/process/__init__.py +0 -0
  16. blaxel/sandbox/client/api/process/delete_process_identifier.py +163 -0
  17. blaxel/sandbox/client/api/process/delete_process_identifier_kill.py +189 -0
  18. blaxel/sandbox/client/api/process/get_process.py +135 -0
  19. blaxel/sandbox/client/api/process/get_process_identifier.py +159 -0
  20. blaxel/sandbox/client/api/process/get_process_identifier_logs.py +167 -0
  21. blaxel/sandbox/client/api/process/post_process.py +176 -0
  22. blaxel/sandbox/client/client.py +162 -0
  23. blaxel/sandbox/client/errors.py +16 -0
  24. blaxel/sandbox/client/models/__init__.py +35 -0
  25. blaxel/sandbox/client/models/delete_network_process_pid_monitor_response_200.py +45 -0
  26. blaxel/sandbox/client/models/directory.py +110 -0
  27. blaxel/sandbox/client/models/error_response.py +60 -0
  28. blaxel/sandbox/client/models/file.py +105 -0
  29. blaxel/sandbox/client/models/file_request.py +78 -0
  30. blaxel/sandbox/client/models/file_with_content.py +114 -0
  31. blaxel/sandbox/client/models/get_network_process_pid_ports_response_200.py +45 -0
  32. blaxel/sandbox/client/models/get_process_identifier_logs_response_200.py +45 -0
  33. blaxel/sandbox/client/models/port_monitor_request.py +60 -0
  34. blaxel/sandbox/client/models/post_network_process_pid_monitor_response_200.py +45 -0
  35. blaxel/sandbox/client/models/process_kill_request.py +60 -0
  36. blaxel/sandbox/client/models/process_request.py +118 -0
  37. blaxel/sandbox/client/models/process_response.py +123 -0
  38. blaxel/sandbox/client/models/success_response.py +69 -0
  39. blaxel/sandbox/client/py.typed +1 -0
  40. blaxel/sandbox/client/types.py +46 -0
  41. blaxel/sandbox/filesystem.py +104 -0
  42. blaxel/sandbox/process.py +57 -0
  43. blaxel/sandbox/sandbox.py +92 -0
  44. blaxel/tools/__init__.py +1 -1
  45. {blaxel-0.1.9rc37.dist-info → blaxel-0.1.10rc39.dist-info}/METADATA +1 -1
  46. {blaxel-0.1.9rc37.dist-info → blaxel-0.1.10rc39.dist-info}/RECORD +48 -8
  47. {blaxel-0.1.9rc37.dist-info → blaxel-0.1.10rc39.dist-info}/WHEEL +0 -0
  48. {blaxel-0.1.9rc37.dist-info → blaxel-0.1.10rc39.dist-info}/licenses/LICENSE +0 -0
@@ -19,16 +19,25 @@ def get_credentials() -> Optional[CredentialsType]:
19
19
  Returns:
20
20
  Optional[CredentialsType]: The credentials or None if not found
21
21
  """
22
+ def get_workspace():
23
+ if os.environ.get("BL_WORKSPACE"):
24
+ return os.environ.get("BL_WORKSPACE")
25
+ home_dir = Path.home()
26
+ config_path = home_dir / '.blaxel' / 'config.yaml'
27
+ with open(config_path, encoding='utf-8') as f:
28
+ config_json = yaml.safe_load(f)
29
+ return config_json.get("context", {}).get("workspace")
30
+
22
31
  if os.environ.get("BL_API_KEY"):
23
32
  return CredentialsType(
24
33
  api_key=os.environ.get("BL_API_KEY"),
25
- workspace=os.environ.get("BL_WORKSPACE")
34
+ workspace=get_workspace()
26
35
  )
27
36
 
28
37
  if os.environ.get("BL_CLIENT_CREDENTIALS"):
29
38
  return CredentialsType(
30
39
  client_credentials=os.environ.get("BL_CLIENT_CREDENTIALS"),
31
- workspace=os.environ.get("BL_WORKSPACE")
40
+ workspace=get_workspace()
32
41
  )
33
42
 
34
43
  try:
blaxel/common/autoload.py CHANGED
@@ -2,6 +2,7 @@ from ..client import client
2
2
  from ..instrumentation.manager import telemetry_manager
3
3
  from .settings import settings
4
4
 
5
+
5
6
  def autoload() -> None:
6
7
  client.with_base_url(settings.base_url)
7
8
  client.with_auth(settings.auth)
blaxel/common/internal.py CHANGED
@@ -2,24 +2,24 @@ import base64
2
2
  import hashlib
3
3
  import os
4
4
  import re
5
- from typing import Optional
6
5
  from logging import getLogger
6
+ from typing import Optional
7
7
 
8
8
  logger = getLogger(__name__)
9
9
 
10
10
  def get_alphanumeric_limited_hash(input_str, max_size):
11
11
  # Create SHA-256 hash of the input string
12
12
  hash_obj = hashlib.sha256(input_str.encode('utf-8'))
13
-
13
+
14
14
  # Get the hash digest in base64 format
15
15
  hash_base64 = base64.b64encode(hash_obj.digest()).decode('utf-8')
16
-
16
+
17
17
  # Remove non-alphanumeric characters and convert to lowercase
18
18
  alphanumeric = re.sub(r'[^a-zA-Z0-9]', '', hash_base64).lower()
19
-
19
+
20
20
  # Skip the first character to match the Node.js crypto output
21
21
  alphanumeric = alphanumeric[1:]
22
-
22
+
23
23
  # Limit to max_size characters
24
24
  return alphanumeric[:max_size] if len(alphanumeric) > max_size else alphanumeric
25
25
 
blaxel/sandbox/base.py ADDED
@@ -0,0 +1,68 @@
1
+ import os
2
+
3
+ from httpx import Response
4
+
5
+ from ..client.models import Sandbox
6
+ from ..common.internal import get_global_unique_hash
7
+ from ..common.settings import settings
8
+ from .client.client import client
9
+ from .client.models import ErrorResponse
10
+
11
+
12
+ class ResponseError(Exception):
13
+ def __init__(self, response: Response):
14
+ self.status_code = response.status_code
15
+ self.status_text = response.content
16
+ self.error = None
17
+ data_error = {
18
+ "status": response.status_code,
19
+ "statusText": response.content,
20
+ }
21
+ if hasattr(response, "parsed") and isinstance(response.parsed, ErrorResponse):
22
+ data_error["error"] = response.parsed.error
23
+ self.error = response.parsed.error
24
+ super().__init__(str(data_error))
25
+
26
+
27
+ class SandboxHandleBase:
28
+ def __init__(self, sandbox: Sandbox):
29
+ self.sandbox = sandbox
30
+ self.client = client.with_base_url(self.url).with_headers(settings.headers)
31
+
32
+ @property
33
+ def name(self):
34
+ return self.sandbox.metadata and self.sandbox.metadata.name
35
+
36
+ @property
37
+ def fallback_url(self):
38
+ if self.external_url != self.url:
39
+ return self.external_url
40
+ return None
41
+
42
+ @property
43
+ def external_url(self):
44
+ return f"{settings.run_url}/{settings.workspace}/sandboxes/{self.name}"
45
+
46
+ @property
47
+ def internal_url(self):
48
+ hash_ = get_global_unique_hash(settings.workspace, "sandbox", self.name)
49
+ return f"{settings.run_internal_protocol}://bl-{settings.env}-{hash_}.{settings.run_internal_hostname}"
50
+
51
+ @property
52
+ def forced_url(self):
53
+ env_var = self.name.replace("-", "_").upper()
54
+ env_name = f"BL_SANDBOX_{env_var}_URL"
55
+ return os.environ.get(env_name)
56
+
57
+ @property
58
+ def url(self):
59
+ if self.forced_url:
60
+ return self.forced_url
61
+ if settings.run_internal_hostname:
62
+ return self.internal_url
63
+ return self.external_url
64
+
65
+ def handle_response(self, response: Response):
66
+ if response.status_code >= 400:
67
+ raise ResponseError(response)
68
+
@@ -0,0 +1,8 @@
1
+ """A client library for accessing Sandbox API"""
2
+
3
+ from .client import Client, client
4
+
5
+ __all__ = (
6
+ "Client",
7
+ "client",
8
+ )
@@ -0,0 +1 @@
1
+ """Contains methods for accessing the API"""
File without changes
@@ -0,0 +1,184 @@
1
+ from http import HTTPStatus
2
+ from typing import Any, Optional, Union
3
+
4
+ import httpx
5
+
6
+ from ... import errors
7
+ from ...client import Client
8
+ from ...models.error_response import ErrorResponse
9
+ from ...models.success_response import SuccessResponse
10
+ from ...types import UNSET, Response, Unset
11
+
12
+
13
+ def _get_kwargs(
14
+ path: str,
15
+ *,
16
+ recursive: Union[Unset, bool] = UNSET,
17
+ ) -> dict[str, Any]:
18
+ params: dict[str, Any] = {}
19
+
20
+ params["recursive"] = recursive
21
+
22
+ params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
23
+
24
+ _kwargs: dict[str, Any] = {
25
+ "method": "delete",
26
+ "url": f"/filesystem/{path}",
27
+ "params": params,
28
+ }
29
+
30
+ return _kwargs
31
+
32
+
33
+ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[ErrorResponse, SuccessResponse]]:
34
+ if response.status_code == 200:
35
+ response_200 = SuccessResponse.from_dict(response.json())
36
+
37
+ return response_200
38
+ if response.status_code == 404:
39
+ response_404 = ErrorResponse.from_dict(response.json())
40
+
41
+ return response_404
42
+ if response.status_code == 500:
43
+ response_500 = ErrorResponse.from_dict(response.json())
44
+
45
+ return response_500
46
+ if client.raise_on_unexpected_status:
47
+ raise errors.UnexpectedStatus(response.status_code, response.content)
48
+ else:
49
+ return None
50
+
51
+
52
+ def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[ErrorResponse, SuccessResponse]]:
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
+ path: str,
63
+ *,
64
+ client: Union[Client],
65
+ recursive: Union[Unset, bool] = UNSET,
66
+ ) -> Response[Union[ErrorResponse, SuccessResponse]]:
67
+ """Delete file or directory
68
+
69
+ Delete a file or directory
70
+
71
+ Args:
72
+ path (str):
73
+ recursive (Union[Unset, bool]):
74
+
75
+ Raises:
76
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
77
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
78
+
79
+ Returns:
80
+ Response[Union[ErrorResponse, SuccessResponse]]
81
+ """
82
+
83
+ kwargs = _get_kwargs(
84
+ path=path,
85
+ recursive=recursive,
86
+ )
87
+
88
+ response = client.get_httpx_client().request(
89
+ **kwargs,
90
+ )
91
+
92
+ return _build_response(client=client, response=response)
93
+
94
+
95
+ def sync(
96
+ path: str,
97
+ *,
98
+ client: Union[Client],
99
+ recursive: Union[Unset, bool] = UNSET,
100
+ ) -> Optional[Union[ErrorResponse, SuccessResponse]]:
101
+ """Delete file or directory
102
+
103
+ Delete a file or directory
104
+
105
+ Args:
106
+ path (str):
107
+ recursive (Union[Unset, bool]):
108
+
109
+ Raises:
110
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
111
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
112
+
113
+ Returns:
114
+ Union[ErrorResponse, SuccessResponse]
115
+ """
116
+
117
+ return sync_detailed(
118
+ path=path,
119
+ client=client,
120
+ recursive=recursive,
121
+ ).parsed
122
+
123
+
124
+ async def asyncio_detailed(
125
+ path: str,
126
+ *,
127
+ client: Union[Client],
128
+ recursive: Union[Unset, bool] = UNSET,
129
+ ) -> Response[Union[ErrorResponse, SuccessResponse]]:
130
+ """Delete file or directory
131
+
132
+ Delete a file or directory
133
+
134
+ Args:
135
+ path (str):
136
+ recursive (Union[Unset, bool]):
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
+ Response[Union[ErrorResponse, SuccessResponse]]
144
+ """
145
+
146
+ kwargs = _get_kwargs(
147
+ path=path,
148
+ recursive=recursive,
149
+ )
150
+
151
+ response = await client.get_async_httpx_client().request(**kwargs)
152
+
153
+ return _build_response(client=client, response=response)
154
+
155
+
156
+ async def asyncio(
157
+ path: str,
158
+ *,
159
+ client: Union[Client],
160
+ recursive: Union[Unset, bool] = UNSET,
161
+ ) -> Optional[Union[ErrorResponse, SuccessResponse]]:
162
+ """Delete file or directory
163
+
164
+ Delete a file or directory
165
+
166
+ Args:
167
+ path (str):
168
+ recursive (Union[Unset, bool]):
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
+ Union[ErrorResponse, SuccessResponse]
176
+ """
177
+
178
+ return (
179
+ await asyncio_detailed(
180
+ path=path,
181
+ client=client,
182
+ recursive=recursive,
183
+ )
184
+ ).parsed
@@ -0,0 +1,184 @@
1
+ from http import HTTPStatus
2
+ from typing import Any, Optional, Union
3
+
4
+ import httpx
5
+
6
+ from ... import errors
7
+ from ...client import Client
8
+ from ...models.directory import Directory
9
+ from ...models.error_response import ErrorResponse
10
+ from ...models.file_with_content import FileWithContent
11
+ from ...types import Response
12
+
13
+
14
+ def _get_kwargs(
15
+ path: str,
16
+ ) -> dict[str, Any]:
17
+ _kwargs: dict[str, Any] = {
18
+ "method": "get",
19
+ "url": f"/filesystem/{path}",
20
+ }
21
+
22
+ return _kwargs
23
+
24
+
25
+ def _parse_response(
26
+ *, client: Client, response: httpx.Response
27
+ ) -> Optional[Union[ErrorResponse, Union["Directory", "FileWithContent"]]]:
28
+ if response.status_code == 200:
29
+
30
+ def _parse_response_200(data: object) -> Union["Directory", "FileWithContent"]:
31
+ try:
32
+ if not isinstance(data, dict):
33
+ raise TypeError()
34
+ response_200_type_0 = Directory.from_dict(data)
35
+
36
+ return response_200_type_0
37
+ except: # noqa: E722
38
+ pass
39
+ if not isinstance(data, dict):
40
+ raise TypeError()
41
+ response_200_type_1 = FileWithContent.from_dict(data)
42
+
43
+ return response_200_type_1
44
+
45
+ response_200 = _parse_response_200(response.json())
46
+
47
+ return response_200
48
+ if response.status_code == 404:
49
+ response_404 = ErrorResponse.from_dict(response.json())
50
+
51
+ return response_404
52
+ if response.status_code == 500:
53
+ response_500 = ErrorResponse.from_dict(response.json())
54
+
55
+ return response_500
56
+ if client.raise_on_unexpected_status:
57
+ raise errors.UnexpectedStatus(response.status_code, response.content)
58
+ else:
59
+ return None
60
+
61
+
62
+ def _build_response(
63
+ *, client: Client, response: httpx.Response
64
+ ) -> Response[Union[ErrorResponse, Union["Directory", "FileWithContent"]]]:
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
+ path: str,
75
+ *,
76
+ client: Union[Client],
77
+ ) -> Response[Union[ErrorResponse, Union["Directory", "FileWithContent"]]]:
78
+ """Get file or directory information
79
+
80
+ Get content of a file or listing of a directory
81
+
82
+ Args:
83
+ path (str):
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[ErrorResponse, Union['Directory', 'FileWithContent']]]
91
+ """
92
+
93
+ kwargs = _get_kwargs(
94
+ path=path,
95
+ )
96
+
97
+ response = client.get_httpx_client().request(
98
+ **kwargs,
99
+ )
100
+
101
+ return _build_response(client=client, response=response)
102
+
103
+
104
+ def sync(
105
+ path: str,
106
+ *,
107
+ client: Union[Client],
108
+ ) -> Optional[Union[ErrorResponse, Union["Directory", "FileWithContent"]]]:
109
+ """Get file or directory information
110
+
111
+ Get content of a file or listing of a directory
112
+
113
+ Args:
114
+ path (str):
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
+ Union[ErrorResponse, Union['Directory', 'FileWithContent']]
122
+ """
123
+
124
+ return sync_detailed(
125
+ path=path,
126
+ client=client,
127
+ ).parsed
128
+
129
+
130
+ async def asyncio_detailed(
131
+ path: str,
132
+ *,
133
+ client: Union[Client],
134
+ ) -> Response[Union[ErrorResponse, Union["Directory", "FileWithContent"]]]:
135
+ """Get file or directory information
136
+
137
+ Get content of a file or listing of a directory
138
+
139
+ Args:
140
+ path (str):
141
+
142
+ Raises:
143
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
144
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
145
+
146
+ Returns:
147
+ Response[Union[ErrorResponse, Union['Directory', 'FileWithContent']]]
148
+ """
149
+
150
+ kwargs = _get_kwargs(
151
+ path=path,
152
+ )
153
+
154
+ response = await client.get_async_httpx_client().request(**kwargs)
155
+
156
+ return _build_response(client=client, response=response)
157
+
158
+
159
+ async def asyncio(
160
+ path: str,
161
+ *,
162
+ client: Union[Client],
163
+ ) -> Optional[Union[ErrorResponse, Union["Directory", "FileWithContent"]]]:
164
+ """Get file or directory information
165
+
166
+ Get content of a file or listing of a directory
167
+
168
+ Args:
169
+ path (str):
170
+
171
+ Raises:
172
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
173
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
174
+
175
+ Returns:
176
+ Union[ErrorResponse, Union['Directory', 'FileWithContent']]
177
+ """
178
+
179
+ return (
180
+ await asyncio_detailed(
181
+ path=path,
182
+ client=client,
183
+ )
184
+ ).parsed
@@ -0,0 +1,189 @@
1
+ from http import HTTPStatus
2
+ from typing import Any, Optional, Union
3
+
4
+ import httpx
5
+
6
+ from ... import errors
7
+ from ...client import Client
8
+ from ...models.error_response import ErrorResponse
9
+ from ...models.file_request import FileRequest
10
+ from ...models.success_response import SuccessResponse
11
+ from ...types import Response
12
+
13
+
14
+ def _get_kwargs(
15
+ path: str,
16
+ *,
17
+ body: FileRequest,
18
+ ) -> dict[str, Any]:
19
+ headers: dict[str, Any] = {}
20
+
21
+ _kwargs: dict[str, Any] = {
22
+ "method": "put",
23
+ "url": f"/filesystem/{path}",
24
+ }
25
+
26
+ if type(body) == dict:
27
+ _body = body
28
+ else:
29
+ _body = body.to_dict()
30
+
31
+ _kwargs["json"] = _body
32
+ headers["Content-Type"] = "application/json"
33
+
34
+ _kwargs["headers"] = headers
35
+ return _kwargs
36
+
37
+
38
+ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Union[ErrorResponse, SuccessResponse]]:
39
+ if response.status_code == 200:
40
+ response_200 = SuccessResponse.from_dict(response.json())
41
+
42
+ return response_200
43
+ if response.status_code == 400:
44
+ response_400 = ErrorResponse.from_dict(response.json())
45
+
46
+ return response_400
47
+ if response.status_code == 500:
48
+ response_500 = ErrorResponse.from_dict(response.json())
49
+
50
+ return response_500
51
+ if client.raise_on_unexpected_status:
52
+ raise errors.UnexpectedStatus(response.status_code, response.content)
53
+ else:
54
+ return None
55
+
56
+
57
+ def _build_response(*, client: Client, response: httpx.Response) -> Response[Union[ErrorResponse, SuccessResponse]]:
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
+ path: str,
68
+ *,
69
+ client: Union[Client],
70
+ body: FileRequest,
71
+ ) -> Response[Union[ErrorResponse, SuccessResponse]]:
72
+ """Create or update file or directory
73
+
74
+ Create or update a file or directory
75
+
76
+ Args:
77
+ path (str):
78
+ body (FileRequest):
79
+
80
+ Raises:
81
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
82
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
83
+
84
+ Returns:
85
+ Response[Union[ErrorResponse, SuccessResponse]]
86
+ """
87
+
88
+ kwargs = _get_kwargs(
89
+ path=path,
90
+ body=body,
91
+ )
92
+
93
+ response = client.get_httpx_client().request(
94
+ **kwargs,
95
+ )
96
+
97
+ return _build_response(client=client, response=response)
98
+
99
+
100
+ def sync(
101
+ path: str,
102
+ *,
103
+ client: Union[Client],
104
+ body: FileRequest,
105
+ ) -> Optional[Union[ErrorResponse, SuccessResponse]]:
106
+ """Create or update file or directory
107
+
108
+ Create or update a file or directory
109
+
110
+ Args:
111
+ path (str):
112
+ body (FileRequest):
113
+
114
+ Raises:
115
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
116
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
117
+
118
+ Returns:
119
+ Union[ErrorResponse, SuccessResponse]
120
+ """
121
+
122
+ return sync_detailed(
123
+ path=path,
124
+ client=client,
125
+ body=body,
126
+ ).parsed
127
+
128
+
129
+ async def asyncio_detailed(
130
+ path: str,
131
+ *,
132
+ client: Union[Client],
133
+ body: FileRequest,
134
+ ) -> Response[Union[ErrorResponse, SuccessResponse]]:
135
+ """Create or update file or directory
136
+
137
+ Create or update a file or directory
138
+
139
+ Args:
140
+ path (str):
141
+ body (FileRequest):
142
+
143
+ Raises:
144
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
145
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
146
+
147
+ Returns:
148
+ Response[Union[ErrorResponse, SuccessResponse]]
149
+ """
150
+
151
+ kwargs = _get_kwargs(
152
+ path=path,
153
+ body=body,
154
+ )
155
+
156
+ response = await client.get_async_httpx_client().request(**kwargs)
157
+
158
+ return _build_response(client=client, response=response)
159
+
160
+
161
+ async def asyncio(
162
+ path: str,
163
+ *,
164
+ client: Union[Client],
165
+ body: FileRequest,
166
+ ) -> Optional[Union[ErrorResponse, SuccessResponse]]:
167
+ """Create or update file or directory
168
+
169
+ Create or update a file or directory
170
+
171
+ Args:
172
+ path (str):
173
+ body (FileRequest):
174
+
175
+ Raises:
176
+ errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
177
+ httpx.TimeoutException: If the request takes longer than Client.timeout.
178
+
179
+ Returns:
180
+ Union[ErrorResponse, SuccessResponse]
181
+ """
182
+
183
+ return (
184
+ await asyncio_detailed(
185
+ path=path,
186
+ client=client,
187
+ body=body,
188
+ )
189
+ ).parsed
File without changes