channel3-sdk 1.0.0__py3-none-any.whl → 2.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.

Potentially problematic release.


This version of channel3-sdk might be problematic. Click here for more details.

Files changed (85) hide show
  1. channel3_sdk/__init__.py +94 -44
  2. channel3_sdk/_base_client.py +1995 -0
  3. channel3_sdk/_client.py +549 -0
  4. channel3_sdk/_compat.py +219 -0
  5. channel3_sdk/_constants.py +14 -0
  6. channel3_sdk/_exceptions.py +108 -0
  7. channel3_sdk/_files.py +123 -0
  8. channel3_sdk/_models.py +829 -0
  9. channel3_sdk/_qs.py +150 -0
  10. channel3_sdk/_resource.py +43 -0
  11. channel3_sdk/_response.py +832 -0
  12. channel3_sdk/_streaming.py +333 -0
  13. channel3_sdk/_types.py +253 -0
  14. channel3_sdk/_utils/__init__.py +64 -0
  15. channel3_sdk/_utils/_compat.py +45 -0
  16. channel3_sdk/_utils/_datetime_parse.py +136 -0
  17. channel3_sdk/_utils/_logs.py +25 -0
  18. channel3_sdk/_utils/_proxy.py +65 -0
  19. channel3_sdk/_utils/_reflection.py +42 -0
  20. channel3_sdk/_utils/_resources_proxy.py +24 -0
  21. channel3_sdk/_utils/_streams.py +12 -0
  22. channel3_sdk/_utils/_sync.py +86 -0
  23. channel3_sdk/_utils/_transform.py +457 -0
  24. channel3_sdk/_utils/_typing.py +156 -0
  25. channel3_sdk/_utils/_utils.py +421 -0
  26. channel3_sdk/_version.py +4 -0
  27. channel3_sdk/lib/.keep +4 -0
  28. channel3_sdk/py.typed +0 -0
  29. channel3_sdk/resources/__init__.py +61 -0
  30. channel3_sdk/resources/brands.py +268 -0
  31. channel3_sdk/resources/enrich.py +167 -0
  32. channel3_sdk/resources/products.py +163 -0
  33. channel3_sdk/resources/search.py +227 -0
  34. channel3_sdk/types/__init__.py +15 -0
  35. channel3_sdk/types/availability_status.py +9 -0
  36. channel3_sdk/types/brand.py +17 -0
  37. channel3_sdk/types/brand_list_params.py +16 -0
  38. channel3_sdk/types/brand_list_response.py +25 -0
  39. channel3_sdk/types/enrich_enrich_url_params.py +12 -0
  40. channel3_sdk/types/enrich_enrich_url_response.py +20 -0
  41. channel3_sdk/types/price.py +18 -0
  42. channel3_sdk/types/product_retrieve_response.py +39 -0
  43. channel3_sdk/types/search_perform_params.py +64 -0
  44. channel3_sdk/types/search_perform_response.py +36 -0
  45. channel3_sdk/types/variant.py +13 -0
  46. channel3_sdk-2.1.0.dist-info/METADATA +414 -0
  47. channel3_sdk-2.1.0.dist-info/RECORD +49 -0
  48. {channel3_sdk-1.0.0.dist-info → channel3_sdk-2.1.0.dist-info}/WHEEL +1 -1
  49. channel3_sdk-2.1.0.dist-info/licenses/LICENSE +201 -0
  50. channel3_sdk/_gen/.gitignore +0 -23
  51. channel3_sdk/_gen/README.md +0 -124
  52. channel3_sdk/_gen/fast_api_client/__init__.py +0 -8
  53. channel3_sdk/_gen/fast_api_client/api/__init__.py +0 -1
  54. channel3_sdk/_gen/fast_api_client/api/channel3_api/__init__.py +0 -1
  55. channel3_sdk/_gen/fast_api_client/api/channel3_api/get_brand_detail_v0_brands_brand_id_get.py +0 -179
  56. channel3_sdk/_gen/fast_api_client/api/channel3_api/get_brands_v0_brands_get.py +0 -218
  57. channel3_sdk/_gen/fast_api_client/api/channel3_api/get_product_detail_v0_products_product_id_get.py +0 -179
  58. channel3_sdk/_gen/fast_api_client/api/channel3_api/search_v0_search_post.py +0 -193
  59. channel3_sdk/_gen/fast_api_client/api/default/__init__.py +0 -1
  60. channel3_sdk/_gen/fast_api_client/api/default/root_get.py +0 -79
  61. channel3_sdk/_gen/fast_api_client/client.py +0 -268
  62. channel3_sdk/_gen/fast_api_client/errors.py +0 -16
  63. channel3_sdk/_gen/fast_api_client/models/__init__.py +0 -35
  64. channel3_sdk/_gen/fast_api_client/models/availability_status.py +0 -15
  65. channel3_sdk/_gen/fast_api_client/models/brand.py +0 -109
  66. channel3_sdk/_gen/fast_api_client/models/error_response.py +0 -59
  67. channel3_sdk/_gen/fast_api_client/models/paginated_response_brand.py +0 -83
  68. channel3_sdk/_gen/fast_api_client/models/pagination_meta.py +0 -84
  69. channel3_sdk/_gen/fast_api_client/models/price.py +0 -89
  70. channel3_sdk/_gen/fast_api_client/models/product.py +0 -166
  71. channel3_sdk/_gen/fast_api_client/models/product_detail.py +0 -306
  72. channel3_sdk/_gen/fast_api_client/models/product_detail_gender_type_0.py +0 -10
  73. channel3_sdk/_gen/fast_api_client/models/search_config.py +0 -69
  74. channel3_sdk/_gen/fast_api_client/models/search_filter_price.py +0 -92
  75. channel3_sdk/_gen/fast_api_client/models/search_filters.py +0 -191
  76. channel3_sdk/_gen/fast_api_client/models/search_filters_gender_type_0.py +0 -10
  77. channel3_sdk/_gen/fast_api_client/models/search_request.py +0 -191
  78. channel3_sdk/_gen/fast_api_client/models/variant.py +0 -75
  79. channel3_sdk/_gen/fast_api_client/py.typed +0 -1
  80. channel3_sdk/_gen/fast_api_client/types.py +0 -54
  81. channel3_sdk/_gen/pyproject.toml +0 -26
  82. channel3_sdk/client.py +0 -361
  83. channel3_sdk/exceptions.py +0 -48
  84. channel3_sdk-1.0.0.dist-info/METADATA +0 -341
  85. channel3_sdk-1.0.0.dist-info/RECORD +0 -38
