Skip to content

Commit 443ad36

Browse files
authored
feat(product_catalog): add environmental impact (scaleway#956)
1 parent 0c1453a commit 443ad36

File tree

10 files changed

+2198
-0
lines changed

10 files changed

+2198
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# This file was automatically generated. DO NOT EDIT.
2+
# If you have any remark or suggestion do not hesitate to open an issue.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# This file was automatically generated. DO NOT EDIT.
2+
# If you have any remark or suggestion do not hesitate to open an issue.
3+
from .types import PublicCatalogProductPriceUnitOfMeasureCountableUnit
4+
from .types import PublicCatalogProductPropertiesHardwareCPUArch
5+
from .types import PublicCatalogProductPropertiesHardwareCPUPhysical
6+
from .types import PublicCatalogProductPropertiesHardwareCPUVirtual
7+
from .types import PublicCatalogProductPropertiesHardwareCPU
8+
from .types import PublicCatalogProductPropertiesHardwareGPU
9+
from .types import PublicCatalogProductPropertiesHardwareNetwork
10+
from .types import PublicCatalogProductPropertiesHardwareRAM
11+
from .types import PublicCatalogProductPropertiesHardwareStorage
12+
from .types import PublicCatalogProductPriceUnitOfMeasure
13+
from .types import PublicCatalogProductPropertiesAppleSilicon
14+
from .types import PublicCatalogProductPropertiesDedibox
15+
from .types import PublicCatalogProductPropertiesElasticMetal
16+
from .types import PublicCatalogProductPropertiesHardware
17+
from .types import PublicCatalogProductPropertiesInstance
18+
from .types import PublicCatalogProductEnvironmentalImpact
19+
from .types import PublicCatalogProductLocality
20+
from .types import PublicCatalogProductPrice
21+
from .types import PublicCatalogProductProperties
22+
from .types import PublicCatalogProduct
23+
from .types import ListPublicCatalogProductsResponse
24+
from .types import PublicCatalogApiListPublicCatalogProductsRequest
25+
from .api import ProductCatalogV2Alpha1PublicCatalogAPI
26+
27+
__all__ = [
28+
"PublicCatalogProductPriceUnitOfMeasureCountableUnit",
29+
"PublicCatalogProductPropertiesHardwareCPUArch",
30+
"PublicCatalogProductPropertiesHardwareCPUPhysical",
31+
"PublicCatalogProductPropertiesHardwareCPUVirtual",
32+
"PublicCatalogProductPropertiesHardwareCPU",
33+
"PublicCatalogProductPropertiesHardwareGPU",
34+
"PublicCatalogProductPropertiesHardwareNetwork",
35+
"PublicCatalogProductPropertiesHardwareRAM",
36+
"PublicCatalogProductPropertiesHardwareStorage",
37+
"PublicCatalogProductPriceUnitOfMeasure",
38+
"PublicCatalogProductPropertiesAppleSilicon",
39+
"PublicCatalogProductPropertiesDedibox",
40+
"PublicCatalogProductPropertiesElasticMetal",
41+
"PublicCatalogProductPropertiesHardware",
42+
"PublicCatalogProductPropertiesInstance",
43+
"PublicCatalogProductEnvironmentalImpact",
44+
"PublicCatalogProductLocality",
45+
"PublicCatalogProductPrice",
46+
"PublicCatalogProductProperties",
47+
"PublicCatalogProduct",
48+
"ListPublicCatalogProductsResponse",
49+
"PublicCatalogApiListPublicCatalogProductsRequest",
50+
"ProductCatalogV2Alpha1PublicCatalogAPI",
51+
]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# This file was automatically generated. DO NOT EDIT.
2+
# If you have any remark or suggestion do not hesitate to open an issue.
3+
4+
from typing import List, Optional
5+
6+
from scaleway_core.api import API
7+
from scaleway_core.utils import (
8+
fetch_all_pages_async,
9+
)
10+
from .types import (
11+
ListPublicCatalogProductsResponse,
12+
PublicCatalogProduct,
13+
)
14+
from .marshalling import (
15+
unmarshal_ListPublicCatalogProductsResponse,
16+
)
17+
18+
19+
class ProductCatalogV2Alpha1PublicCatalogAPI(API):
20+
""" """
21+
22+
async def list_public_catalog_products(
23+
self,
24+
*,
25+
page: Optional[int] = None,
26+
page_size: Optional[int] = None,
27+
) -> ListPublicCatalogProductsResponse:
28+
"""
29+
List all available products.
30+
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.
31+
:param page: Number of the page. Value must be greater or equal to 1.
32+
:param page_size: The number of products per page. Value must be greater or equal to 1.
33+
:return: :class:`ListPublicCatalogProductsResponse <ListPublicCatalogProductsResponse>`
34+
35+
Usage:
36+
::
37+
38+
result = await api.list_public_catalog_products()
39+
"""
40+
41+
res = self._request(
42+
"GET",
43+
"/product-catalog/v2alpha1/public-catalog/products",
44+
params={
45+
"page": page,
46+
"page_size": page_size or self.client.default_page_size,
47+
},
48+
)
49+
50+
self._throw_on_error(res)
51+
return unmarshal_ListPublicCatalogProductsResponse(res.json())
52+
53+
async def list_public_catalog_products_all(
54+
self,
55+
*,
56+
page: Optional[int] = None,
57+
page_size: Optional[int] = None,
58+
) -> List[PublicCatalogProduct]:
59+
"""
60+
List all available products.
61+
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.
62+
:param page: Number of the page. Value must be greater or equal to 1.
63+
:param page_size: The number of products per page. Value must be greater or equal to 1.
64+
:return: :class:`List[PublicCatalogProduct] <List[PublicCatalogProduct]>`
65+
66+
Usage:
67+
::
68+
69+
result = await api.list_public_catalog_products_all()
70+
"""
71+
72+
return await fetch_all_pages_async(
73+
type=ListPublicCatalogProductsResponse,
74+
key="products",
75+
fetcher=self.list_public_catalog_products,
76+
args={
77+
"page": page,
78+
"page_size": page_size,
79+
},
80+
)

0 commit comments

Comments
 (0)