Skip to content

Commit b7c29d2

Browse files
feat(product_catalog): add enum to filter by product type in the public catalog API (scaleway#994)
Co-authored-by: Jonathan R. <[email protected]>
1 parent b16a8f2 commit b7c29d2

File tree

6 files changed

+58
-0
lines changed

6 files changed

+58
-0
lines changed

scaleway-async/scaleway_async/product_catalog/v2alpha1/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# This file was automatically generated. DO NOT EDIT.
22
# If you have any remark or suggestion do not hesitate to open an issue.
3+
from .types import ListPublicCatalogProductsRequestProductType
34
from .types import PublicCatalogProductPropertiesHardwareCPUArch
45
from .types import PublicCatalogProductStatus
56
from .types import PublicCatalogProductUnitOfMeasureCountableUnit
@@ -26,6 +27,7 @@
2627
from .api import ProductCatalogV2Alpha1PublicCatalogAPI
2728

2829
__all__ = [
30+
"ListPublicCatalogProductsRequestProductType",
2931
"PublicCatalogProductPropertiesHardwareCPUArch",
3032
"PublicCatalogProductStatus",
3133
"PublicCatalogProductUnitOfMeasureCountableUnit",

scaleway-async/scaleway_async/product_catalog/v2alpha1/api.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
fetch_all_pages_async,
99
)
1010
from .types import (
11+
ListPublicCatalogProductsRequestProductType,
1112
ListPublicCatalogProductsResponse,
1213
PublicCatalogProduct,
1314
)
@@ -24,12 +25,16 @@ async def list_public_catalog_products(
2425
*,
2526
page: Optional[int] = None,
2627
page_size: Optional[int] = None,
28+
product_types: Optional[
29+
List[ListPublicCatalogProductsRequestProductType]
30+
] = None,
2731
) -> ListPublicCatalogProductsResponse:
2832
"""
2933
List all available products.
3034
List all available products in the Scaleway catalog. Returns a complete list of products with their corresponding description, locations, prices and properties. You can define the `page` number and `page_size` for your query in the request.
3135
:param page: Number of the page. Value must be greater or equal to 1.
3236
:param page_size: The number of products per page. Value must be greater or equal to 1.
37+
:param product_types: The list of filtered product categories.
3338
:return: :class:`ListPublicCatalogProductsResponse <ListPublicCatalogProductsResponse>`
3439
3540
Usage:
@@ -44,6 +49,7 @@ async def list_public_catalog_products(
4449
params={
4550
"page": page,
4651
"page_size": page_size or self.client.default_page_size,
52+
"product_types": product_types,
4753
},
4854
)
4955

@@ -55,12 +61,16 @@ async def list_public_catalog_products_all(
5561
*,
5662
page: Optional[int] = None,
5763
page_size: Optional[int] = None,
64+
product_types: Optional[
65+
List[ListPublicCatalogProductsRequestProductType]
66+
] = None,
5867
) -> List[PublicCatalogProduct]:
5968
"""
6069
List all available products.
6170
List all available products in the Scaleway catalog. Returns a complete list of products with their corresponding description, locations, prices and properties. You can define the `page` number and `page_size` for your query in the request.
6271
:param page: Number of the page. Value must be greater or equal to 1.
6372
:param page_size: The number of products per page. Value must be greater or equal to 1.
73+
:param product_types: The list of filtered product categories.
6474
:return: :class:`List[PublicCatalogProduct] <List[PublicCatalogProduct]>`
6575
6676
Usage:
@@ -76,5 +86,6 @@ async def list_public_catalog_products_all(
7686
args={
7787
"page": page,
7888
"page_size": page_size,
89+
"product_types": product_types,
7990
},
8091
)

scaleway-async/scaleway_async/product_catalog/v2alpha1/types.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,17 @@
1717
)
1818

1919

20+
class ListPublicCatalogProductsRequestProductType(str, Enum, metaclass=StrEnumMeta):
21+
UNKNOWN_PRODUCT_TYPE = "unknown_product_type"
22+
INSTANCE = "instance"
23+
APPLE_SILICON = "apple_silicon"
24+
ELASTIC_METAL = "elastic_metal"
25+
DEDIBOX = "dedibox"
26+
27+
def __str__(self) -> str:
28+
return str(self.value)
29+
30+
2031
class PublicCatalogProductPropertiesHardwareCPUArch(str, Enum, metaclass=StrEnumMeta):
2132
UNKNOWN_ARCH = "unknown_arch"
2233
X64 = "x64"
@@ -415,3 +426,8 @@ class PublicCatalogApiListPublicCatalogProductsRequest:
415426
"""
416427
The number of products per page. Value must be greater or equal to 1.
417428
"""
429+
430+
product_types: Optional[List[ListPublicCatalogProductsRequestProductType]]
431+
"""
432+
The list of filtered product categories.
433+
"""

