@@ -9,11 +9,31 @@ def post_model_request(
99 * ,
1010 client : Any ,
1111 route_path : str ,
12- data : Dict [str , Any ],
12+ data : Optional [ Dict [str , Any ] ],
1313 files : Optional [Dict [str , Any ]] = None ,
1414 model : Type [T ],
1515 operation_name : str ,
1616) -> T :
17+ response_data = post_model_response_data (
18+ client = client ,
19+ route_path = route_path ,
20+ data = data ,
21+ files = files ,
22+ )
23+ return parse_response_model (
24+ response_data ,
25+ model = model ,
26+ operation_name = operation_name ,
27+ )
28+
29+
30+ def post_model_response_data (
31+ * ,
32+ client : Any ,
33+ route_path : str ,
34+ data : Optional [Dict [str , Any ]],
35+ files : Optional [Dict [str , Any ]] = None ,
36+ ) -> Any :
1737 if files is None :
1838 response = client .transport .post (
1939 client ._build_url (route_path ),
@@ -25,11 +45,7 @@ def post_model_request(
2545 data = data ,
2646 files = files ,
2747 )
28- return parse_response_model (
29- response .data ,
30- model = model ,
31- operation_name = operation_name ,
32- )
48+ return response .data
3349
3450
3551def get_model_request (
@@ -58,11 +74,17 @@ def get_model_response_data(
5874 params : Optional [Dict [str , Any ]] = None ,
5975 follow_redirects : bool = False ,
6076) -> Any :
61- response = client .transport .get (
62- client ._build_url (route_path ),
63- params = params ,
64- follow_redirects = follow_redirects ,
65- )
77+ if follow_redirects :
78+ response = client .transport .get (
79+ client ._build_url (route_path ),
80+ params = params ,
81+ follow_redirects = True ,
82+ )
83+ else :
84+ response = client .transport .get (
85+ client ._build_url (route_path ),
86+ params = params ,
87+ )
6688 return response .data
6789
6890
@@ -91,26 +113,60 @@ def put_model_request(
91113 model : Type [T ],
92114 operation_name : str ,
93115) -> T :
94- response = client .transport .put (
95- client ._build_url (route_path ),
116+ response_data = put_model_response_data (
117+ client = client ,
118+ route_path = route_path ,
96119 data = data ,
97120 )
98121 return parse_response_model (
99- response . data ,
122+ response_data ,
100123 model = model ,
101124 operation_name = operation_name ,
102125 )
103126
104127
128+ def put_model_response_data (
129+ * ,
130+ client : Any ,
131+ route_path : str ,
132+ data : Optional [Dict [str , Any ]],
133+ ) -> Any :
134+ response = client .transport .put (
135+ client ._build_url (route_path ),
136+ data = data ,
137+ )
138+ return response .data
139+
140+
105141async def post_model_request_async (
106142 * ,
107143 client : Any ,
108144 route_path : str ,
109- data : Dict [str , Any ],
145+ data : Optional [ Dict [str , Any ] ],
110146 files : Optional [Dict [str , Any ]] = None ,
111147 model : Type [T ],
112148 operation_name : str ,
113149) -> T :
150+ response_data = await post_model_response_data_async (
151+ client = client ,
152+ route_path = route_path ,
153+ data = data ,
154+ files = files ,
155+ )
156+ return parse_response_model (
157+ response_data ,
158+ model = model ,
159+ operation_name = operation_name ,
160+ )
161+
162+
163+ async def post_model_response_data_async (
164+ * ,
165+ client : Any ,
166+ route_path : str ,
167+ data : Optional [Dict [str , Any ]],
168+ files : Optional [Dict [str , Any ]] = None ,
169+ ) -> Any :
114170 if files is None :
115171 response = await client .transport .post (
116172 client ._build_url (route_path ),
@@ -122,11 +178,7 @@ async def post_model_request_async(
122178 data = data ,
123179 files = files ,
124180 )
125- return parse_response_model (
126- response .data ,
127- model = model ,
128- operation_name = operation_name ,
129- )
181+ return response .data
130182
131183
132184async def get_model_request_async (
@@ -155,11 +207,17 @@ async def get_model_response_data_async(
155207 params : Optional [Dict [str , Any ]] = None ,
156208 follow_redirects : bool = False ,
157209) -> Any :
158- response = await client .transport .get (
159- client ._build_url (route_path ),
160- params = params ,
161- follow_redirects = follow_redirects ,
162- )
210+ if follow_redirects :
211+ response = await client .transport .get (
212+ client ._build_url (route_path ),
213+ params = params ,
214+ follow_redirects = True ,
215+ )
216+ else :
217+ response = await client .transport .get (
218+ client ._build_url (route_path ),
219+ params = params ,
220+ )
163221 return response .data
164222
165223
@@ -188,17 +246,31 @@ async def put_model_request_async(
188246 model : Type [T ],
189247 operation_name : str ,
190248) -> T :
191- response = await client .transport .put (
192- client ._build_url (route_path ),
249+ response_data = await put_model_response_data_async (
250+ client = client ,
251+ route_path = route_path ,
193252 data = data ,
194253 )
195254 return parse_response_model (
196- response . data ,
255+ response_data ,
197256 model = model ,
198257 operation_name = operation_name ,
199258 )
200259
201260
261+ async def put_model_response_data_async (
262+ * ,
263+ client : Any ,
264+ route_path : str ,
265+ data : Optional [Dict [str , Any ]],
266+ ) -> Any :
267+ response = await client .transport .put (
268+ client ._build_url (route_path ),
269+ data = data ,
270+ )
271+ return response .data
272+
273+
202274def post_model_request_to_endpoint (
203275 * ,
204276 client : Any ,
0 commit comments