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,222 @@
|
|
|
1
|
+
# GENERATED by tools/codegen — DO NOT EDIT
|
|
2
|
+
# Source: ordercloud-openapi-v3.json
|
|
3
|
+
"""OrderCloud CostCenters API resource."""
|
|
4
|
+
|
|
5
|
+
from __future__ import annotations
|
|
6
|
+
from typing import Any, Optional, Union
|
|
7
|
+
|
|
8
|
+
from ..models.assignments import CostCenterAssignment
|
|
9
|
+
from ..models.cost_center import CostCenter
|
|
10
|
+
from ..models.shared import ListPage
|
|
11
|
+
from .base import BaseResource
|
|
12
|
+
|
|
13
|
+
__all__ = ["CostCentersResource"]
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class CostCentersResource(BaseResource):
|
|
17
|
+
"""Operations on OrderCloud CostCenters."""
|
|
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[CostCenter]:
|
|
30
|
+
"""List cost centers
|
|
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 CostCenter 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}/costcenters", **params)
|
|
53
|
+
return self._parse_list(resp.json(), CostCenter)
|
|
54
|
+
|
|
55
|
+
async def create(
|
|
56
|
+
self,
|
|
57
|
+
buyer_id: str,
|
|
58
|
+
cost_center: Union[CostCenter, dict[str, Any]],
|
|
59
|
+
) -> CostCenter:
|
|
60
|
+
"""Create a cost center
|
|
61
|
+
|
|
62
|
+
Args:
|
|
63
|
+
buyer_id: ID of the buyer.
|
|
64
|
+
cost_center: A ``CostCenter`` model or dict. Required fields: Name.
|
|
65
|
+
|
|
66
|
+
Returns:
|
|
67
|
+
The CostCenter object.
|
|
68
|
+
"""
|
|
69
|
+
resp = await self._http.post(
|
|
70
|
+
f"/buyers/{buyer_id}/costcenters", json=self._serialize(cost_center)
|
|
71
|
+
)
|
|
72
|
+
return CostCenter(**resp.json())
|
|
73
|
+
|
|
74
|
+
async def get(
|
|
75
|
+
self,
|
|
76
|
+
buyer_id: str,
|
|
77
|
+
cost_center_id: str,
|
|
78
|
+
) -> CostCenter:
|
|
79
|
+
"""Retrieve a cost center
|
|
80
|
+
|
|
81
|
+
Args:
|
|
82
|
+
buyer_id: ID of the buyer.
|
|
83
|
+
cost_center_id: ID of the cost center.
|
|
84
|
+
|
|
85
|
+
Returns:
|
|
86
|
+
The CostCenter object.
|
|
87
|
+
"""
|
|
88
|
+
resp = await self._http.get(f"/buyers/{buyer_id}/costcenters/{cost_center_id}")
|
|
89
|
+
return CostCenter(**resp.json())
|
|
90
|
+
|
|
91
|
+
async def save(
|
|
92
|
+
self,
|
|
93
|
+
buyer_id: str,
|
|
94
|
+
cost_center_id: str,
|
|
95
|
+
cost_center: Union[CostCenter, dict[str, Any]],
|
|
96
|
+
) -> CostCenter:
|
|
97
|
+
"""Create or update a cost center
|
|
98
|
+
|
|
99
|
+
Args:
|
|
100
|
+
buyer_id: ID of the buyer.
|
|
101
|
+
cost_center_id: ID of the cost center.
|
|
102
|
+
cost_center: A ``CostCenter`` model or dict. Required fields: Name.
|
|
103
|
+
|
|
104
|
+
Returns:
|
|
105
|
+
The CostCenter object.
|
|
106
|
+
"""
|
|
107
|
+
resp = await self._http.put(
|
|
108
|
+
f"/buyers/{buyer_id}/costcenters/{cost_center_id}",
|
|
109
|
+
json=self._serialize(cost_center),
|
|
110
|
+
)
|
|
111
|
+
return CostCenter(**resp.json())
|
|
112
|
+
|
|
113
|
+
async def delete(
|
|
114
|
+
self,
|
|
115
|
+
buyer_id: str,
|
|
116
|
+
cost_center_id: str,
|
|
117
|
+
) -> None:
|
|
118
|
+
"""Delete a cost center
|
|
119
|
+
|
|
120
|
+
Args:
|
|
121
|
+
buyer_id: ID of the buyer.
|
|
122
|
+
cost_center_id: ID of the cost center.
|
|
123
|
+
"""
|
|
124
|
+
await self._http.delete(f"/buyers/{buyer_id}/costcenters/{cost_center_id}")
|
|
125
|
+
|
|
126
|
+
async def patch(
|
|
127
|
+
self,
|
|
128
|
+
buyer_id: str,
|
|
129
|
+
cost_center_id: str,
|
|
130
|
+
partial: dict[str, Any],
|
|
131
|
+
) -> CostCenter:
|
|
132
|
+
"""Partially update a cost center
|
|
133
|
+
|
|
134
|
+
Args:
|
|
135
|
+
buyer_id: ID of the buyer.
|
|
136
|
+
cost_center_id: ID of the cost center.
|
|
137
|
+
partial: A dict of fields to update.
|
|
138
|
+
|
|
139
|
+
Returns:
|
|
140
|
+
The CostCenter object.
|
|
141
|
+
"""
|
|
142
|
+
resp = await self._http.patch(
|
|
143
|
+
f"/buyers/{buyer_id}/costcenters/{cost_center_id}", json=partial
|
|
144
|
+
)
|
|
145
|
+
return CostCenter(**resp.json())
|
|
146
|
+
|
|
147
|
+
async def delete_assignment(
|
|
148
|
+
self,
|
|
149
|
+
buyer_id: str,
|
|
150
|
+
cost_center_id: str,
|
|
151
|
+
*,
|
|
152
|
+
user_id: Optional[str] = None,
|
|
153
|
+
user_group_id: Optional[str] = None,
|
|
154
|
+
) -> None:
|
|
155
|
+
"""Delete a cost center assignment
|
|
156
|
+
|
|
157
|
+
Args:
|
|
158
|
+
buyer_id: ID of the buyer.
|
|
159
|
+
cost_center_id: ID of the cost center.
|
|
160
|
+
user_id: ID of the user.
|
|
161
|
+
user_group_id: ID of the user group.
|
|
162
|
+
"""
|
|
163
|
+
_params: dict[str, Any] = {}
|
|
164
|
+
if user_id is not None:
|
|
165
|
+
_params["userID"] = user_id
|
|
166
|
+
if user_group_id is not None:
|
|
167
|
+
_params["userGroupID"] = user_group_id
|
|
168
|
+
await self._http.delete(
|
|
169
|
+
f"/buyers/{buyer_id}/costcenters/{cost_center_id}/assignments", **_params
|
|
170
|
+
)
|
|
171
|
+
|
|
172
|
+
async def list_assignments(
|
|
173
|
+
self,
|
|
174
|
+
buyer_id: str,
|
|
175
|
+
*,
|
|
176
|
+
cost_center_id: Optional[str] = None,
|
|
177
|
+
user_group_id: Optional[str] = None,
|
|
178
|
+
level: Optional[str] = None,
|
|
179
|
+
page: Optional[int] = None,
|
|
180
|
+
page_size: Optional[int] = None,
|
|
181
|
+
) -> ListPage[CostCenterAssignment]:
|
|
182
|
+
"""List cost center assignments
|
|
183
|
+
|
|
184
|
+
Args:
|
|
185
|
+
buyer_id: ID of the buyer.
|
|
186
|
+
cost_center_id: ID of the cost center.
|
|
187
|
+
user_group_id: ID of the user group.
|
|
188
|
+
level: Level of the cost center assignment. Possible values: Group, Company, BuyerGroup.
|
|
189
|
+
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.
|
|
190
|
+
page_size: Number of results to return per page.
|
|
191
|
+
|
|
192
|
+
Returns:
|
|
193
|
+
A paginated list of CostCenterAssignment objects.
|
|
194
|
+
"""
|
|
195
|
+
params = self._build_list_params(
|
|
196
|
+
page=page,
|
|
197
|
+
page_size=page_size,
|
|
198
|
+
)
|
|
199
|
+
if cost_center_id is not None:
|
|
200
|
+
params["costCenterID"] = cost_center_id
|
|
201
|
+
if user_group_id is not None:
|
|
202
|
+
params["userGroupID"] = user_group_id
|
|
203
|
+
if level is not None:
|
|
204
|
+
params["level"] = level
|
|
205
|
+
resp = await self._http.get(f"/buyers/{buyer_id}/costcenters/assignments", **params)
|
|
206
|
+
return self._parse_list(resp.json(), CostCenterAssignment)
|
|
207
|
+
|
|
208
|
+
async def save_assignment(
|
|
209
|
+
self,
|
|
210
|
+
buyer_id: str,
|
|
211
|
+
cost_center_assignment: Union[CostCenterAssignment, dict[str, Any]],
|
|
212
|
+
) -> None:
|
|
213
|
+
"""Create or update a cost center assignment
|
|
214
|
+
|
|
215
|
+
Args:
|
|
216
|
+
buyer_id: ID of the buyer.
|
|
217
|
+
cost_center_assignment: A ``CostCenterAssignment`` model or dict. Required fields: CostCenterID.
|
|
218
|
+
"""
|
|
219
|
+
await self._http.post(
|
|
220
|
+
f"/buyers/{buyer_id}/costcenters/assignments",
|
|
221
|
+
json=self._serialize(cost_center_assignment),
|
|
222
|
+
)
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
# GENERATED by tools/codegen — DO NOT EDIT
|
|
2
|
+
# Source: ordercloud-openapi-v3.json
|
|
3
|
+
"""OrderCloud CreditCards API resource."""
|
|
4
|
+
|
|
5
|
+
from __future__ import annotations
|
|
6
|
+
from typing import Any, Optional, Union
|
|
7
|
+
|
|
8
|
+
from ..models.assignments import CreditCardAssignment
|
|
9
|
+
from ..models.credit_card import CreditCard
|
|
10
|
+
from ..models.misc import PartyType
|
|
11
|
+
from ..models.shared import ListPage
|
|
12
|
+
from .base import BaseResource
|
|
13
|
+
|
|
14
|
+
__all__ = ["CreditCardsResource"]
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class CreditCardsResource(BaseResource):
|
|
18
|
+
"""Operations on OrderCloud CreditCards."""
|
|
19
|
+
|
|
20
|
+
async def list(
|
|
21
|
+
self,
|
|
22
|
+
buyer_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[CreditCard]:
|
|
31
|
+
"""List credit cards
|
|
32
|
+
|
|
33
|
+
Args:
|
|
34
|
+
buyer_id: ID of the buyer.
|
|
35
|
+
search: Word or phrase to search for.
|
|
36
|
+
search_on: Comma-delimited list of fields to search on.
|
|
37
|
+
sort_by: Comma-delimited list of fields to sort by.
|
|
38
|
+
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.
|
|
39
|
+
page_size: Number of results to return per page.
|
|
40
|
+
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.???'
|
|
41
|
+
|
|
42
|
+
Returns:
|
|
43
|
+
A paginated list of CreditCard objects.
|
|
44
|
+
"""
|
|
45
|
+
params = self._build_list_params(
|
|
46
|
+
search=search,
|
|
47
|
+
search_on=search_on,
|
|
48
|
+
sort_by=sort_by,
|
|
49
|
+
page=page,
|
|
50
|
+
page_size=page_size,
|
|
51
|
+
filters=filters,
|
|
52
|
+
)
|
|
53
|
+
resp = await self._http.get(f"/buyers/{buyer_id}/creditcards", **params)
|
|
54
|
+
return self._parse_list(resp.json(), CreditCard)
|
|
55
|
+
|
|
56
|
+
async def create(
|
|
57
|
+
self,
|
|
58
|
+
buyer_id: str,
|
|
59
|
+
credit_card: Union[CreditCard, dict[str, Any]],
|
|
60
|
+
) -> CreditCard:
|
|
61
|
+
"""Create a credit card
|
|
62
|
+
|
|
63
|
+
Args:
|
|
64
|
+
buyer_id: ID of the buyer.
|
|
65
|
+
credit_card: A ``CreditCard`` model or dict.
|
|
66
|
+
|
|
67
|
+
Returns:
|
|
68
|
+
The CreditCard object.
|
|
69
|
+
"""
|
|
70
|
+
resp = await self._http.post(
|
|
71
|
+
f"/buyers/{buyer_id}/creditcards", json=self._serialize(credit_card)
|
|
72
|
+
)
|
|
73
|
+
return CreditCard(**resp.json())
|
|
74
|
+
|
|
75
|
+
async def get(
|
|
76
|
+
self,
|
|
77
|
+
buyer_id: str,
|
|
78
|
+
credit_card_id: str,
|
|
79
|
+
) -> CreditCard:
|
|
80
|
+
"""Retrieve a credit card
|
|
81
|
+
|
|
82
|
+
Args:
|
|
83
|
+
buyer_id: ID of the buyer.
|
|
84
|
+
credit_card_id: ID of the credit card.
|
|
85
|
+
|
|
86
|
+
Returns:
|
|
87
|
+
The CreditCard object.
|
|
88
|
+
"""
|
|
89
|
+
resp = await self._http.get(f"/buyers/{buyer_id}/creditcards/{credit_card_id}")
|
|
90
|
+
return CreditCard(**resp.json())
|
|
91
|
+
|
|
92
|
+
async def save(
|
|
93
|
+
self,
|
|
94
|
+
buyer_id: str,
|
|
95
|
+
credit_card_id: str,
|
|
96
|
+
credit_card: Union[CreditCard, dict[str, Any]],
|
|
97
|
+
) -> CreditCard:
|
|
98
|
+
"""Create or update a credit card
|
|
99
|
+
|
|
100
|
+
Args:
|
|
101
|
+
buyer_id: ID of the buyer.
|
|
102
|
+
credit_card_id: ID of the credit card.
|
|
103
|
+
credit_card: A ``CreditCard`` model or dict.
|
|
104
|
+
|
|
105
|
+
Returns:
|
|
106
|
+
The CreditCard object.
|
|
107
|
+
"""
|
|
108
|
+
resp = await self._http.put(
|
|
109
|
+
f"/buyers/{buyer_id}/creditcards/{credit_card_id}",
|
|
110
|
+
json=self._serialize(credit_card),
|
|
111
|
+
)
|
|
112
|
+
return CreditCard(**resp.json())
|
|
113
|
+
|
|
114
|
+
async def delete(
|
|
115
|
+
self,
|
|
116
|
+
buyer_id: str,
|
|
117
|
+
credit_card_id: str,
|
|
118
|
+
) -> None:
|
|
119
|
+
"""Delete a credit card
|
|
120
|
+
|
|
121
|
+
Args:
|
|
122
|
+
buyer_id: ID of the buyer.
|
|
123
|
+
credit_card_id: ID of the credit card.
|
|
124
|
+
"""
|
|
125
|
+
await self._http.delete(f"/buyers/{buyer_id}/creditcards/{credit_card_id}")
|
|
126
|
+
|
|
127
|
+
async def patch(
|
|
128
|
+
self,
|
|
129
|
+
buyer_id: str,
|
|
130
|
+
credit_card_id: str,
|
|
131
|
+
partial: dict[str, Any],
|
|
132
|
+
) -> CreditCard:
|
|
133
|
+
"""Partially update a credit card
|
|
134
|
+
|
|
135
|
+
Args:
|
|
136
|
+
buyer_id: ID of the buyer.
|
|
137
|
+
credit_card_id: ID of the credit card.
|
|
138
|
+
partial: A dict of fields to update.
|
|
139
|
+
|
|
140
|
+
Returns:
|
|
141
|
+
The CreditCard object.
|
|
142
|
+
"""
|
|
143
|
+
resp = await self._http.patch(
|
|
144
|
+
f"/buyers/{buyer_id}/creditcards/{credit_card_id}", json=partial
|
|
145
|
+
)
|
|
146
|
+
return CreditCard(**resp.json())
|
|
147
|
+
|
|
148
|
+
async def delete_assignment(
|
|
149
|
+
self,
|
|
150
|
+
buyer_id: str,
|
|
151
|
+
credit_card_id: str,
|
|
152
|
+
*,
|
|
153
|
+
user_id: Optional[str] = None,
|
|
154
|
+
user_group_id: Optional[str] = None,
|
|
155
|
+
) -> None:
|
|
156
|
+
"""Delete a credit card assignment
|
|
157
|
+
|
|
158
|
+
Args:
|
|
159
|
+
buyer_id: ID of the buyer.
|
|
160
|
+
credit_card_id: ID of the credit card.
|
|
161
|
+
user_id: ID of the user.
|
|
162
|
+
user_group_id: ID of the user group.
|
|
163
|
+
"""
|
|
164
|
+
_params: dict[str, Any] = {}
|
|
165
|
+
if user_id is not None:
|
|
166
|
+
_params["userID"] = user_id
|
|
167
|
+
if user_group_id is not None:
|
|
168
|
+
_params["userGroupID"] = user_group_id
|
|
169
|
+
await self._http.delete(
|
|
170
|
+
f"/buyers/{buyer_id}/creditcards/{credit_card_id}/assignments", **_params
|
|
171
|
+
)
|
|
172
|
+
|
|
173
|
+
async def list_assignments(
|
|
174
|
+
self,
|
|
175
|
+
buyer_id: str,
|
|
176
|
+
*,
|
|
177
|
+
credit_card_id: Optional[str] = None,
|
|
178
|
+
user_id: Optional[str] = None,
|
|
179
|
+
user_group_id: Optional[str] = None,
|
|
180
|
+
level: Optional[PartyType] = None,
|
|
181
|
+
page: Optional[int] = None,
|
|
182
|
+
page_size: Optional[int] = None,
|
|
183
|
+
) -> ListPage[CreditCardAssignment]:
|
|
184
|
+
"""List credit card assignments
|
|
185
|
+
|
|
186
|
+
Args:
|
|
187
|
+
buyer_id: ID of the buyer.
|
|
188
|
+
credit_card_id: ID of the credit card.
|
|
189
|
+
user_id: ID of the user.
|
|
190
|
+
user_group_id: ID of the user group.
|
|
191
|
+
level: Level of the credit card assignment. Possible values: User, Group, Company, BuyerGroup.
|
|
192
|
+
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.
|
|
193
|
+
page_size: Number of results to return per page.
|
|
194
|
+
|
|
195
|
+
Returns:
|
|
196
|
+
A paginated list of CreditCardAssignment objects.
|
|
197
|
+
"""
|
|
198
|
+
params = self._build_list_params(
|
|
199
|
+
page=page,
|
|
200
|
+
page_size=page_size,
|
|
201
|
+
)
|
|
202
|
+
if credit_card_id is not None:
|
|
203
|
+
params["creditCardID"] = credit_card_id
|
|
204
|
+
if user_id is not None:
|
|
205
|
+
params["userID"] = user_id
|
|
206
|
+
if user_group_id is not None:
|
|
207
|
+
params["userGroupID"] = user_group_id
|
|
208
|
+
if level is not None:
|
|
209
|
+
params["level"] = level
|
|
210
|
+
resp = await self._http.get(f"/buyers/{buyer_id}/creditcards/assignments", **params)
|
|
211
|
+
return self._parse_list(resp.json(), CreditCardAssignment)
|
|
212
|
+
|
|
213
|
+
async def save_assignment(
|
|
214
|
+
self,
|
|
215
|
+
buyer_id: str,
|
|
216
|
+
credit_card_assignment: Union[CreditCardAssignment, dict[str, Any]],
|
|
217
|
+
) -> None:
|
|
218
|
+
"""Create or update a credit card assignment
|
|
219
|
+
|
|
220
|
+
Args:
|
|
221
|
+
buyer_id: ID of the buyer.
|
|
222
|
+
credit_card_assignment: A ``CreditCardAssignment`` model or dict. Required fields: CreditCardID.
|
|
223
|
+
"""
|
|
224
|
+
await self._http.post(
|
|
225
|
+
f"/buyers/{buyer_id}/creditcards/assignments",
|
|
226
|
+
json=self._serialize(credit_card_assignment),
|
|
227
|
+
)
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
# GENERATED by tools/codegen — DO NOT EDIT
|
|
2
|
+
# Source: ordercloud-openapi-v3.json
|
|
3
|
+
"""OrderCloud DeliveryConfigurations API resource."""
|
|
4
|
+
|
|
5
|
+
from __future__ import annotations
|
|
6
|
+
from typing import Any, Optional, Union
|
|
7
|
+
|
|
8
|
+
from ..models.delivery import DeliveryConfig
|
|
9
|
+
from ..models.shared import ListPage
|
|
10
|
+
from .base import BaseResource
|
|
11
|
+
|
|
12
|
+
__all__ = ["DeliveryConfigurationsResource"]
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class DeliveryConfigurationsResource(BaseResource):
|
|
16
|
+
"""Operations on OrderCloud DeliveryConfigurations."""
|
|
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[DeliveryConfig]:
|
|
28
|
+
"""List delivery configurations
|
|
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 DeliveryConfig 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("/integrations/deliveryconfig", **params)
|
|
50
|
+
return self._parse_list(resp.json(), DeliveryConfig)
|
|
51
|
+
|
|
52
|
+
async def create(
|
|
53
|
+
self,
|
|
54
|
+
delivery_config: Union[DeliveryConfig, dict[str, Any]],
|
|
55
|
+
) -> DeliveryConfig:
|
|
56
|
+
"""Create a delivery configuration
|
|
57
|
+
|
|
58
|
+
Args:
|
|
59
|
+
delivery_config: A ``DeliveryConfig`` model or dict. Required fields: Name, DeliveryTargets.
|
|
60
|
+
|
|
61
|
+
Returns:
|
|
62
|
+
The DeliveryConfig object.
|
|
63
|
+
"""
|
|
64
|
+
resp = await self._http.post(
|
|
65
|
+
"/integrations/deliveryconfig", json=self._serialize(delivery_config)
|
|
66
|
+
)
|
|
67
|
+
return DeliveryConfig(**resp.json())
|
|
68
|
+
|
|
69
|
+
async def get(
|
|
70
|
+
self,
|
|
71
|
+
delivery_config_id: str,
|
|
72
|
+
) -> DeliveryConfig:
|
|
73
|
+
"""Retrieve a delivery configuration
|
|
74
|
+
|
|
75
|
+
Args:
|
|
76
|
+
delivery_config_id: ID of the delivery config.
|
|
77
|
+
|
|
78
|
+
Returns:
|
|
79
|
+
The DeliveryConfig object.
|
|
80
|
+
"""
|
|
81
|
+
resp = await self._http.get(f"/integrations/deliveryconfig/{delivery_config_id}")
|
|
82
|
+
return DeliveryConfig(**resp.json())
|
|
83
|
+
|
|
84
|
+
async def save(
|
|
85
|
+
self,
|
|
86
|
+
delivery_config_id: str,
|
|
87
|
+
delivery_config: Union[DeliveryConfig, dict[str, Any]],
|
|
88
|
+
) -> DeliveryConfig:
|
|
89
|
+
"""Create or update a delivery configuration
|
|
90
|
+
|
|
91
|
+
Args:
|
|
92
|
+
delivery_config_id: ID of the delivery config.
|
|
93
|
+
delivery_config: A ``DeliveryConfig`` model or dict. Required fields: Name, DeliveryTargets.
|
|
94
|
+
|
|
95
|
+
Returns:
|
|
96
|
+
The DeliveryConfig object.
|
|
97
|
+
"""
|
|
98
|
+
resp = await self._http.put(
|
|
99
|
+
f"/integrations/deliveryconfig/{delivery_config_id}",
|
|
100
|
+
json=self._serialize(delivery_config),
|
|
101
|
+
)
|
|
102
|
+
return DeliveryConfig(**resp.json())
|
|
103
|
+
|
|
104
|
+
async def delete(
|
|
105
|
+
self,
|
|
106
|
+
delivery_config_id: str,
|
|
107
|
+
) -> None:
|
|
108
|
+
"""Delete a delivery configuration
|
|
109
|
+
|
|
110
|
+
Args:
|
|
111
|
+
delivery_config_id: ID of the delivery config.
|
|
112
|
+
"""
|
|
113
|
+
await self._http.delete(f"/integrations/deliveryconfig/{delivery_config_id}")
|
|
114
|
+
|
|
115
|
+
async def patch(
|
|
116
|
+
self,
|
|
117
|
+
delivery_config_id: str,
|
|
118
|
+
partial: dict[str, Any],
|
|
119
|
+
) -> DeliveryConfig:
|
|
120
|
+
"""Partially update a delivery configuration
|
|
121
|
+
|
|
122
|
+
Args:
|
|
123
|
+
delivery_config_id: ID of the delivery config. Required.
|
|
124
|
+
partial: A dict of fields to update.
|
|
125
|
+
|
|
126
|
+
Returns:
|
|
127
|
+
The DeliveryConfig object.
|
|
128
|
+
"""
|
|
129
|
+
resp = await self._http.patch(
|
|
130
|
+
f"/integrations/deliveryconfig/{delivery_config_id}", json=partial
|
|
131
|
+
)
|
|
132
|
+
return DeliveryConfig(**resp.json())
|