ordercloud-python 2026.4.1__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.
- ordercloud/__init__.py +37 -0
- ordercloud/auth.py +136 -0
- ordercloud/client.py +211 -0
- ordercloud/config.py +42 -0
- ordercloud/errors.py +47 -0
- ordercloud/http.py +218 -0
- ordercloud/middleware.py +66 -0
- ordercloud/models/__init__.py +271 -0
- ordercloud/models/address.py +47 -0
- ordercloud/models/api_client.py +116 -0
- ordercloud/models/approval.py +73 -0
- ordercloud/models/assignments.py +402 -0
- ordercloud/models/auth_models.py +114 -0
- ordercloud/models/bundle.py +31 -0
- ordercloud/models/buyer.py +271 -0
- ordercloud/models/catalog.py +33 -0
- ordercloud/models/category.py +35 -0
- ordercloud/models/cost_center.py +27 -0
- ordercloud/models/credit_card.py +35 -0
- ordercloud/models/delivery.py +277 -0
- ordercloud/models/discount.py +63 -0
- ordercloud/models/integration.py +76 -0
- ordercloud/models/inventory_record.py +53 -0
- ordercloud/models/line_item.py +95 -0
- ordercloud/models/line_item_types.py +89 -0
- ordercloud/models/message_sender.py +80 -0
- ordercloud/models/misc.py +280 -0
- ordercloud/models/open_id_connect.py +47 -0
- ordercloud/models/order.py +477 -0
- ordercloud/models/order_return.py +92 -0
- ordercloud/models/payment.py +77 -0
- ordercloud/models/price_schedule.py +76 -0
- ordercloud/models/product.py +227 -0
- ordercloud/models/product_collection.py +186 -0
- ordercloud/models/promotion.py +297 -0
- ordercloud/models/security.py +89 -0
- ordercloud/models/shared.py +131 -0
- ordercloud/models/shipment.py +150 -0
- ordercloud/models/spec.py +67 -0
- ordercloud/models/spending_account.py +33 -0
- ordercloud/models/subscription.py +125 -0
- ordercloud/models/supplier.py +43 -0
- ordercloud/models/sync.py +172 -0
- ordercloud/models/user.py +207 -0
- ordercloud/models/user_group.py +27 -0
- ordercloud/models/webhook.py +58 -0
- ordercloud/py.typed +0 -0
- ordercloud/resources/__init__.py +65 -0
- ordercloud/resources/addresses.py +228 -0
- ordercloud/resources/admin_addresses.py +128 -0
- ordercloud/resources/admin_user_groups.py +185 -0
- ordercloud/resources/admin_users.py +150 -0
- ordercloud/resources/api_clients.py +308 -0
- ordercloud/resources/approval_rules.py +144 -0
- ordercloud/resources/base.py +145 -0
- ordercloud/resources/bundle_line_items.py +59 -0
- ordercloud/resources/bundle_subscription_items.py +54 -0
- ordercloud/resources/bundles.py +278 -0
- ordercloud/resources/buyer_groups.py +128 -0
- ordercloud/resources/buyers.py +164 -0
- ordercloud/resources/cart.py +613 -0
- ordercloud/resources/catalogs.py +311 -0
- ordercloud/resources/categories.py +392 -0
- ordercloud/resources/cost_centers.py +222 -0
- ordercloud/resources/credit_cards.py +227 -0
- ordercloud/resources/delivery_configurations.py +132 -0
- ordercloud/resources/discounts.py +201 -0
- ordercloud/resources/entity_syncs.py +534 -0
- ordercloud/resources/error_configs.py +71 -0
- ordercloud/resources/forgotten_credentials.py +74 -0
- ordercloud/resources/group_orders.py +28 -0
- ordercloud/resources/impersonation_configs.py +132 -0
- ordercloud/resources/incrementors.py +128 -0
- ordercloud/resources/integration_events.py +203 -0
- ordercloud/resources/inventory_integrations.py +65 -0
- ordercloud/resources/inventory_records.py +484 -0
- ordercloud/resources/line_items.py +262 -0
- ordercloud/resources/locales.py +203 -0
- ordercloud/resources/me.py +1882 -0
- ordercloud/resources/message_senders.py +261 -0
- ordercloud/resources/open_id_connects.py +128 -0
- ordercloud/resources/order_returns.py +306 -0
- ordercloud/resources/order_syncs.py +65 -0
- ordercloud/resources/orders.py +689 -0
- ordercloud/resources/payments.py +176 -0
- ordercloud/resources/price_schedules.py +164 -0
- ordercloud/resources/product_collections.py +116 -0
- ordercloud/resources/product_facets.py +128 -0
- ordercloud/resources/product_syncs.py +76 -0
- ordercloud/resources/products.py +454 -0
- ordercloud/resources/promotion_integrations.py +65 -0
- ordercloud/resources/promotions.py +203 -0
- ordercloud/resources/security_profiles.py +222 -0
- ordercloud/resources/seller_approval_rules.py +128 -0
- ordercloud/resources/shipments.py +256 -0
- ordercloud/resources/specs.py +313 -0
- ordercloud/resources/spending_accounts.py +227 -0
- ordercloud/resources/subscription_integrations.py +65 -0
- ordercloud/resources/subscription_items.py +146 -0
- ordercloud/resources/subscriptions.py +128 -0
- ordercloud/resources/supplier_addresses.py +144 -0
- ordercloud/resources/supplier_user_groups.py +210 -0
- ordercloud/resources/supplier_users.py +170 -0
- ordercloud/resources/suppliers.py +190 -0
- ordercloud/resources/tracking_events.py +130 -0
- ordercloud/resources/user_groups.py +210 -0
- ordercloud/resources/users.py +254 -0
- ordercloud/resources/webhooks.py +128 -0
- ordercloud/resources/xp_indices.py +77 -0
- ordercloud/sync_client.py +170 -0
- ordercloud_python-2026.4.1.dist-info/METADATA +552 -0
- ordercloud_python-2026.4.1.dist-info/RECORD +114 -0
- ordercloud_python-2026.4.1.dist-info/WHEEL +4 -0
- ordercloud_python-2026.4.1.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
# GENERATED by tools/codegen — DO NOT EDIT
|
|
2
|
+
# Source: ordercloud-openapi-v3.json
|
|
3
|
+
"""OrderCloud Payments API resource."""
|
|
4
|
+
|
|
5
|
+
from __future__ import annotations
|
|
6
|
+
from typing import Any, Optional, Union
|
|
7
|
+
|
|
8
|
+
from ..models.misc import OrderDirection
|
|
9
|
+
from ..models.payment import Payment, PaymentTransaction
|
|
10
|
+
from ..models.shared import ListPage
|
|
11
|
+
from .base import BaseResource
|
|
12
|
+
|
|
13
|
+
__all__ = ["PaymentsResource"]
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class PaymentsResource(BaseResource):
|
|
17
|
+
"""Operations on OrderCloud Payments."""
|
|
18
|
+
|
|
19
|
+
async def list(
|
|
20
|
+
self,
|
|
21
|
+
direction: OrderDirection,
|
|
22
|
+
order_id: str,
|
|
23
|
+
*,
|
|
24
|
+
search: Optional[str] = None,
|
|
25
|
+
search_on: Optional[str] = None,
|
|
26
|
+
sort_by: Optional[str] = None,
|
|
27
|
+
page: Optional[int] = None,
|
|
28
|
+
page_size: Optional[int] = None,
|
|
29
|
+
filters: Optional[dict[str, Any]] = None,
|
|
30
|
+
) -> ListPage[Payment]:
|
|
31
|
+
"""List payments
|
|
32
|
+
|
|
33
|
+
Args:
|
|
34
|
+
direction: Direction of the order, from the current user's perspective.
|
|
35
|
+
order_id: ID of the order.
|
|
36
|
+
search: Word or phrase to search for.
|
|
37
|
+
search_on: Comma-delimited list of fields to search on.
|
|
38
|
+
sort_by: Comma-delimited list of fields to sort by.
|
|
39
|
+
page: Page of results to return. When paginating through many items (> page 30), we recommend the "Last ID" method, as outlined in the Advanced Querying documentation.
|
|
40
|
+
page_size: Number of results to return per page.
|
|
41
|
+
filters: An object or dictionary representing key/value pairs to apply as filters. Valid keys are top-level properties of the returned model or 'xp.???'
|
|
42
|
+
|
|
43
|
+
Returns:
|
|
44
|
+
A paginated list of Payment objects.
|
|
45
|
+
"""
|
|
46
|
+
params = self._build_list_params(
|
|
47
|
+
search=search,
|
|
48
|
+
search_on=search_on,
|
|
49
|
+
sort_by=sort_by,
|
|
50
|
+
page=page,
|
|
51
|
+
page_size=page_size,
|
|
52
|
+
filters=filters,
|
|
53
|
+
)
|
|
54
|
+
resp = await self._http.get(f"/orders/{direction}/{order_id}/payments", **params)
|
|
55
|
+
return self._parse_list(resp.json(), Payment)
|
|
56
|
+
|
|
57
|
+
async def create(
|
|
58
|
+
self,
|
|
59
|
+
direction: OrderDirection,
|
|
60
|
+
order_id: str,
|
|
61
|
+
payment: Union[Payment, dict[str, Any]],
|
|
62
|
+
) -> Payment:
|
|
63
|
+
"""Create a payment
|
|
64
|
+
|
|
65
|
+
Args:
|
|
66
|
+
direction: Direction of the order, from the current user's perspective.
|
|
67
|
+
order_id: ID of the order.
|
|
68
|
+
payment: A ``Payment`` model or dict.
|
|
69
|
+
|
|
70
|
+
Returns:
|
|
71
|
+
The Payment object.
|
|
72
|
+
"""
|
|
73
|
+
resp = await self._http.post(
|
|
74
|
+
f"/orders/{direction}/{order_id}/payments", json=self._serialize(payment)
|
|
75
|
+
)
|
|
76
|
+
return Payment(**resp.json())
|
|
77
|
+
|
|
78
|
+
async def get(
|
|
79
|
+
self,
|
|
80
|
+
direction: OrderDirection,
|
|
81
|
+
order_id: str,
|
|
82
|
+
payment_id: str,
|
|
83
|
+
) -> Payment:
|
|
84
|
+
"""Retrieve a payment
|
|
85
|
+
|
|
86
|
+
Args:
|
|
87
|
+
direction: Direction of the order, from the current user's perspective.
|
|
88
|
+
order_id: ID of the order.
|
|
89
|
+
payment_id: ID of the payment.
|
|
90
|
+
|
|
91
|
+
Returns:
|
|
92
|
+
The Payment object.
|
|
93
|
+
"""
|
|
94
|
+
resp = await self._http.get(f"/orders/{direction}/{order_id}/payments/{payment_id}")
|
|
95
|
+
return Payment(**resp.json())
|
|
96
|
+
|
|
97
|
+
async def delete(
|
|
98
|
+
self,
|
|
99
|
+
direction: OrderDirection,
|
|
100
|
+
order_id: str,
|
|
101
|
+
payment_id: str,
|
|
102
|
+
) -> None:
|
|
103
|
+
"""Delete a payment
|
|
104
|
+
|
|
105
|
+
Args:
|
|
106
|
+
direction: Direction of the order, from the current user's perspective.
|
|
107
|
+
order_id: ID of the order.
|
|
108
|
+
payment_id: ID of the payment.
|
|
109
|
+
"""
|
|
110
|
+
await self._http.delete(f"/orders/{direction}/{order_id}/payments/{payment_id}")
|
|
111
|
+
|
|
112
|
+
async def patch(
|
|
113
|
+
self,
|
|
114
|
+
direction: OrderDirection,
|
|
115
|
+
order_id: str,
|
|
116
|
+
payment_id: str,
|
|
117
|
+
partial: dict[str, Any],
|
|
118
|
+
) -> Payment:
|
|
119
|
+
"""Partially update a payment
|
|
120
|
+
|
|
121
|
+
Args:
|
|
122
|
+
direction: Direction of the order, from the current user's perspective.
|
|
123
|
+
order_id: ID of the order.
|
|
124
|
+
payment_id: ID of the payment.
|
|
125
|
+
partial: A dict of fields to update.
|
|
126
|
+
|
|
127
|
+
Returns:
|
|
128
|
+
The Payment object.
|
|
129
|
+
"""
|
|
130
|
+
resp = await self._http.patch(
|
|
131
|
+
f"/orders/{direction}/{order_id}/payments/{payment_id}", json=partial
|
|
132
|
+
)
|
|
133
|
+
return Payment(**resp.json())
|
|
134
|
+
|
|
135
|
+
async def create_transaction(
|
|
136
|
+
self,
|
|
137
|
+
direction: OrderDirection,
|
|
138
|
+
order_id: str,
|
|
139
|
+
payment_id: str,
|
|
140
|
+
payment_transaction: Union[PaymentTransaction, dict[str, Any]],
|
|
141
|
+
) -> Payment:
|
|
142
|
+
"""Create a payment transaction
|
|
143
|
+
|
|
144
|
+
Args:
|
|
145
|
+
direction: Direction of the order, from the current user's perspective.
|
|
146
|
+
order_id: ID of the order.
|
|
147
|
+
payment_id: ID of the payment.
|
|
148
|
+
payment_transaction: A ``PaymentTransaction`` model or dict. Required fields: Type, DateExecuted.
|
|
149
|
+
|
|
150
|
+
Returns:
|
|
151
|
+
The Payment object.
|
|
152
|
+
"""
|
|
153
|
+
resp = await self._http.post(
|
|
154
|
+
f"/orders/{direction}/{order_id}/payments/{payment_id}/transactions",
|
|
155
|
+
json=self._serialize(payment_transaction),
|
|
156
|
+
)
|
|
157
|
+
return Payment(**resp.json())
|
|
158
|
+
|
|
159
|
+
async def delete_transaction(
|
|
160
|
+
self,
|
|
161
|
+
direction: OrderDirection,
|
|
162
|
+
order_id: str,
|
|
163
|
+
payment_id: str,
|
|
164
|
+
transaction_id: str,
|
|
165
|
+
) -> None:
|
|
166
|
+
"""Delete a payment transaction
|
|
167
|
+
|
|
168
|
+
Args:
|
|
169
|
+
direction: Direction of the order, from the current user's perspective.
|
|
170
|
+
order_id: ID of the order.
|
|
171
|
+
payment_id: ID of the payment.
|
|
172
|
+
transaction_id: ID of the transaction.
|
|
173
|
+
"""
|
|
174
|
+
await self._http.delete(
|
|
175
|
+
f"/orders/{direction}/{order_id}/payments/{payment_id}/transactions/{transaction_id}"
|
|
176
|
+
)
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
# GENERATED by tools/codegen — DO NOT EDIT
|
|
2
|
+
# Source: ordercloud-openapi-v3.json
|
|
3
|
+
"""OrderCloud PriceSchedules API resource."""
|
|
4
|
+
|
|
5
|
+
from __future__ import annotations
|
|
6
|
+
from typing import Any, Optional, Union
|
|
7
|
+
|
|
8
|
+
from ..models.price_schedule import PriceBreak, PriceSchedule
|
|
9
|
+
from ..models.shared import ListPage
|
|
10
|
+
from .base import BaseResource
|
|
11
|
+
|
|
12
|
+
__all__ = ["PriceSchedulesResource"]
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class PriceSchedulesResource(BaseResource):
|
|
16
|
+
"""Operations on OrderCloud PriceSchedules."""
|
|
17
|
+
|
|
18
|
+
async def list(
|
|
19
|
+
self,
|
|
20
|
+
*,
|
|
21
|
+
search: Optional[str] = None,
|
|
22
|
+
search_on: Optional[str] = None,
|
|
23
|
+
sort_by: Optional[str] = None,
|
|
24
|
+
page: Optional[int] = None,
|
|
25
|
+
page_size: Optional[int] = None,
|
|
26
|
+
filters: Optional[dict[str, Any]] = None,
|
|
27
|
+
) -> ListPage[PriceSchedule]:
|
|
28
|
+
"""List price schedules
|
|
29
|
+
|
|
30
|
+
Args:
|
|
31
|
+
search: Word or phrase to search for.
|
|
32
|
+
search_on: Comma-delimited list of fields to search on.
|
|
33
|
+
sort_by: Comma-delimited list of fields to sort by.
|
|
34
|
+
page: Page of results to return. When paginating through many items (> page 30), we recommend the "Last ID" method, as outlined in the Advanced Querying documentation.
|
|
35
|
+
page_size: Number of results to return per page.
|
|
36
|
+
filters: An object or dictionary representing key/value pairs to apply as filters. Valid keys are top-level properties of the returned model or 'xp.???'
|
|
37
|
+
|
|
38
|
+
Returns:
|
|
39
|
+
A paginated list of PriceSchedule objects.
|
|
40
|
+
"""
|
|
41
|
+
params = self._build_list_params(
|
|
42
|
+
search=search,
|
|
43
|
+
search_on=search_on,
|
|
44
|
+
sort_by=sort_by,
|
|
45
|
+
page=page,
|
|
46
|
+
page_size=page_size,
|
|
47
|
+
filters=filters,
|
|
48
|
+
)
|
|
49
|
+
resp = await self._http.get("/priceschedules", **params)
|
|
50
|
+
return self._parse_list(resp.json(), PriceSchedule)
|
|
51
|
+
|
|
52
|
+
async def create(
|
|
53
|
+
self,
|
|
54
|
+
price_schedule: Union[PriceSchedule, dict[str, Any]],
|
|
55
|
+
) -> PriceSchedule:
|
|
56
|
+
"""Create a price schedule
|
|
57
|
+
|
|
58
|
+
Args:
|
|
59
|
+
price_schedule: A ``PriceSchedule`` model or dict. Required fields: Name.
|
|
60
|
+
|
|
61
|
+
Returns:
|
|
62
|
+
The PriceSchedule object.
|
|
63
|
+
"""
|
|
64
|
+
resp = await self._http.post("/priceschedules", json=self._serialize(price_schedule))
|
|
65
|
+
return PriceSchedule(**resp.json())
|
|
66
|
+
|
|
67
|
+
async def get(
|
|
68
|
+
self,
|
|
69
|
+
price_schedule_id: str,
|
|
70
|
+
) -> PriceSchedule:
|
|
71
|
+
"""Retrieve a price schedule
|
|
72
|
+
|
|
73
|
+
Args:
|
|
74
|
+
price_schedule_id: ID of the price schedule.
|
|
75
|
+
|
|
76
|
+
Returns:
|
|
77
|
+
The PriceSchedule object.
|
|
78
|
+
"""
|
|
79
|
+
resp = await self._http.get(f"/priceschedules/{price_schedule_id}")
|
|
80
|
+
return PriceSchedule(**resp.json())
|
|
81
|
+
|
|
82
|
+
async def save(
|
|
83
|
+
self,
|
|
84
|
+
price_schedule_id: str,
|
|
85
|
+
price_schedule: Union[PriceSchedule, dict[str, Any]],
|
|
86
|
+
) -> PriceSchedule:
|
|
87
|
+
"""Create or update a price schedule
|
|
88
|
+
|
|
89
|
+
Args:
|
|
90
|
+
price_schedule_id: ID of the price schedule.
|
|
91
|
+
price_schedule: A ``PriceSchedule`` model or dict. Required fields: Name.
|
|
92
|
+
|
|
93
|
+
Returns:
|
|
94
|
+
The PriceSchedule object.
|
|
95
|
+
"""
|
|
96
|
+
resp = await self._http.put(
|
|
97
|
+
f"/priceschedules/{price_schedule_id}",
|
|
98
|
+
json=self._serialize(price_schedule),
|
|
99
|
+
)
|
|
100
|
+
return PriceSchedule(**resp.json())
|
|
101
|
+
|
|
102
|
+
async def delete(
|
|
103
|
+
self,
|
|
104
|
+
price_schedule_id: str,
|
|
105
|
+
) -> None:
|
|
106
|
+
"""Delete a price schedule
|
|
107
|
+
|
|
108
|
+
Args:
|
|
109
|
+
price_schedule_id: ID of the price schedule.
|
|
110
|
+
"""
|
|
111
|
+
await self._http.delete(f"/priceschedules/{price_schedule_id}")
|
|
112
|
+
|
|
113
|
+
async def patch(
|
|
114
|
+
self,
|
|
115
|
+
price_schedule_id: str,
|
|
116
|
+
partial: dict[str, Any],
|
|
117
|
+
) -> PriceSchedule:
|
|
118
|
+
"""Partially update a price schedule
|
|
119
|
+
|
|
120
|
+
Args:
|
|
121
|
+
price_schedule_id: ID of the price schedule.
|
|
122
|
+
partial: A dict of fields to update.
|
|
123
|
+
|
|
124
|
+
Returns:
|
|
125
|
+
The PriceSchedule object.
|
|
126
|
+
"""
|
|
127
|
+
resp = await self._http.patch(f"/priceschedules/{price_schedule_id}", json=partial)
|
|
128
|
+
return PriceSchedule(**resp.json())
|
|
129
|
+
|
|
130
|
+
async def save_price_break(
|
|
131
|
+
self,
|
|
132
|
+
price_schedule_id: str,
|
|
133
|
+
price_break: Union[PriceBreak, dict[str, Any]],
|
|
134
|
+
) -> PriceSchedule:
|
|
135
|
+
"""Create or update a price schedule price break
|
|
136
|
+
|
|
137
|
+
Args:
|
|
138
|
+
price_schedule_id: ID of the price schedule.
|
|
139
|
+
price_break: A ``PriceBreak`` model or dict. Required fields: Quantity, Price.
|
|
140
|
+
|
|
141
|
+
Returns:
|
|
142
|
+
The PriceSchedule object.
|
|
143
|
+
"""
|
|
144
|
+
resp = await self._http.post(
|
|
145
|
+
f"/priceschedules/{price_schedule_id}/PriceBreaks", json=self._serialize(price_break)
|
|
146
|
+
)
|
|
147
|
+
return PriceSchedule(**resp.json())
|
|
148
|
+
|
|
149
|
+
async def delete_price_break(
|
|
150
|
+
self,
|
|
151
|
+
price_schedule_id: str,
|
|
152
|
+
*,
|
|
153
|
+
quantity: Optional[int],
|
|
154
|
+
) -> None:
|
|
155
|
+
"""Delete a price schedule price break
|
|
156
|
+
|
|
157
|
+
Args:
|
|
158
|
+
price_schedule_id: ID of the price schedule.
|
|
159
|
+
quantity: Quantity of the price schedule.
|
|
160
|
+
"""
|
|
161
|
+
_params: dict[str, Any] = {}
|
|
162
|
+
if quantity is not None:
|
|
163
|
+
_params["quantity"] = quantity
|
|
164
|
+
await self._http.delete(f"/priceschedules/{price_schedule_id}/PriceBreaks", **_params)
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# GENERATED by tools/codegen — DO NOT EDIT
|
|
2
|
+
# Source: ordercloud-openapi-v3.json
|
|
3
|
+
"""OrderCloud ProductCollections API resource."""
|
|
4
|
+
|
|
5
|
+
from __future__ import annotations
|
|
6
|
+
from typing import Any, Optional
|
|
7
|
+
|
|
8
|
+
from ..models.misc import SearchType
|
|
9
|
+
from ..models.product_collection import ProductCollection, ProductCollectionProduct
|
|
10
|
+
from ..models.shared import ListPage, MetaWithFacets
|
|
11
|
+
from .base import BaseResource
|
|
12
|
+
|
|
13
|
+
__all__ = ["ProductCollectionsResource"]
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class ProductCollectionsResource(BaseResource):
|
|
17
|
+
"""Operations on OrderCloud ProductCollections."""
|
|
18
|
+
|
|
19
|
+
async def list(
|
|
20
|
+
self,
|
|
21
|
+
buyer_id: str,
|
|
22
|
+
*,
|
|
23
|
+
search: Optional[str] = None,
|
|
24
|
+
search_on: Optional[str] = None,
|
|
25
|
+
sort_by: Optional[str] = None,
|
|
26
|
+
page: Optional[int] = None,
|
|
27
|
+
page_size: Optional[int] = None,
|
|
28
|
+
filters: Optional[dict[str, Any]] = None,
|
|
29
|
+
) -> ListPage[ProductCollection]:
|
|
30
|
+
"""List product collections
|
|
31
|
+
|
|
32
|
+
Args:
|
|
33
|
+
buyer_id: ID of the buyer.
|
|
34
|
+
search: Word or phrase to search for.
|
|
35
|
+
search_on: Comma-delimited list of fields to search on.
|
|
36
|
+
sort_by: Comma-delimited list of fields to sort by.
|
|
37
|
+
page: Page of results to return. When paginating through many items (> page 30), we recommend the "Last ID" method, as outlined in the Advanced Querying documentation.
|
|
38
|
+
page_size: Number of results to return per page.
|
|
39
|
+
filters: An object or dictionary representing key/value pairs to apply as filters. Valid keys are top-level properties of the returned model or 'xp.???'
|
|
40
|
+
|
|
41
|
+
Returns:
|
|
42
|
+
A paginated list of ProductCollection objects.
|
|
43
|
+
"""
|
|
44
|
+
params = self._build_list_params(
|
|
45
|
+
search=search,
|
|
46
|
+
search_on=search_on,
|
|
47
|
+
sort_by=sort_by,
|
|
48
|
+
page=page,
|
|
49
|
+
page_size=page_size,
|
|
50
|
+
filters=filters,
|
|
51
|
+
)
|
|
52
|
+
resp = await self._http.get(f"/buyers/{buyer_id}/productcollections", **params)
|
|
53
|
+
return self._parse_list(resp.json(), ProductCollection)
|
|
54
|
+
|
|
55
|
+
async def get(
|
|
56
|
+
self,
|
|
57
|
+
buyer_id: str,
|
|
58
|
+
product_collection_id: str,
|
|
59
|
+
) -> ProductCollection:
|
|
60
|
+
"""Retrieve a product collection
|
|
61
|
+
|
|
62
|
+
Args:
|
|
63
|
+
buyer_id: ID of the buyer.
|
|
64
|
+
product_collection_id: ID of the product collection.
|
|
65
|
+
|
|
66
|
+
Returns:
|
|
67
|
+
The ProductCollection object.
|
|
68
|
+
"""
|
|
69
|
+
resp = await self._http.get(
|
|
70
|
+
f"/buyers/{buyer_id}/productcollections/{product_collection_id}"
|
|
71
|
+
)
|
|
72
|
+
return ProductCollection(**resp.json())
|
|
73
|
+
|
|
74
|
+
async def list_entries(
|
|
75
|
+
self,
|
|
76
|
+
buyer_id: str,
|
|
77
|
+
product_collection_id: str,
|
|
78
|
+
*,
|
|
79
|
+
search: Optional[str] = None,
|
|
80
|
+
search_on: Optional[str] = None,
|
|
81
|
+
search_type: Optional[SearchType] = None,
|
|
82
|
+
sort_by: Optional[str] = None,
|
|
83
|
+
page: Optional[int] = None,
|
|
84
|
+
page_size: Optional[int] = None,
|
|
85
|
+
filters: Optional[dict[str, Any]] = None,
|
|
86
|
+
) -> ListPage[ProductCollectionProduct]:
|
|
87
|
+
"""List product collection entries
|
|
88
|
+
|
|
89
|
+
Args:
|
|
90
|
+
buyer_id: ID of the buyer.
|
|
91
|
+
product_collection_id: ID of the product collection.
|
|
92
|
+
search: Word or phrase to search for.
|
|
93
|
+
search_on: Comma-delimited list of fields to search on.
|
|
94
|
+
search_type: Type of search to perform.
|
|
95
|
+
sort_by: Comma-delimited list of fields to sort by.
|
|
96
|
+
page: Page of results to return. When paginating through many items (> page 30), we recommend the "Last ID" method, as outlined in the Advanced Querying documentation.
|
|
97
|
+
page_size: Number of results to return per page.
|
|
98
|
+
filters: An object or dictionary representing key/value pairs to apply as filters. Valid keys are top-level properties of the returned model or 'xp.???'
|
|
99
|
+
|
|
100
|
+
Returns:
|
|
101
|
+
A paginated list of ProductCollectionProduct objects.
|
|
102
|
+
"""
|
|
103
|
+
params = self._build_list_params(
|
|
104
|
+
search=search,
|
|
105
|
+
search_on=search_on,
|
|
106
|
+
sort_by=sort_by,
|
|
107
|
+
page=page,
|
|
108
|
+
page_size=page_size,
|
|
109
|
+
filters=filters,
|
|
110
|
+
)
|
|
111
|
+
if search_type is not None:
|
|
112
|
+
params["searchType"] = search_type
|
|
113
|
+
resp = await self._http.get(
|
|
114
|
+
f"/buyers/{buyer_id}/productcollections/{product_collection_id}/products", **params
|
|
115
|
+
)
|
|
116
|
+
return self._parse_list(resp.json(), ProductCollectionProduct, meta_cls=MetaWithFacets)
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# GENERATED by tools/codegen — DO NOT EDIT
|
|
2
|
+
# Source: ordercloud-openapi-v3.json
|
|
3
|
+
"""OrderCloud ProductFacets API resource."""
|
|
4
|
+
|
|
5
|
+
from __future__ import annotations
|
|
6
|
+
from typing import Any, Optional, Union
|
|
7
|
+
|
|
8
|
+
from ..models.misc import ProductFacet
|
|
9
|
+
from ..models.shared import ListPage
|
|
10
|
+
from .base import BaseResource
|
|
11
|
+
|
|
12
|
+
__all__ = ["ProductFacetsResource"]
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class ProductFacetsResource(BaseResource):
|
|
16
|
+
"""Operations on OrderCloud ProductFacets."""
|
|
17
|
+
|
|
18
|
+
async def list(
|
|
19
|
+
self,
|
|
20
|
+
*,
|
|
21
|
+
search: Optional[str] = None,
|
|
22
|
+
search_on: Optional[str] = None,
|
|
23
|
+
sort_by: Optional[str] = None,
|
|
24
|
+
page: Optional[int] = None,
|
|
25
|
+
page_size: Optional[int] = None,
|
|
26
|
+
filters: Optional[dict[str, Any]] = None,
|
|
27
|
+
) -> ListPage[ProductFacet]:
|
|
28
|
+
"""List product facets
|
|
29
|
+
|
|
30
|
+
Args:
|
|
31
|
+
search: Word or phrase to search for.
|
|
32
|
+
search_on: Comma-delimited list of fields to search on.
|
|
33
|
+
sort_by: Comma-delimited list of fields to sort by.
|
|
34
|
+
page: Page of results to return. When paginating through many items (> page 30), we recommend the "Last ID" method, as outlined in the Advanced Querying documentation.
|
|
35
|
+
page_size: Number of results to return per page.
|
|
36
|
+
filters: An object or dictionary representing key/value pairs to apply as filters. Valid keys are top-level properties of the returned model or 'xp.???'
|
|
37
|
+
|
|
38
|
+
Returns:
|
|
39
|
+
A paginated list of ProductFacet objects.
|
|
40
|
+
"""
|
|
41
|
+
params = self._build_list_params(
|
|
42
|
+
search=search,
|
|
43
|
+
search_on=search_on,
|
|
44
|
+
sort_by=sort_by,
|
|
45
|
+
page=page,
|
|
46
|
+
page_size=page_size,
|
|
47
|
+
filters=filters,
|
|
48
|
+
)
|
|
49
|
+
resp = await self._http.get("/productfacets", **params)
|
|
50
|
+
return self._parse_list(resp.json(), ProductFacet)
|
|
51
|
+
|
|
52
|
+
async def create(
|
|
53
|
+
self,
|
|
54
|
+
product_facet: Union[ProductFacet, dict[str, Any]],
|
|
55
|
+
) -> ProductFacet:
|
|
56
|
+
"""Create a product facet
|
|
57
|
+
|
|
58
|
+
Args:
|
|
59
|
+
product_facet: A ``ProductFacet`` model or dict. Required fields: Name.
|
|
60
|
+
|
|
61
|
+
Returns:
|
|
62
|
+
The ProductFacet object.
|
|
63
|
+
"""
|
|
64
|
+
resp = await self._http.post("/productfacets", json=self._serialize(product_facet))
|
|
65
|
+
return ProductFacet(**resp.json())
|
|
66
|
+
|
|
67
|
+
async def get(
|
|
68
|
+
self,
|
|
69
|
+
product_facet_id: str,
|
|
70
|
+
) -> ProductFacet:
|
|
71
|
+
"""Retrieve a product facet
|
|
72
|
+
|
|
73
|
+
Args:
|
|
74
|
+
product_facet_id: ID of the product facet.
|
|
75
|
+
|
|
76
|
+
Returns:
|
|
77
|
+
The ProductFacet object.
|
|
78
|
+
"""
|
|
79
|
+
resp = await self._http.get(f"/productfacets/{product_facet_id}")
|
|
80
|
+
return ProductFacet(**resp.json())
|
|
81
|
+
|
|
82
|
+
async def save(
|
|
83
|
+
self,
|
|
84
|
+
product_facet_id: str,
|
|
85
|
+
product_facet: Union[ProductFacet, dict[str, Any]],
|
|
86
|
+
) -> ProductFacet:
|
|
87
|
+
"""Create or update a product facet
|
|
88
|
+
|
|
89
|
+
Args:
|
|
90
|
+
product_facet_id: ID of the product facet.
|
|
91
|
+
product_facet: A ``ProductFacet`` model or dict. Required fields: Name.
|
|
92
|
+
|
|
93
|
+
Returns:
|
|
94
|
+
The ProductFacet object.
|
|
95
|
+
"""
|
|
96
|
+
resp = await self._http.put(
|
|
97
|
+
f"/productfacets/{product_facet_id}",
|
|
98
|
+
json=self._serialize(product_facet),
|
|
99
|
+
)
|
|
100
|
+
return ProductFacet(**resp.json())
|
|
101
|
+
|
|
102
|
+
async def delete(
|
|
103
|
+
self,
|
|
104
|
+
product_facet_id: str,
|
|
105
|
+
) -> None:
|
|
106
|
+
"""Delete a product facet
|
|
107
|
+
|
|
108
|
+
Args:
|
|
109
|
+
product_facet_id: ID of the product facet.
|
|
110
|
+
"""
|
|
111
|
+
await self._http.delete(f"/productfacets/{product_facet_id}")
|
|
112
|
+
|
|
113
|
+
async def patch(
|
|
114
|
+
self,
|
|
115
|
+
product_facet_id: str,
|
|
116
|
+
partial: dict[str, Any],
|
|
117
|
+
) -> ProductFacet:
|
|
118
|
+
"""Partially update a product facet
|
|
119
|
+
|
|
120
|
+
Args:
|
|
121
|
+
product_facet_id: ID of the product facet.
|
|
122
|
+
partial: A dict of fields to update.
|
|
123
|
+
|
|
124
|
+
Returns:
|
|
125
|
+
The ProductFacet object.
|
|
126
|
+
"""
|
|
127
|
+
resp = await self._http.patch(f"/productfacets/{product_facet_id}", json=partial)
|
|
128
|
+
return ProductFacet(**resp.json())
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# GENERATED by tools/codegen — DO NOT EDIT
|
|
2
|
+
# Source: ordercloud-openapi-v3.json
|
|
3
|
+
"""OrderCloud ProductSyncs API resource."""
|
|
4
|
+
|
|
5
|
+
from __future__ import annotations
|
|
6
|
+
from typing import Any, Union
|
|
7
|
+
|
|
8
|
+
from ..models.sync import ProductSyncConfig, SyncProduct
|
|
9
|
+
from .base import BaseResource
|
|
10
|
+
|
|
11
|
+
__all__ = ["ProductSyncsResource"]
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class ProductSyncsResource(BaseResource):
|
|
15
|
+
"""Operations on OrderCloud ProductSyncs."""
|
|
16
|
+
|
|
17
|
+
async def get(
|
|
18
|
+
self,
|
|
19
|
+
) -> ProductSyncConfig:
|
|
20
|
+
"""Retrieve a product sync
|
|
21
|
+
|
|
22
|
+
Returns:
|
|
23
|
+
The ProductSyncConfig object.
|
|
24
|
+
"""
|
|
25
|
+
resp = await self._http.get("/integrations/productsync")
|
|
26
|
+
return ProductSyncConfig(**resp.json())
|
|
27
|
+
|
|
28
|
+
async def save(
|
|
29
|
+
self,
|
|
30
|
+
product_sync_config: Union[ProductSyncConfig, dict[str, Any]],
|
|
31
|
+
) -> ProductSyncConfig:
|
|
32
|
+
"""Create or update a product sync
|
|
33
|
+
|
|
34
|
+
Args:
|
|
35
|
+
product_sync_config: A ``ProductSyncConfig`` model or dict. Required fields: SyncProductChanged, SyncProductDeleted, DeliveryConfigID.
|
|
36
|
+
|
|
37
|
+
Returns:
|
|
38
|
+
The ProductSyncConfig object.
|
|
39
|
+
"""
|
|
40
|
+
resp = await self._http.put(
|
|
41
|
+
"/integrations/productsync",
|
|
42
|
+
json=self._serialize(product_sync_config),
|
|
43
|
+
)
|
|
44
|
+
return ProductSyncConfig(**resp.json())
|
|
45
|
+
|
|
46
|
+
async def delete(
|
|
47
|
+
self,
|
|
48
|
+
) -> None:
|
|
49
|
+
"""Delete a product sync"""
|
|
50
|
+
await self._http.delete("/integrations/productsync")
|
|
51
|
+
|
|
52
|
+
async def patch(
|
|
53
|
+
self,
|
|
54
|
+
partial: dict[str, Any],
|
|
55
|
+
) -> ProductSyncConfig:
|
|
56
|
+
"""Partially update a product sync
|
|
57
|
+
|
|
58
|
+
Args:
|
|
59
|
+
partial: A dict of fields to update.
|
|
60
|
+
|
|
61
|
+
Returns:
|
|
62
|
+
The ProductSyncConfig object.
|
|
63
|
+
"""
|
|
64
|
+
resp = await self._http.patch("/integrations/productsync", json=partial)
|
|
65
|
+
return ProductSyncConfig(**resp.json())
|
|
66
|
+
|
|
67
|
+
async def sync(
|
|
68
|
+
self,
|
|
69
|
+
sync_product: Union[SyncProduct, dict[str, Any]],
|
|
70
|
+
) -> None:
|
|
71
|
+
"""Sync a product
|
|
72
|
+
|
|
73
|
+
Args:
|
|
74
|
+
sync_product: A ``SyncProduct`` model or dict. Required fields: ProductID.
|
|
75
|
+
"""
|
|
76
|
+
await self._http.post("/integrations/productsync/sync", json=self._serialize(sync_product))
|