scaleway/scaleway/product_catalog/v2alpha1/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# This file was automatically generated. DO NOT EDIT.
22
# If you have any remark or suggestion do not hesitate to open an issue.
3+
from .types import ListPublicCatalogProductsRequestProductType
34
from .types import PublicCatalogProductPropertiesHardwareCPUArch
45
from .types import PublicCatalogProductStatus
56
from .types import PublicCatalogProductUnitOfMeasureCountableUnit
@@ -26,6 +27,7 @@
2627
from .api import ProductCatalogV2Alpha1PublicCatalogAPI
2728

2829
__all__ = [
30+
"ListPublicCatalogProductsRequestProductType",
2931
"PublicCatalogProductPropertiesHardwareCPUArch",
3032
"PublicCatalogProductStatus",
3133
"PublicCatalogProductUnitOfMeasureCountableUnit",

scaleway/scaleway/product_catalog/v2alpha1/api.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
fetch_all_pages,
99
)
1010
from .types import (
11+
ListPublicCatalogProductsRequestProductType,
1112
ListPublicCatalogProductsResponse,
1213
PublicCatalogProduct,
1314
)
@@ -24,12 +25,16 @@ def list_public_catalog_products(
2425
*,
2526
page: Optional[int] = None,
2627
page_size: Optional[int] = None,
28+
product_types: Optional[
29+
List[ListPublicCatalogProductsRequestProductType]
30+
] = None,
2731
) -> ListPublicCatalogProductsResponse:
2832
"""
2933
List all available products.
3034
List all available products in the Scaleway catalog. Returns a complete list of products with their corresponding description, locations, prices and properties. You can define the `page` number and `page_size` for your query in the request.
3135
:param page: Number of the page. Value must be greater or equal to 1.
3236
:param page_size: The number of products per page. Value must be greater or equal to 1.
37+
:param product_types: The list of filtered product categories.
3338
:return: :class:`ListPublicCatalogProductsResponse <ListPublicCatalogProductsResponse>`
3439
3540
Usage:
@@ -44,6 +49,7 @@ def list_public_catalog_products(
4449
params={
4550
"page": page,
4651
"page_size": page_size or self.client.default_page_size,
52+
"product_types": product_types,
4753
},
4854
)
4955

@@ -55,12 +61,16 @@ def list_public_catalog_products_all(
5561
*,
5662
page: Optional[int] = None,
5763
page_size: Optional[int] = None,
64+
product_types: Optional[
65+
List[ListPublicCatalogProductsRequestProductType]
66+
] = None,
5867
) -> List[PublicCatalogProduct]:
5968
"""
6069
List all available products.
6170
List all available products in the Scaleway catalog. Returns a complete list of products with their corresponding description, locations, prices and properties. You can define the `page` number and `page_size` for your query in the request.
6271
:param page: Number of the page. Value must be greater or equal to 1.
6372
:param page_size: The number of products per page. Value must be greater or equal to 1.
73+
:param product_types: The list of filtered product categories.
6474
:return: :class:`List[PublicCatalogProduct] <List[PublicCatalogProduct]>`
6575
6676
Usage:
@@ -76,5 +86,6 @@ def list_public_catalog_products_all(
7686
args={
7787
"page": page,
7888
"page_size": page_size,
89+
"product_types": product_types,
7990
},
8091
)

scaleway/scaleway/product_catalog/v2alpha1/types.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,17 @@
1717
)
1818

1919

20+
class ListPublicCatalogProductsRequestProductType(str, Enum, metaclass=StrEnumMeta):
21+
UNKNOWN_PRODUCT_TYPE = "unknown_product_type"
22+
INSTANCE = "instance"
23+
APPLE_SILICON = "apple_silicon"
24+
ELASTIC_METAL = "elastic_metal"
25+
DEDIBOX = "dedibox"
26+
27+
def __str__(self) -> str:
28+
return str(self.value)
29+
30+
2031
class PublicCatalogProductPropertiesHardwareCPUArch(str, Enum, metaclass=StrEnumMeta):
2132
UNKNOWN_ARCH = "unknown_arch"
2233
X64 = "x64"
@@ -415,3 +426,8 @@ class PublicCatalogApiListPublicCatalogProductsRequest:
415426
"""
416427
The number of products per page. Value must be greater or equal to 1.
417428
"""
429+
430+
product_types: Optional[List[ListPublicCatalogProductsRequestProductType]]
431+
"""
432+
The list of filtered product categories.
433+
"""

0 commit comments

Comments
 (0)