Skip to content

Commit d85198f

Browse files
committed
Automatically generate the services files
1 parent 61671dc commit d85198f

36 files changed

+4621
-1296
lines changed

src/commercetools/services/__init__.py

Lines changed: 42 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@
44
from commercetools.services.carts import CartService
55
from commercetools.services.categories import CategoryService
66
from commercetools.services.channels import ChannelService
7-
from commercetools.services.custom_object import CustomObjectService
7+
from commercetools.services.custom_objects import CustomObjectService
88
from commercetools.services.customer_groups import CustomerGroupService
99
from commercetools.services.customers import CustomerService
1010
from commercetools.services.discount_codes import DiscountCodeService
1111
from commercetools.services.extensions import ExtensionService
1212
from commercetools.services.graphqls import GraphqlService
1313
from commercetools.services.in_stores import In_StoreService
14-
from commercetools.services.inventory_entries import InventoryEntryService
14+
from commercetools.services.inventory import InventoryEntryService
1515
from commercetools.services.login import LoginService
1616
from commercetools.services.me import MeService
1717
from commercetools.services.messages import MessageService
@@ -21,6 +21,7 @@
2121
from commercetools.services.product_projections import ProductProjectionService
2222
from commercetools.services.product_types import ProductTypeService
2323
from commercetools.services.products import ProductService
24+
from commercetools.services.project import ProjectService
2425
from commercetools.services.reviews import ReviewService
2526
from commercetools.services.shipping_methods import ShippingMethodService
2627
from commercetools.services.shopping_lists import ShoppingListService
@@ -32,68 +33,70 @@
3233
from commercetools.services.zones import ZoneService
3334

3435

35-
class ServiceMixin:
36-
category: CategoryService
36+
class ServicesMixin:
37+
api_client: ApiClientService
3738
cart: CartService
3839
cart_discount: CartDiscountService
40+
category: CategoryService
3941
channel: ChannelService
42+
custom_object: CustomObjectService
4043
customer: CustomerService
4144
customer_group: CustomerGroupService
42-
custom_object: CustomObjectService
4345
discount_code: DiscountCodeService
46+
extension: ExtensionService
4447
graphql: GraphqlService
48+
in_store: In_StoreService
4549
inventory_entry: InventoryEntryService
4650
login: LoginService
51+
me: MeService
4752
message: MessageService
4853
order: OrderService
4954
payment: PaymentService
5055
product: ProductService
5156
product_discount: ProductDiscountService
5257
product_projection: ProductProjectionService
5358
product_type: ProductTypeService
59+
project: ProjectService
5460
review: ReviewService
5561
shipping_method: ShippingMethodService
5662
shopping_list: ShoppingListService
5763
state: StateService
64+
store: StoreService
5865
subscription: SubscriptionService
5966
tax_category: TaxCategoryService
6067
type: TypeService
6168
zone: ZoneService
62-
me: MeService
63-
extension: ExtensionService
64-
api_client: ApiClientService
65-
store: StoreService
66-
in_store: In_StoreService
6769

6870
def register_services(self):
69-
self.category = CategoryService(self)
70-
self.cart = CartService(self)
71-
self.cart_discount = CartDiscountService(self)
72-
self.channel = ChannelService(self)
73-
self.customer = CustomerService(self)
74-
self.customer_group = CustomerGroupService(self)
75-
self.custom_object = CustomObjectService(self)
76-
self.discount_code = DiscountCodeService(self)
77-
self.graphql = GraphqlService(self)
78-
self.inventory_entry = InventoryEntryService(self)
71+
self.api_clients = ApiClientService(self)
72+
self.carts = CartService(self)
73+
self.cart_discounts = CartDiscountService(self)
74+
self.categories = CategoryService(self)
75+
self.channels = ChannelService(self)
76+
self.custom_objects = CustomObjectService(self)
77+
self.customers = CustomerService(self)
78+
self.customer_groups = CustomerGroupService(self)
79+
self.discount_codes = DiscountCodeService(self)
80+
self.extensions = ExtensionService(self)
81+
self.graphqls = GraphqlService(self)
82+
self.in_stores = In_StoreService(self)
83+
self.inventory = InventoryEntryService(self)
7984
self.login = LoginService(self)
80-
self.message = MessageService(self)
81-
self.order = OrderService(self)
82-
self.payment = PaymentService(self)
83-
self.product = ProductService(self)
84-
self.product_discount = ProductDiscountService(self)
85-
self.product_projection = ProductProjectionService(self)
86-
self.product_type = ProductTypeService(self)
87-
self.review = ReviewService(self)
88-
self.shipping_method = ShippingMethodService(self)
89-
self.shopping_list = ShoppingListService(self)
90-
self.state = StateService(self)
91-
self.subscription = SubscriptionService(self)
92-
self.tax_category = TaxCategoryService(self)
93-
self.type = TypeService(self)
94-
self.zone = ZoneService(self)
9585
self.me = MeService(self)
96-
self.extension = ExtensionService(self)
97-
self.api_client = ApiClientService(self)
98-
self.store = StoreService(self)
99-
self.in_store = In_StoreService(self)
86+
self.messages = MessageService(self)
87+
self.orders = OrderService(self)
88+
self.payments = PaymentService(self)
89+
self.products = ProductService(self)
90+
self.product_discounts = ProductDiscountService(self)
91+
self.product_projections = ProductProjectionService(self)
92+
self.product_types = ProductTypeService(self)
93+
self.project = ProjectService(self)
94+
self.reviews = ReviewService(self)
95+
self.shipping_methods = ShippingMethodService(self)
96+
self.shopping_lists = ShoppingListService(self)
97+
self.states = StateService(self)
98+
self.stores = StoreService(self)
99+
self.subscriptions = SubscriptionService(self)
100+
self.tax_categories = TaxCategoryService(self)
101+
self.types = TypeService(self)
102+
self.zones = ZoneService(self)
Lines changed: 56 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,88 @@
1+
# DO NOT EDIT! This file is automatically generated
12
import typing
2-
from typing import Optional
33

