mpt-extension-sdk 5.7.0__py3-none-any.whl → 5.9.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.
- mpt_extension_sdk/mpt_http/mpt.py +35 -0
- {mpt_extension_sdk-5.7.0.dist-info → mpt_extension_sdk-5.9.0.dist-info}/METADATA +1 -1
- {mpt_extension_sdk-5.7.0.dist-info → mpt_extension_sdk-5.9.0.dist-info}/RECORD +6 -6
- {mpt_extension_sdk-5.7.0.dist-info → mpt_extension_sdk-5.9.0.dist-info}/WHEEL +0 -0
- {mpt_extension_sdk-5.7.0.dist-info → mpt_extension_sdk-5.9.0.dist-info}/entry_points.txt +0 -0
- {mpt_extension_sdk-5.7.0.dist-info → mpt_extension_sdk-5.9.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import logging
|
|
2
|
+
from collections.abc import Iterable
|
|
2
3
|
from functools import cache
|
|
3
4
|
from itertools import batched
|
|
4
5
|
|
|
@@ -272,6 +273,40 @@ def get_product_onetime_items_by_ids(mpt_client, product_id, item_ids):
|
|
|
272
273
|
return _paginated(mpt_client, url)
|
|
273
274
|
|
|
274
275
|
|
|
276
|
+
@wrap_mpt_http_error
|
|
277
|
+
def get_product_items_by_period(
|
|
278
|
+
mpt_client,
|
|
279
|
+
product_id: str,
|
|
280
|
+
period: str,
|
|
281
|
+
vendor_external_ids: Iterable[str] | None = None,
|
|
282
|
+
):
|
|
283
|
+
"""
|
|
284
|
+
Fetches product items based on a specified period and filters.
|
|
285
|
+
|
|
286
|
+
Args:
|
|
287
|
+
mpt_client: Client in tance to interact with the required API.
|
|
288
|
+
product_id (str): The unique identifier of the product to fetch items for.
|
|
289
|
+
period (str): The period for which to fetch the product items.
|
|
290
|
+
vendor_external_ids (Iterable[str] | None):
|
|
291
|
+
Optional. A list of vendor external IDs to filter out the product items by. Defaults
|
|
292
|
+
to None.
|
|
293
|
+
|
|
294
|
+
Returns:
|
|
295
|
+
list:
|
|
296
|
+
A paginated list of product items matching the specified criteria.
|
|
297
|
+
|
|
298
|
+
"""
|
|
299
|
+
product_cond = f"eq(product.id,{product_id})"
|
|
300
|
+
vendors_cond = ""
|
|
301
|
+
if vendor_external_ids:
|
|
302
|
+
vendor_ids = ",".join(vendor_external_ids)
|
|
303
|
+
vendors_cond = f",in(externalIds.vendor,({vendor_ids})))"
|
|
304
|
+
rql_query = f"and({product_cond},eq(terms.period,{period}){vendors_cond})"
|
|
305
|
+
url = f"/catalog/items?{rql_query}"
|
|
306
|
+
|
|
307
|
+
return _paginated(mpt_client, url)
|
|
308
|
+
|
|
309
|
+
|
|
275
310
|
def get_agreements_by_ids(mpt_client, ids):
|
|
276
311
|
"""Retrieve agreements by their IDs."""
|
|
277
312
|
ids_str = ",".join(ids)
|
|
@@ -16,7 +16,7 @@ mpt_extension_sdk/key_vault/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMp
|
|
|
16
16
|
mpt_extension_sdk/key_vault/base.py,sha256=lgIqLphJTVE3MHxxvtOWBzs13z1seHwN_kJd0XLaBiI,3867
|
|
17
17
|
mpt_extension_sdk/mpt_http/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
18
18
|
mpt_extension_sdk/mpt_http/base.py,sha256=PWjuClTrZzEg1tS43wlgCS8-ardHyG12pHsaLEAWNdQ,1513
|
|
19
|
-
mpt_extension_sdk/mpt_http/mpt.py,sha256=
|
|
19
|
+
mpt_extension_sdk/mpt_http/mpt.py,sha256=8_mOhxj_HCn8WDj8piOLR1mRJAVzODm99SbFr5de8QE,16004
|
|
20
20
|
mpt_extension_sdk/mpt_http/utils.py,sha256=Ek2D4efcJNhQlOyXd4ZeBhwqDjFpvcbBEqxuCqRQ7cU,166
|
|
21
21
|
mpt_extension_sdk/mpt_http/wrap_http_error.py,sha256=O0mEiYfrFwg66wxk9ZRq6h5qShuYlaaepN5ZSlroo2g,2144
|
|
22
22
|
mpt_extension_sdk/runtime/__init__.py,sha256=YY7ChHKTXXv0a6_PG1F4pVASDzleSWMv_Zf7uX0UDyc,244
|
|
@@ -47,8 +47,8 @@ mpt_extension_sdk/runtime/events/utils.py,sha256=6aQVwe9EtUxxictQV9sk8szKC4UXgpQ
|
|
|
47
47
|
mpt_extension_sdk/swo_rql/__init__.py,sha256=QrvRDYhpK-Pd3OF-U2aMeazuKm_kbvXwLRIjd9Mm6ok,104
|
|
48
48
|
mpt_extension_sdk/swo_rql/constants.py,sha256=39BZ78OzdU_dIQtoy-Z_5utXqEXRweIFvM9Zfxg9j5M,171
|
|
49
49
|
mpt_extension_sdk/swo_rql/query_builder.py,sha256=CG1dm7uJNPPCwWcf9sRD5zLbz-dtgECkQ_pX4QXpJPw,10825
|
|
50
|
-
mpt_extension_sdk-5.
|
|
51
|
-
mpt_extension_sdk-5.
|
|
52
|
-
mpt_extension_sdk-5.
|
|
53
|
-
mpt_extension_sdk-5.
|
|
54
|
-
mpt_extension_sdk-5.
|
|
50
|
+
mpt_extension_sdk-5.9.0.dist-info/METADATA,sha256=xX1BOrfDiee5HN5D6Yn0jPrcvV7ESeiFYXouNQ3p-V4,1358
|
|
51
|
+
mpt_extension_sdk-5.9.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
52
|
+
mpt_extension_sdk-5.9.0.dist-info/entry_points.txt,sha256=N8T9gBssEOm_UeBf9ABbGqtlnethrumfMoL4hNYWVFA,146
|
|
53
|
+
mpt_extension_sdk-5.9.0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
54
|
+
mpt_extension_sdk-5.9.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|