mpt-extension-sdk 5.8.0__py3-none-any.whl → 5.9.1__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)
@@ -103,9 +103,8 @@ def show_banner(): # pragma: no cover
103
103
  for line in banner_lines:
104
104
  colored_line = Text()
105
105
  for idx, line_char in enumerate(line):
106
- char = Text(line_char)
107
- char.stylize(colors[idx])
108
- colored_line = Text.assemble(colored_line, char)
106
+ line_char.stylize(colors[idx])
107
+ colored_line = Text.assemble(colored_line, line_char)
109
108
  console.print(colored_line)
110
109
 
111
110
 
@@ -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.1
4
4
  Summary: Extensions SDK for SoftwareONE Marketplace Platform
5
5
  Author: SoftwareOne AG
6
6
  License: Apache-2.0 license
@@ -29,7 +29,7 @@ Requires-Dist: pyjwt==2.8.*
29
29
  Requires-Dist: pymsteams==0.2.*
30
30
  Requires-Dist: regex<2025,>=2024.7.24
31
31
  Requires-Dist: requests==2.32.*
32
- Requires-Dist: rich==13.7.*
32
+ Requires-Dist: rich==14.1.*
33
33
  Requires-Dist: types-openpyxl==3.1.*
34
34
  Requires-Dist: typing-extensions==4.14.*
35
35
  Requires-Dist: watchfiles==0.21.*
@@ -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
@@ -26,7 +26,7 @@ mpt_extension_sdk/runtime/logging.py,sha256=Pq4OvrYv_SVAuAZOjIIYzC_b9DmGzp5jIS6u
26
26
  mpt_extension_sdk/runtime/master.py,sha256=LbukA5cs2IaKBk32_mZG3qITuAQFW7DtUSnNAdF8pQw,5063
27
27
  mpt_extension_sdk/runtime/swoext.py,sha256=wrZ1RzPOzKa2DTOXkhTTiTlT9LXM9u5AKki2lX3fsVY,1806
28
28
  mpt_extension_sdk/runtime/tracer.py,sha256=7c4GPB6BY5SJRLiqzmCPGdS4d7fbL746AfC6RBJ4WsU,458
29
- mpt_extension_sdk/runtime/utils.py,sha256=YmeGFwavqE4jb-gBUNl7-0BFJOSkLaCGHcOWaJvLBnY,5314
29
+ mpt_extension_sdk/runtime/utils.py,sha256=OkQm7Qw52Rm1lbWIMvSxM2uCQM4SvwWtRaucZC7ZfWo,5289
30
30
  mpt_extension_sdk/runtime/workers.py,sha256=AL2mXOu20hQRmnO-ta2VeLwqMCsbjlGSYxo7AJokZTo,2932
31
31
  mpt_extension_sdk/runtime/commands/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
32
32
  mpt_extension_sdk/runtime/commands/django.py,sha256=Xsj4VjuYonekWSu6gL-qUHChMbo6tKuRVmCqEs2jeoA,1247
@@ -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.1.dist-info/METADATA,sha256=USDGixJk6lvIul6Lw6veE1SEdi0ZVmLP74pEOqV_9Mg,1358
51
+ mpt_extension_sdk-5.9.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
52
+ mpt_extension_sdk-5.9.1.dist-info/entry_points.txt,sha256=N8T9gBssEOm_UeBf9ABbGqtlnethrumfMoL4hNYWVFA,146
53
+ mpt_extension_sdk-5.9.1.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
54
+ mpt_extension_sdk-5.9.1.dist-info/RECORD,,