Skip to content

Commit fa519c5

Browse files
committed
Regenerate code
Some small adjustments were done to the raml file for the business unit to fix a cyclic import order. See commercetools/commercetools-api-reference#273
1 parent ed996c2 commit fa519c5

File tree

109 files changed

+18685
-4167
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

109 files changed

+18685
-4167
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ pip-wheel-metadata/
1111
.tox/
1212
.coverage.*
1313

14+
# Env
15+
env/
16+
1417
# Dist files
1518
/build/
1619
/dist/

src/commercetools/importapi/client/by_project_key_request_builder.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@
4646
from .products.by_project_key_products_request_builder import (
4747
ByProjectKeyProductsRequestBuilder,
4848
)
49+
from .standalone_prices.by_project_key_standalone_prices_request_builder import (
50+
ByProjectKeyStandalonePricesRequestBuilder,
51+
)
4952

5053
if typing.TYPE_CHECKING:
5154
from ..base_client import BaseClient
@@ -88,6 +91,12 @@ def prices(self) -> ByProjectKeyPricesRequestBuilder:
8891
client=self._client,
8992
)
9093

94+
def standalone_prices(self) -> ByProjectKeyStandalonePricesRequestBuilder:
95+
return ByProjectKeyStandalonePricesRequestBuilder(
96+
project_key=self._project_key,
97+
client=self._client,
98+
)
99+
91100
def products(self) -> ByProjectKeyProductsRequestBuilder:
92101
return ByProjectKeyProductsRequestBuilder(
93102
project_key=self._project_key,
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# This file is automatically generated by the rmf-codegen project.
2+
#
3+
# The Python code generator is maintained by Lab Digital. If you want to
4+
# contribute to this project then please do not edit this file directly
5+
# but send a pull request to the Lab Digital fork of rmf-codegen at
6+
# https://github.com/labd/rmf-codegen
7+
import typing
8+
import warnings
9+
10+
from ...models.errors import ErrorResponse
11+
from ...models.importrequests import ImportResponse, StandalonePriceImportRequest
12+
13+
if typing.TYPE_CHECKING:
14+
from ...base_client import BaseClient
15+
16+
17+
class ByProjectKeyStandalonePricesImportContainersByImportContainerKeyRequestBuilder:
18+
19+
_client: "BaseClient"
20+
_project_key: str
21+
_import_container_key: str
22+
23+
def __init__(
24+
self,
25+
project_key: str,
26+
import_container_key: str,
27+
client: "BaseClient",
28+
):
29+
self._project_key = project_key
30+
self._import_container_key = import_container_key
31+
self._client = client
32+
33+
def post(
34+
self,
35+
body: "StandalonePriceImportRequest",
36+
*,
37+
headers: typing.Dict[str, str] = None,
38+
options: typing.Dict[str, typing.Any] = None,
39+
) -> "ImportResponse":
40+
"""Creates a request for creating new Standalone Prices or updating existing ones."""
41+
headers = {} if headers is None else headers
42+
response = self._client._post(
43+
endpoint=f"/{self._project_key}/standalone-prices/import-containers/{self._import_container_key}",
44+
params={},
45+
json=body.serialize(),
46+
headers={"Content-Type": "application/json", **headers},
47+
options=options,
48+
)
49+
if response.status_code in (201, 200):
50+
return ImportResponse.deserialize(response.json())
51+
elif response.status_code == 400:
52+
obj = ErrorResponse.deserialize(response.json())
53+
raise self._client._create_exception(obj, response)
54+
warnings.warn("Unhandled status code %d" % response.status_code)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# This file is automatically generated by the rmf-codegen project.
2+
#
3+
# The Python code generator is maintained by Lab Digital. If you want to
4+
# contribute to this project then please do not edit this file directly
5+
# but send a pull request to the Lab Digital fork of rmf-codegen at
6+
# https://github.com/labd/rmf-codegen
7+
import typing
8+
import warnings
9+
10+
from .by_project_key_standalone_prices_import_containers_by_import_container_key_request_builder import (
11+
ByProjectKeyStandalonePricesImportContainersByImportContainerKeyRequestBuilder,
12+
)
13+
14+
if typing.TYPE_CHECKING:
15+
from ...base_client import BaseClient
16+
17+
18+
class ByProjectKeyStandalonePricesImportContainersRequestBuilder:
19+
20+
_client: "BaseClient"
21+
_project_key: str
22+
23+
def __init__(
24+
self,
25+
project_key: str,
26+
client: "BaseClient",
27+
):
28+
self._project_key = project_key
29+
self._client = client
30+
31+
def with_import_container_key_value(
32+
self, import_container_key: str
33+
) -> ByProjectKeyStandalonePricesImportContainersByImportContainerKeyRequestBuilder:
34+
return ByProjectKeyStandalonePricesImportContainersByImportContainerKeyRequestBuilder(
35+
import_container_key=import_container_key,
36+
project_key=self._project_key,
37+
client=self._client,
38+
)
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# This file is automatically generated by the rmf-codegen project.
2+
#
3+
# The Python code generator is maintained by Lab Digital. If you want to
4+
# contribute to this project then please do not edit this file directly
5+
# but send a pull request to the Lab Digital fork of rmf-codegen at
6+
# https://github.com/labd/rmf-codegen
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# This file is automatically generated by the rmf-codegen project.
2+
#
3+
# The Python code generator is maintained by Lab Digital. If you want to
4+
# contribute to this project then please do not edit this file directly
5+
# but send a pull request to the Lab Digital fork of rmf-codegen at
6+
# https://github.com/labd/rmf-codegen
7+
import typing
8+
import warnings
9+
10+
from ..import_containers.by_project_key_standalone_prices_import_containers_request_builder import (
11+
ByProjectKeyStandalonePricesImportContainersRequestBuilder,
12+
)
13+
14+
if typing.TYPE_CHECKING:
15+
from ...base_client import BaseClient
16+
17+
18+
class ByProjectKeyStandalonePricesRequestBuilder:
19+
20+
_client: "BaseClient"
21+
_project_key: str
22+
23+
def __init__(
24+
self,
25+
project_key: str,
26+
client: "BaseClient",
27+
):
28+
self._project_key = project_key
29+
self._client = client
30+
31+
def import_containers(
32+
self,
33+
) -> ByProjectKeyStandalonePricesImportContainersRequestBuilder:
34+
return ByProjectKeyStandalonePricesImportContainersRequestBuilder(
35+
project_key=self._project_key,
36+
client=self._client,
37+
)

src/commercetools/importapi/models/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,4 @@
2222
from .products import * # noqa
2323
from .producttypes import * # noqa
2424
from .productvariants import * # noqa
25+
from .standalone_prices import * # noqa

src/commercetools/importapi/models/_schemas/customers.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,13 @@ class CustomerAddressSchema(helpers.BaseSchema):
112112
missing=None,
113113
data_key="externalId",
114114
)
115+
custom = helpers.LazyNestedField(
116+
nested=helpers.absmod(__name__, ".customfields.CustomSchema"),
117+
allow_none=True,
118+
unknown=marshmallow.EXCLUDE,
119+
metadata={"omit_empty": True},
120+
missing=None,
121+
)
115122

