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,349 @@
|
|
|
1
|
+
"""Base class for StatusPro Pydantic models with attrs conversion support.
|
|
2
|
+
|
|
3
|
+
This module provides the base class that all generated Pydantic models inherit from,
|
|
4
|
+
enabling bi-directional conversion between attrs models (used by the API transport layer)
|
|
5
|
+
and Pydantic models (for validation, serialization, and user-facing operations).
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
import datetime
|
|
11
|
+
import enum
|
|
12
|
+
from collections.abc import Callable, Iterable
|
|
13
|
+
from typing import TYPE_CHECKING, Any, ClassVar, TypeVar, cast, get_args, get_origin
|
|
14
|
+
|
|
15
|
+
from pydantic import BaseModel, ConfigDict
|
|
16
|
+
|
|
17
|
+
if TYPE_CHECKING:
|
|
18
|
+
pass
|
|
19
|
+
|
|
20
|
+
T = TypeVar("T", bound="StatusProPydanticBase")
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def _is_unset(value: Any) -> bool:
|
|
24
|
+
"""Check if a value is the UNSET sentinel.
|
|
25
|
+
|
|
26
|
+
The attrs models use an Unset class instance as a sentinel for
|
|
27
|
+
fields that were not provided in the API response.
|
|
28
|
+
"""
|
|
29
|
+
return type(value).__name__ == "Unset"
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def _get_unset() -> Any:
|
|
33
|
+
"""Get the UNSET sentinel value from client_types."""
|
|
34
|
+
from ..client_types import UNSET
|
|
35
|
+
|
|
36
|
+
return UNSET
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
class StatusProPydanticBase(BaseModel):
|
|
40
|
+
"""Base class for all generated Pydantic models.
|
|
41
|
+
|
|
42
|
+
This base class provides:
|
|
43
|
+
- Immutable (frozen) models for data integrity
|
|
44
|
+
- Strict validation that forbids extra fields (request models)
|
|
45
|
+
- BaseEntity overrides with extra="ignore" for API response tolerance
|
|
46
|
+
- Bi-directional conversion with attrs models
|
|
47
|
+
|
|
48
|
+
Example:
|
|
49
|
+
```python
|
|
50
|
+
from statuspro_public_api_client.models import Product as AttrsProduct
|
|
51
|
+
from statuspro_public_api_client.models_pydantic import (
|
|
52
|
+
Product as PydanticProduct,
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
# Convert attrs -> pydantic
|
|
56
|
+
attrs_product = await get_product(client, 123)
|
|
57
|
+
pydantic_product = PydanticProduct.from_attrs(attrs_product)
|
|
58
|
+
|
|
59
|
+
# Convert pydantic -> attrs (for API calls)
|
|
60
|
+
attrs_product = pydantic_product.to_attrs()
|
|
61
|
+
```
|
|
62
|
+
"""
|
|
63
|
+
|
|
64
|
+
model_config = ConfigDict(
|
|
65
|
+
frozen=True,
|
|
66
|
+
validate_assignment=True,
|
|
67
|
+
extra="forbid",
|
|
68
|
+
# Use enum values for serialization
|
|
69
|
+
use_enum_values=False,
|
|
70
|
+
# Validate default values
|
|
71
|
+
validate_default=True,
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
# Class variable to store the corresponding attrs model class
|
|
75
|
+
# This is set by the registry after model generation
|
|
76
|
+
_attrs_model: ClassVar[type | None] = None
|
|
77
|
+
|
|
78
|
+
@classmethod
|
|
79
|
+
def from_attrs(cls: type[T], attrs_obj: Any) -> T:
|
|
80
|
+
"""Convert an attrs model instance to this Pydantic model.
|
|
81
|
+
|
|
82
|
+
Handles:
|
|
83
|
+
- UNSET sentinel -> None conversion
|
|
84
|
+
- Nested object conversion (via registry lookup)
|
|
85
|
+
- Enum value extraction
|
|
86
|
+
- Field name mapping (type_ -> type)
|
|
87
|
+
|
|
88
|
+
Args:
|
|
89
|
+
attrs_obj: An instance of the corresponding attrs model.
|
|
90
|
+
|
|
91
|
+
Returns:
|
|
92
|
+
A new instance of this Pydantic model.
|
|
93
|
+
|
|
94
|
+
Raises:
|
|
95
|
+
ValueError: If attrs_obj is None or type doesn't match expected.
|
|
96
|
+
"""
|
|
97
|
+
from . import _registry
|
|
98
|
+
|
|
99
|
+
if attrs_obj is None:
|
|
100
|
+
msg = f"Cannot convert None to {cls.__name__}"
|
|
101
|
+
raise ValueError(msg)
|
|
102
|
+
|
|
103
|
+
# Extract field values from attrs object
|
|
104
|
+
data: dict[str, Any] = {}
|
|
105
|
+
|
|
106
|
+
# Get the attrs object's fields
|
|
107
|
+
if hasattr(attrs_obj, "__attrs_attrs__"):
|
|
108
|
+
field_names = [attr.name for attr in attrs_obj.__attrs_attrs__]
|
|
109
|
+
else:
|
|
110
|
+
# Fallback: use __dict__ for non-attrs objects
|
|
111
|
+
field_names = list(vars(attrs_obj).keys())
|
|
112
|
+
|
|
113
|
+
for field_name in field_names:
|
|
114
|
+
value = getattr(attrs_obj, field_name)
|
|
115
|
+
|
|
116
|
+
# Skip additional_properties field (handled separately)
|
|
117
|
+
if field_name == "additional_properties":
|
|
118
|
+
continue
|
|
119
|
+
|
|
120
|
+
# Convert UNSET -> None
|
|
121
|
+
if _is_unset(value):
|
|
122
|
+
value = None
|
|
123
|
+
elif isinstance(value, list):
|
|
124
|
+
# Handle lists of nested objects
|
|
125
|
+
value = [_convert_nested_value(item, _registry) for item in value]
|
|
126
|
+
elif isinstance(value, dict) and field_name != "additional_properties":
|
|
127
|
+
# Handle dict values (but not additional_properties)
|
|
128
|
+
value = {
|
|
129
|
+
k: _convert_nested_value(v, _registry) for k, v in value.items()
|
|
130
|
+
}
|
|
131
|
+
else:
|
|
132
|
+
value = _convert_nested_value(value, _registry)
|
|
133
|
+
|
|
134
|
+
# Map field names (type_ -> type for pydantic)
|
|
135
|
+
pydantic_field_name = field_name
|
|
136
|
+
if field_name.endswith("_") and not field_name.startswith("_"):
|
|
137
|
+
# Remove trailing underscore for pydantic field
|
|
138
|
+
pydantic_field_name = field_name[:-1]
|
|
139
|
+
|
|
140
|
+
data[pydantic_field_name] = value
|
|
141
|
+
|
|
142
|
+
return cls.model_validate(data)
|
|
143
|
+
|
|
144
|
+
def to_attrs(self) -> Any:
|
|
145
|
+
"""Convert this Pydantic model to the corresponding attrs model.
|
|
146
|
+
|
|
147
|
+
Handles:
|
|
148
|
+
- None -> UNSET conversion (where appropriate based on attrs field types)
|
|
149
|
+
- Nested object conversion (via registry lookup)
|
|
150
|
+
- Enum reconstruction from values
|
|
151
|
+
- Field name mapping (type -> type_)
|
|
152
|
+
|
|
153
|
+
Returns:
|
|
154
|
+
An instance of the corresponding attrs model.
|
|
155
|
+
|
|
156
|
+
Raises:
|
|
157
|
+
RuntimeError: If no attrs model is registered for this class.
|
|
158
|
+
"""
|
|
159
|
+
from . import _registry
|
|
160
|
+
|
|
161
|
+
attrs_class = _registry.get_attrs_class(type(self))
|
|
162
|
+
if attrs_class is None:
|
|
163
|
+
msg = f"No attrs model registered for {type(self).__name__}"
|
|
164
|
+
raise RuntimeError(msg)
|
|
165
|
+
|
|
166
|
+
# Get UNSET sentinel
|
|
167
|
+
unset = _get_unset()
|
|
168
|
+
|
|
169
|
+
# Build kwargs for attrs constructor
|
|
170
|
+
kwargs: dict[str, Any] = {}
|
|
171
|
+
|
|
172
|
+
# Get attrs field info to know which fields accept UNSET
|
|
173
|
+
attrs_fields: dict[str, Any] = {}
|
|
174
|
+
if hasattr(attrs_class, "__attrs_attrs__"):
|
|
175
|
+
attrs_attrs = cast(Iterable[Any], attrs_class.__attrs_attrs__)
|
|
176
|
+
for attr in attrs_attrs:
|
|
177
|
+
attrs_fields[attr.name] = attr
|
|
178
|
+
|
|
179
|
+
for field_name, field_value in self.model_dump().items():
|
|
180
|
+
# Map field names (type -> type_ for attrs)
|
|
181
|
+
attrs_field_name = field_name
|
|
182
|
+
# Check if attrs model uses trailing underscore (skip private fields)
|
|
183
|
+
if not field_name.startswith("_") and f"{field_name}_" in attrs_fields:
|
|
184
|
+
attrs_field_name = f"{field_name}_"
|
|
185
|
+
|
|
186
|
+
# Convert None -> UNSET where the attrs field type includes Unset
|
|
187
|
+
converted_value = field_value
|
|
188
|
+
if field_value is None and attrs_field_name in attrs_fields:
|
|
189
|
+
# Check if the field type includes Unset
|
|
190
|
+
attr_info = attrs_fields[attrs_field_name]
|
|
191
|
+
type_hint = attr_info.type if hasattr(attr_info, "type") else None
|
|
192
|
+
if type_hint is not None and "Unset" in str(type_hint):
|
|
193
|
+
converted_value = unset
|
|
194
|
+
|
|
195
|
+
# Handle nested objects
|
|
196
|
+
if isinstance(converted_value, dict):
|
|
197
|
+
# Try to find the corresponding attrs class for nested objects
|
|
198
|
+
nested_pydantic_class = _get_field_type(type(self), field_name)
|
|
199
|
+
if nested_pydantic_class and issubclass(
|
|
200
|
+
nested_pydantic_class, StatusProPydanticBase
|
|
201
|
+
):
|
|
202
|
+
nested_attrs_class = _registry.get_attrs_class(
|
|
203
|
+
nested_pydantic_class
|
|
204
|
+
)
|
|
205
|
+
if nested_attrs_class and hasattr(nested_attrs_class, "from_dict"):
|
|
206
|
+
from_dict_fn = cast(
|
|
207
|
+
Callable[[dict[str, Any]], Any],
|
|
208
|
+
nested_attrs_class.from_dict,
|
|
209
|
+
)
|
|
210
|
+
converted_value = from_dict_fn(converted_value)
|
|
211
|
+
elif isinstance(converted_value, list):
|
|
212
|
+
# Handle lists of nested objects
|
|
213
|
+
new_list = []
|
|
214
|
+
for item in converted_value:
|
|
215
|
+
if isinstance(item, dict):
|
|
216
|
+
# We'd need more type info to convert dicts in lists properly
|
|
217
|
+
new_list.append(item)
|
|
218
|
+
else:
|
|
219
|
+
new_list.append(
|
|
220
|
+
_convert_to_attrs_value(item, _registry, attrs_fields, None)
|
|
221
|
+
)
|
|
222
|
+
converted_value = new_list
|
|
223
|
+
else:
|
|
224
|
+
converted_value = _convert_to_attrs_value(
|
|
225
|
+
converted_value, _registry, attrs_fields, attrs_field_name
|
|
226
|
+
)
|
|
227
|
+
|
|
228
|
+
kwargs[attrs_field_name] = converted_value
|
|
229
|
+
|
|
230
|
+
return attrs_class(**kwargs)
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
def _convert_nested_value(value: Any, registry: Any) -> Any:
|
|
234
|
+
"""Convert a nested value from attrs to pydantic representation.
|
|
235
|
+
|
|
236
|
+
Args:
|
|
237
|
+
value: The value to convert.
|
|
238
|
+
registry: The model registry module.
|
|
239
|
+
|
|
240
|
+
Returns:
|
|
241
|
+
The converted value suitable for a Pydantic model.
|
|
242
|
+
|
|
243
|
+
Note:
|
|
244
|
+
If an attrs object is not registered in the registry, a warning is logged
|
|
245
|
+
and the original attrs object is returned as-is. This may cause issues
|
|
246
|
+
with Pydantic validation.
|
|
247
|
+
"""
|
|
248
|
+
import logging
|
|
249
|
+
|
|
250
|
+
if value is None:
|
|
251
|
+
return None
|
|
252
|
+
|
|
253
|
+
if _is_unset(value):
|
|
254
|
+
return None
|
|
255
|
+
|
|
256
|
+
# Handle enums - extract the value
|
|
257
|
+
if isinstance(value, enum.Enum):
|
|
258
|
+
return value.value
|
|
259
|
+
|
|
260
|
+
# Handle datetime objects
|
|
261
|
+
if isinstance(value, datetime.datetime):
|
|
262
|
+
return value
|
|
263
|
+
|
|
264
|
+
# Handle datetime.date objects
|
|
265
|
+
if isinstance(value, datetime.date):
|
|
266
|
+
return value
|
|
267
|
+
|
|
268
|
+
# Handle nested attrs objects
|
|
269
|
+
if hasattr(value, "__attrs_attrs__"):
|
|
270
|
+
pydantic_class = registry.get_pydantic_class(type(value))
|
|
271
|
+
if pydantic_class:
|
|
272
|
+
return pydantic_class.from_attrs(value)
|
|
273
|
+
# Warn about unregistered attrs classes
|
|
274
|
+
logger = logging.getLogger(__name__)
|
|
275
|
+
logger.warning(
|
|
276
|
+
"Nested attrs class %s is not registered in the pydantic registry. "
|
|
277
|
+
"Conversion may fail or produce unexpected results.",
|
|
278
|
+
type(value).__name__,
|
|
279
|
+
)
|
|
280
|
+
|
|
281
|
+
return value
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
def _convert_to_attrs_value(
|
|
285
|
+
value: Any,
|
|
286
|
+
registry: Any,
|
|
287
|
+
attrs_fields: dict[str, Any],
|
|
288
|
+
field_name: str | None,
|
|
289
|
+
) -> Any:
|
|
290
|
+
"""Convert a value from pydantic to attrs representation."""
|
|
291
|
+
if value is None:
|
|
292
|
+
return value
|
|
293
|
+
|
|
294
|
+
# Handle pydantic models -> attrs models
|
|
295
|
+
if isinstance(value, StatusProPydanticBase):
|
|
296
|
+
return value.to_attrs()
|
|
297
|
+
|
|
298
|
+
# Handle enums - the attrs model expects enum instances
|
|
299
|
+
if isinstance(value, str) and field_name and field_name in attrs_fields:
|
|
300
|
+
attr_info = attrs_fields[field_name]
|
|
301
|
+
type_hint = attr_info.type if hasattr(attr_info, "type") else None
|
|
302
|
+
# Try to reconstruct enum from string value
|
|
303
|
+
if type_hint:
|
|
304
|
+
enum_class = _extract_enum_class(type_hint)
|
|
305
|
+
if enum_class:
|
|
306
|
+
try:
|
|
307
|
+
return enum_class(value)
|
|
308
|
+
except ValueError:
|
|
309
|
+
pass
|
|
310
|
+
|
|
311
|
+
return value
|
|
312
|
+
|
|
313
|
+
|
|
314
|
+
def _extract_enum_class(type_hint: Any) -> type[enum.Enum] | None:
|
|
315
|
+
"""Extract an enum class from a type hint."""
|
|
316
|
+
# Handle Union types
|
|
317
|
+
origin = get_origin(type_hint)
|
|
318
|
+
if origin is not None:
|
|
319
|
+
args = get_args(type_hint)
|
|
320
|
+
for arg in args:
|
|
321
|
+
result = _extract_enum_class(arg)
|
|
322
|
+
if result:
|
|
323
|
+
return result
|
|
324
|
+
return None
|
|
325
|
+
|
|
326
|
+
# Check if it's an enum class
|
|
327
|
+
if isinstance(type_hint, type) and issubclass(type_hint, enum.Enum):
|
|
328
|
+
return type_hint
|
|
329
|
+
|
|
330
|
+
return None
|
|
331
|
+
|
|
332
|
+
|
|
333
|
+
def _get_field_type(
|
|
334
|
+
model_class: type[StatusProPydanticBase], field_name: str
|
|
335
|
+
) -> type | None:
|
|
336
|
+
"""Get the type of a field from a pydantic model class."""
|
|
337
|
+
if field_name in model_class.model_fields:
|
|
338
|
+
field_info = model_class.model_fields[field_name]
|
|
339
|
+
annotation = field_info.annotation
|
|
340
|
+
if annotation:
|
|
341
|
+
# Handle Optional types
|
|
342
|
+
origin = get_origin(annotation)
|
|
343
|
+
if origin is not None:
|
|
344
|
+
args = get_args(annotation)
|
|
345
|
+
for arg in args:
|
|
346
|
+
if arg is not type(None):
|
|
347
|
+
return arg
|
|
348
|
+
return annotation
|
|
349
|
+
return None
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"""Auto-generated Pydantic models from OpenAPI specification.
|
|
2
|
+
|
|
3
|
+
DO NOT EDIT - This file is generated by scripts/generate_pydantic_models.py
|
|
4
|
+
|
|
5
|
+
The models in this package mirror the attrs models in statuspro_public_api_client/models/
|
|
6
|
+
but use Pydantic v2 for validation and serialization.
|
|
7
|
+
|
|
8
|
+
To regenerate these models, run:
|
|
9
|
+
uv run poe generate-pydantic
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
from .errors import ErrorResponse, MessageResponse, ValidationErrorResponse
|
|
13
|
+
from .orders import (
|
|
14
|
+
AddOrderCommentRequest,
|
|
15
|
+
BulkStatusUpdateRequest,
|
|
16
|
+
BulkStatusUpdateResponse,
|
|
17
|
+
Customer,
|
|
18
|
+
HistoryItem,
|
|
19
|
+
LocaleTranslation,
|
|
20
|
+
MailLog,
|
|
21
|
+
OrderListItem,
|
|
22
|
+
OrderListMeta,
|
|
23
|
+
OrderListResponse,
|
|
24
|
+
OrderResponse,
|
|
25
|
+
ProgressTimelineItem,
|
|
26
|
+
SetDueDateRequest,
|
|
27
|
+
Status,
|
|
28
|
+
UpdateOrderStatusRequest,
|
|
29
|
+
)
|
|
30
|
+
from .statuses import StatusDefinition, ViableStatus
|
|
31
|
+
|
|
32
|
+
__all__ = [
|
|
33
|
+
"AddOrderCommentRequest",
|
|
34
|
+
"BulkStatusUpdateRequest",
|
|
35
|
+
"BulkStatusUpdateResponse",
|
|
36
|
+
"Customer",
|
|
37
|
+
"ErrorResponse",
|
|
38
|
+
"HistoryItem",
|
|
39
|
+
"LocaleTranslation",
|
|
40
|
+
"MailLog",
|
|
41
|
+
"MessageResponse",
|
|
42
|
+
"OrderListItem",
|
|
43
|
+
"OrderListMeta",
|
|
44
|
+
"OrderListResponse",
|
|
45
|
+
"OrderResponse",
|
|
46
|
+
"ProgressTimelineItem",
|
|
47
|
+
"SetDueDateRequest",
|
|
48
|
+
"Status",
|
|
49
|
+
"StatusDefinition",
|
|
50
|
+
"UpdateOrderStatusRequest",
|
|
51
|
+
"ValidationErrorResponse",
|
|
52
|
+
"ViableStatus",
|
|
53
|
+
]
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"""Auto-generated Pydantic models - errors domain.
|
|
2
|
+
|
|
3
|
+
DO NOT EDIT - This file is generated by scripts/generate_pydantic_models.py
|
|
4
|
+
|
|
5
|
+
To regenerate, run:
|
|
6
|
+
uv run poe generate-pydantic
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
from statuspro_public_api_client.models_pydantic._base import StatusProPydanticBase
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class ErrorResponse(StatusProPydanticBase):
|
|
15
|
+
message: str | None = None
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class ValidationErrorResponse(StatusProPydanticBase):
|
|
19
|
+
message: str | None = None
|
|
20
|
+
errors: dict[str, list[str]] | None = None
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class MessageResponse(StatusProPydanticBase):
|
|
24
|
+
message: str
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"""Auto-generated Pydantic models - orders domain.
|
|
2
|
+
|
|
3
|
+
DO NOT EDIT - This file is generated by scripts/generate_pydantic_models.py
|
|
4
|
+
|
|
5
|
+
To regenerate, run:
|
|
6
|
+
uv run poe generate-pydantic
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
from datetime import date
|
|
12
|
+
from typing import Annotated
|
|
13
|
+
|
|
14
|
+
from pydantic import AwareDatetime, EmailStr, Field
|
|
15
|
+
|
|
16
|
+
from statuspro_public_api_client.models_pydantic._base import StatusProPydanticBase
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class UpdateOrderStatusRequest(StatusProPydanticBase):
|
|
20
|
+
status_code: str
|
|
21
|
+
comment: str | None = None
|
|
22
|
+
public: bool | None = False
|
|
23
|
+
email_customer: bool | None = True
|
|
24
|
+
email_additional: bool | None = True
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class BulkStatusUpdateRequest(StatusProPydanticBase):
|
|
28
|
+
order_ids: Annotated[list[int], Field(max_length=50, min_length=1)]
|
|
29
|
+
status_code: str
|
|
30
|
+
comment: str | None = None
|
|
31
|
+
public: bool | None = False
|
|
32
|
+
email_customer: bool | None = True
|
|
33
|
+
email_additional: bool | None = True
|
|
34
|
+
send_at: Annotated[
|
|
35
|
+
int | None, Field(description="Unix timestamp to schedule status emails.")
|
|
36
|
+
] = None
|
|
37
|
+
due_date: date | None = None
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
class BulkStatusUpdateResponse(StatusProPydanticBase):
|
|
41
|
+
message: str
|
|
42
|
+
count: int
|
|
43
|
+
limit: int
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
class AddOrderCommentRequest(StatusProPydanticBase):
|
|
47
|
+
comment: Annotated[str, Field(max_length=1000, min_length=3)]
|
|
48
|
+
public: bool | None = False
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
class SetDueDateRequest(StatusProPydanticBase):
|
|
52
|
+
due_date: date | None
|
|
53
|
+
due_date_to: date | None = None
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
class Customer(StatusProPydanticBase):
|
|
57
|
+
name: str | None = None
|
|
58
|
+
email: EmailStr | None = None
|
|
59
|
+
locale: str | None = None
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
class LocaleTranslation(StatusProPydanticBase):
|
|
63
|
+
name: str | None = None
|
|
64
|
+
description: str | None = None
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
class Status(StatusProPydanticBase):
|
|
68
|
+
is_set: bool | None = None
|
|
69
|
+
code: str | None = None
|
|
70
|
+
name: str | None = None
|
|
71
|
+
public_name: str | None = None
|
|
72
|
+
description: str | None = None
|
|
73
|
+
public: bool | None = None
|
|
74
|
+
set_at: AwareDatetime | None = None
|
|
75
|
+
auto_change_at: AwareDatetime | None = None
|
|
76
|
+
translations: dict[str, LocaleTranslation] | None = None
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
class MailLog(StatusProPydanticBase):
|
|
80
|
+
from_: Annotated[EmailStr | None, Field(alias="from")] = None
|
|
81
|
+
to: EmailStr | None = None
|
|
82
|
+
subject: str | None = None
|
|
83
|
+
delivery_status: str | None = None
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
class HistoryItem(StatusProPydanticBase):
|
|
87
|
+
event: str | None = None
|
|
88
|
+
status: Annotated[Status | None, Field()] = None
|
|
89
|
+
comment: str | None = None
|
|
90
|
+
comment_is_public: bool | None = None
|
|
91
|
+
created_at: AwareDatetime | None = None
|
|
92
|
+
mail_log: Annotated[MailLog | None, Field()] = None
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
class ProgressTimelineItem(StatusProPydanticBase):
|
|
96
|
+
name: str | None = None
|
|
97
|
+
description: str | None = None
|
|
98
|
+
progress: str | None = None
|
|
99
|
+
timestamp: str | None = None
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
class OrderResponse(StatusProPydanticBase):
|
|
103
|
+
id: int | None = None
|
|
104
|
+
name: str | None = None
|
|
105
|
+
order_number: str | None = None
|
|
106
|
+
customer: Customer | None = None
|
|
107
|
+
status: Status | None = None
|
|
108
|
+
history: list[HistoryItem] | None = None
|
|
109
|
+
public_progress_timeline: list[ProgressTimelineItem] | None = None
|
|
110
|
+
due_date: AwareDatetime | None = None
|
|
111
|
+
due_date_to: AwareDatetime | None = None
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
class OrderListItem(StatusProPydanticBase):
|
|
115
|
+
id: int | None = None
|
|
116
|
+
name: str | None = None
|
|
117
|
+
order_number: str | None = None
|
|
118
|
+
customer: Customer | None = None
|
|
119
|
+
status: Status | None = None
|
|
120
|
+
due_date: AwareDatetime | None = None
|
|
121
|
+
due_date_to: AwareDatetime | None = None
|
|
122
|
+
history_count: int | None = None
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
class OrderListMeta(StatusProPydanticBase):
|
|
126
|
+
current_page: int | None = None
|
|
127
|
+
from_: Annotated[int | None, Field(alias="from")] = None
|
|
128
|
+
last_page: int | None = None
|
|
129
|
+
per_page: int | None = None
|
|
130
|
+
to: int | None = None
|
|
131
|
+
total: int | None = None
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
class OrderListResponse(StatusProPydanticBase):
|
|
135
|
+
data: list[OrderListItem]
|
|
136
|
+
meta: OrderListMeta
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"""Auto-generated Pydantic models - statuses domain.
|
|
2
|
+
|
|
3
|
+
DO NOT EDIT - This file is generated by scripts/generate_pydantic_models.py
|
|
4
|
+
|
|
5
|
+
To regenerate, run:
|
|
6
|
+
uv run poe generate-pydantic
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
from statuspro_public_api_client.models_pydantic._base import StatusProPydanticBase
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class StatusDefinition(StatusProPydanticBase):
|
|
15
|
+
name: str | None = None
|
|
16
|
+
description: str | None = None
|
|
17
|
+
code: str | None = None
|
|
18
|
+
color: str | None = None
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class ViableStatus(StatusProPydanticBase):
|
|
22
|
+
code: str | None = None
|
|
23
|
+
name: str | None = None
|
|
24
|
+
description: str | None = None
|
|
25
|
+
color: str | None = None
|