Skip to content

Commit 74bf102

Browse files
committed
regenerate with latest raml spec
1 parent 249c7ed commit 74bf102

19 files changed

+968
-4
lines changed
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
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.error import ErrorResponse
11+
from ...models.me import MyCart, MyCartUpdate
12+
13+
if typing.TYPE_CHECKING:
14+
from ...base_client import BaseClient
15+
16+
17+
class ByProjectKeyMeCartsKeyByKeyRequestBuilder:
18+
19+
_client: "BaseClient"
20+
_project_key: str
21+
_key: str
22+
23+
def __init__(
24+
self,
25+
project_key: str,
26+
key: str,
27+
client: "BaseClient",
28+
):
29+
self._project_key = project_key
30+
self._key = key
31+
self._client = client
32+
33+
def get(
34+
self,
35+
*,
36+
expand: typing.List["str"] = None,
37+
headers: typing.Dict[str, str] = None,
38+
options: typing.Dict[str, typing.Any] = None,
39+
) -> typing.Optional["MyCart"]:
40+
"""Get MyCart by key"""
41+
headers = {} if headers is None else headers
42+
response = self._client._get(
43+
endpoint=f"/{self._project_key}/me/carts/key={self._key}",
44+
params={"expand": expand},
45+
headers=headers,
46+
options=options,
47+
)
48+
if response.status_code == 200:
49+
return MyCart.deserialize(response.json())
50+
elif response.status_code in (400, 401, 403, 500, 503):
51+
obj = ErrorResponse.deserialize(response.json())
52+
raise self._client._create_exception(obj, response)
53+
elif response.status_code == 404:
54+
return None
55+
warnings.warn("Unhandled status code %d" % response.status_code)
56+
57+
def post(
58+
self,
59+
body: "MyCartUpdate",
60+
*,
61+
expand: typing.List["str"] = None,
62+
headers: typing.Dict[str, str] = None,
63+
options: typing.Dict[str, typing.Any] = None,
64+
) -> typing.Optional["MyCart"]:
65+
"""Update MyCart by key"""
66+
headers = {} if headers is None else headers
67+
response = self._client._post(
68+
endpoint=f"/{self._project_key}/me/carts/key={self._key}",
69+
params={"expand": expand},
70+
json=body.serialize(),
71+
headers={"Content-Type": "application/json", **headers},
72+
options=options,
73+
)
74+
if response.status_code == 200:
75+
return MyCart.deserialize(response.json())
76+
elif response.status_code in (409, 400, 401, 403, 500, 503):
77+
obj = ErrorResponse.deserialize(response.json())
78+
raise self._client._create_exception(obj, response)
79+
elif response.status_code == 404:
80+
return None
81+
warnings.warn("Unhandled status code %d" % response.status_code)
82+
83+
def delete(
84+
self,
85+
*,
86+
version: int,
87+
expand: typing.List["str"] = None,
88+
headers: typing.Dict[str, str] = None,
89+
options: typing.Dict[str, typing.Any] = None,
90+
) -> typing.Optional["MyCart"]:
91+
"""Delete MyCart by key"""
92+
headers = {} if headers is None else headers
93+
response = self._client._delete(
94+
endpoint=f"/{self._project_key}/me/carts/key={self._key}",
95+
params={"version": version, "expand": expand},
96+
headers=headers,
97+
options=options,
98+
)
99+
if response.status_code == 200:
100+
return MyCart.deserialize(response.json())
101+
elif response.status_code in (409, 400, 401, 403, 500, 503):
102+
obj = ErrorResponse.deserialize(response.json())
103+
raise self._client._create_exception(obj, response)
104+
elif response.status_code == 404:
105+
return None
106+
warnings.warn("Unhandled status code %d" % response.status_code)

src/commercetools/platform/client/carts/by_project_key_me_carts_request_builder.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@
1313
from .by_project_key_me_carts_by_id_request_builder import (
1414
ByProjectKeyMeCartsByIDRequestBuilder,
1515
)
16+
from .by_project_key_me_carts_key_by_key_request_builder import (
17+
ByProjectKeyMeCartsKeyByKeyRequestBuilder,
18+
)
1619

