5
5
6
6
from ... import errors
7
7
from ...client import Client
8
- from ...models .post_storage_response_403 import PostStorageResponse403
8
+ from ...models .error import Error
9
9
from ...models .storage_definition import StorageDefinition
10
10
from ...types import Response
11
11
@@ -32,30 +32,33 @@ def _get_kwargs(
32
32
}
33
33
34
34
35
- def _parse_response (* , client : Client , response : httpx .Response ) -> Optional [Union [PostStorageResponse403 , str ]]:
35
+ def _parse_response (* , client : Client , response : httpx .Response ) -> Optional [Union [Error , str ]]:
36
36
if response .status_code == HTTPStatus .OK :
37
37
response_200 = cast (str , response .json ())
38
38
return response_200
39
39
if response .status_code == HTTPStatus .BAD_REQUEST :
40
- response_400 = cast (str , response .json ())
40
+ response_400 = Error .from_dict (response .json ())
41
+
41
42
return response_400
42
43
if response .status_code == HTTPStatus .FORBIDDEN :
43
- response_403 = PostStorageResponse403 .from_dict (response .json ())
44
+ response_403 = Error .from_dict (response .json ())
44
45
45
46
return response_403
46
47
if response .status_code == HTTPStatus .UNPROCESSABLE_ENTITY :
47
- response_422 = cast (str , response .json ())
48
+ response_422 = Error .from_dict (response .json ())
49
+
48
50
return response_422
49
51
if response .status_code == HTTPStatus .INTERNAL_SERVER_ERROR :
50
- response_500 = cast (str , response .json ())
52
+ response_500 = Error .from_dict (response .json ())
53
+
51
54
return response_500
52
55
if client .raise_on_unexpected_status :
53
56
raise errors .UnexpectedStatus (f"Unexpected status code: { response .status_code } " )
54
57
else :
55
58
return None
56
59
57
60
58
- def _build_response (* , client : Client , response : httpx .Response ) -> Response [Union [PostStorageResponse403 , str ]]:
61
+ def _build_response (* , client : Client , response : httpx .Response ) -> Response [Union [Error , str ]]:
59
62
return Response (
60
63
status_code = HTTPStatus (response .status_code ),
61
64
content = response .content ,
@@ -68,7 +71,7 @@ def sync_detailed(
68
71
* ,
69
72
client : Client ,
70
73
json_body : StorageDefinition ,
71
- ) -> Response [Union [PostStorageResponse403 , str ]]:
74
+ ) -> Response [Union [Error , str ]]:
72
75
"""Request a Storage operation
73
76
74
77
Args:
@@ -79,7 +82,7 @@ def sync_detailed(
79
82
httpx.TimeoutException: If the request takes longer than Client.timeout.
80
83
81
84
Returns:
82
- Response[Union[PostStorageResponse403 , str]]
85
+ Response[Union[Error , str]]
83
86
"""
84
87
85
88
kwargs = _get_kwargs (
@@ -99,7 +102,7 @@ def sync(
99
102
* ,
100
103
client : Client ,
101
104
json_body : StorageDefinition ,
102
- ) -> Optional [Union [PostStorageResponse403 , str ]]:
105
+ ) -> Optional [Union [Error , str ]]:
103
106
"""Request a Storage operation
104
107
105
108
Args:
@@ -110,7 +113,7 @@ def sync(
110
113
httpx.TimeoutException: If the request takes longer than Client.timeout.
111
114
112
115
Returns:
113
- Response[Union[PostStorageResponse403 , str]]
116
+ Response[Union[Error , str]]
114
117
"""
115
118
116
119
return sync_detailed (
@@ -123,7 +126,7 @@ async def asyncio_detailed(
123
126
* ,
124
127
client : Client ,
125
128
json_body : StorageDefinition ,
126
- ) -> Response [Union [PostStorageResponse403 , str ]]:
129
+ ) -> Response [Union [Error , str ]]:
127
130
"""Request a Storage operation
128
131
129
132
Args:
@@ -134,7 +137,7 @@ async def asyncio_detailed(
134
137
httpx.TimeoutException: If the request takes longer than Client.timeout.
135
138
136
139
Returns:
137
- Response[Union[PostStorageResponse403 , str]]
140
+ Response[Union[Error , str]]
138
141
"""
139
142
140
143
kwargs = _get_kwargs (
@@ -152,7 +155,7 @@ async def asyncio(
152
155
* ,
153
156
client : Client ,
154
157
json_body : StorageDefinition ,
155
- ) -> Optional [Union [PostStorageResponse403 , str ]]:
158
+ ) -> Optional [Union [Error , str ]]:
156
159
"""Request a Storage operation
157
160
158
161
Args:
@@ -163,7 +166,7 @@ async def asyncio(
163
166
httpx.TimeoutException: If the request takes longer than Client.timeout.
164
167
165
168
Returns:
166
- Response[Union[PostStorageResponse403 , str]]
169
+ Response[Union[Error , str]]
167
170
"""
168
171
169
172
return (
0 commit comments