116123
class Meta:
117124
unknown = marshmallow.EXCLUDE

src/commercetools/importapi/models/_schemas/importrequests.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,26 @@ def post_load(self, data, **kwargs):
162162
return models.PriceImportRequest(**data)
163163

164164

165+
class StandalonePriceImportRequestSchema(ImportRequestSchema):
166+
resources = helpers.LazyNestedField(
167+
nested=helpers.absmod(
168+
__name__, ".standalone_prices.StandalonePriceImportSchema"
169+
),
170+
allow_none=True,
171+
many=True,
172+
unknown=marshmallow.EXCLUDE,
173+
missing=None,
174+
)
175+
176+
class Meta:
177+
unknown = marshmallow.EXCLUDE
178+
179+
@marshmallow.post_load
180+
def post_load(self, data, **kwargs):
181+
del data["type"]
182+
return models.StandalonePriceImportRequest(**data)
183+
184+
165185
class OrderImportRequestSchema(ImportRequestSchema):
166186
resources = helpers.LazyNestedField(
167187
nested=helpers.absmod(__name__, ".orders.OrderImportSchema"),

src/commercetools/importapi/models/_schemas/orders.py

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,13 @@ class LineItemImportDraftSchema(helpers.BaseSchema):
336336
missing=None,
337337
data_key="shippingDetails",
338338
)
339+
custom = helpers.LazyNestedField(
340+
nested=helpers.absmod(__name__, ".customfields.CustomSchema"),
341+
allow_none=True,
342+
unknown=marshmallow.EXCLUDE,
343+
metadata={"omit_empty": True},
344+
missing=None,
345+
)
339346

340347
class Meta:
341348
unknown = marshmallow.EXCLUDE
@@ -936,14 +943,6 @@ class TaxedPriceSchema(helpers.BaseSchema):
936943
missing=None,
937944
data_key="taxPortions",
938945
)
939-
total_tax = helpers.LazyNestedField(
940-
nested=helpers.absmod(__name__, ".common.MoneySchema"),
941-
allow_none=True,
942-
unknown=marshmallow.EXCLUDE,
943-
metadata={"omit_empty": True},
944-
missing=None,
945-
data_key="totalTax",
946-
)
947946

948947
class Meta:
949948
unknown = marshmallow.EXCLUDE
@@ -1213,6 +1212,13 @@ class OrderImportSchema(helpers.BaseSchema):
12131212
missing=None,
12141213
data_key="itemShippingAddresses",
12151214
)
1215+
store = helpers.LazyNestedField(
1216+
nested=helpers.absmod(__name__, ".common.StoreKeyReferenceSchema"),
1217+
allow_none=True,
1218+
unknown=marshmallow.EXCLUDE,
1219+
metadata={"omit_empty": True},
1220+
missing=None,
1221+
)
12161222

12171223
class Meta:
12181224
unknown = marshmallow.EXCLUDE

0 commit comments

Comments
 (0)