Skip to content

Commit 93efec4

Browse files
authored
feat(product_catalog): add generative apis to catalog api (scaleway#1400)
1 parent bb7eb63 commit 93efec4

File tree

6 files changed

+148
-0
lines changed

6 files changed

+148
-0
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# If you have any remark or suggestion do not hesitate to open an issue.
33
from .types import ListPublicCatalogProductsRequestProductType
44
from .types import ListPublicCatalogProductsRequestStatus
5+
from .types import PublicCatalogProductProductBadge
56
from .types import PublicCatalogProductPropertiesHardwareCPUArch
67
from .types import PublicCatalogProductStatus
78
from .types import PublicCatalogProductUnitOfMeasureCountableUnit
@@ -16,6 +17,7 @@
1617
from .types import PublicCatalogProductPropertiesBlockStorage
1718
from .types import PublicCatalogProductPropertiesDedibox
1819
from .types import PublicCatalogProductPropertiesElasticMetal
20+
from .types import PublicCatalogProductPropertiesGenerativeApis
1921
from .types import PublicCatalogProductPropertiesHardware
2022
from .types import PublicCatalogProductPropertiesInstance
2123
from .types import PublicCatalogProductPropertiesManagedInference
@@ -33,6 +35,7 @@
3335
__all__ = [
3436
"ListPublicCatalogProductsRequestProductType",
3537
"ListPublicCatalogProductsRequestStatus",
38+
"PublicCatalogProductProductBadge",
3639
"PublicCatalogProductPropertiesHardwareCPUArch",
3740
"PublicCatalogProductStatus",
3841
"PublicCatalogProductUnitOfMeasureCountableUnit",
@@ -47,6 +50,7 @@
4750
"PublicCatalogProductPropertiesBlockStorage",
4851
"PublicCatalogProductPropertiesDedibox",
4952
"PublicCatalogProductPropertiesElasticMetal",
53+
"PublicCatalogProductPropertiesGenerativeApis",
5054
"PublicCatalogProductPropertiesHardware",
5155
"PublicCatalogProductPropertiesInstance",
5256
"PublicCatalogProductPropertiesManagedInference",

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

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
unmarshal_Money,
99
)
1010
from .types import (
11+
PublicCatalogProductProductBadge,
1112
PublicCatalogProductPropertiesHardwareCPUArch,
1213
PublicCatalogProductStatus,
1314
PublicCatalogProductPropertiesHardwareCPUPhysical,
@@ -21,6 +22,7 @@
2122
PublicCatalogProductPropertiesBlockStorage,
2223
PublicCatalogProductPropertiesDedibox,
2324
PublicCatalogProductPropertiesElasticMetal,
25+
PublicCatalogProductPropertiesGenerativeApis,
2426
PublicCatalogProductPropertiesHardware,
2527
PublicCatalogProductPropertiesInstance,
2628
PublicCatalogProductPropertiesManagedInference,
@@ -374,6 +376,31 @@ def unmarshal_PublicCatalogProductPropertiesElasticMetal(
374376
return PublicCatalogProductPropertiesElasticMetal(**args)
375377

376378

379+
def unmarshal_PublicCatalogProductPropertiesGenerativeApis(
380+
data: Any,
381+
) -> PublicCatalogProductPropertiesGenerativeApis:
382+
if not isinstance(data, dict):
383+
raise TypeError(
384+
"Unmarshalling the type 'PublicCatalogProductPropertiesGenerativeApis' failed as data isn't a dictionary."
385+
)
386+
387+
args: dict[str, Any] = {}
388+
389+
field = data.get("reasoning", None)
390+
if field is not None:
391+
args["reasoning"] = field
392+
else:
393+
args["reasoning"] = None
394+
395+
field = data.get("supported_apis", None)
396+
if field is not None:
397+
args["supported_apis"] = field
398+
else:
399+
args["supported_apis"] = None
400+
401+
return PublicCatalogProductPropertiesGenerativeApis(**args)
402+
403+
377404
def unmarshal_PublicCatalogProductPropertiesHardware(
378405
data: Any,
379406
) -> PublicCatalogProductPropertiesHardware:
@@ -625,6 +652,14 @@ def unmarshal_PublicCatalogProductProperties(
625652
else:
626653
args["managed_inference"] = None
627654

655+
field = data.get("generative_apis", None)
656+
if field is not None:
657+
args["generative_apis"] = (
658+
unmarshal_PublicCatalogProductPropertiesGenerativeApis(field)
659+
)
660+
else:
661+
args["generative_apis"] = None
662+
628663
return PublicCatalogProductProperties(**args)
629664

630665

@@ -703,6 +738,16 @@ def unmarshal_PublicCatalogProduct(data: Any) -> PublicCatalogProduct:
703738
else:
704739
args["status"] = PublicCatalogProductStatus.UNKNOWN_STATUS
705740

741+
field = data.get("badges", None)
742+
if field is not None:
743+
args["badges"] = (
744+
[PublicCatalogProductProductBadge(v) for v in field]
745+
if field is not None
746+
else None
747+
)
748+
else:
749+
args["badges"] = []
750+
706751
field = data.get("locality", None)
707752
if field is not None:
708753
args["locality"] = unmarshal_PublicCatalogProductLocality(field)

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

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ class ListPublicCatalogProductsRequestProductType(str, Enum, metaclass=StrEnumMe
2626
BLOCK_STORAGE = "block_storage"
2727
OBJECT_STORAGE = "object_storage"
2828
MANAGED_INFERENCE = "managed_inference"
29+
GENERATIVE_APIS = "generative_apis"
2930

3031
def __str__(self) -> str:
3132
return str(self.value)
@@ -46,6 +47,17 @@ def __str__(self) -> str:
4647
return str(self.value)
4748

4849

50+
class PublicCatalogProductProductBadge(str, Enum, metaclass=StrEnumMeta):
51+
UNKNOWN_PRODUCT_BADGE = "unknown_product_badge"
52+
NEW_PRODUCT = "new_product"
53+
BEST_SELLER = "best_seller"
54+
BEST_VALUE = "best_value"
55+
POPULAR = "popular"
56+
57+
def __str__(self) -> str:
58+
return str(self.value)
59+
60+
4961
class PublicCatalogProductPropertiesHardwareCPUArch(str, Enum, metaclass=StrEnumMeta):
5062
UNKNOWN_ARCH = "unknown_arch"
5163
X64 = "x64"
@@ -295,6 +307,12 @@ class PublicCatalogProductPropertiesElasticMetal:
295307
"""
296308

297309

310+
@dataclass
311+
class PublicCatalogProductPropertiesGenerativeApis:
312+
reasoning: bool
313+
supported_apis: list[str]
314+
315+
298316
@dataclass
299317
class PublicCatalogProductPropertiesHardware:
300318
cpu: Optional[PublicCatalogProductPropertiesHardwareCPU] = None
@@ -400,6 +418,8 @@ class PublicCatalogProductProperties:
400418

401419
managed_inference: Optional[PublicCatalogProductPropertiesManagedInference] = None
402420

421+
generative_apis: Optional[PublicCatalogProductPropertiesGenerativeApis] = None
422+
403423

404424
@dataclass
405425
class PublicCatalogProductUnitOfMeasure:
@@ -444,6 +464,11 @@ class PublicCatalogProduct:
444464
The status of the product.
445465
"""
446466

467+
badges: list[PublicCatalogProductProductBadge]
468+
"""
469+
Different badges that can be associated with the product.
470+
"""
471+
447472
locality: Optional[PublicCatalogProductLocality] = None
448473
"""
449474
The locality of the product.

scaleway/scaleway/product_catalog/v2alpha1/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
# If you have any remark or suggestion do not hesitate to open an issue.
33
from .types import ListPublicCatalogProductsRequestProductType
44
from .types import ListPublicCatalogProductsRequestStatus
5+
from .types import PublicCatalogProductProductBadge
56
from .types import PublicCatalogProductPropertiesHardwareCPUArch
67
from .types import PublicCatalogProductStatus
78
from .types import PublicCatalogProductUnitOfMeasureCountableUnit
@@ -16,6 +17,7 @@
1617
from .types import PublicCatalogProductPropertiesBlockStorage
1718
from .types import PublicCatalogProductPropertiesDedibox
1819
from .types import PublicCatalogProductPropertiesElasticMetal
20+
from .types import PublicCatalogProductPropertiesGenerativeApis
1921
from .types import PublicCatalogProductPropertiesHardware
2022
from .types import PublicCatalogProductPropertiesInstance
2123
from .types import PublicCatalogProductPropertiesManagedInference
@@ -33,6 +35,7 @@
3335
__all__ = [
3436
"ListPublicCatalogProductsRequestProductType",
3537
"ListPublicCatalogProductsRequestStatus",
38+
"PublicCatalogProductProductBadge",
3639
"PublicCatalogProductPropertiesHardwareCPUArch",
3740
"PublicCatalogProductStatus",
3841
"PublicCatalogProductUnitOfMeasureCountableUnit",
@@ -47,6 +50,7 @@
4750
"PublicCatalogProductPropertiesBlockStorage",
4851
"PublicCatalogProductPropertiesDedibox",
4952
"PublicCatalogProductPropertiesElasticMetal",
53+
"PublicCatalogProductPropertiesGenerativeApis",
5054
"PublicCatalogProductPropertiesHardware",
5155
"PublicCatalogProductPropertiesInstance",
5256
"PublicCatalogProductPropertiesManagedInference",

scaleway/scaleway/product_catalog/v2alpha1/marshalling.py

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
unmarshal_Money,
99
)
1010
from .types import (
11+
PublicCatalogProductProductBadge,
1112
PublicCatalogProductPropertiesHardwareCPUArch,
1213
PublicCatalogProductStatus,
1314
PublicCatalogProductPropertiesHardwareCPUPhysical,
@@ -21,6 +22,7 @@
2122
PublicCatalogProductPropertiesBlockStorage,
2223
PublicCatalogProductPropertiesDedibox,
2324
PublicCatalogProductPropertiesElasticMetal,
25+
PublicCatalogProductPropertiesGenerativeApis,
2426
PublicCatalogProductPropertiesHardware,
2527
PublicCatalogProductPropertiesInstance,
2628
PublicCatalogProductPropertiesManagedInference,
@@ -374,6 +376,31 @@ def unmarshal_PublicCatalogProductPropertiesElasticMetal(
374376
return PublicCatalogProductPropertiesElasticMetal(**args)
375377

376378

379+
def unmarshal_PublicCatalogProductPropertiesGenerativeApis(
380+
data: Any,
381+
) -> PublicCatalogProductPropertiesGenerativeApis:
382+
if not isinstance(data, dict):
383+
raise TypeError(
384+
"Unmarshalling the type 'PublicCatalogProductPropertiesGenerativeApis' failed as data isn't a dictionary."
385+
)
386+
387+
args: dict[str, Any] = {}
388+
389+
field = data.get("reasoning", None)
390+
if field is not None:
391+
args["reasoning"] = field
392+
else:
393+
args["reasoning"] = None
394+
395+
field = data.get("supported_apis", None)
396+
if field is not None:
397+
args["supported_apis"] = field
398+
else:
399+
args["supported_apis"] = None
400+
401+
return PublicCatalogProductPropertiesGenerativeApis(**args)
402+
403+
377404
def unmarshal_PublicCatalogProductPropertiesHardware(
378405
data: Any,
379406
) -> PublicCatalogProductPropertiesHardware:
@@ -625,6 +652,14 @@ def unmarshal_PublicCatalogProductProperties(
625652
else:
626653
args["managed_inference"] = None
627654

655+
field = data.get("generative_apis", None)
656+
if field is not None:
657+
args["generative_apis"] = (
658+
unmarshal_PublicCatalogProductPropertiesGenerativeApis(field)
659+
)
660+
else:
661+
args["generative_apis"] = None
662+
628663
return PublicCatalogProductProperties(**args)
629664

630665

@@ -703,6 +738,16 @@ def unmarshal_PublicCatalogProduct(data: Any) -> PublicCatalogProduct:
703738
else:
704739
args["status"] = PublicCatalogProductStatus.UNKNOWN_STATUS
705740

741+
field = data.get("badges", None)
742+
if field is not None:
743+
args["badges"] = (
744+
[PublicCatalogProductProductBadge(v) for v in field]
745+
if field is not None
746+
else None
747+
)
748+
else:
749+
args["badges"] = []
750+
706751
field = data.get("locality", None)
707752
if field is not None:
708753
args["locality"] = unmarshal_PublicCatalogProductLocality(field)

scaleway/scaleway/product_catalog/v2alpha1/types.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ class ListPublicCatalogProductsRequestProductType(str, Enum, metaclass=StrEnumMe
2626
BLOCK_STORAGE = "block_storage"
2727
OBJECT_STORAGE = "object_storage"
2828
MANAGED_INFERENCE = "managed_inference"
29+
GENERATIVE_APIS = "generative_apis"
2930

3031
def __str__(self) -> str:
3132
return str(self.value)
@@ -46,6 +47,17 @@ def __str__(self) -> str:
4647
return str(self.value)
4748

4849

50+
class PublicCatalogProductProductBadge(str, Enum, metaclass=StrEnumMeta):
51+
UNKNOWN_PRODUCT_BADGE = "unknown_product_badge"
52+
NEW_PRODUCT = "new_product"
53+
BEST_SELLER = "best_seller"
54+
BEST_VALUE = "best_value"
55+
POPULAR = "popular"
56+
57+
def __str__(self) -> str:
58+
return str(self.value)
59+
60+
4961
class PublicCatalogProductPropertiesHardwareCPUArch(str, Enum, metaclass=StrEnumMeta):
5062
UNKNOWN_ARCH = "unknown_arch"
5163
X64 = "x64"
@@ -295,6 +307,12 @@ class PublicCatalogProductPropertiesElasticMetal:
295307
"""
296308

297309

310+
@dataclass
311+
class PublicCatalogProductPropertiesGenerativeApis:
312+
reasoning: bool
313+
supported_apis: list[str]
314+
315+
298316
@dataclass
299317
class PublicCatalogProductPropertiesHardware:
300318
cpu: Optional[PublicCatalogProductPropertiesHardwareCPU] = None
@@ -400,6 +418,8 @@ class PublicCatalogProductProperties:
400418

401419
managed_inference: Optional[PublicCatalogProductPropertiesManagedInference] = None
402420

421+
generative_apis: Optional[PublicCatalogProductPropertiesGenerativeApis] = None
422+
403423

404424
@dataclass
405425
class PublicCatalogProductUnitOfMeasure:
@@ -444,6 +464,11 @@ class PublicCatalogProduct:
444464
The status of the product.
445465
"""
446466

467+
badges: list[PublicCatalogProductProductBadge]
468+
"""
469+
Different badges that can be associated with the product.
470+
"""
471+
447472
locality: Optional[PublicCatalogProductLocality] = None
448473
"""
449474
The locality of the product.

0 commit comments

Comments
 (0)