channel3-sdk 0.2.1__py3-none-any.whl → 1.0.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.
- channel3_sdk/__init__.py +23 -17
- channel3_sdk/_gen/.gitignore +23 -0
- channel3_sdk/_gen/README.md +124 -0
- channel3_sdk/_gen/fast_api_client/__init__.py +8 -0
- channel3_sdk/_gen/fast_api_client/api/__init__.py +1 -0
- channel3_sdk/_gen/fast_api_client/api/channel3_api/__init__.py +1 -0
- channel3_sdk/_gen/fast_api_client/api/channel3_api/get_brand_detail_v0_brands_brand_id_get.py +179 -0
- channel3_sdk/_gen/fast_api_client/api/channel3_api/get_brands_v0_brands_get.py +218 -0
- channel3_sdk/_gen/fast_api_client/api/channel3_api/get_product_detail_v0_products_product_id_get.py +179 -0
- channel3_sdk/_gen/fast_api_client/api/channel3_api/search_v0_search_post.py +193 -0
- channel3_sdk/_gen/fast_api_client/api/default/__init__.py +1 -0
- channel3_sdk/_gen/fast_api_client/api/default/root_get.py +79 -0
- channel3_sdk/_gen/fast_api_client/client.py +268 -0
- channel3_sdk/_gen/fast_api_client/errors.py +16 -0
- channel3_sdk/_gen/fast_api_client/models/__init__.py +35 -0
- channel3_sdk/_gen/fast_api_client/models/availability_status.py +15 -0
- channel3_sdk/_gen/fast_api_client/models/brand.py +109 -0
- channel3_sdk/_gen/fast_api_client/models/error_response.py +59 -0
- channel3_sdk/_gen/fast_api_client/models/paginated_response_brand.py +83 -0
- channel3_sdk/_gen/fast_api_client/models/pagination_meta.py +84 -0
- channel3_sdk/_gen/fast_api_client/models/price.py +89 -0
- channel3_sdk/_gen/fast_api_client/models/product.py +166 -0
- channel3_sdk/_gen/fast_api_client/models/product_detail.py +306 -0
- channel3_sdk/_gen/fast_api_client/models/product_detail_gender_type_0.py +10 -0
- channel3_sdk/_gen/fast_api_client/models/search_config.py +69 -0
- channel3_sdk/_gen/fast_api_client/models/search_filter_price.py +92 -0
- channel3_sdk/_gen/fast_api_client/models/search_filters.py +191 -0
- channel3_sdk/_gen/fast_api_client/models/search_filters_gender_type_0.py +10 -0
- channel3_sdk/_gen/fast_api_client/models/search_request.py +191 -0
- channel3_sdk/_gen/fast_api_client/models/variant.py +75 -0
- channel3_sdk/_gen/fast_api_client/py.typed +1 -0
- channel3_sdk/_gen/fast_api_client/types.py +54 -0
- channel3_sdk/_gen/pyproject.toml +26 -0
- channel3_sdk/client.py +266 -479
- {channel3_sdk-0.2.1.dist-info → channel3_sdk-1.0.0.dist-info}/METADATA +83 -26
- channel3_sdk-1.0.0.dist-info/RECORD +38 -0
- {channel3_sdk-0.2.1.dist-info → channel3_sdk-1.0.0.dist-info}/WHEEL +1 -1
- channel3_sdk/models.py +0 -135
- channel3_sdk-0.2.1.dist-info/RECORD +0 -7
|
@@ -0,0 +1,92 @@
|
|
|
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="SearchFilterPrice")
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
@_attrs_define
|
|
13
|
+
class SearchFilterPrice:
|
|
14
|
+
"""Price filter. Values are inclusive.
|
|
15
|
+
|
|
16
|
+
Attributes:
|
|
17
|
+
min_price (Union[None, Unset, float]): Minimum price, in dollars and cents
|
|
18
|
+
max_price (Union[None, Unset, float]): Maximum price, in dollars and cents
|
|
19
|
+
"""
|
|
20
|
+
|
|
21
|
+
min_price: Union[None, Unset, float] = UNSET
|
|
22
|
+
max_price: Union[None, Unset, float] = UNSET
|
|
23
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
24
|
+
|
|
25
|
+
def to_dict(self) -> dict[str, Any]:
|
|
26
|
+
min_price: Union[None, Unset, float]
|
|
27
|
+
if isinstance(self.min_price, Unset):
|
|
28
|
+
min_price = UNSET
|
|
29
|
+
else:
|
|
30
|
+
min_price = self.min_price
|
|
31
|
+
|
|
32
|
+
max_price: Union[None, Unset, float]
|
|
33
|
+
if isinstance(self.max_price, Unset):
|
|
34
|
+
max_price = UNSET
|
|
35
|
+
else:
|
|
36
|
+
max_price = self.max_price
|
|
37
|
+
|
|
38
|
+
field_dict: dict[str, Any] = {}
|
|
39
|
+
field_dict.update(self.additional_properties)
|
|
40
|
+
field_dict.update({})
|
|
41
|
+
if min_price is not UNSET:
|
|
42
|
+
field_dict["min_price"] = min_price
|
|
43
|
+
if max_price is not UNSET:
|
|
44
|
+
field_dict["max_price"] = max_price
|
|
45
|
+
|
|
46
|
+
return field_dict
|
|
47
|
+
|
|
48
|
+
@classmethod
|
|
49
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
50
|
+
d = dict(src_dict)
|
|
51
|
+
|
|
52
|
+
def _parse_min_price(data: object) -> Union[None, Unset, float]:
|
|
53
|
+
if data is None:
|
|
54
|
+
return data
|
|
55
|
+
if isinstance(data, Unset):
|
|
56
|
+
return data
|
|
57
|
+
return cast(Union[None, Unset, float], data)
|
|
58
|
+
|
|
59
|
+
min_price = _parse_min_price(d.pop("min_price", UNSET))
|
|
60
|
+
|
|
61
|
+
def _parse_max_price(data: object) -> Union[None, Unset, float]:
|
|
62
|
+
if data is None:
|
|
63
|
+
return data
|
|
64
|
+
if isinstance(data, Unset):
|
|
65
|
+
return data
|
|
66
|
+
return cast(Union[None, Unset, float], data)
|
|
67
|
+
|
|
68
|
+
max_price = _parse_max_price(d.pop("max_price", UNSET))
|
|
69
|
+
|
|
70
|
+
search_filter_price = cls(
|
|
71
|
+
min_price=min_price,
|
|
72
|
+
max_price=max_price,
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
search_filter_price.additional_properties = d
|
|
76
|
+
return search_filter_price
|
|
77
|
+
|
|
78
|
+
@property
|
|
79
|
+
def additional_keys(self) -> list[str]:
|
|
80
|
+
return list(self.additional_properties.keys())
|
|
81
|
+
|
|
82
|
+
def __getitem__(self, key: str) -> Any:
|
|
83
|
+
return self.additional_properties[key]
|
|
84
|
+
|
|
85
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
86
|
+
self.additional_properties[key] = value
|
|
87
|
+
|
|
88
|
+
def __delitem__(self, key: str) -> None:
|
|
89
|
+
del self.additional_properties[key]
|
|
90
|
+
|
|
91
|
+
def __contains__(self, key: str) -> bool:
|
|
92
|
+
return key in self.additional_properties
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
from collections.abc import Mapping
|
|
2
|
+
from typing import TYPE_CHECKING, Any, TypeVar, Union, cast
|
|
3
|
+
|
|
4
|
+
from attrs import define as _attrs_define
|
|
5
|
+
from attrs import field as _attrs_field
|
|
6
|
+
|
|
7
|
+
from ..models.availability_status import AvailabilityStatus
|
|
8
|
+
from ..models.search_filters_gender_type_0 import SearchFiltersGenderType0
|
|
9
|
+
from ..types import UNSET, Unset
|
|
10
|
+
|
|
11
|
+
if TYPE_CHECKING:
|
|
12
|
+
from ..models.search_filter_price import SearchFilterPrice
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
T = TypeVar("T", bound="SearchFilters")
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
@_attrs_define
|
|
19
|
+
class SearchFilters:
|
|
20
|
+
"""
|
|
21
|
+
Attributes:
|
|
22
|
+
brand_ids (Union[None, Unset, list[str]]): List of brand IDs
|
|
23
|
+
gender (Union[None, SearchFiltersGenderType0, Unset]):
|
|
24
|
+
price (Union['SearchFilterPrice', None, Unset]): Price filter. Values are inclusive.
|
|
25
|
+
availability (Union[None, Unset, list[AvailabilityStatus]]): List of availability statuses
|
|
26
|
+
"""
|
|
27
|
+
|
|
28
|
+
brand_ids: Union[None, Unset, list[str]] = UNSET
|
|
29
|
+
gender: Union[None, SearchFiltersGenderType0, Unset] = UNSET
|
|
30
|
+
price: Union["SearchFilterPrice", None, Unset] = UNSET
|
|
31
|
+
availability: Union[None, Unset, list[AvailabilityStatus]] = UNSET
|
|
32
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
33
|
+
|
|
34
|
+
def to_dict(self) -> dict[str, Any]:
|
|
35
|
+
from ..models.search_filter_price import SearchFilterPrice
|
|
36
|
+
|
|
37
|
+
brand_ids: Union[None, Unset, list[str]]
|
|
38
|
+
if isinstance(self.brand_ids, Unset):
|
|
39
|
+
brand_ids = UNSET
|
|
40
|
+
elif isinstance(self.brand_ids, list):
|
|
41
|
+
brand_ids = self.brand_ids
|
|
42
|
+
|
|
43
|
+
else:
|
|
44
|
+
brand_ids = self.brand_ids
|
|
45
|
+
|
|
46
|
+
gender: Union[None, Unset, str]
|
|
47
|
+
if isinstance(self.gender, Unset):
|
|
48
|
+
gender = UNSET
|
|
49
|
+
elif isinstance(self.gender, SearchFiltersGenderType0):
|
|
50
|
+
gender = self.gender.value
|
|
51
|
+
else:
|
|
52
|
+
gender = self.gender
|
|
53
|
+
|
|
54
|
+
price: Union[None, Unset, dict[str, Any]]
|
|
55
|
+
if isinstance(self.price, Unset):
|
|
56
|
+
price = UNSET
|
|
57
|
+
elif isinstance(self.price, SearchFilterPrice):
|
|
58
|
+
price = self.price.to_dict()
|
|
59
|
+
else:
|
|
60
|
+
price = self.price
|
|
61
|
+
|
|
62
|
+
availability: Union[None, Unset, list[str]]
|
|
63
|
+
if isinstance(self.availability, Unset):
|
|
64
|
+
availability = UNSET
|
|
65
|
+
elif isinstance(self.availability, list):
|
|
66
|
+
availability = []
|
|
67
|
+
for availability_type_0_item_data in self.availability:
|
|
68
|
+
availability_type_0_item = availability_type_0_item_data.value
|
|
69
|
+
availability.append(availability_type_0_item)
|
|
70
|
+
|
|
71
|
+
else:
|
|
72
|
+
availability = self.availability
|
|
73
|
+
|
|
74
|
+
field_dict: dict[str, Any] = {}
|
|
75
|
+
field_dict.update(self.additional_properties)
|
|
76
|
+
field_dict.update({})
|
|
77
|
+
if brand_ids is not UNSET:
|
|
78
|
+
field_dict["brand_ids"] = brand_ids
|
|
79
|
+
if gender is not UNSET:
|
|
80
|
+
field_dict["gender"] = gender
|
|
81
|
+
if price is not UNSET:
|
|
82
|
+
field_dict["price"] = price
|
|
83
|
+
if availability is not UNSET:
|
|
84
|
+
field_dict["availability"] = availability
|
|
85
|
+
|
|
86
|
+
return field_dict
|
|
87
|
+
|
|
88
|
+
@classmethod
|
|
89
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
90
|
+
from ..models.search_filter_price import SearchFilterPrice
|
|
91
|
+
|
|
92
|
+
d = dict(src_dict)
|
|
93
|
+
|
|
94
|
+
def _parse_brand_ids(data: object) -> Union[None, Unset, list[str]]:
|
|
95
|
+
if data is None:
|
|
96
|
+
return data
|
|
97
|
+
if isinstance(data, Unset):
|
|
98
|
+
return data
|
|
99
|
+
try:
|
|
100
|
+
if not isinstance(data, list):
|
|
101
|
+
raise TypeError()
|
|
102
|
+
brand_ids_type_0 = cast(list[str], data)
|
|
103
|
+
|
|
104
|
+
return brand_ids_type_0
|
|
105
|
+
except: # noqa: E722
|
|
106
|
+
pass
|
|
107
|
+
return cast(Union[None, Unset, list[str]], data)
|
|
108
|
+
|
|
109
|
+
brand_ids = _parse_brand_ids(d.pop("brand_ids", UNSET))
|
|
110
|
+
|
|
111
|
+
def _parse_gender(data: object) -> Union[None, SearchFiltersGenderType0, Unset]:
|
|
112
|
+
if data is None:
|
|
113
|
+
return data
|
|
114
|
+
if isinstance(data, Unset):
|
|
115
|
+
return data
|
|
116
|
+
try:
|
|
117
|
+
if not isinstance(data, str):
|
|
118
|
+
raise TypeError()
|
|
119
|
+
gender_type_0 = SearchFiltersGenderType0(data)
|
|
120
|
+
|
|
121
|
+
return gender_type_0
|
|
122
|
+
except: # noqa: E722
|
|
123
|
+
pass
|
|
124
|
+
return cast(Union[None, SearchFiltersGenderType0, Unset], data)
|
|
125
|
+
|
|
126
|
+
gender = _parse_gender(d.pop("gender", UNSET))
|
|
127
|
+
|
|
128
|
+
def _parse_price(data: object) -> Union["SearchFilterPrice", None, Unset]:
|
|
129
|
+
if data is None:
|
|
130
|
+
return data
|
|
131
|
+
if isinstance(data, Unset):
|
|
132
|
+
return data
|
|
133
|
+
try:
|
|
134
|
+
if not isinstance(data, dict):
|
|
135
|
+
raise TypeError()
|
|
136
|
+
price_type_0 = SearchFilterPrice.from_dict(data)
|
|
137
|
+
|
|
138
|
+
return price_type_0
|
|
139
|
+
except: # noqa: E722
|
|
140
|
+
pass
|
|
141
|
+
return cast(Union["SearchFilterPrice", None, Unset], data)
|
|
142
|
+
|
|
143
|
+
price = _parse_price(d.pop("price", UNSET))
|
|
144
|
+
|
|
145
|
+
def _parse_availability(data: object) -> Union[None, Unset, list[AvailabilityStatus]]:
|
|
146
|
+
if data is None:
|
|
147
|
+
return data
|
|
148
|
+
if isinstance(data, Unset):
|
|
149
|
+
return data
|
|
150
|
+
try:
|
|
151
|
+
if not isinstance(data, list):
|
|
152
|
+
raise TypeError()
|
|
153
|
+
availability_type_0 = []
|
|
154
|
+
_availability_type_0 = data
|
|
155
|
+
for availability_type_0_item_data in _availability_type_0:
|
|
156
|
+
availability_type_0_item = AvailabilityStatus(availability_type_0_item_data)
|
|
157
|
+
|
|
158
|
+
availability_type_0.append(availability_type_0_item)
|
|
159
|
+
|
|
160
|
+
return availability_type_0
|
|
161
|
+
except: # noqa: E722
|
|
162
|
+
pass
|
|
163
|
+
return cast(Union[None, Unset, list[AvailabilityStatus]], data)
|
|
164
|
+
|
|
165
|
+
availability = _parse_availability(d.pop("availability", UNSET))
|
|
166
|
+
|
|
167
|
+
search_filters = cls(
|
|
168
|
+
brand_ids=brand_ids,
|
|
169
|
+
gender=gender,
|
|
170
|
+
price=price,
|
|
171
|
+
availability=availability,
|
|
172
|
+
)
|
|
173
|
+
|
|
174
|
+
search_filters.additional_properties = d
|
|
175
|
+
return search_filters
|
|
176
|
+
|
|
177
|
+
@property
|
|
178
|
+
def additional_keys(self) -> list[str]:
|
|
179
|
+
return list(self.additional_properties.keys())
|
|
180
|
+
|
|
181
|
+
def __getitem__(self, key: str) -> Any:
|
|
182
|
+
return self.additional_properties[key]
|
|
183
|
+
|
|
184
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
185
|
+
self.additional_properties[key] = value
|
|
186
|
+
|
|
187
|
+
def __delitem__(self, key: str) -> None:
|
|
188
|
+
del self.additional_properties[key]
|
|
189
|
+
|
|
190
|
+
def __contains__(self, key: str) -> bool:
|
|
191
|
+
return key in self.additional_properties
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
from collections.abc import Mapping
|
|
2
|
+
from typing import TYPE_CHECKING, 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
|
+
if TYPE_CHECKING:
|
|
10
|
+
from ..models.search_config import SearchConfig
|
|
11
|
+
from ..models.search_filters import SearchFilters
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
T = TypeVar("T", bound="SearchRequest")
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
@_attrs_define
|
|
18
|
+
class SearchRequest:
|
|
19
|
+
"""
|
|
20
|
+
Attributes:
|
|
21
|
+
query (Union[None, Unset, str]):
|
|
22
|
+
image_url (Union[None, Unset, str]):
|
|
23
|
+
base64_image (Union[None, Unset, str]):
|
|
24
|
+
limit (Union[None, Unset, int]): Default: 20.
|
|
25
|
+
filters (Union[Unset, SearchFilters]):
|
|
26
|
+
config (Union[Unset, SearchConfig]): Configuration for a search request
|
|
27
|
+
context (Union[None, Unset, str]): Context for the search
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
query: Union[None, Unset, str] = UNSET
|
|
31
|
+
image_url: Union[None, Unset, str] = UNSET
|
|
32
|
+
base64_image: Union[None, Unset, str] = UNSET
|
|
33
|
+
limit: Union[None, Unset, int] = 20
|
|
34
|
+
filters: Union[Unset, "SearchFilters"] = UNSET
|
|
35
|
+
config: Union[Unset, "SearchConfig"] = UNSET
|
|
36
|
+
context: Union[None, Unset, str] = UNSET
|
|
37
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
38
|
+
|
|
39
|
+
def to_dict(self) -> dict[str, Any]:
|
|
40
|
+
query: Union[None, Unset, str]
|
|
41
|
+
if isinstance(self.query, Unset):
|
|
42
|
+
query = UNSET
|
|
43
|
+
else:
|
|
44
|
+
query = self.query
|
|
45
|
+
|
|
46
|
+
image_url: Union[None, Unset, str]
|
|
47
|
+
if isinstance(self.image_url, Unset):
|
|
48
|
+
image_url = UNSET
|
|
49
|
+
else:
|
|
50
|
+
image_url = self.image_url
|
|
51
|
+
|
|
52
|
+
base64_image: Union[None, Unset, str]
|
|
53
|
+
if isinstance(self.base64_image, Unset):
|
|
54
|
+
base64_image = UNSET
|
|
55
|
+
else:
|
|
56
|
+
base64_image = self.base64_image
|
|
57
|
+
|
|
58
|
+
limit: Union[None, Unset, int]
|
|
59
|
+
if isinstance(self.limit, Unset):
|
|
60
|
+
limit = UNSET
|
|
61
|
+
else:
|
|
62
|
+
limit = self.limit
|
|
63
|
+
|
|
64
|
+
filters: Union[Unset, dict[str, Any]] = UNSET
|
|
65
|
+
if not isinstance(self.filters, Unset):
|
|
66
|
+
filters = self.filters.to_dict()
|
|
67
|
+
|
|
68
|
+
config: Union[Unset, dict[str, Any]] = UNSET
|
|
69
|
+
if not isinstance(self.config, Unset):
|
|
70
|
+
config = self.config.to_dict()
|
|
71
|
+
|
|
72
|
+
context: Union[None, Unset, str]
|
|
73
|
+
if isinstance(self.context, Unset):
|
|
74
|
+
context = UNSET
|
|
75
|
+
else:
|
|
76
|
+
context = self.context
|
|
77
|
+
|
|
78
|
+
field_dict: dict[str, Any] = {}
|
|
79
|
+
field_dict.update(self.additional_properties)
|
|
80
|
+
field_dict.update({})
|
|
81
|
+
if query is not UNSET:
|
|
82
|
+
field_dict["query"] = query
|
|
83
|
+
if image_url is not UNSET:
|
|
84
|
+
field_dict["image_url"] = image_url
|
|
85
|
+
if base64_image is not UNSET:
|
|
86
|
+
field_dict["base64_image"] = base64_image
|
|
87
|
+
if limit is not UNSET:
|
|
88
|
+
field_dict["limit"] = limit
|
|
89
|
+
if filters is not UNSET:
|
|
90
|
+
field_dict["filters"] = filters
|
|
91
|
+
if config is not UNSET:
|
|
92
|
+
field_dict["config"] = config
|
|
93
|
+
if context is not UNSET:
|
|
94
|
+
field_dict["context"] = context
|
|
95
|
+
|
|
96
|
+
return field_dict
|
|
97
|
+
|
|
98
|
+
@classmethod
|
|
99
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
100
|
+
from ..models.search_config import SearchConfig
|
|
101
|
+
from ..models.search_filters import SearchFilters
|
|
102
|
+
|
|
103
|
+
d = dict(src_dict)
|
|
104
|
+
|
|
105
|
+
def _parse_query(data: object) -> Union[None, Unset, str]:
|
|
106
|
+
if data is None:
|
|
107
|
+
return data
|
|
108
|
+
if isinstance(data, Unset):
|
|
109
|
+
return data
|
|
110
|
+
return cast(Union[None, Unset, str], data)
|
|
111
|
+
|
|
112
|
+
query = _parse_query(d.pop("query", UNSET))
|
|
113
|
+
|
|
114
|
+
def _parse_image_url(data: object) -> Union[None, Unset, str]:
|
|
115
|
+
if data is None:
|
|
116
|
+
return data
|
|
117
|
+
if isinstance(data, Unset):
|
|
118
|
+
return data
|
|
119
|
+
return cast(Union[None, Unset, str], data)
|
|
120
|
+
|
|
121
|
+
image_url = _parse_image_url(d.pop("image_url", UNSET))
|
|
122
|
+
|
|
123
|
+
def _parse_base64_image(data: object) -> Union[None, Unset, str]:
|
|
124
|
+
if data is None:
|
|
125
|
+
return data
|
|
126
|
+
if isinstance(data, Unset):
|
|
127
|
+
return data
|
|
128
|
+
return cast(Union[None, Unset, str], data)
|
|
129
|
+
|
|
130
|
+
base64_image = _parse_base64_image(d.pop("base64_image", UNSET))
|
|
131
|
+
|
|
132
|
+
def _parse_limit(data: object) -> Union[None, Unset, int]:
|
|
133
|
+
if data is None:
|
|
134
|
+
return data
|
|
135
|
+
if isinstance(data, Unset):
|
|
136
|
+
return data
|
|
137
|
+
return cast(Union[None, Unset, int], data)
|
|
138
|
+
|
|
139
|
+
limit = _parse_limit(d.pop("limit", UNSET))
|
|
140
|
+
|
|
141
|
+
_filters = d.pop("filters", UNSET)
|
|
142
|
+
filters: Union[Unset, SearchFilters]
|
|
143
|
+
if isinstance(_filters, Unset):
|
|
144
|
+
filters = UNSET
|
|
145
|
+
else:
|
|
146
|
+
filters = SearchFilters.from_dict(_filters)
|
|
147
|
+
|
|
148
|
+
_config = d.pop("config", UNSET)
|
|
149
|
+
config: Union[Unset, SearchConfig]
|
|
150
|
+
if isinstance(_config, Unset):
|
|
151
|
+
config = UNSET
|
|
152
|
+
else:
|
|
153
|
+
config = SearchConfig.from_dict(_config)
|
|
154
|
+
|
|
155
|
+
def _parse_context(data: object) -> Union[None, Unset, str]:
|
|
156
|
+
if data is None:
|
|
157
|
+
return data
|
|
158
|
+
if isinstance(data, Unset):
|
|
159
|
+
return data
|
|
160
|
+
return cast(Union[None, Unset, str], data)
|
|
161
|
+
|
|
162
|
+
context = _parse_context(d.pop("context", UNSET))
|
|
163
|
+
|
|
164
|
+
search_request = cls(
|
|
165
|
+
query=query,
|
|
166
|
+
image_url=image_url,
|
|
167
|
+
base64_image=base64_image,
|
|
168
|
+
limit=limit,
|
|
169
|
+
filters=filters,
|
|
170
|
+
config=config,
|
|
171
|
+
context=context,
|
|
172
|
+
)
|
|
173
|
+
|
|
174
|
+
search_request.additional_properties = d
|
|
175
|
+
return search_request
|
|
176
|
+
|
|
177
|
+
@property
|
|
178
|
+
def additional_keys(self) -> list[str]:
|
|
179
|
+
return list(self.additional_properties.keys())
|
|
180
|
+
|
|
181
|
+
def __getitem__(self, key: str) -> Any:
|
|
182
|
+
return self.additional_properties[key]
|
|
183
|
+
|
|
184
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
185
|
+
self.additional_properties[key] = value
|
|
186
|
+
|
|
187
|
+
def __delitem__(self, key: str) -> None:
|
|
188
|
+
del self.additional_properties[key]
|
|
189
|
+
|
|
190
|
+
def __contains__(self, key: str) -> bool:
|
|
191
|
+
return key in self.additional_properties
|
|
@@ -0,0 +1,75 @@
|
|
|
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="Variant")
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@_attrs_define
|
|
11
|
+
class Variant:
|
|
12
|
+
"""
|
|
13
|
+
Attributes:
|
|
14
|
+
product_id (str):
|
|
15
|
+
title (str):
|
|
16
|
+
image_url (str):
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
product_id: str
|
|
20
|
+
title: str
|
|
21
|
+
image_url: str
|
|
22
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
23
|
+
|
|
24
|
+
def to_dict(self) -> dict[str, Any]:
|
|
25
|
+
product_id = self.product_id
|
|
26
|
+
|
|
27
|
+
title = self.title
|
|
28
|
+
|
|
29
|
+
image_url = self.image_url
|
|
30
|
+
|
|
31
|
+
field_dict: dict[str, Any] = {}
|
|
32
|
+
field_dict.update(self.additional_properties)
|
|
33
|
+
field_dict.update(
|
|
34
|
+
{
|
|
35
|
+
"product_id": product_id,
|
|
36
|
+
"title": title,
|
|
37
|
+
"image_url": image_url,
|
|
38
|
+
}
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
return field_dict
|
|
42
|
+
|
|
43
|
+
@classmethod
|
|
44
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
45
|
+
d = dict(src_dict)
|
|
46
|
+
product_id = d.pop("product_id")
|
|
47
|
+
|
|
48
|
+
title = d.pop("title")
|
|
49
|
+
|
|
50
|
+
image_url = d.pop("image_url")
|
|
51
|
+
|
|
52
|
+
variant = cls(
|
|
53
|
+
product_id=product_id,
|
|
54
|
+
title=title,
|
|
55
|
+
image_url=image_url,
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
variant.additional_properties = d
|
|
59
|
+
return variant
|
|
60
|
+
|
|
61
|
+
@property
|
|
62
|
+
def additional_keys(self) -> list[str]:
|
|
63
|
+
return list(self.additional_properties.keys())
|
|
64
|
+
|
|
65
|
+
def __getitem__(self, key: str) -> Any:
|
|
66
|
+
return self.additional_properties[key]
|
|
67
|
+
|
|
68
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
69
|
+
self.additional_properties[key] = value
|
|
70
|
+
|
|
71
|
+
def __delitem__(self, key: str) -> None:
|
|
72
|
+
del self.additional_properties[key]
|
|
73
|
+
|
|
74
|
+
def __contains__(self, key: str) -> bool:
|
|
75
|
+
return key in self.additional_properties
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
# Marker file for PEP 561
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"""Contains some shared types for properties"""
|
|
2
|
+
|
|
3
|
+
from collections.abc import Mapping, MutableMapping
|
|
4
|
+
from http import HTTPStatus
|
|
5
|
+
from typing import IO, BinaryIO, Generic, Literal, Optional, TypeVar, Union
|
|
6
|
+
|
|
7
|
+
from attrs import define
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class Unset:
|
|
11
|
+
def __bool__(self) -> Literal[False]:
|
|
12
|
+
return False
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
UNSET: Unset = Unset()
|
|
16
|
+
|
|
17
|
+
# The types that `httpx.Client(files=)` can accept, copied from that library.
|
|
18
|
+
FileContent = Union[IO[bytes], bytes, str]
|
|
19
|
+
FileTypes = Union[
|
|
20
|
+
# (filename, file (or bytes), content_type)
|
|
21
|
+
tuple[Optional[str], FileContent, Optional[str]],
|
|
22
|
+
# (filename, file (or bytes), content_type, headers)
|
|
23
|
+
tuple[Optional[str], FileContent, Optional[str], Mapping[str, str]],
|
|
24
|
+
]
|
|
25
|
+
RequestFiles = list[tuple[str, FileTypes]]
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
@define
|
|
29
|
+
class File:
|
|
30
|
+
"""Contains information for file uploads"""
|
|
31
|
+
|
|
32
|
+
payload: BinaryIO
|
|
33
|
+
file_name: Optional[str] = None
|
|
34
|
+
mime_type: Optional[str] = None
|
|
35
|
+
|
|
36
|
+
def to_tuple(self) -> FileTypes:
|
|
37
|
+
"""Return a tuple representation that httpx will accept for multipart/form-data"""
|
|
38
|
+
return self.file_name, self.payload, self.mime_type
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
T = TypeVar("T")
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
@define
|
|
45
|
+
class Response(Generic[T]):
|
|
46
|
+
"""A response from an endpoint"""
|
|
47
|
+
|
|
48
|
+
status_code: HTTPStatus
|
|
49
|
+
content: bytes
|
|
50
|
+
headers: MutableMapping[str, str]
|
|
51
|
+
parsed: Optional[T]
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
__all__ = ["UNSET", "File", "FileTypes", "RequestFiles", "Response", "Unset"]
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
[tool.poetry]
|
|
2
|
+
name = "fast-api-client"
|
|
3
|
+
version = "0.1.0"
|
|
4
|
+
description = "A client library for accessing FastAPI"
|
|
5
|
+
authors = []
|
|
6
|
+
readme = "README.md"
|
|
7
|
+
packages = [
|
|
8
|
+
{ include = "fast_api_client" },
|
|
9
|
+
]
|
|
10
|
+
include = ["CHANGELOG.md", "fast_api_client/py.typed"]
|
|
11
|
+
|
|
12
|
+
[tool.poetry.dependencies]
|
|
13
|
+
python = "^3.9"
|
|
14
|
+
httpx = ">=0.23.0,<0.29.0"
|
|
15
|
+
attrs = ">=22.2.0"
|
|
16
|
+
python-dateutil = "^2.8.0"
|
|
17
|
+
|
|
18
|
+
[build-system]
|
|
19
|
+
requires = ["poetry-core>=2.0.0,<3.0.0"]
|
|
20
|
+
build-backend = "poetry.core.masonry.api"
|
|
21
|
+
|
|
22
|
+
[tool.ruff]
|
|
23
|
+
line-length = 120
|
|
24
|
+
|
|
25
|
+
[tool.ruff.lint]
|
|
26
|
+
select = ["F", "I", "UP"]
|