44
from commercetools import schemas, types
5-
from commercetools.services import abstract
5+
from commercetools.services import abstract, traits
66
from commercetools.typing import OptionalListStr
77

8-
__all__ = ["ApiClientService"]
98

10-
11-
class ApiClientDeleteSchema(abstract.AbstractDeleteSchema):
9+
class _ApiClientQuerySchema(
10+
traits.ExpandableSchema,
11+
traits.SortableSchema,
12+
traits.PagingSchema,
13+
traits.QuerySchema,
14+
):
1215
pass
1316

1417

15-
class ApiClientQuerySchema(abstract.AbstractQuerySchema):
16-
pass
18+
class ApiClientService(abstract.AbstractService):
19+
"""Manage your API Clients via an API.
1720
21+
Useful for Infrastructure-as-Code tooling, and regularly rotating API secrets.
22+
"""
1823

19-
class ApiClientService(abstract.AbstractService):
20-
def get_by_id(self, id: str) -> types.ApiClient:
21-
return self._client._get(f"api-clients/{id}", {}, schemas.ApiClientSchemaSchema)
24+
def get_by_id(self, id) -> types.ApiClient:
25+
"""Get ApiClient by ID"""
26+
params = {}
27+
return self._client._get(
28+
endpoint=f"api-clients/{id}",
29+
params=params,
30+
schema_cls=schemas.ApiClientSchema,
31+
)
2232

2333
def query(
2434
self,
25-
where: OptionalListStr = None,
35+
*,
36+
expand: OptionalListStr = None,
2637
sort: OptionalListStr = None,
27-
expand: typing.Optional[str] = None,
28-
limit: typing.Optional[int] = None,
29-
offset: typing.Optional[int] = None,
38+
limit: int = None,
39+
offset: int = None,
40+
with_total: bool = None,
41+
where: OptionalListStr = None,
42+
predicate_var: typing.Dict[str, str] = None,
3043
) -> types.ApiClientPagedQueryResponse:
31-
params = ApiClientQuerySchema().dump(
44+
"""Manage your API Clients via an API. Useful for Infrastructure-as-Code
45+
tooling, and regularly rotating API secrets.
46+
"""
47+
params = self._serialize_params(
3248
{
33-
"where": where,
34-
"sort": sort,
3549
"expand": expand,
50+
"sort": sort,
3651
"limit": limit,
3752
"offset": offset,
38-
}
53+
"withTotal": with_total,
54+
"where": where,
55+
"predicate_var": predicate_var,
56+
},
57+
_ApiClientQuerySchema,
3958
)
4059
return self._client._get(
41-
"api-clients", params, schemas.ApiClientPagedQueryResponseSchema
60+
endpoint="api-clients",
61+
params=params,
62+
schema_cls=schemas.ApiClientPagedQueryResponseSchema,
4263
)
4364

44-
def create(self, draft: types.ApiClientDraft) -> types.ApiClient:
65+
def create(
66+
self, draft: types.ApiClientDraft, *, expand: OptionalListStr = None
67+
) -> types.ApiClient:
68+
"""Manage your API Clients via an API. Useful for Infrastructure-as-Code
69+
tooling, and regularly rotating API secrets.
70+
"""
71+
params = self._serialize_params({"expand": expand}, traits.ExpandableSchema)
4572
return self._client._post(
46-
"api-clients",
47-
{},
48-
draft,
49-
schemas.ApiClientDraftSchema,
50-
schemas.ApiClientSchema,
73+
endpoint="api-clients",
74+
params=params,
75+
data_object=draft,
76+
request_schema_cls=schemas.ApiClientDraftSchema,
77+
response_schema_cls=schemas.ApiClientSchema,
5178
)
5279

53-
def delete_by_id(self, id: str, *, force_delete: bool = False) -> types.ApiClient:
80+
def delete_by_id(self, id, *, force_delete: bool = False) -> types.ApiClient:
81+
"""Delete ApiClient by ID"""
82+
params = {}
5483
return self._client._delete(
5584
endpoint=f"api-clients/{id}",
56-
params={},
85+
params=params,
5786
response_schema_cls=schemas.ApiClientSchema,
5887
force_delete=force_delete,
5988
)

0 commit comments

Comments
 (0)