1
1
from http import HTTPStatus
2
- from typing import Any , Dict , Optional , Union
2
+ from typing import Any , Dict , Optional , Union , cast
3
3
4
4
import httpx
5
5
@@ -19,6 +19,8 @@ def _get_kwargs(
19
19
name : Union [Unset , None , str ] = UNSET ,
20
20
numrows : int ,
21
21
seed : Union [Unset , None , str ] = UNSET ,
22
+ create_datasource : Union [Unset , None , bool ] = UNSET ,
23
+ clear_if_exists : Union [Unset , None , bool ] = UNSET ,
22
24
) -> Dict [str , Any ]:
23
25
url = "{}/mock/dataset" .format (client .base_url )
24
26
@@ -36,6 +38,10 @@ def _get_kwargs(
36
38
37
39
params ["seed" ] = seed
38
40
41
+ params ["createDatasource" ] = create_datasource
42
+
43
+ params ["clearIfExists" ] = clear_if_exists
44
+
39
45
params = {k : v for k , v in params .items () if v is not UNSET and v is not None }
40
46
41
47
json_json_body = json_body
@@ -51,7 +57,10 @@ def _get_kwargs(
51
57
}
52
58
53
59
54
- def _parse_response (* , client : Client , response : httpx .Response ) -> Optional [Union [DataSource , Error ]]:
60
+ def _parse_response (* , client : Client , response : httpx .Response ) -> Optional [Union [Any , DataSource , Error ]]:
61
+ if response .status_code == HTTPStatus .OK :
62
+ response_200 = cast (Any , None )
63
+ return response_200
55
64
if response .status_code == HTTPStatus .CREATED :
56
65
response_201 = DataSource .from_dict (response .json ())
57
66
@@ -74,7 +83,7 @@ def _parse_response(*, client: Client, response: httpx.Response) -> Optional[Uni
74
83
return None
75
84
76
85
77
- def _build_response (* , client : Client , response : httpx .Response ) -> Response [Union [DataSource , Error ]]:
86
+ def _build_response (* , client : Client , response : httpx .Response ) -> Response [Union [Any , DataSource , Error ]]:
78
87
return Response (
79
88
status_code = HTTPStatus (response .status_code ),
80
89
content = response .content ,
@@ -91,22 +100,26 @@ def sync_detailed(
91
100
name : Union [Unset , None , str ] = UNSET ,
92
101
numrows : int ,
93
102
seed : Union [Unset , None , str ] = UNSET ,
94
- ) -> Response [Union [DataSource , Error ]]:
103
+ create_datasource : Union [Unset , None , bool ] = UNSET ,
104
+ clear_if_exists : Union [Unset , None , bool ] = UNSET ,
105
+ ) -> Response [Union [Any , DataSource , Error ]]:
95
106
"""Request the creation of a mock dataset.
96
107
97
108
Args:
98
109
method (PostMockDatasetMethod):
99
110
name (Union[Unset, None, str]):
100
111
numrows (int):
101
112
seed (Union[Unset, None, str]):
113
+ create_datasource (Union[Unset, None, bool]):
114
+ clear_if_exists (Union[Unset, None, bool]):
102
115
json_body (str):
103
116
104
117
Raises:
105
118
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
106
119
httpx.TimeoutException: If the request takes longer than Client.timeout.
107
120
108
121
Returns:
109
- Response[Union[DataSource, Error]]
122
+ Response[Union[Any, DataSource, Error]]
110
123
"""
111
124
112
125
kwargs = _get_kwargs (
@@ -116,6 +129,8 @@ def sync_detailed(
116
129
name = name ,
117
130
numrows = numrows ,
118
131
seed = seed ,
132
+ create_datasource = create_datasource ,
133
+ clear_if_exists = clear_if_exists ,
119
134
)
120
135
121
136
response = httpx .request (
@@ -134,22 +149,26 @@ def sync(
134
149
name : Union [Unset , None , str ] = UNSET ,
135
150
numrows : int ,
136
151
seed : Union [Unset , None , str ] = UNSET ,
137
- ) -> Optional [Union [DataSource , Error ]]:
152
+ create_datasource : Union [Unset , None , bool ] = UNSET ,
153
+ clear_if_exists : Union [Unset , None , bool ] = UNSET ,
154
+ ) -> Optional [Union [Any , DataSource , Error ]]:
138
155
"""Request the creation of a mock dataset.
139
156
140
157
Args:
141
158
method (PostMockDatasetMethod):
142
159
name (Union[Unset, None, str]):
143
160
numrows (int):
144
161
seed (Union[Unset, None, str]):
162
+ create_datasource (Union[Unset, None, bool]):
163
+ clear_if_exists (Union[Unset, None, bool]):
145
164
json_body (str):
146
165
147
166
Raises:
148
167
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
149
168
httpx.TimeoutException: If the request takes longer than Client.timeout.
150
169
151
170
Returns:
152
- Response[Union[DataSource, Error]]
171
+ Response[Union[Any, DataSource, Error]]
153
172
"""
154
173
155
174
return sync_detailed (
@@ -159,6 +178,8 @@ def sync(
159
178
name = name ,
160
179
numrows = numrows ,
161
180
seed = seed ,
181
+ create_datasource = create_datasource ,
182
+ clear_if_exists = clear_if_exists ,
162
183
).parsed
163
184
164
185
@@ -170,22 +191,26 @@ async def asyncio_detailed(
170
191
name : Union [Unset , None , str ] = UNSET ,
171
192
numrows : int ,
172
193
seed : Union [Unset , None , str ] = UNSET ,
173
- ) -> Response [Union [DataSource , Error ]]:
194
+ create_datasource : Union [Unset , None , bool ] = UNSET ,
195
+ clear_if_exists : Union [Unset , None , bool ] = UNSET ,
196
+ ) -> Response [Union [Any , DataSource , Error ]]:
174
197
"""Request the creation of a mock dataset.
175
198
176
199
Args:
177
200
method (PostMockDatasetMethod):
178
201
name (Union[Unset, None, str]):
179
202
numrows (int):
180
203
seed (Union[Unset, None, str]):
204
+ create_datasource (Union[Unset, None, bool]):
205
+ clear_if_exists (Union[Unset, None, bool]):
181
206
json_body (str):
182
207
183
208
Raises:
184
209
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
185
210
httpx.TimeoutException: If the request takes longer than Client.timeout.
186
211
187
212
Returns:
188
- Response[Union[DataSource, Error]]
213
+ Response[Union[Any, DataSource, Error]]
189
214
"""
190
215
191
216
kwargs = _get_kwargs (
@@ -195,6 +220,8 @@ async def asyncio_detailed(
195
220
name = name ,
196
221
numrows = numrows ,
197
222
seed = seed ,
223
+ create_datasource = create_datasource ,
224
+ clear_if_exists = clear_if_exists ,
198
225
)
199
226
200
227
async with httpx .AsyncClient (verify = client .verify_ssl ) as _client :
@@ -211,22 +238,26 @@ async def asyncio(
211
238
name : Union [Unset , None , str ] = UNSET ,
212
239
numrows : int ,
213
240
seed : Union [Unset , None , str ] = UNSET ,
214
- ) -> Optional [Union [DataSource , Error ]]:
241
+ create_datasource : Union [Unset , None , bool ] = UNSET ,
242
+ clear_if_exists : Union [Unset , None , bool ] = UNSET ,
243
+ ) -> Optional [Union [Any , DataSource , Error ]]:
215
244
"""Request the creation of a mock dataset.
216
245
217
246
Args:
218
247
method (PostMockDatasetMethod):
219
248
name (Union[Unset, None, str]):
220
249
numrows (int):
221
250
seed (Union[Unset, None, str]):
251
+ create_datasource (Union[Unset, None, bool]):
252
+ clear_if_exists (Union[Unset, None, bool]):
222
253
json_body (str):
223
254
224
255
Raises:
225
256
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
226
257
httpx.TimeoutException: If the request takes longer than Client.timeout.
227
258
228
259
Returns:
229
- Response[Union[DataSource, Error]]
260
+ Response[Union[Any, DataSource, Error]]
230
261
"""
231
262
232
263
return (
@@ -237,5 +268,7 @@ async def asyncio(
237
268
name = name ,
238
269
numrows = numrows ,
239
270
seed = seed ,
271
+ create_datasource = create_datasource ,
272
+ clear_if_exists = clear_if_exists ,
240
273
)
241
274
).parsed
0 commit comments