channel3-sdk 2.11.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.
- channel3_sdk/__init__.py +102 -0
- channel3_sdk/_base_client.py +2001 -0
- channel3_sdk/_client.py +636 -0
- channel3_sdk/_compat.py +219 -0
- channel3_sdk/_constants.py +14 -0
- channel3_sdk/_exceptions.py +108 -0
- channel3_sdk/_files.py +123 -0
- channel3_sdk/_models.py +857 -0
- channel3_sdk/_qs.py +150 -0
- channel3_sdk/_resource.py +43 -0
- channel3_sdk/_response.py +832 -0
- channel3_sdk/_streaming.py +333 -0
- channel3_sdk/_types.py +261 -0
- channel3_sdk/_utils/__init__.py +64 -0
- channel3_sdk/_utils/_compat.py +45 -0
- channel3_sdk/_utils/_datetime_parse.py +136 -0
- channel3_sdk/_utils/_logs.py +25 -0
- channel3_sdk/_utils/_proxy.py +65 -0
- channel3_sdk/_utils/_reflection.py +42 -0
- channel3_sdk/_utils/_resources_proxy.py +24 -0
- channel3_sdk/_utils/_streams.py +12 -0
- channel3_sdk/_utils/_sync.py +58 -0
- channel3_sdk/_utils/_transform.py +457 -0
- channel3_sdk/_utils/_typing.py +156 -0
- channel3_sdk/_utils/_utils.py +421 -0
- channel3_sdk/_version.py +4 -0
- channel3_sdk/lib/.keep +4 -0
- channel3_sdk/py.typed +0 -0
- channel3_sdk/resources/__init__.py +89 -0
- channel3_sdk/resources/brands.py +169 -0
- channel3_sdk/resources/enrich.py +169 -0
- channel3_sdk/resources/price_tracking.py +450 -0
- channel3_sdk/resources/products.py +206 -0
- channel3_sdk/resources/search.py +231 -0
- channel3_sdk/resources/websites.py +171 -0
- channel3_sdk/types/__init__.py +30 -0
- channel3_sdk/types/availability_status.py +9 -0
- channel3_sdk/types/brand.py +20 -0
- channel3_sdk/types/brand_find_params.py +11 -0
- channel3_sdk/types/enrich_enrich_url_params.py +12 -0
- channel3_sdk/types/paginated_subscriptions.py +14 -0
- channel3_sdk/types/price.py +18 -0
- channel3_sdk/types/price_history.py +43 -0
- channel3_sdk/types/price_tracking_get_history_params.py +12 -0
- channel3_sdk/types/price_tracking_list_subscriptions_params.py +14 -0
- channel3_sdk/types/price_tracking_start_params.py +11 -0
- channel3_sdk/types/price_tracking_stop_params.py +11 -0
- channel3_sdk/types/product.py +89 -0
- channel3_sdk/types/product_detail.py +84 -0
- channel3_sdk/types/product_retrieve_params.py +26 -0
- channel3_sdk/types/redirect_mode.py +7 -0
- channel3_sdk/types/search_config_param.py +27 -0
- channel3_sdk/types/search_filter_price_param.py +18 -0
- channel3_sdk/types/search_filters_param.py +44 -0
- channel3_sdk/types/search_perform_params.py +37 -0
- channel3_sdk/types/search_perform_response.py +10 -0
- channel3_sdk/types/subscription.py +16 -0
- channel3_sdk/types/variant.py +13 -0
- channel3_sdk/types/website.py +16 -0
- channel3_sdk/types/website_find_params.py +11 -0
- channel3_sdk-2.11.0.dist-info/METADATA +411 -0
- channel3_sdk-2.11.0.dist-info/RECORD +64 -0
- channel3_sdk-2.11.0.dist-info/WHEEL +4 -0
- channel3_sdk-2.11.0.dist-info/licenses/LICENSE +201 -0
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import httpx
|
|
6
|
+
|
|
7
|
+
from ..types import enrich_enrich_url_params
|
|
8
|
+
from .._types import Body, Query, Headers, NotGiven, not_given
|
|
9
|
+
from .._utils import maybe_transform, async_maybe_transform
|
|
10
|
+
from .._compat import cached_property
|
|
11
|
+
from .._resource import SyncAPIResource, AsyncAPIResource
|
|
12
|
+
from .._response import (
|
|
13
|
+
to_raw_response_wrapper,
|
|
14
|
+
to_streamed_response_wrapper,
|
|
15
|
+
async_to_raw_response_wrapper,
|
|
16
|
+
async_to_streamed_response_wrapper,
|
|
17
|
+
)
|
|
18
|
+
from .._base_client import make_request_options
|
|
19
|
+
from ..types.product_detail import ProductDetail
|
|
20
|
+
|
|
21
|
+
__all__ = ["EnrichResource", "AsyncEnrichResource"]
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class EnrichResource(SyncAPIResource):
|
|
25
|
+
@cached_property
|
|
26
|
+
def with_raw_response(self) -> EnrichResourceWithRawResponse:
|
|
27
|
+
"""
|
|
28
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
29
|
+
the raw response object instead of the parsed content.
|
|
30
|
+
|
|
31
|
+
For more information, see https://www.github.com/channel3-ai/sdk-python#accessing-raw-response-data-eg-headers
|
|
32
|
+
"""
|
|
33
|
+
return EnrichResourceWithRawResponse(self)
|
|
34
|
+
|
|
35
|
+
@cached_property
|
|
36
|
+
def with_streaming_response(self) -> EnrichResourceWithStreamingResponse:
|
|
37
|
+
"""
|
|
38
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
39
|
+
|
|
40
|
+
For more information, see https://www.github.com/channel3-ai/sdk-python#with_streaming_response
|
|
41
|
+
"""
|
|
42
|
+
return EnrichResourceWithStreamingResponse(self)
|
|
43
|
+
|
|
44
|
+
def enrich_url(
|
|
45
|
+
self,
|
|
46
|
+
*,
|
|
47
|
+
url: str,
|
|
48
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
49
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
50
|
+
extra_headers: Headers | None = None,
|
|
51
|
+
extra_query: Query | None = None,
|
|
52
|
+
extra_body: Body | None = None,
|
|
53
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
54
|
+
) -> ProductDetail:
|
|
55
|
+
"""
|
|
56
|
+
Search by product URL, get back full product information from Channel3’s product
|
|
57
|
+
database.
|
|
58
|
+
|
|
59
|
+
Args:
|
|
60
|
+
url: The URL of the product to enrich
|
|
61
|
+
|
|
62
|
+
extra_headers: Send extra headers
|
|
63
|
+
|
|
64
|
+
extra_query: Add additional query parameters to the request
|
|
65
|
+
|
|
66
|
+
extra_body: Add additional JSON properties to the request
|
|
67
|
+
|
|
68
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
69
|
+
"""
|
|
70
|
+
return self._post(
|
|
71
|
+
"/v0/enrich",
|
|
72
|
+
body=maybe_transform({"url": url}, enrich_enrich_url_params.EnrichEnrichURLParams),
|
|
73
|
+
options=make_request_options(
|
|
74
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
75
|
+
),
|
|
76
|
+
cast_to=ProductDetail,
|
|
77
|
+
)
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
class AsyncEnrichResource(AsyncAPIResource):
|
|
81
|
+
@cached_property
|
|
82
|
+
def with_raw_response(self) -> AsyncEnrichResourceWithRawResponse:
|
|
83
|
+
"""
|
|
84
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
85
|
+
the raw response object instead of the parsed content.
|
|
86
|
+
|
|
87
|
+
For more information, see https://www.github.com/channel3-ai/sdk-python#accessing-raw-response-data-eg-headers
|
|
88
|
+
"""
|
|
89
|
+
return AsyncEnrichResourceWithRawResponse(self)
|
|
90
|
+
|
|
91
|
+
@cached_property
|
|
92
|
+
def with_streaming_response(self) -> AsyncEnrichResourceWithStreamingResponse:
|
|
93
|
+
"""
|
|
94
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
95
|
+
|
|
96
|
+
For more information, see https://www.github.com/channel3-ai/sdk-python#with_streaming_response
|
|
97
|
+
"""
|
|
98
|
+
return AsyncEnrichResourceWithStreamingResponse(self)
|
|
99
|
+
|
|
100
|
+
async def enrich_url(
|
|
101
|
+
self,
|
|
102
|
+
*,
|
|
103
|
+
url: str,
|
|
104
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
105
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
106
|
+
extra_headers: Headers | None = None,
|
|
107
|
+
extra_query: Query | None = None,
|
|
108
|
+
extra_body: Body | None = None,
|
|
109
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
110
|
+
) -> ProductDetail:
|
|
111
|
+
"""
|
|
112
|
+
Search by product URL, get back full product information from Channel3’s product
|
|
113
|
+
database.
|
|
114
|
+
|
|
115
|
+
Args:
|
|
116
|
+
url: The URL of the product to enrich
|
|
117
|
+
|
|
118
|
+
extra_headers: Send extra headers
|
|
119
|
+
|
|
120
|
+
extra_query: Add additional query parameters to the request
|
|
121
|
+
|
|
122
|
+
extra_body: Add additional JSON properties to the request
|
|
123
|
+
|
|
124
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
125
|
+
"""
|
|
126
|
+
return await self._post(
|
|
127
|
+
"/v0/enrich",
|
|
128
|
+
body=await async_maybe_transform({"url": url}, enrich_enrich_url_params.EnrichEnrichURLParams),
|
|
129
|
+
options=make_request_options(
|
|
130
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
131
|
+
),
|
|
132
|
+
cast_to=ProductDetail,
|
|
133
|
+
)
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
class EnrichResourceWithRawResponse:
|
|
137
|
+
def __init__(self, enrich: EnrichResource) -> None:
|
|
138
|
+
self._enrich = enrich
|
|
139
|
+
|
|
140
|
+
self.enrich_url = to_raw_response_wrapper(
|
|
141
|
+
enrich.enrich_url,
|
|
142
|
+
)
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
class AsyncEnrichResourceWithRawResponse:
|
|
146
|
+
def __init__(self, enrich: AsyncEnrichResource) -> None:
|
|
147
|
+
self._enrich = enrich
|
|
148
|
+
|
|
149
|
+
self.enrich_url = async_to_raw_response_wrapper(
|
|
150
|
+
enrich.enrich_url,
|
|
151
|
+
)
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
class EnrichResourceWithStreamingResponse:
|
|
155
|
+
def __init__(self, enrich: EnrichResource) -> None:
|
|
156
|
+
self._enrich = enrich
|
|
157
|
+
|
|
158
|
+
self.enrich_url = to_streamed_response_wrapper(
|
|
159
|
+
enrich.enrich_url,
|
|
160
|
+
)
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
class AsyncEnrichResourceWithStreamingResponse:
|
|
164
|
+
def __init__(self, enrich: AsyncEnrichResource) -> None:
|
|
165
|
+
self._enrich = enrich
|
|
166
|
+
|
|
167
|
+
self.enrich_url = async_to_streamed_response_wrapper(
|
|
168
|
+
enrich.enrich_url,
|
|
169
|
+
)
|
|
@@ -0,0 +1,450 @@
|
|
|
1
|
+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Optional
|
|
6
|
+
|
|
7
|
+
import httpx
|
|
8
|
+
|
|
9
|
+
from ..types import (
|
|
10
|
+
price_tracking_stop_params,
|
|
11
|
+
price_tracking_start_params,
|
|
12
|
+
price_tracking_get_history_params,
|
|
13
|
+
price_tracking_list_subscriptions_params,
|
|
14
|
+
)
|
|
15
|
+
from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given
|
|
16
|
+
from .._utils import maybe_transform, async_maybe_transform
|
|
17
|
+
from .._compat import cached_property
|
|
18
|
+
from .._resource import SyncAPIResource, AsyncAPIResource
|
|
19
|
+
from .._response import (
|
|
20
|
+
to_raw_response_wrapper,
|
|
21
|
+
to_streamed_response_wrapper,
|
|
22
|
+
async_to_raw_response_wrapper,
|
|
23
|
+
async_to_streamed_response_wrapper,
|
|
24
|
+
)
|
|
25
|
+
from .._base_client import make_request_options
|
|
26
|
+
from ..types.subscription import Subscription
|
|
27
|
+
from ..types.price_history import PriceHistory
|
|
28
|
+
from ..types.paginated_subscriptions import PaginatedSubscriptions
|
|
29
|
+
|
|
30
|
+
__all__ = ["PriceTrackingResource", "AsyncPriceTrackingResource"]
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
class PriceTrackingResource(SyncAPIResource):
|
|
34
|
+
@cached_property
|
|
35
|
+
def with_raw_response(self) -> PriceTrackingResourceWithRawResponse:
|
|
36
|
+
"""
|
|
37
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
38
|
+
the raw response object instead of the parsed content.
|
|
39
|
+
|
|
40
|
+
For more information, see https://www.github.com/channel3-ai/sdk-python#accessing-raw-response-data-eg-headers
|
|
41
|
+
"""
|
|
42
|
+
return PriceTrackingResourceWithRawResponse(self)
|
|
43
|
+
|
|
44
|
+
@cached_property
|
|
45
|
+
def with_streaming_response(self) -> PriceTrackingResourceWithStreamingResponse:
|
|
46
|
+
"""
|
|
47
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
48
|
+
|
|
49
|
+
For more information, see https://www.github.com/channel3-ai/sdk-python#with_streaming_response
|
|
50
|
+
"""
|
|
51
|
+
return PriceTrackingResourceWithStreamingResponse(self)
|
|
52
|
+
|
|
53
|
+
def get_history(
|
|
54
|
+
self,
|
|
55
|
+
canonical_product_id: str,
|
|
56
|
+
*,
|
|
57
|
+
days: int | Omit = omit,
|
|
58
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
59
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
60
|
+
extra_headers: Headers | None = None,
|
|
61
|
+
extra_query: Query | None = None,
|
|
62
|
+
extra_body: Body | None = None,
|
|
63
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
64
|
+
) -> PriceHistory:
|
|
65
|
+
"""
|
|
66
|
+
Get price history for a canonical product.
|
|
67
|
+
|
|
68
|
+
Args:
|
|
69
|
+
days: Number of days of history to fetch (max 30)
|
|
70
|
+
|
|
71
|
+
extra_headers: Send extra headers
|
|
72
|
+
|
|
73
|
+
extra_query: Add additional query parameters to the request
|
|
74
|
+
|
|
75
|
+
extra_body: Add additional JSON properties to the request
|
|
76
|
+
|
|
77
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
78
|
+
"""
|
|
79
|
+
if not canonical_product_id:
|
|
80
|
+
raise ValueError(
|
|
81
|
+
f"Expected a non-empty value for `canonical_product_id` but received {canonical_product_id!r}"
|
|
82
|
+
)
|
|
83
|
+
return self._get(
|
|
84
|
+
f"/v0/price-tracking/history/{canonical_product_id}",
|
|
85
|
+
options=make_request_options(
|
|
86
|
+
extra_headers=extra_headers,
|
|
87
|
+
extra_query=extra_query,
|
|
88
|
+
extra_body=extra_body,
|
|
89
|
+
timeout=timeout,
|
|
90
|
+
query=maybe_transform({"days": days}, price_tracking_get_history_params.PriceTrackingGetHistoryParams),
|
|
91
|
+
),
|
|
92
|
+
cast_to=PriceHistory,
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
def list_subscriptions(
|
|
96
|
+
self,
|
|
97
|
+
*,
|
|
98
|
+
limit: int | Omit = omit,
|
|
99
|
+
page_token: Optional[str] | Omit = omit,
|
|
100
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
101
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
102
|
+
extra_headers: Headers | None = None,
|
|
103
|
+
extra_query: Query | None = None,
|
|
104
|
+
extra_body: Body | None = None,
|
|
105
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
106
|
+
) -> PaginatedSubscriptions:
|
|
107
|
+
"""
|
|
108
|
+
List your active price tracking subscriptions.
|
|
109
|
+
|
|
110
|
+
Args:
|
|
111
|
+
extra_headers: Send extra headers
|
|
112
|
+
|
|
113
|
+
extra_query: Add additional query parameters to the request
|
|
114
|
+
|
|
115
|
+
extra_body: Add additional JSON properties to the request
|
|
116
|
+
|
|
117
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
118
|
+
"""
|
|
119
|
+
return self._get(
|
|
120
|
+
"/v0/price-tracking/subscriptions",
|
|
121
|
+
options=make_request_options(
|
|
122
|
+
extra_headers=extra_headers,
|
|
123
|
+
extra_query=extra_query,
|
|
124
|
+
extra_body=extra_body,
|
|
125
|
+
timeout=timeout,
|
|
126
|
+
query=maybe_transform(
|
|
127
|
+
{
|
|
128
|
+
"limit": limit,
|
|
129
|
+
"page_token": page_token,
|
|
130
|
+
},
|
|
131
|
+
price_tracking_list_subscriptions_params.PriceTrackingListSubscriptionsParams,
|
|
132
|
+
),
|
|
133
|
+
),
|
|
134
|
+
cast_to=PaginatedSubscriptions,
|
|
135
|
+
)
|
|
136
|
+
|
|
137
|
+
def start(
|
|
138
|
+
self,
|
|
139
|
+
*,
|
|
140
|
+
canonical_product_id: str,
|
|
141
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
142
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
143
|
+
extra_headers: Headers | None = None,
|
|
144
|
+
extra_query: Query | None = None,
|
|
145
|
+
extra_body: Body | None = None,
|
|
146
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
147
|
+
) -> Subscription:
|
|
148
|
+
"""
|
|
149
|
+
Start tracking prices for a canonical product.
|
|
150
|
+
|
|
151
|
+
Args:
|
|
152
|
+
extra_headers: Send extra headers
|
|
153
|
+
|
|
154
|
+
extra_query: Add additional query parameters to the request
|
|
155
|
+
|
|
156
|
+
extra_body: Add additional JSON properties to the request
|
|
157
|
+
|
|
158
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
159
|
+
"""
|
|
160
|
+
return self._post(
|
|
161
|
+
"/v0/price-tracking/start",
|
|
162
|
+
body=maybe_transform(
|
|
163
|
+
{"canonical_product_id": canonical_product_id}, price_tracking_start_params.PriceTrackingStartParams
|
|
164
|
+
),
|
|
165
|
+
options=make_request_options(
|
|
166
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
167
|
+
),
|
|
168
|
+
cast_to=Subscription,
|
|
169
|
+
)
|
|
170
|
+
|
|
171
|
+
def stop(
|
|
172
|
+
self,
|
|
173
|
+
*,
|
|
174
|
+
canonical_product_id: str,
|
|
175
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
176
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
177
|
+
extra_headers: Headers | None = None,
|
|
178
|
+
extra_query: Query | None = None,
|
|
179
|
+
extra_body: Body | None = None,
|
|
180
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
181
|
+
) -> Subscription:
|
|
182
|
+
"""
|
|
183
|
+
Stop tracking prices for a canonical product.
|
|
184
|
+
|
|
185
|
+
Args:
|
|
186
|
+
extra_headers: Send extra headers
|
|
187
|
+
|
|
188
|
+
extra_query: Add additional query parameters to the request
|
|
189
|
+
|
|
190
|
+
extra_body: Add additional JSON properties to the request
|
|
191
|
+
|
|
192
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
193
|
+
"""
|
|
194
|
+
return self._post(
|
|
195
|
+
"/v0/price-tracking/stop",
|
|
196
|
+
body=maybe_transform(
|
|
197
|
+
{"canonical_product_id": canonical_product_id}, price_tracking_stop_params.PriceTrackingStopParams
|
|
198
|
+
),
|
|
199
|
+
options=make_request_options(
|
|
200
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
201
|
+
),
|
|
202
|
+
cast_to=Subscription,
|
|
203
|
+
)
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
class AsyncPriceTrackingResource(AsyncAPIResource):
|
|
207
|
+
@cached_property
|
|
208
|
+
def with_raw_response(self) -> AsyncPriceTrackingResourceWithRawResponse:
|
|
209
|
+
"""
|
|
210
|
+
This property can be used as a prefix for any HTTP method call to return
|
|
211
|
+
the raw response object instead of the parsed content.
|
|
212
|
+
|
|
213
|
+
For more information, see https://www.github.com/channel3-ai/sdk-python#accessing-raw-response-data-eg-headers
|
|
214
|
+
"""
|
|
215
|
+
return AsyncPriceTrackingResourceWithRawResponse(self)
|
|
216
|
+
|
|
217
|
+
@cached_property
|
|
218
|
+
def with_streaming_response(self) -> AsyncPriceTrackingResourceWithStreamingResponse:
|
|
219
|
+
"""
|
|
220
|
+
An alternative to `.with_raw_response` that doesn't eagerly read the response body.
|
|
221
|
+
|
|
222
|
+
For more information, see https://www.github.com/channel3-ai/sdk-python#with_streaming_response
|
|
223
|
+
"""
|
|
224
|
+
return AsyncPriceTrackingResourceWithStreamingResponse(self)
|
|
225
|
+
|
|
226
|
+
async def get_history(
|
|
227
|
+
self,
|
|
228
|
+
canonical_product_id: str,
|
|
229
|
+
*,
|
|
230
|
+
days: int | Omit = omit,
|
|
231
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
232
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
233
|
+
extra_headers: Headers | None = None,
|
|
234
|
+
extra_query: Query | None = None,
|
|
235
|
+
extra_body: Body | None = None,
|
|
236
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
237
|
+
) -> PriceHistory:
|
|
238
|
+
"""
|
|
239
|
+
Get price history for a canonical product.
|
|
240
|
+
|
|
241
|
+
Args:
|
|
242
|
+
days: Number of days of history to fetch (max 30)
|
|
243
|
+
|
|
244
|
+
extra_headers: Send extra headers
|
|
245
|
+
|
|
246
|
+
extra_query: Add additional query parameters to the request
|
|
247
|
+
|
|
248
|
+
extra_body: Add additional JSON properties to the request
|
|
249
|
+
|
|
250
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
251
|
+
"""
|
|
252
|
+
if not canonical_product_id:
|
|
253
|
+
raise ValueError(
|
|
254
|
+
f"Expected a non-empty value for `canonical_product_id` but received {canonical_product_id!r}"
|
|
255
|
+
)
|
|
256
|
+
return await self._get(
|
|
257
|
+
f"/v0/price-tracking/history/{canonical_product_id}",
|
|
258
|
+
options=make_request_options(
|
|
259
|
+
extra_headers=extra_headers,
|
|
260
|
+
extra_query=extra_query,
|
|
261
|
+
extra_body=extra_body,
|
|
262
|
+
timeout=timeout,
|
|
263
|
+
query=await async_maybe_transform(
|
|
264
|
+
{"days": days}, price_tracking_get_history_params.PriceTrackingGetHistoryParams
|
|
265
|
+
),
|
|
266
|
+
),
|
|
267
|
+
cast_to=PriceHistory,
|
|
268
|
+
)
|
|
269
|
+
|
|
270
|
+
async def list_subscriptions(
|
|
271
|
+
self,
|
|
272
|
+
*,
|
|
273
|
+
limit: int | Omit = omit,
|
|
274
|
+
page_token: Optional[str] | Omit = omit,
|
|
275
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
276
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
277
|
+
extra_headers: Headers | None = None,
|
|
278
|
+
extra_query: Query | None = None,
|
|
279
|
+
extra_body: Body | None = None,
|
|
280
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
281
|
+
) -> PaginatedSubscriptions:
|
|
282
|
+
"""
|
|
283
|
+
List your active price tracking subscriptions.
|
|
284
|
+
|
|
285
|
+
Args:
|
|
286
|
+
extra_headers: Send extra headers
|
|
287
|
+
|
|
288
|
+
extra_query: Add additional query parameters to the request
|
|
289
|
+
|
|
290
|
+
extra_body: Add additional JSON properties to the request
|
|
291
|
+
|
|
292
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
293
|
+
"""
|
|
294
|
+
return await self._get(
|
|
295
|
+
"/v0/price-tracking/subscriptions",
|
|
296
|
+
options=make_request_options(
|
|
297
|
+
extra_headers=extra_headers,
|
|
298
|
+
extra_query=extra_query,
|
|
299
|
+
extra_body=extra_body,
|
|
300
|
+
timeout=timeout,
|
|
301
|
+
query=await async_maybe_transform(
|
|
302
|
+
{
|
|
303
|
+
"limit": limit,
|
|
304
|
+
"page_token": page_token,
|
|
305
|
+
},
|
|
306
|
+
price_tracking_list_subscriptions_params.PriceTrackingListSubscriptionsParams,
|
|
307
|
+
),
|
|
308
|
+
),
|
|
309
|
+
cast_to=PaginatedSubscriptions,
|
|
310
|
+
)
|
|
311
|
+
|
|
312
|
+
async def start(
|
|
313
|
+
self,
|
|
314
|
+
*,
|
|
315
|
+
canonical_product_id: str,
|
|
316
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
317
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
318
|
+
extra_headers: Headers | None = None,
|
|
319
|
+
extra_query: Query | None = None,
|
|
320
|
+
extra_body: Body | None = None,
|
|
321
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
322
|
+
) -> Subscription:
|
|
323
|
+
"""
|
|
324
|
+
Start tracking prices for a canonical product.
|
|
325
|
+
|
|
326
|
+
Args:
|
|
327
|
+
extra_headers: Send extra headers
|
|
328
|
+
|
|
329
|
+
extra_query: Add additional query parameters to the request
|
|
330
|
+
|
|
331
|
+
extra_body: Add additional JSON properties to the request
|
|
332
|
+
|
|
333
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
334
|
+
"""
|
|
335
|
+
return await self._post(
|
|
336
|
+
"/v0/price-tracking/start",
|
|
337
|
+
body=await async_maybe_transform(
|
|
338
|
+
{"canonical_product_id": canonical_product_id}, price_tracking_start_params.PriceTrackingStartParams
|
|
339
|
+
),
|
|
340
|
+
options=make_request_options(
|
|
341
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
342
|
+
),
|
|
343
|
+
cast_to=Subscription,
|
|
344
|
+
)
|
|
345
|
+
|
|
346
|
+
async def stop(
|
|
347
|
+
self,
|
|
348
|
+
*,
|
|
349
|
+
canonical_product_id: str,
|
|
350
|
+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
|
|
351
|
+
# The extra values given here take precedence over values defined on the client or passed to this method.
|
|
352
|
+
extra_headers: Headers | None = None,
|
|
353
|
+
extra_query: Query | None = None,
|
|
354
|
+
extra_body: Body | None = None,
|
|
355
|
+
timeout: float | httpx.Timeout | None | NotGiven = not_given,
|
|
356
|
+
) -> Subscription:
|
|
357
|
+
"""
|
|
358
|
+
Stop tracking prices for a canonical product.
|
|
359
|
+
|
|
360
|
+
Args:
|
|
361
|
+
extra_headers: Send extra headers
|
|
362
|
+
|
|
363
|
+
extra_query: Add additional query parameters to the request
|
|
364
|
+
|
|
365
|
+
extra_body: Add additional JSON properties to the request
|
|
366
|
+
|
|
367
|
+
timeout: Override the client-level default timeout for this request, in seconds
|
|
368
|
+
"""
|
|
369
|
+
return await self._post(
|
|
370
|
+
"/v0/price-tracking/stop",
|
|
371
|
+
body=await async_maybe_transform(
|
|
372
|
+
{"canonical_product_id": canonical_product_id}, price_tracking_stop_params.PriceTrackingStopParams
|
|
373
|
+
),
|
|
374
|
+
options=make_request_options(
|
|
375
|
+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
|
|
376
|
+
),
|
|
377
|
+
cast_to=Subscription,
|
|
378
|
+
)
|
|
379
|
+
|
|
380
|
+
|
|
381
|
+
class PriceTrackingResourceWithRawResponse:
|
|
382
|
+
def __init__(self, price_tracking: PriceTrackingResource) -> None:
|
|
383
|
+
self._price_tracking = price_tracking
|
|
384
|
+
|
|
385
|
+
self.get_history = to_raw_response_wrapper(
|
|
386
|
+
price_tracking.get_history,
|
|
387
|
+
)
|
|
388
|
+
self.list_subscriptions = to_raw_response_wrapper(
|
|
389
|
+
price_tracking.list_subscriptions,
|
|
390
|
+
)
|
|
391
|
+
self.start = to_raw_response_wrapper(
|
|
392
|
+
price_tracking.start,
|
|
393
|
+
)
|
|
394
|
+
self.stop = to_raw_response_wrapper(
|
|
395
|
+
price_tracking.stop,
|
|
396
|
+
)
|
|
397
|
+
|
|
398
|
+
|
|
399
|
+
class AsyncPriceTrackingResourceWithRawResponse:
|
|
400
|
+
def __init__(self, price_tracking: AsyncPriceTrackingResource) -> None:
|
|
401
|
+
self._price_tracking = price_tracking
|
|
402
|
+
|
|
403
|
+
self.get_history = async_to_raw_response_wrapper(
|
|
404
|
+
price_tracking.get_history,
|
|
405
|
+
)
|
|
406
|
+
self.list_subscriptions = async_to_raw_response_wrapper(
|
|
407
|
+
price_tracking.list_subscriptions,
|
|
408
|
+
)
|
|
409
|
+
self.start = async_to_raw_response_wrapper(
|
|
410
|
+
price_tracking.start,
|
|
411
|
+
)
|
|
412
|
+
self.stop = async_to_raw_response_wrapper(
|
|
413
|
+
price_tracking.stop,
|
|
414
|
+
)
|
|
415
|
+
|
|
416
|
+
|
|
417
|
+
class PriceTrackingResourceWithStreamingResponse:
|
|
418
|
+
def __init__(self, price_tracking: PriceTrackingResource) -> None:
|
|
419
|
+
self._price_tracking = price_tracking
|
|
420
|
+
|
|
421
|
+
self.get_history = to_streamed_response_wrapper(
|
|
422
|
+
price_tracking.get_history,
|
|
423
|
+
)
|
|
424
|
+
self.list_subscriptions = to_streamed_response_wrapper(
|
|
425
|
+
price_tracking.list_subscriptions,
|
|
426
|
+
)
|
|
427
|
+
self.start = to_streamed_response_wrapper(
|
|
428
|
+
price_tracking.start,
|
|
429
|
+
)
|
|
430
|
+
self.stop = to_streamed_response_wrapper(
|
|
431
|
+
price_tracking.stop,
|
|
432
|
+
)
|
|
433
|
+
|
|
434
|
+
|
|
435
|
+
class AsyncPriceTrackingResourceWithStreamingResponse:
|
|
436
|
+
def __init__(self, price_tracking: AsyncPriceTrackingResource) -> None:
|
|
437
|
+
self._price_tracking = price_tracking
|
|
438
|
+
|
|
439
|
+
self.get_history = async_to_streamed_response_wrapper(
|
|
440
|
+
price_tracking.get_history,
|
|
441
|
+
)
|
|
442
|
+
self.list_subscriptions = async_to_streamed_response_wrapper(
|
|
443
|
+
price_tracking.list_subscriptions,
|
|
444
|
+
)
|
|
445
|
+
self.start = async_to_streamed_response_wrapper(
|
|
446
|
+
price_tracking.start,
|
|
447
|
+
)
|
|
448
|
+
self.stop = async_to_streamed_response_wrapper(
|
|
449
|
+
price_tracking.stop,
|
|
450
|
+
)
|