1720
if typing.TYPE_CHECKING:
1821
from ...base_client import BaseClient
@@ -31,6 +34,13 @@ def __init__(
3134
self._project_key = project_key
3235
self._client = client
3336

37+
def with_key(self, key: str) -> ByProjectKeyMeCartsKeyByKeyRequestBuilder:
38+
return ByProjectKeyMeCartsKeyByKeyRequestBuilder(
39+
key=key,
40+
project_key=self._project_key,
41+
client=self._client,
42+
)
43+
3444
def with_id(self, id: str) -> ByProjectKeyMeCartsByIDRequestBuilder:
3545
return ByProjectKeyMeCartsByIDRequestBuilder(
3646
id=id,

src/commercetools/platform/client/in_store/by_project_key_in_store_key_by_store_key_request_builder.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525
from ..shipping_methods.by_project_key_in_store_key_by_store_key_shipping_methods_request_builder import (
2626
ByProjectKeyInStoreKeyByStoreKeyShippingMethodsRequestBuilder,
2727
)
28+
from ..shopping_lists.by_project_key_in_store_key_by_store_key_shopping_lists_request_builder import (
29+
ByProjectKeyInStoreKeyByStoreKeyShoppingListsRequestBuilder,
30+
)
2831

2932
if typing.TYPE_CHECKING:
3033
from ...base_client import BaseClient
@@ -96,3 +99,13 @@ def shipping_methods(
9699
store_key=self._store_key,
97100
client=self._client,
98101
)
102+
103+
def shopping_lists(
104+
self,
105+
) -> ByProjectKeyInStoreKeyByStoreKeyShoppingListsRequestBuilder:
106+
"""shopping-lists e.g. for wishlist support"""
107+
return ByProjectKeyInStoreKeyByStoreKeyShoppingListsRequestBuilder(
108+
project_key=self._project_key,
109+
store_key=self._store_key,
110+
client=self._client,
111+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
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.error import ErrorResponse
11+
from ...models.shopping_list import ShoppingList, ShoppingListUpdate
12+
13+
if typing.TYPE_CHECKING:
14+
from ...base_client import BaseClient
15+
16+
17+
class ByProjectKeyInStoreKeyByStoreKeyShoppingListsByIDRequestBuilder:
18+
19+
_client: "BaseClient"
20+
_project_key: str
21+
_store_key: str
22+
_id: str
23+
24+
def __init__(
25+
self,
26+
project_key: str,
27+
store_key: str,
28+
id: str,
29+
client: "BaseClient",
30+
):
31+
self._project_key = project_key
32+
self._store_key = store_key
33+
self._id = id
34+
self._client = client
35+
36+
def get(
37+
self,
38+
*,
39+
expand: typing.List["str"] = None,
40+
headers: typing.Dict[str, str] = None,
41+
options: typing.Dict[str, typing.Any] = None,
42+
) -> typing.Optional["ShoppingList"]:
43+
"""Gets a shopping list by ID."""
44+
headers = {} if headers is None else headers
45+
response = self._client._get(
46+
endpoint=f"/{self._project_key}/in-store/key={self._store_key}/shopping-lists/{self._id}",
47+
params={"expand": expand},
48+
headers=headers,
49+
options=options,
50+
)
51+
if response.status_code == 200:
52+
return ShoppingList.deserialize(response.json())
53+
elif response.status_code in (400, 401, 403, 500, 503):
54+
obj = ErrorResponse.deserialize(response.json())
55+
raise self._client._create_exception(obj, response)
56+
elif response.status_code == 404:
57+
return None
58+
warnings.warn("Unhandled status code %d" % response.status_code)
59+
60+
def post(
61+
self,
62+
body: "ShoppingListUpdate",
63+
*,
64+
expand: typing.List["str"] = None,
65+
headers: typing.Dict[str, str] = None,
66+
options: typing.Dict[str, typing.Any] = None,
67+
) -> typing.Optional["ShoppingList"]:
68+
"""Update ShoppingList by ID"""
69+
headers = {} if headers is None else headers
70+
response = self._client._post(
71+
endpoint=f"/{self._project_key}/in-store/key={self._store_key}/shopping-lists/{self._id}",
72+
params={"expand": expand},
73+
json=body.serialize(),
74+
headers={"Content-Type": "application/json", **headers},
75+
options=options,
76+
)
77+
if response.status_code == 200:
78+
return ShoppingList.deserialize(response.json())
79+
elif response.status_code in (409, 400, 401, 403, 500, 503):
80+
obj = ErrorResponse.deserialize(response.json())
81+
raise self._client._create_exception(obj, response)
82+
elif response.status_code == 404:
83+
return None
84+
warnings.warn("Unhandled status code %d" % response.status_code)
85+
86+
def delete(
87+
self,
88+
*,
89+
data_erasure: bool = None,
90+
version: int,
91+
expand: typing.List["str"] = None,
92+
headers: typing.Dict[str, str] = None,
93+
options: typing.Dict[str, typing.Any] = None,
94+
) -> typing.Optional["ShoppingList"]:
95+
"""Delete ShoppingList by ID"""
96+
headers = {} if headers is None else headers
97+
response = self._client._delete(
98+
endpoint=f"/{self._project_key}/in-store/key={self._store_key}/shopping-lists/{self._id}",
99+
params={"dataErasure": data_erasure, "version": version, "expand": expand},
100+
headers=headers,
101+
options=options,
102+
)
103+
if response.status_code == 200:
104+
return ShoppingList.deserialize(response.json())
105+
elif response.status_code in (409, 400, 401, 403, 500, 503):
106+
obj = ErrorResponse.deserialize(response.json())
107+
raise self._client._create_exception(obj, response)
108+
elif response.status_code == 404:
109+
return None
110+
warnings.warn("Unhandled status code %d" % response.status_code)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
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.error import ErrorResponse
11+
from ...models.shopping_list import ShoppingList, ShoppingListUpdate
12+
13+
if typing.TYPE_CHECKING:
14+
from ...base_client import BaseClient
15+
16+
17+
class ByProjectKeyInStoreKeyByStoreKeyShoppingListsKeyByKeyRequestBuilder:
18+
19+
_client: "BaseClient"
20+
_project_key: str
21+
_store_key: str
22+
_key: str
23+
24+
def __init__(
25+
self,
26+
project_key: str,
27+
store_key: str,
28+
key: str,
29+
client: "BaseClient",
30+
):
31+
self._project_key = project_key
32+
self._store_key = store_key
33+
self._key = key
34+
self._client = client
35+
36+
def get(
37+
self,
38+
*,
39+
expand: typing.List["str"] = None,
40+
headers: typing.Dict[str, str] = None,
41+
options: typing.Dict[str, typing.Any] = None,
42+
) -> typing.Optional["ShoppingList"]:
43+
"""Gets a shopping list by Key."""
44+
headers = {} if headers is None else headers
45+
response = self._client._get(
46+
endpoint=f"/{self._project_key}/in-store/key={self._store_key}/shopping-lists/key={self._key}",
47+
params={"expand": expand},
48+
headers=headers,
49+
options=options,
50+
)
51+
if response.status_code == 200:
52+
return ShoppingList.deserialize(response.json())
53+
elif response.status_code in (400, 401, 403, 500, 503):
54+
obj = ErrorResponse.deserialize(response.json())
55+
raise self._client._create_exception(obj, response)
56+
elif response.status_code == 404:
57+
return None
58+
warnings.warn("Unhandled status code %d" % response.status_code)
59+
60+
def post(
61+
self,
62+
body: "ShoppingListUpdate",
63+
*,
64+
expand: typing.List["str"] = None,
65+
headers: typing.Dict[str, str] = None,
66+
options: typing.Dict[str, typing.Any] = None,
67+
) -> typing.Optional["ShoppingList"]:
68+
"""Update a shopping list found by its Key."""
69+
headers = {} if headers is None else headers
70+
response = self._client._post(
71+
endpoint=f"/{self._project_key}/in-store/key={self._store_key}/shopping-lists/key={self._key}",
72+
params={"expand": expand},
73+
json=body.serialize(),
74+
headers={"Content-Type": "application/json", **headers},
75+
options=options,
76+
)
77+
if response.status_code == 200:
78+
return ShoppingList.deserialize(response.json())
79+
elif response.status_code in (409, 400, 401, 403, 500, 503):
80+
obj = ErrorResponse.deserialize(response.json())
81+
raise self._client._create_exception(obj, response)
82+
elif response.status_code == 404:
83+
return None
84+
warnings.warn("Unhandled status code %d" % response.status_code)
85+
86+
def delete(
87+
self,
88+
*,
89+
data_erasure: bool = None,
90+
version: int,
91+
expand: typing.List["str"] = None,
92+
headers: typing.Dict[str, str] = None,
93+
options: typing.Dict[str, typing.Any] = None,
94+
) -> typing.Optional["ShoppingList"]:
95+
"""Delete ShoppingList by key"""
96+
headers = {} if headers is None else headers
97+
response = self._client._delete(
98+
endpoint=f"/{self._project_key}/in-store/key={self._store_key}/shopping-lists/key={self._key}",
99+
params={"dataErasure": data_erasure, "version": version, "expand": expand},
100+
headers=headers,
101+
options=options,
102+
)
103+
if response.status_code == 200:
104+
return ShoppingList.deserialize(response.json())
105+
elif response.status_code in (409, 400, 401, 403, 500, 503):
106+
obj = ErrorResponse.deserialize(response.json())
107+
raise self._client._create_exception(obj, response)
108+
elif response.status_code == 404:
109+
return None
110+
warnings.warn("Unhandled status code %d" % response.status_code)

0 commit comments

Comments
 (0)