Skip to content

Commit ada0322

Browse files
Generate stackitmarketplace
1 parent c7340e3 commit ada0322

File tree

9 files changed

+422
-0
lines changed

9 files changed

+422
-0
lines changed

services/stackitmarketplace/src/stackit/stackitmarketplace/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
from stackit.stackitmarketplace.models.approve_subscription_payload import (
3838
ApproveSubscriptionPayload,
3939
)
40+
from stackit.stackitmarketplace.models.assets import Assets
4041
from stackit.stackitmarketplace.models.become_vendor import BecomeVendor
4142
from stackit.stackitmarketplace.models.catalog_pricing_option_highlight import (
4243
CatalogPricingOptionHighlight,
@@ -89,6 +90,8 @@
8990
from stackit.stackitmarketplace.models.list_vendor_subscriptions_response import (
9091
ListVendorSubscriptionsResponse,
9192
)
93+
from stackit.stackitmarketplace.models.localized_version import LocalizedVersion
94+
from stackit.stackitmarketplace.models.notice_period import NoticePeriod
9295
from stackit.stackitmarketplace.models.offer_type import OfferType
9396
from stackit.stackitmarketplace.models.price_type import PriceType
9497
from stackit.stackitmarketplace.models.pricing_option_unit import PricingOptionUnit
@@ -99,6 +102,7 @@
99102
from stackit.stackitmarketplace.models.resolve_customer_payload import (
100103
ResolveCustomerPayload,
101104
)
105+
from stackit.stackitmarketplace.models.service_certificate import ServiceCertificate
102106
from stackit.stackitmarketplace.models.subscription_lifecycle_state import (
103107
SubscriptionLifecycleState,
104108
)

services/stackitmarketplace/src/stackit/stackitmarketplace/models/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
from stackit.stackitmarketplace.models.approve_subscription_payload import (
1919
ApproveSubscriptionPayload,
2020
)
21+
from stackit.stackitmarketplace.models.assets import Assets
2122
from stackit.stackitmarketplace.models.become_vendor import BecomeVendor
2223
from stackit.stackitmarketplace.models.catalog_pricing_option_highlight import (
2324
CatalogPricingOptionHighlight,
@@ -70,6 +71,8 @@
7071
from stackit.stackitmarketplace.models.list_vendor_subscriptions_response import (
7172
ListVendorSubscriptionsResponse,
7273
)
74+
from stackit.stackitmarketplace.models.localized_version import LocalizedVersion
75+
from stackit.stackitmarketplace.models.notice_period import NoticePeriod
7376
from stackit.stackitmarketplace.models.offer_type import OfferType
7477
from stackit.stackitmarketplace.models.price_type import PriceType
7578
from stackit.stackitmarketplace.models.pricing_option_unit import PricingOptionUnit
@@ -80,6 +83,7 @@
8083
from stackit.stackitmarketplace.models.resolve_customer_payload import (
8184
ResolveCustomerPayload,
8285
)
86+
from stackit.stackitmarketplace.models.service_certificate import ServiceCertificate
8387
from stackit.stackitmarketplace.models.subscription_lifecycle_state import (
8488
SubscriptionLifecycleState,
8589
)
Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
# coding: utf-8
2+
3+
"""
4+
STACKIT Marketplace API
5+
6+
API to manage STACKIT Marketplace.
7+
8+
The version of the OpenAPI document: 1
9+
Contact: marketplace@stackit.cloud
10+
Generated by OpenAPI Generator (https://openapi-generator.tech)
11+
12+
Do not edit the class manually.
13+
""" # noqa: E501 docstring might be too long
14+
15+
from __future__ import annotations
16+
17+
import json
18+
import pprint
19+
from typing import Any, ClassVar, Dict, List, Optional, Set
20+
21+
from pydantic import BaseModel, ConfigDict, Field
22+
from typing_extensions import Self
23+
24+
from stackit.stackitmarketplace.models.service_certificate import ServiceCertificate
25+
26+
27+
class Assets(BaseModel):
28+
"""
29+
The assets associated with the product.
30+
"""
31+
32+
service_certificate: Optional[ServiceCertificate] = Field(default=None, alias="serviceCertificate")
33+
__properties: ClassVar[List[str]] = ["serviceCertificate"]
34+
35+
model_config = ConfigDict(
36+
populate_by_name=True,
37+
validate_assignment=True,
38+
protected_namespaces=(),
39+
)
40+
41+
def to_str(self) -> str:
42+
"""Returns the string representation of the model using alias"""
43+
return pprint.pformat(self.model_dump(by_alias=True))
44+
45+
def to_json(self) -> str:
46+
"""Returns the JSON representation of the model using alias"""
47+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
48+
return json.dumps(self.to_dict())
49+
50+
@classmethod
51+
def from_json(cls, json_str: str) -> Optional[Self]:
52+
"""Create an instance of Assets from a JSON string"""
53+
return cls.from_dict(json.loads(json_str))
54+
55+
def to_dict(self) -> Dict[str, Any]:
56+
"""Return the dictionary representation of the model using alias.
57+
58+
This has the following differences from calling pydantic's
59+
`self.model_dump(by_alias=True)`:
60+
61+
* `None` is only added to the output dict for nullable fields that
62+
were set at model initialization. Other fields with value `None`
63+
are ignored.
64+
"""
65+
excluded_fields: Set[str] = set([])
66+
67+
_dict = self.model_dump(
68+
by_alias=True,
69+
exclude=excluded_fields,
70+
exclude_none=True,
71+
)
72+
# override the default output from pydantic by calling `to_dict()` of service_certificate
73+
if self.service_certificate:
74+
_dict["serviceCertificate"] = self.service_certificate.to_dict()
75+
return _dict
76+
77+
@classmethod
78+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
79+
"""Create an instance of Assets from a dict"""
80+
if obj is None:
81+
return None
82+
83+
if not isinstance(obj, dict):
84+
return cls.model_validate(obj)
85+
86+
_obj = cls.model_validate(
87+
{
88+
"serviceCertificate": (
89+
ServiceCertificate.from_dict(obj["serviceCertificate"])
90+
if obj.get("serviceCertificate") is not None
91+
else None
92+
)
93+
}
94+
)
95+
return _obj

services/stackitmarketplace/src/stackit/stackitmarketplace/models/catalog_product_detail.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
)
3131
from typing_extensions import Annotated, Self
3232

33+
from stackit.stackitmarketplace.models.assets import Assets
3334
from stackit.stackitmarketplace.models.catalog_product_details_vendor import (
3435
CatalogProductDetailsVendor,
3536
)
@@ -57,6 +58,7 @@ class CatalogProductDetail(BaseModel):
5758
CatalogProductDetail
5859
"""
5960

61+
assets: Optional[Assets] = None
6062
categories: Optional[List[StrictStr]] = Field(
6163
default=None, description="The list of categories associated to the product."
6264
)
@@ -103,6 +105,7 @@ class CatalogProductDetail(BaseModel):
103105
description="The video URL.", alias="videoUrl"
104106
)
105107
__properties: ClassVar[List[str]] = [
108+
"assets",
106109
"categories",
107110
"deliveryMethod",
108111
"description",
@@ -207,6 +210,9 @@ def to_dict(self) -> Dict[str, Any]:
207210
exclude=excluded_fields,
208211
exclude_none=True,
209212
)
213+
# override the default output from pydantic by calling `to_dict()` of assets
214+
if self.assets:
215+
_dict["assets"] = self.assets.to_dict()
210216
# override the default output from pydantic by calling `to_dict()` of each item in highlights (list)
211217
_items = []
212218
if self.highlights:
@@ -251,6 +257,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
251257

252258
_obj = cls.model_validate(
253259
{
260+
"assets": Assets.from_dict(obj["assets"]) if obj.get("assets") is not None else None,
254261
"categories": obj.get("categories"),
255262
"deliveryMethod": obj.get("deliveryMethod"),
256263
"description": obj.get("description"),

services/stackitmarketplace/src/stackit/stackitmarketplace/models/catalog_product_pricing_option.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
from stackit.stackitmarketplace.models.catalog_pricing_option_highlight import (
2525
CatalogPricingOptionHighlight,
2626
)
27+
from stackit.stackitmarketplace.models.notice_period import NoticePeriod
2728
from stackit.stackitmarketplace.models.price_type import PriceType
2829
from stackit.stackitmarketplace.models.pricing_option_unit import PricingOptionUnit
2930

@@ -36,6 +37,7 @@ class CatalogProductPricingOption(BaseModel):
3637
description: StrictStr = Field(description="The pricing option description.")
3738
highlights: List[CatalogPricingOptionHighlight] = Field(description="The list of highlights.")
3839
name: StrictStr = Field(description="The pricing option name.")
40+
notice_period: Optional[NoticePeriod] = Field(default=None, alias="noticePeriod")
3941
price_type: Optional[PriceType] = Field(default=None, alias="priceType")
4042
pricing_plan: Optional[StrictStr] = Field(
4143
default=None, description="Additional price type information.", alias="pricingPlan"
@@ -51,6 +53,7 @@ class CatalogProductPricingOption(BaseModel):
5153
"description",
5254
"highlights",
5355
"name",
56+
"noticePeriod",
5457
"priceType",
5558
"pricingPlan",
5659
"rate",
@@ -104,6 +107,9 @@ def to_dict(self) -> Dict[str, Any]:
104107
if _item:
105108
_items.append(_item.to_dict())
106109
_dict["highlights"] = _items
110+
# override the default output from pydantic by calling `to_dict()` of notice_period
111+
if self.notice_period:
112+
_dict["noticePeriod"] = self.notice_period.to_dict()
107113
return _dict
108114

109115
@classmethod
@@ -124,6 +130,9 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
124130
else None
125131
),
126132
"name": obj.get("name"),
133+
"noticePeriod": (
134+
NoticePeriod.from_dict(obj["noticePeriod"]) if obj.get("noticePeriod") is not None else None
135+
),
127136
"priceType": obj.get("priceType"),
128137
"pricingPlan": obj.get("pricingPlan"),
129138
"rate": obj.get("rate"),
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
# coding: utf-8
2+
3+
"""
4+
STACKIT Marketplace API
5+
6+
API to manage STACKIT Marketplace.
7+
8+
The version of the OpenAPI document: 1
9+
Contact: marketplace@stackit.cloud
10+
Generated by OpenAPI Generator (https://openapi-generator.tech)
11+
12+
Do not edit the class manually.
13+
""" # noqa: E501 docstring might be too long
14+
15+
from __future__ import annotations
16+
17+
import json
18+
import pprint
19+
import re
20+
from typing import Any, ClassVar, Dict, List, Optional, Set
21+
22+
from pydantic import BaseModel, ConfigDict, Field, field_validator
23+
from typing_extensions import Annotated, Self
24+
25+
26+
class LocalizedVersion(BaseModel):
27+
"""
28+
The localized version (file name) of a file.
29+
"""
30+
31+
de: Optional[Annotated[str, Field(strict=True)]] = Field(
32+
default=None, description="The file version matching the file name (localized)."
33+
)
34+
en: Optional[Annotated[str, Field(strict=True)]] = Field(
35+
default=None, description="The file version matching the file name (localized)."
36+
)
37+
__properties: ClassVar[List[str]] = ["de", "en"]
38+
39+
@field_validator("de")
40+
def de_validate_regular_expression(cls, value):
41+
"""Validates the regular expression"""
42+
if value is None:
43+
return value
44+
45+
if not re.match(r"^\d{4}_\d{2}_\d{2}_\d{3}_[a-zA-Z0-9_-]+_(DE|EN)\.$", value):
46+
raise ValueError(
47+
r"must validate the regular expression /^\d{4}_\d{2}_\d{2}_\d{3}_[a-zA-Z0-9_-]+_(DE|EN)\.$/"
48+
)
49+
return value
50+
51+
@field_validator("en")
52+
def en_validate_regular_expression(cls, value):
53+
"""Validates the regular expression"""
54+
if value is None:
55+
return value
56+
57+
if not re.match(r"^\d{4}_\d{2}_\d{2}_\d{3}_[a-zA-Z0-9_-]+_(DE|EN)\.$", value):
58+
raise ValueError(
59+
r"must validate the regular expression /^\d{4}_\d{2}_\d{2}_\d{3}_[a-zA-Z0-9_-]+_(DE|EN)\.$/"
60+
)
61+
return value
62+
63+
model_config = ConfigDict(
64+
populate_by_name=True,
65+
validate_assignment=True,
66+
protected_namespaces=(),
67+
)
68+
69+
def to_str(self) -> str:
70+
"""Returns the string representation of the model using alias"""
71+
return pprint.pformat(self.model_dump(by_alias=True))
72+
73+
def to_json(self) -> str:
74+
"""Returns the JSON representation of the model using alias"""
75+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
76+
return json.dumps(self.to_dict())
77+
78+
@classmethod
79+
def from_json(cls, json_str: str) -> Optional[Self]:
80+
"""Create an instance of LocalizedVersion from a JSON string"""
81+
return cls.from_dict(json.loads(json_str))
82+
83+
def to_dict(self) -> Dict[str, Any]:
84+
"""Return the dictionary representation of the model using alias.
85+
86+
This has the following differences from calling pydantic's
87+
`self.model_dump(by_alias=True)`:
88+
89+
* `None` is only added to the output dict for nullable fields that
90+
were set at model initialization. Other fields with value `None`
91+
are ignored.
92+
"""
93+
excluded_fields: Set[str] = set([])
94+
95+
_dict = self.model_dump(
96+
by_alias=True,
97+
exclude=excluded_fields,
98+
exclude_none=True,
99+
)
100+
return _dict
101+
102+
@classmethod
103+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
104+
"""Create an instance of LocalizedVersion from a dict"""
105+
if obj is None:
106+
return None
107+
108+
if not isinstance(obj, dict):
109+
return cls.model_validate(obj)
110+
111+
_obj = cls.model_validate({"de": obj.get("de"), "en": obj.get("en")})
112+
return _obj

0 commit comments

Comments
 (0)