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
channel3_sdk/_gen/fast_api_client/api/channel3_api/get_product_detail_v0_products_product_id_get.py
ADDED
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any, Optional, Union
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
|
|
6
|
+
from ... import errors
|
|
7
|
+
from ...client import AuthenticatedClient, Client
|
|
8
|
+
from ...models.error_response import ErrorResponse
|
|
9
|
+
from ...models.product_detail import ProductDetail
|
|
10
|
+
from ...types import Response
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def _get_kwargs(
|
|
14
|
+
product_id: str,
|
|
15
|
+
) -> dict[str, Any]:
|
|
16
|
+
_kwargs: dict[str, Any] = {
|
|
17
|
+
"method": "get",
|
|
18
|
+
"url": f"/v0/products/{product_id}",
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return _kwargs
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def _parse_response(
|
|
25
|
+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
|
26
|
+
) -> Optional[Union[ErrorResponse, ProductDetail]]:
|
|
27
|
+
if response.status_code == 200:
|
|
28
|
+
response_200 = ProductDetail.from_dict(response.json())
|
|
29
|
+
|
|
30
|
+
return response_200
|
|
31
|
+
if response.status_code == 401:
|
|
32
|
+
response_401 = ErrorResponse.from_dict(response.json())
|
|
33
|
+
|
|
34
|
+
return response_401
|
|
35
|
+
if response.status_code == 402:
|
|
36
|
+
response_402 = ErrorResponse.from_dict(response.json())
|
|
37
|
+
|
|
38
|
+
return response_402
|
|
39
|
+
if response.status_code == 422:
|
|
40
|
+
response_422 = ErrorResponse.from_dict(response.json())
|
|
41
|
+
|
|
42
|
+
return response_422
|
|
43
|
+
if response.status_code == 500:
|
|
44
|
+
response_500 = ErrorResponse.from_dict(response.json())
|
|
45
|
+
|
|
46
|
+
return response_500
|
|
47
|
+
if response.status_code == 404:
|
|
48
|
+
response_404 = ErrorResponse.from_dict(response.json())
|
|
49
|
+
|
|
50
|
+
return response_404
|
|
51
|
+
if client.raise_on_unexpected_status:
|
|
52
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
53
|
+
else:
|
|
54
|
+
return None
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def _build_response(
|
|
58
|
+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
|
59
|
+
) -> Response[Union[ErrorResponse, ProductDetail]]:
|
|
60
|
+
return Response(
|
|
61
|
+
status_code=HTTPStatus(response.status_code),
|
|
62
|
+
content=response.content,
|
|
63
|
+
headers=response.headers,
|
|
64
|
+
parsed=_parse_response(client=client, response=response),
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
def sync_detailed(
|
|
69
|
+
product_id: str,
|
|
70
|
+
*,
|
|
71
|
+
client: AuthenticatedClient,
|
|
72
|
+
) -> Response[Union[ErrorResponse, ProductDetail]]:
|
|
73
|
+
"""Get Product Detail
|
|
74
|
+
|
|
75
|
+
Get detailed information about a specific product by its ID.
|
|
76
|
+
|
|
77
|
+
Args:
|
|
78
|
+
product_id (str):
|
|
79
|
+
|
|
80
|
+
Raises:
|
|
81
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
82
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
83
|
+
|
|
84
|
+
Returns:
|
|
85
|
+
Response[Union[ErrorResponse, ProductDetail]]
|
|
86
|
+
"""
|
|
87
|
+
|
|
88
|
+
kwargs = _get_kwargs(
|
|
89
|
+
product_id=product_id,
|
|
90
|
+
)
|
|
91
|
+
|
|
92
|
+
response = client.get_httpx_client().request(
|
|
93
|
+
**kwargs,
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
return _build_response(client=client, response=response)
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
def sync(
|
|
100
|
+
product_id: str,
|
|
101
|
+
*,
|
|
102
|
+
client: AuthenticatedClient,
|
|
103
|
+
) -> Optional[Union[ErrorResponse, ProductDetail]]:
|
|
104
|
+
"""Get Product Detail
|
|
105
|
+
|
|
106
|
+
Get detailed information about a specific product by its ID.
|
|
107
|
+
|
|
108
|
+
Args:
|
|
109
|
+
product_id (str):
|
|
110
|
+
|
|
111
|
+
Raises:
|
|
112
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
113
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
114
|
+
|
|
115
|
+
Returns:
|
|
116
|
+
Union[ErrorResponse, ProductDetail]
|
|
117
|
+
"""
|
|
118
|
+
|
|
119
|
+
return sync_detailed(
|
|
120
|
+
product_id=product_id,
|
|
121
|
+
client=client,
|
|
122
|
+
).parsed
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
async def asyncio_detailed(
|
|
126
|
+
product_id: str,
|
|
127
|
+
*,
|
|
128
|
+
client: AuthenticatedClient,
|
|
129
|
+
) -> Response[Union[ErrorResponse, ProductDetail]]:
|
|
130
|
+
"""Get Product Detail
|
|
131
|
+
|
|
132
|
+
Get detailed information about a specific product by its ID.
|
|
133
|
+
|
|
134
|
+
Args:
|
|
135
|
+
product_id (str):
|
|
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
|
+
Returns:
|
|
142
|
+
Response[Union[ErrorResponse, ProductDetail]]
|
|
143
|
+
"""
|
|
144
|
+
|
|
145
|
+
kwargs = _get_kwargs(
|
|
146
|
+
product_id=product_id,
|
|
147
|
+
)
|
|
148
|
+
|
|
149
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
150
|
+
|
|
151
|
+
return _build_response(client=client, response=response)
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
async def asyncio(
|
|
155
|
+
product_id: str,
|
|
156
|
+
*,
|
|
157
|
+
client: AuthenticatedClient,
|
|
158
|
+
) -> Optional[Union[ErrorResponse, ProductDetail]]:
|
|
159
|
+
"""Get Product Detail
|
|
160
|
+
|
|
161
|
+
Get detailed information about a specific product by its ID.
|
|
162
|
+
|
|
163
|
+
Args:
|
|
164
|
+
product_id (str):
|
|
165
|
+
|
|
166
|
+
Raises:
|
|
167
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
168
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
169
|
+
|
|
170
|
+
Returns:
|
|
171
|
+
Union[ErrorResponse, ProductDetail]
|
|
172
|
+
"""
|
|
173
|
+
|
|
174
|
+
return (
|
|
175
|
+
await asyncio_detailed(
|
|
176
|
+
product_id=product_id,
|
|
177
|
+
client=client,
|
|
178
|
+
)
|
|
179
|
+
).parsed
|
|
@@ -0,0 +1,193 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any, Optional, Union
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
|
|
6
|
+
from ... import errors
|
|
7
|
+
from ...client import AuthenticatedClient, Client
|
|
8
|
+
from ...models.error_response import ErrorResponse
|
|
9
|
+
from ...models.product import Product
|
|
10
|
+
from ...models.search_request import SearchRequest
|
|
11
|
+
from ...types import Response
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def _get_kwargs(
|
|
15
|
+
*,
|
|
16
|
+
body: SearchRequest,
|
|
17
|
+
) -> dict[str, Any]:
|
|
18
|
+
headers: dict[str, Any] = {}
|
|
19
|
+
|
|
20
|
+
_kwargs: dict[str, Any] = {
|
|
21
|
+
"method": "post",
|
|
22
|
+
"url": "/v0/search",
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
_kwargs["json"] = body.to_dict()
|
|
26
|
+
|
|
27
|
+
headers["Content-Type"] = "application/json"
|
|
28
|
+
|
|
29
|
+
_kwargs["headers"] = headers
|
|
30
|
+
return _kwargs
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def _parse_response(
|
|
34
|
+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
|
35
|
+
) -> Optional[Union[ErrorResponse, list["Product"]]]:
|
|
36
|
+
if response.status_code == 200:
|
|
37
|
+
response_200 = []
|
|
38
|
+
_response_200 = response.json()
|
|
39
|
+
for response_200_item_data in _response_200:
|
|
40
|
+
response_200_item = Product.from_dict(response_200_item_data)
|
|
41
|
+
|
|
42
|
+
response_200.append(response_200_item)
|
|
43
|
+
|
|
44
|
+
return response_200
|
|
45
|
+
if response.status_code == 401:
|
|
46
|
+
response_401 = ErrorResponse.from_dict(response.json())
|
|
47
|
+
|
|
48
|
+
return response_401
|
|
49
|
+
if response.status_code == 402:
|
|
50
|
+
response_402 = ErrorResponse.from_dict(response.json())
|
|
51
|
+
|
|
52
|
+
return response_402
|
|
53
|
+
if response.status_code == 422:
|
|
54
|
+
response_422 = ErrorResponse.from_dict(response.json())
|
|
55
|
+
|
|
56
|
+
return response_422
|
|
57
|
+
if response.status_code == 500:
|
|
58
|
+
response_500 = ErrorResponse.from_dict(response.json())
|
|
59
|
+
|
|
60
|
+
return response_500
|
|
61
|
+
if response.status_code == 400:
|
|
62
|
+
response_400 = ErrorResponse.from_dict(response.json())
|
|
63
|
+
|
|
64
|
+
return response_400
|
|
65
|
+
if client.raise_on_unexpected_status:
|
|
66
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
67
|
+
else:
|
|
68
|
+
return None
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def _build_response(
|
|
72
|
+
*, client: Union[AuthenticatedClient, Client], response: httpx.Response
|
|
73
|
+
) -> Response[Union[ErrorResponse, list["Product"]]]:
|
|
74
|
+
return Response(
|
|
75
|
+
status_code=HTTPStatus(response.status_code),
|
|
76
|
+
content=response.content,
|
|
77
|
+
headers=response.headers,
|
|
78
|
+
parsed=_parse_response(client=client, response=response),
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def sync_detailed(
|
|
83
|
+
*,
|
|
84
|
+
client: AuthenticatedClient,
|
|
85
|
+
body: SearchRequest,
|
|
86
|
+
) -> Response[Union[ErrorResponse, list["Product"]]]:
|
|
87
|
+
"""Search
|
|
88
|
+
|
|
89
|
+
Search for products.
|
|
90
|
+
|
|
91
|
+
Args:
|
|
92
|
+
body (SearchRequest):
|
|
93
|
+
|
|
94
|
+
Raises:
|
|
95
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
96
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
97
|
+
|
|
98
|
+
Returns:
|
|
99
|
+
Response[Union[ErrorResponse, list['Product']]]
|
|
100
|
+
"""
|
|
101
|
+
|
|
102
|
+
kwargs = _get_kwargs(
|
|
103
|
+
body=body,
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
response = client.get_httpx_client().request(
|
|
107
|
+
**kwargs,
|
|
108
|
+
)
|
|
109
|
+
|
|
110
|
+
return _build_response(client=client, response=response)
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
def sync(
|
|
114
|
+
*,
|
|
115
|
+
client: AuthenticatedClient,
|
|
116
|
+
body: SearchRequest,
|
|
117
|
+
) -> Optional[Union[ErrorResponse, list["Product"]]]:
|
|
118
|
+
"""Search
|
|
119
|
+
|
|
120
|
+
Search for products.
|
|
121
|
+
|
|
122
|
+
Args:
|
|
123
|
+
body (SearchRequest):
|
|
124
|
+
|
|
125
|
+
Raises:
|
|
126
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
127
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
128
|
+
|
|
129
|
+
Returns:
|
|
130
|
+
Union[ErrorResponse, list['Product']]
|
|
131
|
+
"""
|
|
132
|
+
|
|
133
|
+
return sync_detailed(
|
|
134
|
+
client=client,
|
|
135
|
+
body=body,
|
|
136
|
+
).parsed
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
async def asyncio_detailed(
|
|
140
|
+
*,
|
|
141
|
+
client: AuthenticatedClient,
|
|
142
|
+
body: SearchRequest,
|
|
143
|
+
) -> Response[Union[ErrorResponse, list["Product"]]]:
|
|
144
|
+
"""Search
|
|
145
|
+
|
|
146
|
+
Search for products.
|
|
147
|
+
|
|
148
|
+
Args:
|
|
149
|
+
body (SearchRequest):
|
|
150
|
+
|
|
151
|
+
Raises:
|
|
152
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
153
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
154
|
+
|
|
155
|
+
Returns:
|
|
156
|
+
Response[Union[ErrorResponse, list['Product']]]
|
|
157
|
+
"""
|
|
158
|
+
|
|
159
|
+
kwargs = _get_kwargs(
|
|
160
|
+
body=body,
|
|
161
|
+
)
|
|
162
|
+
|
|
163
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
164
|
+
|
|
165
|
+
return _build_response(client=client, response=response)
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
async def asyncio(
|
|
169
|
+
*,
|
|
170
|
+
client: AuthenticatedClient,
|
|
171
|
+
body: SearchRequest,
|
|
172
|
+
) -> Optional[Union[ErrorResponse, list["Product"]]]:
|
|
173
|
+
"""Search
|
|
174
|
+
|
|
175
|
+
Search for products.
|
|
176
|
+
|
|
177
|
+
Args:
|
|
178
|
+
body (SearchRequest):
|
|
179
|
+
|
|
180
|
+
Raises:
|
|
181
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
182
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
183
|
+
|
|
184
|
+
Returns:
|
|
185
|
+
Union[ErrorResponse, list['Product']]
|
|
186
|
+
"""
|
|
187
|
+
|
|
188
|
+
return (
|
|
189
|
+
await asyncio_detailed(
|
|
190
|
+
client=client,
|
|
191
|
+
body=body,
|
|
192
|
+
)
|
|
193
|
+
).parsed
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Contains endpoint functions for accessing the API"""
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
from http import HTTPStatus
|
|
2
|
+
from typing import Any, Optional, Union
|
|
3
|
+
|
|
4
|
+
import httpx
|
|
5
|
+
|
|
6
|
+
from ... import errors
|
|
7
|
+
from ...client import AuthenticatedClient, Client
|
|
8
|
+
from ...types import Response
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def _get_kwargs() -> dict[str, Any]:
|
|
12
|
+
_kwargs: dict[str, Any] = {
|
|
13
|
+
"method": "get",
|
|
14
|
+
"url": "/",
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return _kwargs
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def _parse_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Optional[Any]:
|
|
21
|
+
if response.status_code == 200:
|
|
22
|
+
return None
|
|
23
|
+
if client.raise_on_unexpected_status:
|
|
24
|
+
raise errors.UnexpectedStatus(response.status_code, response.content)
|
|
25
|
+
else:
|
|
26
|
+
return None
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def _build_response(*, client: Union[AuthenticatedClient, Client], response: httpx.Response) -> Response[Any]:
|
|
30
|
+
return Response(
|
|
31
|
+
status_code=HTTPStatus(response.status_code),
|
|
32
|
+
content=response.content,
|
|
33
|
+
headers=response.headers,
|
|
34
|
+
parsed=_parse_response(client=client, response=response),
|
|
35
|
+
)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def sync_detailed(
|
|
39
|
+
*,
|
|
40
|
+
client: Union[AuthenticatedClient, Client],
|
|
41
|
+
) -> Response[Any]:
|
|
42
|
+
"""Root
|
|
43
|
+
|
|
44
|
+
Raises:
|
|
45
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
46
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
47
|
+
|
|
48
|
+
Returns:
|
|
49
|
+
Response[Any]
|
|
50
|
+
"""
|
|
51
|
+
|
|
52
|
+
kwargs = _get_kwargs()
|
|
53
|
+
|
|
54
|
+
response = client.get_httpx_client().request(
|
|
55
|
+
**kwargs,
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
return _build_response(client=client, response=response)
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
async def asyncio_detailed(
|
|
62
|
+
*,
|
|
63
|
+
client: Union[AuthenticatedClient, Client],
|
|
64
|
+
) -> Response[Any]:
|
|
65
|
+
"""Root
|
|
66
|
+
|
|
67
|
+
Raises:
|
|
68
|
+
errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True.
|
|
69
|
+
httpx.TimeoutException: If the request takes longer than Client.timeout.
|
|
70
|
+
|
|
71
|
+
Returns:
|
|
72
|
+
Response[Any]
|
|
73
|
+
"""
|
|
74
|
+
|
|
75
|
+
kwargs = _get_kwargs()
|
|
76
|
+
|
|
77
|
+
response = await client.get_async_httpx_client().request(**kwargs)
|
|
78
|
+
|
|
79
|
+
return _build_response(client=client, response=response)
|