stackit-stackitmarketplace 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. stackit/stackitmarketplace/__init__.py +84 -0
  2. stackit/stackitmarketplace/api/__init__.py +4 -0
  3. stackit/stackitmarketplace/api/default_api.py +1719 -0
  4. stackit/stackitmarketplace/api_client.py +627 -0
  5. stackit/stackitmarketplace/api_response.py +23 -0
  6. stackit/stackitmarketplace/configuration.py +138 -0
  7. stackit/stackitmarketplace/exceptions.py +199 -0
  8. stackit/stackitmarketplace/models/__init__.py +65 -0
  9. stackit/stackitmarketplace/models/catalog_pricing_option_highlight.py +84 -0
  10. stackit/stackitmarketplace/models/catalog_product_detail.py +246 -0
  11. stackit/stackitmarketplace/models/catalog_product_details_vendor.py +96 -0
  12. stackit/stackitmarketplace/models/catalog_product_highlight.py +94 -0
  13. stackit/stackitmarketplace/models/catalog_product_overview.py +132 -0
  14. stackit/stackitmarketplace/models/catalog_product_overview_vendor.py +86 -0
  15. stackit/stackitmarketplace/models/catalog_product_pricing_option.py +146 -0
  16. stackit/stackitmarketplace/models/catalog_product_support_resource.py +89 -0
  17. stackit/stackitmarketplace/models/catalog_product_vendor_terms.py +86 -0
  18. stackit/stackitmarketplace/models/current_subscription_state_response.py +103 -0
  19. stackit/stackitmarketplace/models/error_response.py +95 -0
  20. stackit/stackitmarketplace/models/list_catalog_products_response.py +109 -0
  21. stackit/stackitmarketplace/models/list_vendor_subscriptions_response.py +107 -0
  22. stackit/stackitmarketplace/models/requested_subscription_state_response.py +103 -0
  23. stackit/stackitmarketplace/models/resolve_customer_payload.py +82 -0
  24. stackit/stackitmarketplace/models/subscription_cancel_response.py +109 -0
  25. stackit/stackitmarketplace/models/subscription_product.py +130 -0
  26. stackit/stackitmarketplace/models/vendor_subscription.py +115 -0
  27. stackit/stackitmarketplace/py.typed +0 -0
  28. stackit/stackitmarketplace/rest.py +149 -0
  29. stackit_stackitmarketplace-0.1.0.dist-info/METADATA +44 -0
  30. stackit_stackitmarketplace-0.1.0.dist-info/RECORD +31 -0
  31. stackit_stackitmarketplace-0.1.0.dist-info/WHEEL +4 -0
