Skip to content

Generator: Update SDK /services/stackitmarketplace #1337

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
from stackit.stackitmarketplace.models.approve_subscription_payload import (
ApproveSubscriptionPayload,
)
from stackit.stackitmarketplace.models.assets import Assets
from stackit.stackitmarketplace.models.become_vendor import BecomeVendor
from stackit.stackitmarketplace.models.catalog_pricing_option_highlight import (
CatalogPricingOptionHighlight,
Expand Down Expand Up @@ -89,6 +90,8 @@
from stackit.stackitmarketplace.models.list_vendor_subscriptions_response import (
ListVendorSubscriptionsResponse,
)
from stackit.stackitmarketplace.models.localized_version import LocalizedVersion
from stackit.stackitmarketplace.models.notice_period import NoticePeriod
from stackit.stackitmarketplace.models.offer_type import OfferType
from stackit.stackitmarketplace.models.price_type import PriceType
from stackit.stackitmarketplace.models.pricing_option_unit import PricingOptionUnit
Expand All @@ -99,6 +102,7 @@
from stackit.stackitmarketplace.models.resolve_customer_payload import (
ResolveCustomerPayload,
)
from stackit.stackitmarketplace.models.service_certificate import ServiceCertificate
from stackit.stackitmarketplace.models.subscription_lifecycle_state import (
SubscriptionLifecycleState,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from stackit.stackitmarketplace.models.approve_subscription_payload import (
ApproveSubscriptionPayload,
)
from stackit.stackitmarketplace.models.assets import Assets
from stackit.stackitmarketplace.models.become_vendor import BecomeVendor
from stackit.stackitmarketplace.models.catalog_pricing_option_highlight import (
CatalogPricingOptionHighlight,
Expand Down Expand Up @@ -70,6 +71,8 @@
from stackit.stackitmarketplace.models.list_vendor_subscriptions_response import (
ListVendorSubscriptionsResponse,
)
from stackit.stackitmarketplace.models.localized_version import LocalizedVersion
from stackit.stackitmarketplace.models.notice_period import NoticePeriod
from stackit.stackitmarketplace.models.offer_type import OfferType
from stackit.stackitmarketplace.models.price_type import PriceType
from stackit.stackitmarketplace.models.pricing_option_unit import PricingOptionUnit
Expand All @@ -80,6 +83,7 @@
from stackit.stackitmarketplace.models.resolve_customer_payload import (
ResolveCustomerPayload,
)
from stackit.stackitmarketplace.models.service_certificate import ServiceCertificate
from stackit.stackitmarketplace.models.subscription_lifecycle_state import (
SubscriptionLifecycleState,
)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
# coding: utf-8

"""
STACKIT Marketplace API

API to manage STACKIT Marketplace.

The version of the OpenAPI document: 1
Contact: marketplace@stackit.cloud
Generated by OpenAPI Generator (https://openapi-generator.tech)

Do not edit the class manually.
""" # noqa: E501 docstring might be too long

from __future__ import annotations

import json
import pprint
from typing import Any, ClassVar, Dict, List, Optional, Set

from pydantic import BaseModel, ConfigDict, Field
from typing_extensions import Self

from stackit.stackitmarketplace.models.service_certificate import ServiceCertificate


class Assets(BaseModel):
"""
The assets associated with the product.
"""

service_certificate: Optional[ServiceCertificate] = Field(default=None, alias="serviceCertificate")
__properties: ClassVar[List[str]] = ["serviceCertificate"]

model_config = ConfigDict(
populate_by_name=True,
validate_assignment=True,
protected_namespaces=(),
)

def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.model_dump(by_alias=True))

def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
return json.dumps(self.to_dict())

@classmethod
def from_json(cls, json_str: str) -> Optional[Self]:
"""Create an instance of Assets from a JSON string"""
return cls.from_dict(json.loads(json_str))

def to_dict(self) -> Dict[str, Any]:
"""Return the dictionary representation of the model using alias.

This has the following differences from calling pydantic's
`self.model_dump(by_alias=True)`:

* `None` is only added to the output dict for nullable fields that
were set at model initialization. Other fields with value `None`
are ignored.
"""
excluded_fields: Set[str] = set([])

_dict = self.model_dump(
by_alias=True,
exclude=excluded_fields,
exclude_none=True,
)
# override the default output from pydantic by calling `to_dict()` of service_certificate
if self.service_certificate:
_dict["serviceCertificate"] = self.service_certificate.to_dict()
return _dict

@classmethod
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
"""Create an instance of Assets from a dict"""
if obj is None:
return None

if not isinstance(obj, dict):
return cls.model_validate(obj)

_obj = cls.model_validate(
{
"serviceCertificate": (
ServiceCertificate.from_dict(obj["serviceCertificate"])
if obj.get("serviceCertificate") is not None
else None
)
}
)
return _obj
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
)
from typing_extensions import Annotated, Self

from stackit.stackitmarketplace.models.assets import Assets
from stackit.stackitmarketplace.models.catalog_product_details_vendor import (
CatalogProductDetailsVendor,
)
Expand Down Expand Up @@ -57,6 +58,7 @@ class CatalogProductDetail(BaseModel):
CatalogProductDetail
"""

assets: Optional[Assets] = None
categories: Optional[List[StrictStr]] = Field(
default=None, description="The list of categories associated to the product."
)
Expand Down Expand Up @@ -103,6 +105,7 @@ class CatalogProductDetail(BaseModel):
description="The video URL.", alias="videoUrl"
)
__properties: ClassVar[List[str]] = [
"assets",
"categories",
"deliveryMethod",
"description",
Expand Down Expand Up @@ -207,6 +210,9 @@ def to_dict(self) -> Dict[str, Any]:
exclude=excluded_fields,
exclude_none=True,
)
# override the default output from pydantic by calling `to_dict()` of assets
if self.assets:
_dict["assets"] = self.assets.to_dict()
# override the default output from pydantic by calling `to_dict()` of each item in highlights (list)
_items = []
if self.highlights:
Expand Down Expand Up @@ -251,6 +257,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:

_obj = cls.model_validate(
{
"assets": Assets.from_dict(obj["assets"]) if obj.get("assets") is not None else None,
"categories": obj.get("categories"),
"deliveryMethod": obj.get("deliveryMethod"),
"description": obj.get("description"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
from stackit.stackitmarketplace.models.catalog_pricing_option_highlight import (
CatalogPricingOptionHighlight,
)
from stackit.stackitmarketplace.models.notice_period import NoticePeriod
from stackit.stackitmarketplace.models.price_type import PriceType
from stackit.stackitmarketplace.models.pricing_option_unit import PricingOptionUnit

Expand All @@ -36,6 +37,7 @@ class CatalogProductPricingOption(BaseModel):
description: StrictStr = Field(description="The pricing option description.")
highlights: List[CatalogPricingOptionHighlight] = Field(description="The list of highlights.")
name: StrictStr = Field(description="The pricing option name.")
notice_period: Optional[NoticePeriod] = Field(default=None, alias="noticePeriod")
price_type: Optional[PriceType] = Field(default=None, alias="priceType")
pricing_plan: Optional[StrictStr] = Field(
default=None, description="Additional price type information.", alias="pricingPlan"
Expand All @@ -51,6 +53,7 @@ class CatalogProductPricingOption(BaseModel):
"description",
"highlights",
"name",
"noticePeriod",
"priceType",
"pricingPlan",
"rate",
Expand Down Expand Up @@ -104,6 +107,9 @@ def to_dict(self) -> Dict[str, Any]:
if _item:
_items.append(_item.to_dict())
_dict["highlights"] = _items
# override the default output from pydantic by calling `to_dict()` of notice_period
if self.notice_period:
_dict["noticePeriod"] = self.notice_period.to_dict()
return _dict

@classmethod
Expand All @@ -124,6 +130,9 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
else None
),
"name": obj.get("name"),
"noticePeriod": (
NoticePeriod.from_dict(obj["noticePeriod"]) if obj.get("noticePeriod") is not None else None
),
"priceType": obj.get("priceType"),
"pricingPlan": obj.get("pricingPlan"),
"rate": obj.get("rate"),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
# coding: utf-8

"""
STACKIT Marketplace API

API to manage STACKIT Marketplace.

The version of the OpenAPI document: 1
Contact: marketplace@stackit.cloud
Generated by OpenAPI Generator (https://openapi-generator.tech)

Do not edit the class manually.
""" # noqa: E501 docstring might be too long

from __future__ import annotations

import json
import pprint
import re
from typing import Any, ClassVar, Dict, List, Optional, Set

from pydantic import BaseModel, ConfigDict, Field, field_validator
from typing_extensions import Annotated, Self


class LocalizedVersion(BaseModel):
"""
The localized version (file name) of a file.
"""

de: Optional[Annotated[str, Field(strict=True)]] = Field(
default=None, description="The file version matching the file name (localized)."
)
en: Optional[Annotated[str, Field(strict=True)]] = Field(
default=None, description="The file version matching the file name (localized)."
)
__properties: ClassVar[List[str]] = ["de", "en"]

@field_validator("de")
def de_validate_regular_expression(cls, value):
"""Validates the regular expression"""
if value is None:
return value

if not re.match(r"^\d{4}_\d{2}_\d{2}_\d{3}_[a-zA-Z0-9_-]+_(DE|EN)\.$", value):
raise ValueError(
r"must validate the regular expression /^\d{4}_\d{2}_\d{2}_\d{3}_[a-zA-Z0-9_-]+_(DE|EN)\.$/"
)
return value

@field_validator("en")
def en_validate_regular_expression(cls, value):
"""Validates the regular expression"""
if value is None:
return value

if not re.match(r"^\d{4}_\d{2}_\d{2}_\d{3}_[a-zA-Z0-9_-]+_(DE|EN)\.$", value):
raise ValueError(
r"must validate the regular expression /^\d{4}_\d{2}_\d{2}_\d{3}_[a-zA-Z0-9_-]+_(DE|EN)\.$/"
)
return value

model_config = ConfigDict(
populate_by_name=True,
validate_assignment=True,
protected_namespaces=(),
)

def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.model_dump(by_alias=True))

def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
return json.dumps(self.to_dict())

@classmethod
def from_json(cls, json_str: str) -> Optional[Self]:
"""Create an instance of LocalizedVersion from a JSON string"""
return cls.from_dict(json.loads(json_str))

def to_dict(self) -> Dict[str, Any]:
"""Return the dictionary representation of the model using alias.

This has the following differences from calling pydantic's
`self.model_dump(by_alias=True)`:

* `None` is only added to the output dict for nullable fields that
were set at model initialization. Other fields with value `None`
are ignored.
"""
excluded_fields: Set[str] = set([])

_dict = self.model_dump(
by_alias=True,
exclude=excluded_fields,
exclude_none=True,
)
return _dict

@classmethod
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
"""Create an instance of LocalizedVersion from a dict"""
if obj is None:
return None

if not isinstance(obj, dict):
return cls.model_validate(obj)

_obj = cls.model_validate({"de": obj.get("de"), "en": obj.get("en")})
return _obj
Loading
Loading