@@ -1,268 +0,0 @@
1
- import ssl
2
- from typing import Any, Optional, Union
3
-
4
- import httpx
5
- from attrs import define, evolve, field
6
-
7
-
8
- @define
9
- class Client:
10
- """A class for keeping track of data related to the API
11
-
12
- The following are accepted as keyword arguments and will be used to construct httpx Clients internally:
13
-
14
- ``base_url``: The base URL for the API, all requests are made to a relative path to this URL
15
-
16
- ``cookies``: A dictionary of cookies to be sent with every request
17
-
18
- ``headers``: A dictionary of headers to be sent with every request
19
-
20
- ``timeout``: The maximum amount of a time a request can take. API functions will raise
21
- httpx.TimeoutException if this is exceeded.
22
-
23
- ``verify_ssl``: Whether or not to verify the SSL certificate of the API server. This should be True in production,
24
- but can be set to False for testing purposes.
25
-
26
- ``follow_redirects``: Whether or not to follow redirects. Default value is False.
27
-
28
- ``httpx_args``: A dictionary of additional arguments to be passed to the ``httpx.Client`` and ``httpx.AsyncClient`` constructor.
29
-
30
-
31
- Attributes:
32
- raise_on_unexpected_status: Whether or not to raise an errors.UnexpectedStatus if the API returns a
33
- status code that was not documented in the source OpenAPI document. Can also be provided as a keyword
34
- argument to the constructor.
35
- """
36
-
37
- raise_on_unexpected_status: bool = field(default=False, kw_only=True)
38
- _base_url: str = field(alias="base_url")
39
- _cookies: dict[str, str] = field(factory=dict, kw_only=True, alias="cookies")
40
- _headers: dict[str, str] = field(factory=dict, kw_only=True, alias="headers")
41
- _timeout: Optional[httpx.Timeout] = field(default=None, kw_only=True, alias="timeout")
42
- _verify_ssl: Union[str, bool, ssl.SSLContext] = field(default=True, kw_only=True, alias="verify_ssl")
43
- _follow_redirects: bool = field(default=False, kw_only=True, alias="follow_redirects")
44
- _httpx_args: dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx_args")
45
- _client: Optional[httpx.Client] = field(default=None, init=False)
46
- _async_client: Optional[httpx.AsyncClient] = field(default=None, init=False)
47
-
48
- def with_headers(self, headers: dict[str, str]) -> "Client":
49
- """Get a new client matching this one with additional headers"""
50
- if self._client is not None:
51
- self._client.headers.update(headers)
52
- if self._async_client is not None:
53
- self._async_client.headers.update(headers)
54
- return evolve(self, headers={**self._headers, **headers})
55
-
56
- def with_cookies(self, cookies: dict[str, str]) -> "Client":
57
- """Get a new client matching this one with additional cookies"""
58
- if self._client is not None:
59
- self._client.cookies.update(cookies)
60
- if self._async_client is not None:
61
- self._async_client.cookies.update(cookies)
62
- return evolve(self, cookies={**self._cookies, **cookies})
63
-
64
- def with_timeout(self, timeout: httpx.Timeout) -> "Client":
65
- """Get a new client matching this one with a new timeout (in seconds)"""
66
- if self._client is not None:
67
- self._client.timeout = timeout
68
- if self._async_client is not None:
69
- self._async_client.timeout = timeout
70
- return evolve(self, timeout=timeout)
71
-
72
- def set_httpx_client(self, client: httpx.Client) -> "Client":
73
- """Manually set the underlying httpx.Client
74
-
75
- **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
76
- """
77
- self._client = client
78
- return self
79
-
80
- def get_httpx_client(self) -> httpx.Client:
81
- """Get the underlying httpx.Client, constructing a new one if not previously set"""
82
- if self._client is None:
83
- self._client = httpx.Client(
84
- base_url=self._base_url,
85
- cookies=self._cookies,
86
- headers=self._headers,
87
- timeout=self._timeout,
88
- verify=self._verify_ssl,
89
- follow_redirects=self._follow_redirects,
90
- **self._httpx_args,
91
- )
92
- return self._client
93
-
94
- def __enter__(self) -> "Client":
95
- """Enter a context manager for self.client—you cannot enter twice (see httpx docs)"""
96
- self.get_httpx_client().__enter__()
97
- return self
98
-
99
- def __exit__(self, *args: Any, **kwargs: Any) -> None:
100
- """Exit a context manager for internal httpx.Client (see httpx docs)"""
101
- self.get_httpx_client().__exit__(*args, **kwargs)
102
-
103
- def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> "Client":
104
- """Manually the underlying httpx.AsyncClient
105
-
106
- **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
107
- """
108
- self._async_client = async_client
109
- return self
110
-
111
- def get_async_httpx_client(self) -> httpx.AsyncClient:
112
- """Get the underlying httpx.AsyncClient, constructing a new one if not previously set"""
113
- if self._async_client is None:
114
- self._async_client = httpx.AsyncClient(
115
- base_url=self._base_url,
116
- cookies=self._cookies,
117
- headers=self._headers,
118
- timeout=self._timeout,
119
- verify=self._verify_ssl,
120
- follow_redirects=self._follow_redirects,
121
- **self._httpx_args,
122
- )
123
- return self._async_client
124
-
125
- async def __aenter__(self) -> "Client":
126
- """Enter a context manager for underlying httpx.AsyncClient—you cannot enter twice (see httpx docs)"""
127
- await self.get_async_httpx_client().__aenter__()
128
- return self
129
-
130
- async def __aexit__(self, *args: Any, **kwargs: Any) -> None:
131
- """Exit a context manager for underlying httpx.AsyncClient (see httpx docs)"""
132
- await self.get_async_httpx_client().__aexit__(*args, **kwargs)
133
-
134
-
135
- @define
136
- class AuthenticatedClient:
137
- """A Client which has been authenticated for use on secured endpoints
138
-
139
- The following are accepted as keyword arguments and will be used to construct httpx Clients internally:
140
-
141
- ``base_url``: The base URL for the API, all requests are made to a relative path to this URL
142
-
143
- ``cookies``: A dictionary of cookies to be sent with every request
144
-
145
- ``headers``: A dictionary of headers to be sent with every request
146
-
147
- ``timeout``: The maximum amount of a time a request can take. API functions will raise
148
- httpx.TimeoutException if this is exceeded.
149
-
150
- ``verify_ssl``: Whether or not to verify the SSL certificate of the API server. This should be True in production,
151
- but can be set to False for testing purposes.
152
-
153
- ``follow_redirects``: Whether or not to follow redirects. Default value is False.
154
-
155
- ``httpx_args``: A dictionary of additional arguments to be passed to the ``httpx.Client`` and ``httpx.AsyncClient`` constructor.
156
-
157
-
158
- Attributes:
159
- raise_on_unexpected_status: Whether or not to raise an errors.UnexpectedStatus if the API returns a
160
- status code that was not documented in the source OpenAPI document. Can also be provided as a keyword
161
- argument to the constructor.
162
- token: The token to use for authentication
163
- prefix: The prefix to use for the Authorization header
164
- auth_header_name: The name of the Authorization header
165
- """
166
-
167
- raise_on_unexpected_status: bool = field(default=False, kw_only=True)
168
- _base_url: str = field(alias="base_url")
169
- _cookies: dict[str, str] = field(factory=dict, kw_only=True, alias="cookies")
170
- _headers: dict[str, str] = field(factory=dict, kw_only=True, alias="headers")
171
- _timeout: Optional[httpx.Timeout] = field(default=None, kw_only=True, alias="timeout")
172
- _verify_ssl: Union[str, bool, ssl.SSLContext] = field(default=True, kw_only=True, alias="verify_ssl")
173
- _follow_redirects: bool = field(default=False, kw_only=True, alias="follow_redirects")
174
- _httpx_args: dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx_args")
175
- _client: Optional[httpx.Client] = field(default=None, init=False)
176
- _async_client: Optional[httpx.AsyncClient] = field(default=None, init=False)
177
-
178
- token: str
179
- prefix: str = "Bearer"
180
- auth_header_name: str = "Authorization"
181
-
182
- def with_headers(self, headers: dict[str, str]) -> "AuthenticatedClient":
183
- """Get a new client matching this one with additional headers"""
184
- if self._client is not None:
185
- self._client.headers.update(headers)
186
- if self._async_client is not None:
187
- self._async_client.headers.update(headers)
188
- return evolve(self, headers={**self._headers, **headers})
189
-
190
- def with_cookies(self, cookies: dict[str, str]) -> "AuthenticatedClient":
191
- """Get a new client matching this one with additional cookies"""
192
- if self._client is not None:
193
- self._client.cookies.update(cookies)
194
- if self._async_client is not None:
195
- self._async_client.cookies.update(cookies)
196
- return evolve(self, cookies={**self._cookies, **cookies})
197
-
198
- def with_timeout(self, timeout: httpx.Timeout) -> "AuthenticatedClient":
199
- """Get a new client matching this one with a new timeout (in seconds)"""
200
- if self._client is not None:
201
- self._client.timeout = timeout
202
- if self._async_client is not None:
203
- self._async_client.timeout = timeout
204
- return evolve(self, timeout=timeout)
205
-
206
- def set_httpx_client(self, client: httpx.Client) -> "AuthenticatedClient":
207
- """Manually set the underlying httpx.Client
208
-
209
- **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
210
- """
211
- self._client = client
212
- return self
213
-
214
- def get_httpx_client(self) -> httpx.Client:
215
- """Get the underlying httpx.Client, constructing a new one if not previously set"""
216
- if self._client is None:
217
- self._headers[self.auth_header_name] = f"{self.prefix} {self.token}" if self.prefix else self.token
218
- self._client = httpx.Client(
219
- base_url=self._base_url,
220
- cookies=self._cookies,
221
- headers=self._headers,
222
- timeout=self._timeout,
223
- verify=self._verify_ssl,
224
- follow_redirects=self._follow_redirects,
225
- **self._httpx_args,
226
- )
227
- return self._client
228
-
229
- def __enter__(self) -> "AuthenticatedClient":
230
- """Enter a context manager for self.client—you cannot enter twice (see httpx docs)"""
231
- self.get_httpx_client().__enter__()
232
- return self
233
-
234
- def __exit__(self, *args: Any, **kwargs: Any) -> None:
235
- """Exit a context manager for internal httpx.Client (see httpx docs)"""
236
- self.get_httpx_client().__exit__(*args, **kwargs)
237
-
238
- def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> "AuthenticatedClient":
239
- """Manually the underlying httpx.AsyncClient
240
-
241
- **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout.
242
- """
243
- self._async_client = async_client
244
- return self
245
-
246
- def get_async_httpx_client(self) -> httpx.AsyncClient:
247
- """Get the underlying httpx.AsyncClient, constructing a new one if not previously set"""
248
- if self._async_client is None:
249
- self._headers[self.auth_header_name] = f"{self.prefix} {self.token}" if self.prefix else self.token
250
- self._async_client = httpx.AsyncClient(
251
- base_url=self._base_url,
252
- cookies=self._cookies,
253
- headers=self._headers,
254
- timeout=self._timeout,
255
- verify=self._verify_ssl,
256
- follow_redirects=self._follow_redirects,
257
- **self._httpx_args,
258
- )
259
- return self._async_client
260
-
261
- async def __aenter__(self) -> "AuthenticatedClient":
262
- """Enter a context manager for underlying httpx.AsyncClient—you cannot enter twice (see httpx docs)"""
263
- await self.get_async_httpx_client().__aenter__()
264
- return self
265
-
266
- async def __aexit__(self, *args: Any, **kwargs: Any) -> None:
267
- """Exit a context manager for underlying httpx.AsyncClient (see httpx docs)"""
268
- await self.get_async_httpx_client().__aexit__(*args, **kwargs)
@@ -1,16 +0,0 @@
1
- """Contains shared errors types that can be raised from API functions"""
2
-
3
-
4
- class UnexpectedStatus(Exception):
5
- """Raised by api functions when the response status an undocumented status and Client.raise_on_unexpected_status is True"""
6
-
7
- def __init__(self, status_code: int, content: bytes):
8
- self.status_code = status_code
9
- self.content = content
10
-
11
- super().__init__(
12
- f"Unexpected status code: {status_code}\n\nResponse content:\n{content.decode(errors='ignore')}"
13
- )
14
-
15
-
16
- __all__ = ["UnexpectedStatus"]
@@ -1,35 +0,0 @@
1
- """Contains all the data models used in inputs/outputs"""
2
-
3
- from .availability_status import AvailabilityStatus
4
- from .brand import Brand
5
- from .error_response import ErrorResponse
6
- from .paginated_response_brand import PaginatedResponseBrand
7
- from .pagination_meta import PaginationMeta
8
- from .price import Price
9
- from .product import Product
10
- from .product_detail import ProductDetail
11
- from .product_detail_gender_type_0 import ProductDetailGenderType0
12
- from .search_config import SearchConfig
13
- from .search_filter_price import SearchFilterPrice
14
- from .search_filters import SearchFilters
15
- from .search_filters_gender_type_0 import SearchFiltersGenderType0
16
- from .search_request import SearchRequest
17
- from .variant import Variant
18
-
19
- __all__ = (
20
- "AvailabilityStatus",
21
- "Brand",
22
- "ErrorResponse",
23
- "PaginatedResponseBrand",
24
- "PaginationMeta",
25
- "Price",
26
- "Product",
27
- "ProductDetail",
28
- "ProductDetailGenderType0",
29
- "SearchConfig",
30
- "SearchFilterPrice",
31
- "SearchFilters",
32
- "SearchFiltersGenderType0",
33
- "SearchRequest",
34
- "Variant",
35
- )
@@ -1,15 +0,0 @@
1
- from enum import Enum
2
-
3
-
4
- class AvailabilityStatus(str, Enum):
5
- BACKORDER = "BackOrder"
6
- DISCONTINUED = "Discontinued"
7
- INSTOCK = "InStock"
8
- LIMITEDAVAILABILITY = "LimitedAvailability"
9
- OUTOFSTOCK = "OutOfStock"
10
- PREORDER = "PreOrder"
11
- SOLDOUT = "SoldOut"
12
- UNKNOWN = "Unknown"
13
-
14
- def __str__(self) -> str:
15
- return str(self.value)
@@ -1,109 +0,0 @@
1
- from collections.abc import Mapping
2
- from typing import Any, TypeVar, Union, cast
3
-
4
- from attrs import define as _attrs_define
5
- from attrs import field as _attrs_field
6
-
7
- from ..types import UNSET, Unset
8
-
9
- T = TypeVar("T", bound="Brand")
10
-
11
-
12
- @_attrs_define
13
- class Brand:
14
- """
15
- Attributes:
16
- id (str):
17
- name (str):
18
- logo_url (Union[None, Unset, str]):
19
- description (Union[None, Unset, str]):
20
- """
21
-
22
- id: str
23
- name: str
24
- logo_url: Union[None, Unset, str] = UNSET
25
- description: Union[None, Unset, str] = UNSET
26
- additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
27
-
28
- def to_dict(self) -> dict[str, Any]:
29
- id = self.id
30
-
31
- name = self.name
32
-
33
- logo_url: Union[None, Unset, str]
34
- if isinstance(self.logo_url, Unset):
35
- logo_url = UNSET
36
- else:
37
- logo_url = self.logo_url
38
-
39
- description: Union[None, Unset, str]
40
- if isinstance(self.description, Unset):
41
- description = UNSET
42
- else:
43
- description = self.description
44
-
45
- field_dict: dict[str, Any] = {}
46
- field_dict.update(self.additional_properties)
47
- field_dict.update(
48
- {
49
- "id": id,
50
- "name": name,
51
- }
52
- )
53
- if logo_url is not UNSET:
54
- field_dict["logo_url"] = logo_url
55
- if description is not UNSET:
56
- field_dict["description"] = description
57
-
58
- return field_dict
59
-
60
- @classmethod
61
- def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
62
- d = dict(src_dict)
63
- id = d.pop("id")
64
-
65
- name = d.pop("name")
66
-
67
- def _parse_logo_url(data: object) -> Union[None, Unset, str]:
68
- if data is None:
69
- return data
70
- if isinstance(data, Unset):
71
- return data
72
- return cast(Union[None, Unset, str], data)
73
-
74
- logo_url = _parse_logo_url(d.pop("logo_url", UNSET))
75
-
76
- def _parse_description(data: object) -> Union[None, Unset, str]:
77
- if data is None:
78
- return data
79
- if isinstance(data, Unset):
80
- return data
81
- return cast(Union[None, Unset, str], data)
82
-
83
- description = _parse_description(d.pop("description", UNSET))
84
-
85
- brand = cls(
86
- id=id,
87
- name=name,
88
- logo_url=logo_url,
89
- description=description,
90
- )
91
-
92
- brand.additional_properties = d
93
- return brand
94
-
95
- @property
96
- def additional_keys(self) -> list[str]:
97
- return list(self.additional_properties.keys())
98
-
99
- def __getitem__(self, key: str) -> Any:
100
- return self.additional_properties[key]
101
-
102
- def __setitem__(self, key: str, value: Any) -> None:
103
- self.additional_properties[key] = value
104
-
105
- def __delitem__(self, key: str) -> None:
106
- del self.additional_properties[key]
107
-
108
- def __contains__(self, key: str) -> bool:
109
- return key in self.additional_properties
@@ -1,59 +0,0 @@
1
- from collections.abc import Mapping
2
- from typing import Any, TypeVar
3
-
4
- from attrs import define as _attrs_define
5
- from attrs import field as _attrs_field
6
-
7
- T = TypeVar("T", bound="ErrorResponse")
8
-
9
-
10
- @_attrs_define
11
- class ErrorResponse:
12
- """
13
- Attributes:
14
- detail (Any):
15
- """
16
-
17
- detail: Any
18
- additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
19
-
20
- def to_dict(self) -> dict[str, Any]:
21
- detail = self.detail
22
-
23
- field_dict: dict[str, Any] = {}
24
- field_dict.update(self.additional_properties)
25
- field_dict.update(
26
- {
27
- "detail": detail,
28
- }
29
- )
30
-
31
- return field_dict
32
-
33
- @classmethod
34
- def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
35
- d = dict(src_dict)
36
- detail = d.pop("detail")
37
-
38
- error_response = cls(
39
- detail=detail,
40
- )
41
-
42
- error_response.additional_properties = d
43
- return error_response
44
-
45
- @property
46
- def additional_keys(self) -> list[str]:
47
- return list(self.additional_properties.keys())
48
-
49
- def __getitem__(self, key: str) -> Any:
50
- return self.additional_properties[key]
51
-
52
- def __setitem__(self, key: str, value: Any) -> None:
53
- self.additional_properties[key] = value
54
-
55
- def __delitem__(self, key: str) -> None:
56
- del self.additional_properties[key]
57
-
58
- def __contains__(self, key: str) -> bool:
59
- return key in self.additional_properties
@@ -1,83 +0,0 @@
1
- from collections.abc import Mapping
2
- from typing import TYPE_CHECKING, Any, TypeVar
3
-
4
- from attrs import define as _attrs_define
5
- from attrs import field as _attrs_field
6
-
7
- if TYPE_CHECKING:
8
- from ..models.brand import Brand
9
- from ..models.pagination_meta import PaginationMeta
10
-
11
-
12
- T = TypeVar("T", bound="PaginatedResponseBrand")
13
-
14
-
15
- @_attrs_define
16
- class PaginatedResponseBrand:
17
- """
18
- Attributes:
19
- items (list['Brand']):
20
- pagination (PaginationMeta): Pagination metadata for responses
21
- """
22
-
23
- items: list["Brand"]
24
- pagination: "PaginationMeta"
25
- additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
26
-
27
- def to_dict(self) -> dict[str, Any]:
28
- items = []
29
- for items_item_data in self.items:
30
- items_item = items_item_data.to_dict()
31
- items.append(items_item)
32
-
33
- pagination = self.pagination.to_dict()
34
-
35
- field_dict: dict[str, Any] = {}
36
- field_dict.update(self.additional_properties)
37
- field_dict.update(
38
- {
39
- "items": items,
40
- "pagination": pagination,
41
- }
42
- )
43
-
44
- return field_dict
45
-
46
- @classmethod
47
- def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
48
- from ..models.brand import Brand
49
- from ..models.pagination_meta import PaginationMeta
50
-
51
- d = dict(src_dict)
52
- items = []
53
- _items = d.pop("items")
54
- for items_item_data in _items:
55
- items_item = Brand.from_dict(items_item_data)
56
-
57
- items.append(items_item)
58
-
59
- pagination = PaginationMeta.from_dict(d.pop("pagination"))
60
-
61
- paginated_response_brand = cls(
62
- items=items,
63
- pagination=pagination,
64
- )
65
-
66
- paginated_response_brand.additional_properties = d
67
- return paginated_response_brand
68
-
69
- @property
70
- def additional_keys(self) -> list[str]:
71
- return list(self.additional_properties.keys())
72
-
73
- def __getitem__(self, key: str) -> Any:
74
- return self.additional_properties[key]
75
-
76
- def __setitem__(self, key: str, value: Any) -> None:
77
- self.additional_properties[key] = value
78
-
79
- def __delitem__(self, key: str) -> None:
80
- del self.additional_properties[key]
81
-
82
- def __contains__(self, key: str) -> bool:
83
- return key in self.additional_properties
@@ -1,84 +0,0 @@
1
- from collections.abc import Mapping
2
- from typing import Any, TypeVar
3
-
4
- from attrs import define as _attrs_define
5
- from attrs import field as _attrs_field
6
-
7
- T = TypeVar("T", bound="PaginationMeta")
8
-
9
-
10
- @_attrs_define
11
- class PaginationMeta:
12
- """Pagination metadata for responses
13
-
14
- Attributes:
15
- current_page (int):
16
- page_size (int):
17
- total_count (int):
18
- total_pages (int):
19
- """
20
-
21
- current_page: int
22
- page_size: int
23
- total_count: int
24
- total_pages: int
25
- additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
26
-
27
- def to_dict(self) -> dict[str, Any]:
28
- current_page = self.current_page
29
-
30
- page_size = self.page_size
31
-
32
- total_count = self.total_count
33
-
34
- total_pages = self.total_pages
35
-
36
- field_dict: dict[str, Any] = {}
37
- field_dict.update(self.additional_properties)
38
- field_dict.update(
39
- {
40
- "current_page": current_page,
41
- "page_size": page_size,
42
- "total_count": total_count,
43
- "total_pages": total_pages,
44
- }
45
- )
46
-
47
- return field_dict
48
-
49
- @classmethod
50
- def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
51
- d = dict(src_dict)
52
- current_page = d.pop("current_page")
53
-
54
- page_size = d.pop("page_size")
55
-
56
- total_count = d.pop("total_count")
57
-
58
- total_pages = d.pop("total_pages")
59
-
60
- pagination_meta = cls(
61
- current_page=current_page,
62
- page_size=page_size,
63
- total_count=total_count,
64
- total_pages=total_pages,
65
- )
66
-
67
- pagination_meta.additional_properties = d
68
- return pagination_meta
69
-
70
- @property
71
- def additional_keys(self) -> list[str]:
72
- return list(self.additional_properties.keys())
73
-
74
- def __getitem__(self, key: str) -> Any:
75
- return self.additional_properties[key]
76
-
77
- def __setitem__(self, key: str, value: Any) -> None:
78
- self.additional_properties[key] = value
79
-
80
- def __delitem__(self, key: str) -> None:
81
- del self.additional_properties[key]
82
-
83
- def __contains__(self, key: str) -> bool:
84
- return key in self.additional_properties