@@ -0,0 +1,146 @@
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.de
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, StrictStr, field_validator
22
+ from typing_extensions import Self
23
+
24
+ from stackit.stackitmarketplace.models.catalog_pricing_option_highlight import (
25
+ CatalogPricingOptionHighlight,
26
+ )
27
+
28
+
29
+ class CatalogProductPricingOption(BaseModel):
30
+ """
31
+ CatalogProductPricingOption
32
+ """
33
+
34
+ description: StrictStr = Field(description="The pricing option description.")
35
+ highlights: List[CatalogPricingOptionHighlight] = Field(description="The list of highlights.")
36
+ name: StrictStr = Field(description="The pricing option name.")
37
+ price_type: Optional[StrictStr] = Field(
38
+ default=None, description="The price type / pricing model.", alias="priceType"
39
+ )
40
+ pricing_plan: Optional[StrictStr] = Field(
41
+ default=None, description="Additional price type information.", alias="pricingPlan"
42
+ )
43
+ rate: Optional[StrictStr] = Field(default=None, description="The price of the product (per unit).")
44
+ sku: StrictStr = Field(description="The concrete variant of the product.")
45
+ sku_info: StrictStr = Field(description="Short description of this offering.", alias="skuInfo")
46
+ sku_info_details: StrictStr = Field(
47
+ description="More details about what this offering entails.", alias="skuInfoDetails"
48
+ )
49
+ unit: Optional[StrictStr] = Field(default=None, description="The interval to which the rate applies.")
50
+ __properties: ClassVar[List[str]] = [
51
+ "description",
52
+ "highlights",
53
+ "name",
54
+ "priceType",
55
+ "pricingPlan",
56
+ "rate",
57
+ "sku",
58
+ "skuInfo",
59
+ "skuInfoDetails",
60
+ "unit",
61
+ ]
62
+
63
+ @field_validator("price_type")
64
+ def price_type_validate_enum(cls, value):
65
+ """Validates the enum"""
66
+ if value is None:
67
+ return value
68
+
69
+ if value not in set(["CONTRACT", "FREE", "FREE_TRIAL", "BYOL", "PAYG"]):
70
+ raise ValueError("must be one of enum values ('CONTRACT', 'FREE', 'FREE_TRIAL', 'BYOL', 'PAYG')")
71
+ return value
72
+
73
+ model_config = ConfigDict(
74
+ populate_by_name=True,
75
+ validate_assignment=True,
76
+ protected_namespaces=(),
77
+ )
78
+
79
+ def to_str(self) -> str:
80
+ """Returns the string representation of the model using alias"""
81
+ return pprint.pformat(self.model_dump(by_alias=True))
82
+
83
+ def to_json(self) -> str:
84
+ """Returns the JSON representation of the model using alias"""
85
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
86
+ return json.dumps(self.to_dict())
87
+
88
+ @classmethod
89
+ def from_json(cls, json_str: str) -> Optional[Self]:
90
+ """Create an instance of CatalogProductPricingOption from a JSON string"""
91
+ return cls.from_dict(json.loads(json_str))
92
+
93
+ def to_dict(self) -> Dict[str, Any]:
94
+ """Return the dictionary representation of the model using alias.
95
+
96
+ This has the following differences from calling pydantic's
97
+ `self.model_dump(by_alias=True)`:
98
+
99
+ * `None` is only added to the output dict for nullable fields that
100
+ were set at model initialization. Other fields with value `None`
101
+ are ignored.
102
+ """
103
+ excluded_fields: Set[str] = set([])
104
+
105
+ _dict = self.model_dump(
106
+ by_alias=True,
107
+ exclude=excluded_fields,
108
+ exclude_none=True,
109
+ )
110
+ # override the default output from pydantic by calling `to_dict()` of each item in highlights (list)
111
+ _items = []
112
+ if self.highlights:
113
+ for _item in self.highlights:
114
+ if _item:
115
+ _items.append(_item.to_dict())
116
+ _dict["highlights"] = _items
117
+ return _dict
118
+
119
+ @classmethod
120
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
121
+ """Create an instance of CatalogProductPricingOption from a dict"""
122
+ if obj is None:
123
+ return None
124
+
125
+ if not isinstance(obj, dict):
126
+ return cls.model_validate(obj)
127
+
128
+ _obj = cls.model_validate(
129
+ {
130
+ "description": obj.get("description"),
131
+ "highlights": (
132
+ [CatalogPricingOptionHighlight.from_dict(_item) for _item in obj["highlights"]]
133
+ if obj.get("highlights") is not None
134
+ else None
135
+ ),
136
+ "name": obj.get("name"),
137
+ "priceType": obj.get("priceType"),
138
+ "pricingPlan": obj.get("pricingPlan"),
139
+ "rate": obj.get("rate"),
140
+ "sku": obj.get("sku"),
141
+ "skuInfo": obj.get("skuInfo"),
142
+ "skuInfoDetails": obj.get("skuInfoDetails"),
143
+ "unit": obj.get("unit"),
144
+ }
145
+ )
146
+ return _obj
@@ -0,0 +1,89 @@
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.de
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, StrictStr
22
+ from typing_extensions import Self
23
+
24
+
25
+ class CatalogProductSupportResource(BaseModel):
26
+ """
27
+ CatalogProductSupportResource
28
+ """
29
+
30
+ support_link: Optional[StrictStr] = Field(
31
+ default=None, description="The support resource link.", alias="supportLink"
32
+ )
33
+ support_link_title: Optional[StrictStr] = Field(
34
+ default=None, description="The support resource link title.", alias="supportLinkTitle"
35
+ )
36
+ __properties: ClassVar[List[str]] = ["supportLink", "supportLinkTitle"]
37
+
38
+ model_config = ConfigDict(
39
+ populate_by_name=True,
40
+ validate_assignment=True,
41
+ protected_namespaces=(),
42
+ )
43
+
44
+ def to_str(self) -> str:
45
+ """Returns the string representation of the model using alias"""
46
+ return pprint.pformat(self.model_dump(by_alias=True))
47
+
48
+ def to_json(self) -> str:
49
+ """Returns the JSON representation of the model using alias"""
50
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
51
+ return json.dumps(self.to_dict())
52
+
53
+ @classmethod
54
+ def from_json(cls, json_str: str) -> Optional[Self]:
55
+ """Create an instance of CatalogProductSupportResource from a JSON string"""
56
+ return cls.from_dict(json.loads(json_str))
57
+
58
+ def to_dict(self) -> Dict[str, Any]:
59
+ """Return the dictionary representation of the model using alias.
60
+
61
+ This has the following differences from calling pydantic's
62
+ `self.model_dump(by_alias=True)`:
63
+
64
+ * `None` is only added to the output dict for nullable fields that
65
+ were set at model initialization. Other fields with value `None`
66
+ are ignored.
67
+ """
68
+ excluded_fields: Set[str] = set([])
69
+
70
+ _dict = self.model_dump(
71
+ by_alias=True,
72
+ exclude=excluded_fields,
73
+ exclude_none=True,
74
+ )
75
+ return _dict
76
+
77
+ @classmethod
78
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
79
+ """Create an instance of CatalogProductSupportResource 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
+ {"supportLink": obj.get("supportLink"), "supportLinkTitle": obj.get("supportLinkTitle")}
88
+ )
89
+ return _obj
@@ -0,0 +1,86 @@
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.de
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, StrictStr
22
+ from typing_extensions import Self
23
+
24
+
25
+ class CatalogProductVendorTerms(BaseModel):
26
+ """
27
+ CatalogProductVendorTerms
28
+ """
29
+
30
+ description: StrictStr = Field(description="The terms of use description.")
31
+ title: StrictStr = Field(description="The terms of use title.")
32
+ url: StrictStr = Field(description="The terms of use url.")
33
+ __properties: ClassVar[List[str]] = ["description", "title", "url"]
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 CatalogProductVendorTerms 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
+ return _dict
73
+
74
+ @classmethod
75
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
76
+ """Create an instance of CatalogProductVendorTerms from a dict"""
77
+ if obj is None:
78
+ return None
79
+
80
+ if not isinstance(obj, dict):
81
+ return cls.model_validate(obj)
82
+
83
+ _obj = cls.model_validate(
84
+ {"description": obj.get("description"), "title": obj.get("title"), "url": obj.get("url")}
85
+ )
86
+ return _obj
@@ -0,0 +1,103 @@
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.de
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, StrictStr, field_validator
22
+ from typing_extensions import Self
23
+
24
+
25
+ class CurrentSubscriptionStateResponse(BaseModel):
26
+ """
27
+ CurrentSubscriptionStateResponse
28
+ """
29
+
30
+ lifecycle_state: StrictStr = Field(description="Lifecycle state of the subscription.", alias="lifecycleState")
31
+ subscription_id: StrictStr = Field(description="The subscription ID.", alias="subscriptionId")
32
+ __properties: ClassVar[List[str]] = ["lifecycleState", "subscriptionId"]
33
+
34
+ @field_validator("lifecycle_state")
35
+ def lifecycle_state_validate_enum(cls, value):
36
+ """Validates the enum"""
37
+ if value not in set(
38
+ [
39
+ "SUBSCRIPTION_PENDING",
40
+ "SUBSCRIPTION_ACTIVE",
41
+ "SUBSCRIPTION_INACTIVE",
42
+ "SUBSCRIPTION_CANCELLING",
43
+ "SUBSCRIPTION_CANCELLED",
44
+ "SUBSCRIPTION_REJECTED",
45
+ ]
46
+ ):
47
+ raise ValueError(
48
+ "must be one of enum values ('SUBSCRIPTION_PENDING', 'SUBSCRIPTION_ACTIVE', 'SUBSCRIPTION_INACTIVE', 'SUBSCRIPTION_CANCELLING', 'SUBSCRIPTION_CANCELLED', 'SUBSCRIPTION_REJECTED')"
49
+ )
50
+ return value
51
+
52
+ model_config = ConfigDict(
53
+ populate_by_name=True,
54
+ validate_assignment=True,
55
+ protected_namespaces=(),
56
+ )
57
+
58
+ def to_str(self) -> str:
59
+ """Returns the string representation of the model using alias"""
60
+ return pprint.pformat(self.model_dump(by_alias=True))
61
+
62
+ def to_json(self) -> str:
63
+ """Returns the JSON representation of the model using alias"""
64
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
65
+ return json.dumps(self.to_dict())
66
+
67
+ @classmethod
68
+ def from_json(cls, json_str: str) -> Optional[Self]:
69
+ """Create an instance of CurrentSubscriptionStateResponse from a JSON string"""
70
+ return cls.from_dict(json.loads(json_str))
71
+
72
+ def to_dict(self) -> Dict[str, Any]:
73
+ """Return the dictionary representation of the model using alias.
74
+
75
+ This has the following differences from calling pydantic's
76
+ `self.model_dump(by_alias=True)`:
77
+
78
+ * `None` is only added to the output dict for nullable fields that
79
+ were set at model initialization. Other fields with value `None`
80
+ are ignored.
81
+ """
82
+ excluded_fields: Set[str] = set([])
83
+
84
+ _dict = self.model_dump(
85
+ by_alias=True,
86
+ exclude=excluded_fields,
87
+ exclude_none=True,
88
+ )
89
+ return _dict
90
+
91
+ @classmethod
92
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
93
+ """Create an instance of CurrentSubscriptionStateResponse from a dict"""
94
+ if obj is None:
95
+ return None
96
+
97
+ if not isinstance(obj, dict):
98
+ return cls.model_validate(obj)
99
+
100
+ _obj = cls.model_validate(
101
+ {"lifecycleState": obj.get("lifecycleState"), "subscriptionId": obj.get("subscriptionId")}
102
+ )
103
+ return _obj
@@ -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.de
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 datetime import datetime
20
+ from typing import Any, ClassVar, Dict, List, Optional, Set
21
+
22
+ from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr
23
+ from typing_extensions import Self
24
+
25
+
26
+ class ErrorResponse(BaseModel):
27
+ """
28
+ ErrorResponse
29
+ """
30
+
31
+ error: StrictStr = Field(description="Reason phrase of the status code.")
32
+ message: StrictStr = Field(description="Description of the error.")
33
+ path: StrictStr = Field(description="Path which was called.")
34
+ status: StrictInt = Field(description="HTTP response status code.")
35
+ time_stamp: datetime = Field(description="Timestamp at which the error occurred.", alias="timeStamp")
36
+ __properties: ClassVar[List[str]] = ["error", "message", "path", "status", "timeStamp"]
37
+
38
+ model_config = ConfigDict(
39
+ populate_by_name=True,
40
+ validate_assignment=True,
41
+ protected_namespaces=(),
42
+ )
43
+
44
+ def to_str(self) -> str:
45
+ """Returns the string representation of the model using alias"""
46
+ return pprint.pformat(self.model_dump(by_alias=True))
47
+
48
+ def to_json(self) -> str:
49
+ """Returns the JSON representation of the model using alias"""
50
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
51
+ return json.dumps(self.to_dict())
52
+
53
+ @classmethod
54
+ def from_json(cls, json_str: str) -> Optional[Self]:
55
+ """Create an instance of ErrorResponse from a JSON string"""
56
+ return cls.from_dict(json.loads(json_str))
57
+
58
+ def to_dict(self) -> Dict[str, Any]:
59
+ """Return the dictionary representation of the model using alias.
60
+
61
+ This has the following differences from calling pydantic's
62
+ `self.model_dump(by_alias=True)`:
63
+
64
+ * `None` is only added to the output dict for nullable fields that
65
+ were set at model initialization. Other fields with value `None`
66
+ are ignored.
67
+ """
68
+ excluded_fields: Set[str] = set([])
69
+
70
+ _dict = self.model_dump(
71
+ by_alias=True,
72
+ exclude=excluded_fields,
73
+ exclude_none=True,
74
+ )
75
+ return _dict
76
+
77
+ @classmethod
78
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
79
+ """Create an instance of ErrorResponse 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
+ "error": obj.get("error"),
89
+ "message": obj.get("message"),
90
+ "path": obj.get("path"),
91
+ "status": obj.get("status"),
92
+ "timeStamp": obj.get("timeStamp"),
93
+ }
94
+ )
95
+ return _obj
@@ -0,0 +1,109 @@
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.de
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, StrictStr
22
+ from typing_extensions import Annotated, Self
23
+
24
+ from stackit.stackitmarketplace.models.catalog_product_overview import (
25
+ CatalogProductOverview,
26
+ )
27
+
28
+
29
+ class ListCatalogProductsResponse(BaseModel):
30
+ """
31
+ ListCatalogProductsResponse
32
+ """
33
+
34
+ cursor: StrictStr = Field(
35
+ description="A pagination cursor that represents a position in the dataset. Use it in subsequent requests to continue retrieving data from this position. If `null`, there are no more results to retrieve."
36
+ )
37
+ items: List[CatalogProductOverview]
38
+ limit: Annotated[int, Field(le=100, strict=True, ge=0)] = Field(
39
+ description="The maximum number of items to return in the response. If not present, an appropriate default will be used. If maximum is exceeded, maximum is used."
40
+ )
41
+ __properties: ClassVar[List[str]] = ["cursor", "items", "limit"]
42
+
43
+ model_config = ConfigDict(
44
+ populate_by_name=True,
45
+ validate_assignment=True,
46
+ protected_namespaces=(),
47
+ )
48
+
49
+ def to_str(self) -> str:
50
+ """Returns the string representation of the model using alias"""
51
+ return pprint.pformat(self.model_dump(by_alias=True))
52
+
53
+ def to_json(self) -> str:
54
+ """Returns the JSON representation of the model using alias"""
55
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
56
+ return json.dumps(self.to_dict())
57
+
58
+ @classmethod
59
+ def from_json(cls, json_str: str) -> Optional[Self]:
60
+ """Create an instance of ListCatalogProductsResponse from a JSON string"""
61
+ return cls.from_dict(json.loads(json_str))
62
+
63
+ def to_dict(self) -> Dict[str, Any]:
64
+ """Return the dictionary representation of the model using alias.
65
+
66
+ This has the following differences from calling pydantic's
67
+ `self.model_dump(by_alias=True)`:
68
+
69
+ * `None` is only added to the output dict for nullable fields that
70
+ were set at model initialization. Other fields with value `None`
71
+ are ignored.
72
+ """
73
+ excluded_fields: Set[str] = set([])
74
+
75
+ _dict = self.model_dump(
76
+ by_alias=True,
77
+ exclude=excluded_fields,
78
+ exclude_none=True,
79
+ )
80
+ # override the default output from pydantic by calling `to_dict()` of each item in items (list)
81
+ _items = []
82
+ if self.items:
83
+ for _item in self.items:
84
+ if _item:
85
+ _items.append(_item.to_dict())
86
+ _dict["items"] = _items
87
+ return _dict
88
+
89
+ @classmethod
90
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
91
+ """Create an instance of ListCatalogProductsResponse from a dict"""
92
+ if obj is None:
93
+ return None
94
+
95
+ if not isinstance(obj, dict):
96
+ return cls.model_validate(obj)
97
+
98
+ _obj = cls.model_validate(
99
+ {
100
+ "cursor": obj.get("cursor"),
101
+ "items": (
102
+ [CatalogProductOverview.from_dict(_item) for _item in obj["items"]]
103
+ if obj.get("items") is not None
104
+ else None
105
+ ),
106
+ "limit": obj.get("limit") if obj.get("limit") is not None else 50,
107
+ }
108
+ )
109
+ return _obj