11from http import HTTPStatus
2- from typing import Any , Dict , Optional , Union , cast
2+ from typing import Any , Optional , Union , cast
33
44import httpx
55
66from ... import errors
7- from ...client import Client
7+ from ...client import AuthenticatedClient , Client
88from ...models .error_response import ErrorResponse
99from ...models .workflow_config_update_request import WorkflowConfigUpdateRequest
1010from ...types import Response
1111
1212
1313def _get_kwargs (
1414 * ,
15- client : Client ,
16- json_body : WorkflowConfigUpdateRequest ,
17- ) -> Dict [str , Any ]:
18- url = "{}/api/v1/workflow/config/update" .format (client .base_url )
15+ body : WorkflowConfigUpdateRequest ,
16+ ) -> dict [str , Any ]:
17+ headers : dict [str , Any ] = {}
1918
20- headers : Dict [str , str ] = client .get_headers ()
21- cookies : Dict [str , Any ] = client .get_cookies ()
22-
23- json_json_body = json_body .to_dict ()
24-
25- return {
19+ _kwargs : dict [str , Any ] = {
2620 "method" : "post" ,
27- "url" : url ,
28- "headers" : headers ,
29- "cookies" : cookies ,
30- "timeout" : client .get_timeout (),
31- "follow_redirects" : client .follow_redirects ,
32- "json" : json_json_body ,
21+ "url" : "/api/v1/workflow/config/update" ,
3322 }
3423
24+ _body = body .to_dict ()
25+
26+ _kwargs ["json" ] = _body
27+ headers ["Content-Type" ] = "application/json"
28+
29+ _kwargs ["headers" ] = headers
30+ return _kwargs
31+
3532
3633def _parse_response (
37- * , client : Client , response : httpx .Response
34+ * , client : Union [ AuthenticatedClient , Client ] , response : httpx .Response
3835) -> Optional [Union [Any , ErrorResponse ]]:
39- if response .status_code == HTTPStatus . OK :
36+ if response .status_code == 200 :
4037 response_200 = cast (Any , None )
4138 return response_200
42- if response .status_code == HTTPStatus . BAD_REQUEST :
39+ if response .status_code == 400 :
4340 response_400 = ErrorResponse .from_dict (response .json ())
4441
4542 return response_400
@@ -50,7 +47,7 @@ def _parse_response(
5047
5148
5249def _build_response (
53- * , client : Client , response : httpx .Response
50+ * , client : Union [ AuthenticatedClient , Client ] , response : httpx .Response
5451) -> Response [Union [Any , ErrorResponse ]]:
5552 return Response (
5653 status_code = HTTPStatus (response .status_code ),
@@ -62,13 +59,13 @@ def _build_response(
6259
6360def sync_detailed (
6461 * ,
65- client : Client ,
66- json_body : WorkflowConfigUpdateRequest ,
62+ client : Union [ AuthenticatedClient , Client ] ,
63+ body : WorkflowConfigUpdateRequest ,
6764) -> Response [Union [Any , ErrorResponse ]]:
6865 """update the config of a workflow
6966
7067 Args:
71- json_body (WorkflowConfigUpdateRequest):
68+ body (WorkflowConfigUpdateRequest):
7269
7370 Raises:
7471 errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@@ -79,12 +76,10 @@ def sync_detailed(
7976 """
8077
8178 kwargs = _get_kwargs (
82- client = client ,
83- json_body = json_body ,
79+ body = body ,
8480 )
8581
86- response = httpx .request (
87- verify = client .verify_ssl ,
82+ response = client .get_httpx_client ().request (
8883 ** kwargs ,
8984 )
9085
@@ -93,13 +88,13 @@ def sync_detailed(
9388
9489def sync (
9590 * ,
96- client : Client ,
97- json_body : WorkflowConfigUpdateRequest ,
91+ client : Union [ AuthenticatedClient , Client ] ,
92+ body : WorkflowConfigUpdateRequest ,
9893) -> Optional [Union [Any , ErrorResponse ]]:
9994 """update the config of a workflow
10095
10196 Args:
102- json_body (WorkflowConfigUpdateRequest):
97+ body (WorkflowConfigUpdateRequest):
10398
10499 Raises:
105100 errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@@ -111,19 +106,19 @@ def sync(
111106
112107 return sync_detailed (
113108 client = client ,
114- json_body = json_body ,
109+ body = body ,
115110 ).parsed
116111
117112
118113async def asyncio_detailed (
119114 * ,
120- client : Client ,
121- json_body : WorkflowConfigUpdateRequest ,
115+ client : Union [ AuthenticatedClient , Client ] ,
116+ body : WorkflowConfigUpdateRequest ,
122117) -> Response [Union [Any , ErrorResponse ]]:
123118 """update the config of a workflow
124119
125120 Args:
126- json_body (WorkflowConfigUpdateRequest):
121+ body (WorkflowConfigUpdateRequest):
127122
128123 Raises:
129124 errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@@ -134,25 +129,23 @@ async def asyncio_detailed(
134129 """
135130
136131 kwargs = _get_kwargs (
137- client = client ,
138- json_body = json_body ,
132+ body = body ,
139133 )
140134
141- async with httpx .AsyncClient (verify = client .verify_ssl ) as _client :
142- response = await _client .request (** kwargs )
135+ response = await client .get_async_httpx_client ().request (** kwargs )
143136
144137 return _build_response (client = client , response = response )
145138
146139
147140async def asyncio (
148141 * ,
149- client : Client ,
150- json_body : WorkflowConfigUpdateRequest ,
142+ client : Union [ AuthenticatedClient , Client ] ,
143+ body : WorkflowConfigUpdateRequest ,
151144) -> Optional [Union [Any , ErrorResponse ]]:
152145 """update the config of a workflow
153146
154147 Args:
155- json_body (WorkflowConfigUpdateRequest):
148+ body (WorkflowConfigUpdateRequest):
156149
157150 Raises:
158151 errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
@@ -165,6 +158,6 @@ async def asyncio(
165158 return (
166159 await asyncio_detailed (
167160 client = client ,
168- json_body = json_body ,
161+ body = body ,
169162 )
170163 ).parsed
0 commit comments