statuspro-openapi-client 0.1.0__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.
- statuspro_openapi_client-0.1.0.dist-info/METADATA +337 -0
- statuspro_openapi_client-0.1.0.dist-info/RECORD +74 -0
- statuspro_openapi_client-0.1.0.dist-info/WHEEL +4 -0
- statuspro_openapi_client-0.1.0.dist-info/entry_points.txt +3 -0
- statuspro_openapi_client-0.1.0.dist-info/licenses/LICENSE +21 -0
- statuspro_public_api_client/__init__.py +36 -0
- statuspro_public_api_client/_logging.py +33 -0
- statuspro_public_api_client/api/__init__.py +1 -0
- statuspro_public_api_client/api/orders/__init__.py +1 -0
- statuspro_public_api_client/api/orders/add_order_comment.py +215 -0
- statuspro_public_api_client/api/orders/bulk_update_order_status.py +194 -0
- statuspro_public_api_client/api/orders/get_order.py +188 -0
- statuspro_public_api_client/api/orders/get_viable_statuses.py +193 -0
- statuspro_public_api_client/api/orders/list_orders.py +366 -0
- statuspro_public_api_client/api/orders/lookup_order.py +208 -0
- statuspro_public_api_client/api/orders/set_order_due_date.py +215 -0
- statuspro_public_api_client/api/orders/update_order_status.py +215 -0
- statuspro_public_api_client/api/statuses/__init__.py +1 -0
- statuspro_public_api_client/api/statuses/get_statuses.py +161 -0
- statuspro_public_api_client/api_wrapper/__init__.py +15 -0
- statuspro_public_api_client/api_wrapper/_namespace.py +40 -0
- statuspro_public_api_client/api_wrapper/_registry.py +43 -0
- statuspro_public_api_client/api_wrapper/_resource.py +116 -0
- statuspro_public_api_client/client.py +267 -0
- statuspro_public_api_client/client_types.py +54 -0
- statuspro_public_api_client/domain/__init__.py +33 -0
- statuspro_public_api_client/domain/base.py +117 -0
- statuspro_public_api_client/domain/converters.py +71 -0
- statuspro_public_api_client/domain/order.py +87 -0
- statuspro_public_api_client/domain/status.py +30 -0
- statuspro_public_api_client/errors.py +16 -0
- statuspro_public_api_client/helpers/__init__.py +21 -0
- statuspro_public_api_client/helpers/base.py +26 -0
- statuspro_public_api_client/helpers/orders.py +78 -0
- statuspro_public_api_client/helpers/statuses.py +37 -0
- statuspro_public_api_client/log_setup.py +99 -0
- statuspro_public_api_client/models/__init__.py +53 -0
- statuspro_public_api_client/models/add_order_comment_request.py +68 -0
- statuspro_public_api_client/models/bulk_status_update_request.py +124 -0
- statuspro_public_api_client/models/bulk_status_update_response.py +72 -0
- statuspro_public_api_client/models/customer.py +74 -0
- statuspro_public_api_client/models/error_response.py +58 -0
- statuspro_public_api_client/models/history_item.py +171 -0
- statuspro_public_api_client/models/list_orders_financial_status_item.py +15 -0
- statuspro_public_api_client/models/list_orders_fulfillment_status_item.py +11 -0
- statuspro_public_api_client/models/locale_translation.py +66 -0
- statuspro_public_api_client/models/mail_log.py +82 -0
- statuspro_public_api_client/models/message_response.py +58 -0
- statuspro_public_api_client/models/order_list_item.py +180 -0
- statuspro_public_api_client/models/order_list_meta.py +120 -0
- statuspro_public_api_client/models/order_list_response.py +81 -0
- statuspro_public_api_client/models/order_response.py +220 -0
- statuspro_public_api_client/models/progress_timeline_item.py +93 -0
- statuspro_public_api_client/models/set_due_date_request.py +95 -0
- statuspro_public_api_client/models/status.py +190 -0
- statuspro_public_api_client/models/status_definition.py +82 -0
- statuspro_public_api_client/models/status_translations.py +62 -0
- statuspro_public_api_client/models/update_order_status_request.py +92 -0
- statuspro_public_api_client/models/validation_error_response.py +81 -0
- statuspro_public_api_client/models/validation_error_response_errors.py +54 -0
- statuspro_public_api_client/models/viable_status.py +82 -0
- statuspro_public_api_client/models_pydantic/__init__.py +122 -0
- statuspro_public_api_client/models_pydantic/_auto_registry.py +115 -0
- statuspro_public_api_client/models_pydantic/_base.py +349 -0
- statuspro_public_api_client/models_pydantic/_generated/__init__.py +53 -0
- statuspro_public_api_client/models_pydantic/_generated/errors.py +24 -0
- statuspro_public_api_client/models_pydantic/_generated/orders.py +136 -0
- statuspro_public_api_client/models_pydantic/_generated/statuses.py +25 -0
- statuspro_public_api_client/models_pydantic/_registry.py +171 -0
- statuspro_public_api_client/models_pydantic/converters.py +184 -0
- statuspro_public_api_client/py.typed +1 -0
- statuspro_public_api_client/statuspro-openapi.yaml +859 -0
- statuspro_public_api_client/statuspro_client.py +1156 -0
- statuspro_public_api_client/utils.py +290 -0
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
|
|
6
|
+
from ... import errors
|
|
7
|
+
from ...client import AuthenticatedClient, Client
|
|
8
|
+
from ...client_types import UNSET, Response
|
|
9
|
+
from ...models.error_response import ErrorResponse
|
|
10
|
+
from ...models.order_response import OrderResponse
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def _get_kwargs(
|
|
14
|
+
*,
|
|
15
|
+
number: str,
|
|
16
|
+
email: str,
|
|
17
|
+
) -> dict[str, Any]:
|
|
18
|
+
|
|
19
|
+
params: dict[str, Any] = {}
|
|
20
|
+
|
|
21
|
+
params["number"] = number
|
|
22
|
+
|
|
23
|
+
params["email"] = email
|
|
24
|
+
|
|
25
|
+
params = {k: v for k, v in params.items() if v is not UNSET and v is not None}
|
|
26
|
+
|
|
27
|
+
_kwargs: dict[str, Any] = {
|
|
28
|
+
"method": "get",
|
|
29
|
+
"url": "/orders/lookup",
|
|
30
|
+
"params": params,
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return _kwargs
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def _parse_response(
|
|
37
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
38
|
+
) -> ErrorResponse | OrderResponse | None:
|
|
39
|
+
if response.status_code == 200:
|
|
40
|
+
response_200 = OrderResponse.from_dict(response.json())
|
|
41
|
+
|
|
42
|
+
return response_200
|
|
43
|
+
|
|
44
|
+
if response.status_code == 400:
|
|
45
|
+
response_400 = ErrorResponse.from_dict(response.json())
|
|
46
|
+
|
|
47
|
+
return response_400
|
|
48
|
+
|
|
49
|
+
if response.status_code == 404:
|
|
50
|
+
response_404 = ErrorResponse.from_dict(response.json())
|
|
51
|
+
|
|
52
|
+
return response_404
|
|
53
|
+
|
|
54
|
+
if response.status_code == 429:
|
|
55
|
+
response_429 = ErrorResponse.from_dict(response.json())
|
|
56
|
+
|
|
57
|
+
return response_429
|
|
58
|
+
|
|
59
|
+
if response.status_code == 500:
|
|
60
|
+
response_500 = ErrorResponse.from_dict(response.json())
|
|
61
|
+
|
|
62
|
+
return response_500
|
|
63
|
+
|
|
64
|
+
if client.raise_on_unexpected_status:
|
|
65
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
66
|
+
else:
|
|
67
|
+
return None
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def _build_response(
|
|
71
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
72
|
+
) -> Response[ErrorResponse | OrderResponse]:
|
|
73
|
+
return Response(
|
|
74
|
+
status_code=HTTPStatus(response.status_code),
|
|
75
|
+
content=response.content,
|
|
76
|
+
headers=response.headers,
|
|
77
|
+
parsed=_parse_response(client=client, response=response),
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def sync_detailed(
|
|
82
|
+
*,
|
|
83
|
+
client: AuthenticatedClient | Client,
|
|
84
|
+
number: str,
|
|
85
|
+
email: str,
|
|
86
|
+
) -> Response[ErrorResponse | OrderResponse]:
|
|
87
|
+
"""Retrieve an order by order number and customer email
|
|
88
|
+
|
|
89
|
+
Limited to 60 requests per minute.
|
|
90
|
+
|
|
91
|
+
Args:
|
|
92
|
+
number (str):
|
|
93
|
+
email (str):
|
|
94
|
+
|
|
95
|
+
Raises:
|
|
96
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
97
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
Returns:
|
|
101
|
+
Response[ErrorResponse | OrderResponse]
|
|
102
|
+
"""
|
|
103
|
+
|
|
104
|
+
kwargs = _get_kwargs(
|
|
105
|
+
number=number,
|
|
106
|
+
email=email,
|
|
107
|
+
)
|
|
108
|
+
|
|
109
|
+
response = client.get_httpx_client().request(
|
|
110
|
+
**kwargs,
|
|
111
|
+
)
|
|
112
|
+
|
|
113
|
+
return _build_response(client=client, response=response)
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
def sync(
|
|
117
|
+
*,
|
|
118
|
+
client: AuthenticatedClient | Client,
|
|
119
|
+
number: str,
|
|
120
|
+
email: str,
|
|
121
|
+
) -> ErrorResponse | OrderResponse | None:
|
|
122
|
+
"""Retrieve an order by order number and customer email
|
|
123
|
+
|
|
124
|
+
Limited to 60 requests per minute.
|
|
125
|
+
|
|
126
|
+
Args:
|
|
127
|
+
number (str):
|
|
128
|
+
email (str):
|
|
129
|
+
|
|
130
|
+
Raises:
|
|
131
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
132
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
Returns:
|
|
136
|
+
ErrorResponse | OrderResponse
|
|
137
|
+
"""
|
|
138
|
+
|
|
139
|
+
return sync_detailed(
|
|
140
|
+
client=client,
|
|
141
|
+
number=number,
|
|
142
|
+
email=email,
|
|
143
|
+
).parsed
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
async def asyncio_detailed(
|
|
147
|
+
*,
|
|
148
|
+
client: AuthenticatedClient | Client,
|
|
149
|
+
number: str,
|
|
150
|
+
email: str,
|
|
151
|
+
) -> Response[ErrorResponse | OrderResponse]:
|
|
152
|
+
"""Retrieve an order by order number and customer email
|
|
153
|
+
|
|
154
|
+
Limited to 60 requests per minute.
|
|
155
|
+
|
|
156
|
+
Args:
|
|
157
|
+
number (str):
|
|
158
|
+
email (str):
|
|
159
|
+
|
|
160
|
+
Raises:
|
|
161
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
162
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
Returns:
|
|
166
|
+
Response[ErrorResponse | OrderResponse]
|
|
167
|
+
"""
|
|
168
|
+
|
|
169
|
+
kwargs = _get_kwargs(
|
|
170
|
+
number=number,
|
|
171
|
+
email=email,
|
|
172
|
+
)
|
|
173
|
+
|
|
174
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
175
|
+
|
|
176
|
+
return _build_response(client=client, response=response)
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
async def asyncio(
|
|
180
|
+
*,
|
|
181
|
+
client: AuthenticatedClient | Client,
|
|
182
|
+
number: str,
|
|
183
|
+
email: str,
|
|
184
|
+
) -> ErrorResponse | OrderResponse | None:
|
|
185
|
+
"""Retrieve an order by order number and customer email
|
|
186
|
+
|
|
187
|
+
Limited to 60 requests per minute.
|
|
188
|
+
|
|
189
|
+
Args:
|
|
190
|
+
number (str):
|
|
191
|
+
email (str):
|
|
192
|
+
|
|
193
|
+
Raises:
|
|
194
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
195
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
Returns:
|
|
199
|
+
ErrorResponse | OrderResponse
|
|
200
|
+
"""
|
|
201
|
+
|
|
202
|
+
return (
|
|
203
|
+
await asyncio_detailed(
|
|
204
|
+
client=client,
|
|
205
|
+
number=number,
|
|
206
|
+
email=email,
|
|
207
|
+
)
|
|
208
|
+
).parsed
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any
|
|
3
|
+
from urllib.parse import quote
|
|
4
|
+
|
|
5
|
+
import httpx
|
|
6
|
+
|
|
7
|
+
from ... import errors
|
|
8
|
+
from ...client import AuthenticatedClient, Client
|
|
9
|
+
from ...client_types import Response
|
|
10
|
+
from ...models.error_response import ErrorResponse
|
|
11
|
+
from ...models.message_response import MessageResponse
|
|
12
|
+
from ...models.set_due_date_request import SetDueDateRequest
|
|
13
|
+
from ...models.validation_error_response import ValidationErrorResponse
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def _get_kwargs(
|
|
17
|
+
order: int,
|
|
18
|
+
*,
|
|
19
|
+
body: SetDueDateRequest,
|
|
20
|
+
) -> dict[str, Any]:
|
|
21
|
+
headers: dict[str, Any] = {}
|
|
22
|
+
|
|
23
|
+
_kwargs: dict[str, Any] = {
|
|
24
|
+
"method": "post",
|
|
25
|
+
"url": "/orders/{order}/due-date".format(
|
|
26
|
+
order=quote(str(order), safe=""),
|
|
27
|
+
),
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
_kwargs["json"] = body.to_dict()
|
|
31
|
+
|
|
32
|
+
headers["Content-Type"] = "application/json"
|
|
33
|
+
|
|
34
|
+
_kwargs["headers"] = headers
|
|
35
|
+
return _kwargs
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def _parse_response(
|
|
39
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
40
|
+
) -> ErrorResponse | MessageResponse | ValidationErrorResponse | None:
|
|
41
|
+
if response.status_code == 200:
|
|
42
|
+
response_200 = MessageResponse.from_dict(response.json())
|
|
43
|
+
|
|
44
|
+
return response_200
|
|
45
|
+
|
|
46
|
+
if response.status_code == 400:
|
|
47
|
+
response_400 = ErrorResponse.from_dict(response.json())
|
|
48
|
+
|
|
49
|
+
return response_400
|
|
50
|
+
|
|
51
|
+
if response.status_code == 404:
|
|
52
|
+
response_404 = ErrorResponse.from_dict(response.json())
|
|
53
|
+
|
|
54
|
+
return response_404
|
|
55
|
+
|
|
56
|
+
if response.status_code == 422:
|
|
57
|
+
response_422 = ValidationErrorResponse.from_dict(response.json())
|
|
58
|
+
|
|
59
|
+
return response_422
|
|
60
|
+
|
|
61
|
+
if response.status_code == 429:
|
|
62
|
+
response_429 = ErrorResponse.from_dict(response.json())
|
|
63
|
+
|
|
64
|
+
return response_429
|
|
65
|
+
|
|
66
|
+
if response.status_code == 500:
|
|
67
|
+
response_500 = ErrorResponse.from_dict(response.json())
|
|
68
|
+
|
|
69
|
+
return response_500
|
|
70
|
+
|
|
71
|
+
if client.raise_on_unexpected_status:
|
|
72
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
73
|
+
else:
|
|
74
|
+
return None
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def _build_response(
|
|
78
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
79
|
+
) -> Response[ErrorResponse | MessageResponse | ValidationErrorResponse]:
|
|
80
|
+
return Response(
|
|
81
|
+
status_code=HTTPStatus(response.status_code),
|
|
82
|
+
content=response.content,
|
|
83
|
+
headers=response.headers,
|
|
84
|
+
parsed=_parse_response(client=client, response=response),
|
|
85
|
+
)
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
def sync_detailed(
|
|
89
|
+
order: int,
|
|
90
|
+
*,
|
|
91
|
+
client: AuthenticatedClient | Client,
|
|
92
|
+
body: SetDueDateRequest,
|
|
93
|
+
) -> Response[ErrorResponse | MessageResponse | ValidationErrorResponse]:
|
|
94
|
+
"""Set a due date on the order
|
|
95
|
+
|
|
96
|
+
Limited to 60 requests per minute.
|
|
97
|
+
|
|
98
|
+
Args:
|
|
99
|
+
order (int):
|
|
100
|
+
body (SetDueDateRequest):
|
|
101
|
+
|
|
102
|
+
Raises:
|
|
103
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
104
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
Returns:
|
|
108
|
+
Response[ErrorResponse | MessageResponse | ValidationErrorResponse]
|
|
109
|
+
"""
|
|
110
|
+
|
|
111
|
+
kwargs = _get_kwargs(
|
|
112
|
+
order=order,
|
|
113
|
+
body=body,
|
|
114
|
+
)
|
|
115
|
+
|
|
116
|
+
response = client.get_httpx_client().request(
|
|
117
|
+
**kwargs,
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
return _build_response(client=client, response=response)
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
def sync(
|
|
124
|
+
order: int,
|
|
125
|
+
*,
|
|
126
|
+
client: AuthenticatedClient | Client,
|
|
127
|
+
body: SetDueDateRequest,
|
|
128
|
+
) -> ErrorResponse | MessageResponse | ValidationErrorResponse | None:
|
|
129
|
+
"""Set a due date on the order
|
|
130
|
+
|
|
131
|
+
Limited to 60 requests per minute.
|
|
132
|
+
|
|
133
|
+
Args:
|
|
134
|
+
order (int):
|
|
135
|
+
body (SetDueDateRequest):
|
|
136
|
+
|
|
137
|
+
Raises:
|
|
138
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
139
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
Returns:
|
|
143
|
+
ErrorResponse | MessageResponse | ValidationErrorResponse
|
|
144
|
+
"""
|
|
145
|
+
|
|
146
|
+
return sync_detailed(
|
|
147
|
+
order=order,
|
|
148
|
+
client=client,
|
|
149
|
+
body=body,
|
|
150
|
+
).parsed
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
async def asyncio_detailed(
|
|
154
|
+
order: int,
|
|
155
|
+
*,
|
|
156
|
+
client: AuthenticatedClient | Client,
|
|
157
|
+
body: SetDueDateRequest,
|
|
158
|
+
) -> Response[ErrorResponse | MessageResponse | ValidationErrorResponse]:
|
|
159
|
+
"""Set a due date on the order
|
|
160
|
+
|
|
161
|
+
Limited to 60 requests per minute.
|
|
162
|
+
|
|
163
|
+
Args:
|
|
164
|
+
order (int):
|
|
165
|
+
body (SetDueDateRequest):
|
|
166
|
+
|
|
167
|
+
Raises:
|
|
168
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
169
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
Returns:
|
|
173
|
+
Response[ErrorResponse | MessageResponse | ValidationErrorResponse]
|
|
174
|
+
"""
|
|
175
|
+
|
|
176
|
+
kwargs = _get_kwargs(
|
|
177
|
+
order=order,
|
|
178
|
+
body=body,
|
|
179
|
+
)
|
|
180
|
+
|
|
181
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
182
|
+
|
|
183
|
+
return _build_response(client=client, response=response)
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
async def asyncio(
|
|
187
|
+
order: int,
|
|
188
|
+
*,
|
|
189
|
+
client: AuthenticatedClient | Client,
|
|
190
|
+
body: SetDueDateRequest,
|
|
191
|
+
) -> ErrorResponse | MessageResponse | ValidationErrorResponse | None:
|
|
192
|
+
"""Set a due date on the order
|
|
193
|
+
|
|
194
|
+
Limited to 60 requests per minute.
|
|
195
|
+
|
|
196
|
+
Args:
|
|
197
|
+
order (int):
|
|
198
|
+
body (SetDueDateRequest):
|
|
199
|
+
|
|
200
|
+
Raises:
|
|
201
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
202
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
Returns:
|
|
206
|
+
ErrorResponse | MessageResponse | ValidationErrorResponse
|
|
207
|
+
"""
|
|
208
|
+
|
|
209
|
+
return (
|
|
210
|
+
await asyncio_detailed(
|
|
211
|
+
order=order,
|
|
212
|
+
client=client,
|
|
213
|
+
body=body,
|
|
214
|
+
)
|
|
215
|
+
).parsed
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any
|
|
3
|
+
from urllib.parse import quote
|
|
4
|
+
|
|
5
|
+
import httpx
|
|
6
|
+
|
|
7
|
+
from ... import errors
|
|
8
|
+
from ...client import AuthenticatedClient, Client
|
|
9
|
+
from ...client_types import Response
|
|
10
|
+
from ...models.error_response import ErrorResponse
|
|
11
|
+
from ...models.message_response import MessageResponse
|
|
12
|
+
from ...models.update_order_status_request import UpdateOrderStatusRequest
|
|
13
|
+
from ...models.validation_error_response import ValidationErrorResponse
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def _get_kwargs(
|
|
17
|
+
order: int,
|
|
18
|
+
*,
|
|
19
|
+
body: UpdateOrderStatusRequest,
|
|
20
|
+
) -> dict[str, Any]:
|
|
21
|
+
headers: dict[str, Any] = {}
|
|
22
|
+
|
|
23
|
+
_kwargs: dict[str, Any] = {
|
|
24
|
+
"method": "post",
|
|
25
|
+
"url": "/orders/{order}/status".format(
|
|
26
|
+
order=quote(str(order), safe=""),
|
|
27
|
+
),
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
_kwargs["json"] = body.to_dict()
|
|
31
|
+
|
|
32
|
+
headers["Content-Type"] = "application/json"
|
|
33
|
+
|
|
34
|
+
_kwargs["headers"] = headers
|
|
35
|
+
return _kwargs
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def _parse_response(
|
|
39
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
40
|
+
) -> ErrorResponse | MessageResponse | ValidationErrorResponse | None:
|
|
41
|
+
if response.status_code == 200:
|
|
42
|
+
response_200 = MessageResponse.from_dict(response.json())
|
|
43
|
+
|
|
44
|
+
return response_200
|
|
45
|
+
|
|
46
|
+
if response.status_code == 400:
|
|
47
|
+
response_400 = ErrorResponse.from_dict(response.json())
|
|
48
|
+
|
|
49
|
+
return response_400
|
|
50
|
+
|
|
51
|
+
if response.status_code == 404:
|
|
52
|
+
response_404 = ErrorResponse.from_dict(response.json())
|
|
53
|
+
|
|
54
|
+
return response_404
|
|
55
|
+
|
|
56
|
+
if response.status_code == 422:
|
|
57
|
+
response_422 = ValidationErrorResponse.from_dict(response.json())
|
|
58
|
+
|
|
59
|
+
return response_422
|
|
60
|
+
|
|
61
|
+
if response.status_code == 429:
|
|
62
|
+
response_429 = ErrorResponse.from_dict(response.json())
|
|
63
|
+
|
|
64
|
+
return response_429
|
|
65
|
+
|
|
66
|
+
if response.status_code == 500:
|
|
67
|
+
response_500 = ErrorResponse.from_dict(response.json())
|
|
68
|
+
|
|
69
|
+
return response_500
|
|
70
|
+
|
|
71
|
+
if client.raise_on_unexpected_status:
|
|
72
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
73
|
+
else:
|
|
74
|
+
return None
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def _build_response(
|
|
78
|
+
*, client: AuthenticatedClient | Client, response: httpx.Response
|
|
79
|
+
) -> Response[ErrorResponse | MessageResponse | ValidationErrorResponse]:
|
|
80
|
+
return Response(
|
|
81
|
+
status_code=HTTPStatus(response.status_code),
|
|
82
|
+
content=response.content,
|
|
83
|
+
headers=response.headers,
|
|
84
|
+
parsed=_parse_response(client=client, response=response),
|
|
85
|
+
)
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
def sync_detailed(
|
|
89
|
+
order: int,
|
|
90
|
+
*,
|
|
91
|
+
client: AuthenticatedClient | Client,
|
|
92
|
+
body: UpdateOrderStatusRequest,
|
|
93
|
+
) -> Response[ErrorResponse | MessageResponse | ValidationErrorResponse]:
|
|
94
|
+
"""Update an order status
|
|
95
|
+
|
|
96
|
+
Limited to 60 requests per minute.
|
|
97
|
+
|
|
98
|
+
Args:
|
|
99
|
+
order (int):
|
|
100
|
+
body (UpdateOrderStatusRequest):
|
|
101
|
+
|
|
102
|
+
Raises:
|
|
103
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
104
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
Returns:
|
|
108
|
+
Response[ErrorResponse | MessageResponse | ValidationErrorResponse]
|
|
109
|
+
"""
|
|
110
|
+
|
|
111
|
+
kwargs = _get_kwargs(
|
|
112
|
+
order=order,
|
|
113
|
+
body=body,
|
|
114
|
+
)
|
|
115
|
+
|
|
116
|
+
response = client.get_httpx_client().request(
|
|
117
|
+
**kwargs,
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
return _build_response(client=client, response=response)
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
def sync(
|
|
124
|
+
order: int,
|
|
125
|
+
*,
|
|
126
|
+
client: AuthenticatedClient | Client,
|
|
127
|
+
body: UpdateOrderStatusRequest,
|
|
128
|
+
) -> ErrorResponse | MessageResponse | ValidationErrorResponse | None:
|
|
129
|
+
"""Update an order status
|
|
130
|
+
|
|
131
|
+
Limited to 60 requests per minute.
|
|
132
|
+
|
|
133
|
+
Args:
|
|
134
|
+
order (int):
|
|
135
|
+
body (UpdateOrderStatusRequest):
|
|
136
|
+
|
|
137
|
+
Raises:
|
|
138
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
139
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
Returns:
|
|
143
|
+
ErrorResponse | MessageResponse | ValidationErrorResponse
|
|
144
|
+
"""
|
|
145
|
+
|
|
146
|
+
return sync_detailed(
|
|
147
|
+
order=order,
|
|
148
|
+
client=client,
|
|
149
|
+
body=body,
|
|
150
|
+
).parsed
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
async def asyncio_detailed(
|
|
154
|
+
order: int,
|
|
155
|
+
*,
|
|
156
|
+
client: AuthenticatedClient | Client,
|
|
157
|
+
body: UpdateOrderStatusRequest,
|
|
158
|
+
) -> Response[ErrorResponse | MessageResponse | ValidationErrorResponse]:
|
|
159
|
+
"""Update an order status
|
|
160
|
+
|
|
161
|
+
Limited to 60 requests per minute.
|
|
162
|
+
|
|
163
|
+
Args:
|
|
164
|
+
order (int):
|
|
165
|
+
body (UpdateOrderStatusRequest):
|
|
166
|
+
|
|
167
|
+
Raises:
|
|
168
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
169
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
Returns:
|
|
173
|
+
Response[ErrorResponse | MessageResponse | ValidationErrorResponse]
|
|
174
|
+
"""
|
|
175
|
+
|
|
176
|
+
kwargs = _get_kwargs(
|
|
177
|
+
order=order,
|
|
178
|
+
body=body,
|
|
179
|
+
)
|
|
180
|
+
|
|
181
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
182
|
+
|
|
183
|
+
return _build_response(client=client, response=response)
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
async def asyncio(
|
|
187
|
+
order: int,
|
|
188
|
+
*,
|
|
189
|
+
client: AuthenticatedClient | Client,
|
|
190
|
+
body: UpdateOrderStatusRequest,
|
|
191
|
+
) -> ErrorResponse | MessageResponse | ValidationErrorResponse | None:
|
|
192
|
+
"""Update an order status
|
|
193
|
+
|
|
194
|
+
Limited to 60 requests per minute.
|
|
195
|
+
|
|
196
|
+
Args:
|
|
197
|
+
order (int):
|
|
198
|
+
body (UpdateOrderStatusRequest):
|
|
199
|
+
|
|
200
|
+
Raises:
|
|
201
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
202
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
Returns:
|
|
206
|
+
ErrorResponse | MessageResponse | ValidationErrorResponse
|
|
207
|
+
"""
|
|
208
|
+
|
|
209
|
+
return (
|
|
210
|
+
await asyncio_detailed(
|
|
211
|
+
order=order,
|
|
212
|
+
client=client,
|
|
213
|
+
body=body,
|
|
214
|
+
)
|
|
215
|
+
).parsed
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Contains endpoint functions for accessing the API"""
|