mpt-extension-sdk 5.8.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.
@@ -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
 
@@ -273,10 +274,34 @@ def get_product_onetime_items_by_ids(mpt_client, product_id, item_ids):
273
274
 
274
275
 
275
276
  @wrap_mpt_http_error
276
- def get_product_items_by_period(mpt_client, product_id, period):
277
- """Fetches one-time items for a product."""
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
+ """
278
299
  product_cond = f"eq(product.id,{product_id})"
279
- rql_query = f"and({product_cond},eq(terms.period,{period}))"
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})"
280
305
  url = f"/catalog/items?{rql_query}"
281
306
 
282
307
  return _paginated(mpt_client, url)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mpt-extension-sdk
3
- Version: 5.8.0
3
+ Version: 5.9.0
4
4
  Summary: Extensions SDK for SoftwareONE Marketplace Platform
5
5
  Author: SoftwareOne AG
6
6
  License: Apache-2.0 license
@@ -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=uqbaXT1U4EzXIeUWkaV1KYkU9VL1O8Z4PF6rO1QYXio,15158
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.8.0.dist-info/METADATA,sha256=o30JKI70pZFqaJM9TBvkwEg-stEWhvqBsUzi2aBn3sU,1358
51
- mpt_extension_sdk-5.8.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
52
- mpt_extension_sdk-5.8.0.dist-info/entry_points.txt,sha256=N8T9gBssEOm_UeBf9ABbGqtlnethrumfMoL4hNYWVFA,146
53
- mpt_extension_sdk-5.8.0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
54
- mpt_extension_sdk-5.8.0.dist-info/RECORD,,
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,,