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,203 @@
|
|
|
1
|
+
# GENERATED by tools/codegen — DO NOT EDIT
|
|
2
|
+
# Source: ordercloud-openapi-v3.json
|
|
3
|
+
"""OrderCloud Promotions API resource."""
|
|
4
|
+
|
|
5
|
+
from __future__ import annotations
|
|
6
|
+
from typing import Any, Optional, Union
|
|
7
|
+
|
|
8
|
+
from ..models.assignments import PromotionAssignment
|
|
9
|
+
from ..models.promotion import Promotion
|
|
10
|
+
from ..models.shared import ListPage
|
|
11
|
+
from .base import BaseResource
|
|
12
|
+
|
|
13
|
+
__all__ = ["PromotionsResource"]
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class PromotionsResource(BaseResource):
|
|
17
|
+
"""Operations on OrderCloud Promotions."""
|
|
18
|
+
|
|
19
|
+
async def list(
|
|
20
|
+
self,
|
|
21
|
+
*,
|
|
22
|
+
search: Optional[str] = None,
|
|
23
|
+
search_on: Optional[str] = None,
|
|
24
|
+
sort_by: Optional[str] = None,
|
|
25
|
+
page: Optional[int] = None,
|
|
26
|
+
page_size: Optional[int] = None,
|
|
27
|
+
filters: Optional[dict[str, Any]] = None,
|
|
28
|
+
) -> ListPage[Promotion]:
|
|
29
|
+
"""List promotions
|
|
30
|
+
|
|
31
|
+
Args:
|
|
32
|
+
search: Word or phrase to search for.
|
|
33
|
+
search_on: Comma-delimited list of fields to search on.
|
|
34
|
+
sort_by: Comma-delimited list of fields to sort by.
|
|
35
|
+
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.
|
|
36
|
+
page_size: Number of results to return per page.
|
|
37
|
+
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.???'
|
|
38
|
+
|
|
39
|
+
Returns:
|
|
40
|
+
A paginated list of Promotion objects.
|
|
41
|
+
"""
|
|
42
|
+
params = self._build_list_params(
|
|
43
|
+
search=search,
|
|
44
|
+
search_on=search_on,
|
|
45
|
+
sort_by=sort_by,
|
|
46
|
+
page=page,
|
|
47
|
+
page_size=page_size,
|
|
48
|
+
filters=filters,
|
|
49
|
+
)
|
|
50
|
+
resp = await self._http.get("/promotions", **params)
|
|
51
|
+
return self._parse_list(resp.json(), Promotion)
|
|
52
|
+
|
|
53
|
+
async def create(
|
|
54
|
+
self,
|
|
55
|
+
promotion: Union[Promotion, dict[str, Any]],
|
|
56
|
+
) -> Promotion:
|
|
57
|
+
"""Create a promotion
|
|
58
|
+
|
|
59
|
+
Args:
|
|
60
|
+
promotion: A ``Promotion`` model or dict. Required fields: Code, EligibleExpression.
|
|
61
|
+
|
|
62
|
+
Returns:
|
|
63
|
+
The Promotion object.
|
|
64
|
+
"""
|
|
65
|
+
resp = await self._http.post("/promotions", json=self._serialize(promotion))
|
|
66
|
+
return Promotion(**resp.json())
|
|
67
|
+
|
|
68
|
+
async def get(
|
|
69
|
+
self,
|
|
70
|
+
promotion_id: str,
|
|
71
|
+
) -> Promotion:
|
|
72
|
+
"""Retrieve a promotion
|
|
73
|
+
|
|
74
|
+
Args:
|
|
75
|
+
promotion_id: ID of the promotion.
|
|
76
|
+
|
|
77
|
+
Returns:
|
|
78
|
+
The Promotion object.
|
|
79
|
+
"""
|
|
80
|
+
resp = await self._http.get(f"/promotions/{promotion_id}")
|
|
81
|
+
return Promotion(**resp.json())
|
|
82
|
+
|
|
83
|
+
async def save(
|
|
84
|
+
self,
|
|
85
|
+
promotion_id: str,
|
|
86
|
+
promotion: Union[Promotion, dict[str, Any]],
|
|
87
|
+
) -> Promotion:
|
|
88
|
+
"""Create or update a promotion
|
|
89
|
+
|
|
90
|
+
Args:
|
|
91
|
+
promotion_id: ID of the promotion.
|
|
92
|
+
promotion: A ``Promotion`` model or dict. Required fields: Code, EligibleExpression.
|
|
93
|
+
|
|
94
|
+
Returns:
|
|
95
|
+
The Promotion object.
|
|
96
|
+
"""
|
|
97
|
+
resp = await self._http.put(
|
|
98
|
+
f"/promotions/{promotion_id}",
|
|
99
|
+
json=self._serialize(promotion),
|
|
100
|
+
)
|
|
101
|
+
return Promotion(**resp.json())
|
|
102
|
+
|
|
103
|
+
async def delete(
|
|
104
|
+
self,
|
|
105
|
+
promotion_id: str,
|
|
106
|
+
) -> None:
|
|
107
|
+
"""Delete a promotion
|
|
108
|
+
|
|
109
|
+
Args:
|
|
110
|
+
promotion_id: ID of the promotion.
|
|
111
|
+
"""
|
|
112
|
+
await self._http.delete(f"/promotions/{promotion_id}")
|
|
113
|
+
|
|
114
|
+
async def patch(
|
|
115
|
+
self,
|
|
116
|
+
promotion_id: str,
|
|
117
|
+
partial: dict[str, Any],
|
|
118
|
+
) -> Promotion:
|
|
119
|
+
"""Partially update a promotion
|
|
120
|
+
|
|
121
|
+
Args:
|
|
122
|
+
promotion_id: ID of the promotion.
|
|
123
|
+
partial: A dict of fields to update.
|
|
124
|
+
|
|
125
|
+
Returns:
|
|
126
|
+
The Promotion object.
|
|
127
|
+
"""
|
|
128
|
+
resp = await self._http.patch(f"/promotions/{promotion_id}", json=partial)
|
|
129
|
+
return Promotion(**resp.json())
|
|
130
|
+
|
|
131
|
+
async def delete_assignment(
|
|
132
|
+
self,
|
|
133
|
+
promotion_id: str,
|
|
134
|
+
*,
|
|
135
|
+
buyer_id: Optional[str],
|
|
136
|
+
user_id: Optional[str] = None,
|
|
137
|
+
user_group_id: Optional[str] = None,
|
|
138
|
+
) -> None:
|
|
139
|
+
"""Delete a promotion assignment
|
|
140
|
+
|
|
141
|
+
Args:
|
|
142
|
+
promotion_id: ID of the promotion.
|
|
143
|
+
buyer_id: ID of the buyer.
|
|
144
|
+
user_id: ID of the user.
|
|
145
|
+
user_group_id: ID of the user group.
|
|
146
|
+
"""
|
|
147
|
+
_params: dict[str, Any] = {}
|
|
148
|
+
if buyer_id is not None:
|
|
149
|
+
_params["buyerID"] = buyer_id
|
|
150
|
+
if user_id is not None:
|
|
151
|
+
_params["userID"] = user_id
|
|
152
|
+
if user_group_id is not None:
|
|
153
|
+
_params["userGroupID"] = user_group_id
|
|
154
|
+
await self._http.delete(f"/promotions/{promotion_id}/assignments", **_params)
|
|
155
|
+
|
|
156
|
+
async def list_assignments(
|
|
157
|
+
self,
|
|
158
|
+
*,
|
|
159
|
+
buyer_id: Optional[str] = None,
|
|
160
|
+
promotion_id: Optional[str] = None,
|
|
161
|
+
user_group_id: Optional[str] = None,
|
|
162
|
+
level: Optional[str] = None,
|
|
163
|
+
page: Optional[int] = None,
|
|
164
|
+
page_size: Optional[int] = None,
|
|
165
|
+
) -> ListPage[PromotionAssignment]:
|
|
166
|
+
"""List promotion assignments
|
|
167
|
+
|
|
168
|
+
Args:
|
|
169
|
+
buyer_id: ID of the buyer.
|
|
170
|
+
promotion_id: ID of the promotion.
|
|
171
|
+
user_group_id: ID of the user group.
|
|
172
|
+
level: Level of the promotion assignment. Possible values: Group, Company, BuyerGroup.
|
|
173
|
+
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.
|
|
174
|
+
page_size: Number of results to return per page.
|
|
175
|
+
|
|
176
|
+
Returns:
|
|
177
|
+
A paginated list of PromotionAssignment objects.
|
|
178
|
+
"""
|
|
179
|
+
params = self._build_list_params(
|
|
180
|
+
page=page,
|
|
181
|
+
page_size=page_size,
|
|
182
|
+
)
|
|
183
|
+
if buyer_id is not None:
|
|
184
|
+
params["buyerID"] = buyer_id
|
|
185
|
+
if promotion_id is not None:
|
|
186
|
+
params["promotionID"] = promotion_id
|
|
187
|
+
if user_group_id is not None:
|
|
188
|
+
params["userGroupID"] = user_group_id
|
|
189
|
+
if level is not None:
|
|
190
|
+
params["level"] = level
|
|
191
|
+
resp = await self._http.get("/promotions/assignments", **params)
|
|
192
|
+
return self._parse_list(resp.json(), PromotionAssignment)
|
|
193
|
+
|
|
194
|
+
async def save_assignment(
|
|
195
|
+
self,
|
|
196
|
+
promotion_assignment: Union[PromotionAssignment, dict[str, Any]],
|
|
197
|
+
) -> None:
|
|
198
|
+
"""Create or update a promotion assignment
|
|
199
|
+
|
|
200
|
+
Args:
|
|
201
|
+
promotion_assignment: A ``PromotionAssignment`` model or dict. Required fields: PromotionID, BuyerID.
|
|
202
|
+
"""
|
|
203
|
+
await self._http.post("/promotions/assignments", json=self._serialize(promotion_assignment))
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
# GENERATED by tools/codegen — DO NOT EDIT
|
|
2
|
+
# Source: ordercloud-openapi-v3.json
|
|
3
|
+
"""OrderCloud SecurityProfiles API resource."""
|
|
4
|
+
|
|
5
|
+
from __future__ import annotations
|
|
6
|
+
from typing import Any, Optional, Union
|
|
7
|
+
|
|
8
|
+
from ..models.assignments import SecurityProfileAssignment
|
|
9
|
+
from ..models.misc import CommerceRole, PartyType
|
|
10
|
+
from ..models.security import SecurityProfile
|
|
11
|
+
from ..models.shared import ListPage
|
|
12
|
+
from .base import BaseResource
|
|
13
|
+
|
|
14
|
+
__all__ = ["SecurityProfilesResource"]
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class SecurityProfilesResource(BaseResource):
|
|
18
|
+
"""Operations on OrderCloud SecurityProfiles."""
|
|
19
|
+
|
|
20
|
+
async def list(
|
|
21
|
+
self,
|
|
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[SecurityProfile]:
|
|
30
|
+
"""List security profiles
|
|
31
|
+
|
|
32
|
+
Args:
|
|
33
|
+
search: Word or phrase to search for.
|
|
34
|
+
search_on: Comma-delimited list of fields to search on.
|
|
35
|
+
sort_by: Comma-delimited list of fields to sort by.
|
|
36
|
+
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.
|
|
37
|
+
page_size: Number of results to return per page.
|
|
38
|
+
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.???'
|
|
39
|
+
|
|
40
|
+
Returns:
|
|
41
|
+
A paginated list of SecurityProfile objects.
|
|
42
|
+
"""
|
|
43
|
+
params = self._build_list_params(
|
|
44
|
+
search=search,
|
|
45
|
+
search_on=search_on,
|
|
46
|
+
sort_by=sort_by,
|
|
47
|
+
page=page,
|
|
48
|
+
page_size=page_size,
|
|
49
|
+
filters=filters,
|
|
50
|
+
)
|
|
51
|
+
resp = await self._http.get("/securityprofiles", **params)
|
|
52
|
+
return self._parse_list(resp.json(), SecurityProfile)
|
|
53
|
+
|
|
54
|
+
async def create(
|
|
55
|
+
self,
|
|
56
|
+
security_profile: Union[SecurityProfile, dict[str, Any]],
|
|
57
|
+
) -> SecurityProfile:
|
|
58
|
+
"""Create a security profile
|
|
59
|
+
|
|
60
|
+
Args:
|
|
61
|
+
security_profile: A ``SecurityProfile`` model or dict. Required fields: Name.
|
|
62
|
+
|
|
63
|
+
Returns:
|
|
64
|
+
The SecurityProfile object.
|
|
65
|
+
"""
|
|
66
|
+
resp = await self._http.post("/securityprofiles", json=self._serialize(security_profile))
|
|
67
|
+
return SecurityProfile(**resp.json())
|
|
68
|
+
|
|
69
|
+
async def get(
|
|
70
|
+
self,
|
|
71
|
+
security_profile_id: str,
|
|
72
|
+
) -> SecurityProfile:
|
|
73
|
+
"""Retrieve a security profile
|
|
74
|
+
|
|
75
|
+
Args:
|
|
76
|
+
security_profile_id: ID of the security profile.
|
|
77
|
+
|
|
78
|
+
Returns:
|
|
79
|
+
The SecurityProfile object.
|
|
80
|
+
"""
|
|
81
|
+
resp = await self._http.get(f"/securityprofiles/{security_profile_id}")
|
|
82
|
+
return SecurityProfile(**resp.json())
|
|
83
|
+
|
|
84
|
+
async def save(
|
|
85
|
+
self,
|
|
86
|
+
security_profile_id: str,
|
|
87
|
+
security_profile: Union[SecurityProfile, dict[str, Any]],
|
|
88
|
+
) -> SecurityProfile:
|
|
89
|
+
"""Create or update a security profile
|
|
90
|
+
|
|
91
|
+
Args:
|
|
92
|
+
security_profile_id: ID of the security profile.
|
|
93
|
+
security_profile: A ``SecurityProfile`` model or dict. Required fields: Name.
|
|
94
|
+
|
|
95
|
+
Returns:
|
|
96
|
+
The SecurityProfile object.
|
|
97
|
+
"""
|
|
98
|
+
resp = await self._http.put(
|
|
99
|
+
f"/securityprofiles/{security_profile_id}",
|
|
100
|
+
json=self._serialize(security_profile),
|
|
101
|
+
)
|
|
102
|
+
return SecurityProfile(**resp.json())
|
|
103
|
+
|
|
104
|
+
async def delete(
|
|
105
|
+
self,
|
|
106
|
+
security_profile_id: str,
|
|
107
|
+
) -> None:
|
|
108
|
+
"""Delete a security profile
|
|
109
|
+
|
|
110
|
+
Args:
|
|
111
|
+
security_profile_id: ID of the security profile.
|
|
112
|
+
"""
|
|
113
|
+
await self._http.delete(f"/securityprofiles/{security_profile_id}")
|
|
114
|
+
|
|
115
|
+
async def patch(
|
|
116
|
+
self,
|
|
117
|
+
security_profile_id: str,
|
|
118
|
+
partial: dict[str, Any],
|
|
119
|
+
) -> SecurityProfile:
|
|
120
|
+
"""Partially update a security profile
|
|
121
|
+
|
|
122
|
+
Args:
|
|
123
|
+
security_profile_id: ID of the security profile.
|
|
124
|
+
partial: A dict of fields to update.
|
|
125
|
+
|
|
126
|
+
Returns:
|
|
127
|
+
The SecurityProfile object.
|
|
128
|
+
"""
|
|
129
|
+
resp = await self._http.patch(f"/securityprofiles/{security_profile_id}", json=partial)
|
|
130
|
+
return SecurityProfile(**resp.json())
|
|
131
|
+
|
|
132
|
+
async def delete_assignment(
|
|
133
|
+
self,
|
|
134
|
+
security_profile_id: str,
|
|
135
|
+
*,
|
|
136
|
+
buyer_id: Optional[str] = None,
|
|
137
|
+
user_id: Optional[str] = None,
|
|
138
|
+
user_group_id: Optional[str] = None,
|
|
139
|
+
supplier_id: Optional[str] = None,
|
|
140
|
+
) -> None:
|
|
141
|
+
"""Delete a security profile assignment
|
|
142
|
+
|
|
143
|
+
Args:
|
|
144
|
+
security_profile_id: ID of the security profile.
|
|
145
|
+
buyer_id: ID of the buyer.
|
|
146
|
+
user_id: ID of the user.
|
|
147
|
+
user_group_id: ID of the user group.
|
|
148
|
+
supplier_id: ID of the supplier.
|
|
149
|
+
"""
|
|
150
|
+
_params: dict[str, Any] = {}
|
|
151
|
+
if buyer_id is not None:
|
|
152
|
+
_params["buyerID"] = buyer_id
|
|
153
|
+
if user_id is not None:
|
|
154
|
+
_params["userID"] = user_id
|
|
155
|
+
if user_group_id is not None:
|
|
156
|
+
_params["userGroupID"] = user_group_id
|
|
157
|
+
if supplier_id is not None:
|
|
158
|
+
_params["supplierID"] = supplier_id
|
|
159
|
+
await self._http.delete(f"/securityprofiles/{security_profile_id}/assignments", **_params)
|
|
160
|
+
|
|
161
|
+
async def list_assignments(
|
|
162
|
+
self,
|
|
163
|
+
*,
|
|
164
|
+
buyer_id: Optional[str] = None,
|
|
165
|
+
supplier_id: Optional[str] = None,
|
|
166
|
+
security_profile_id: Optional[str] = None,
|
|
167
|
+
user_id: Optional[str] = None,
|
|
168
|
+
user_group_id: Optional[str] = None,
|
|
169
|
+
commerce_role: Optional[CommerceRole] = None,
|
|
170
|
+
level: Optional[PartyType] = None,
|
|
171
|
+
page: Optional[int] = None,
|
|
172
|
+
page_size: Optional[int] = None,
|
|
173
|
+
) -> ListPage[SecurityProfileAssignment]:
|
|
174
|
+
"""List security profile assignments
|
|
175
|
+
|
|
176
|
+
Args:
|
|
177
|
+
buyer_id: ID of the buyer.
|
|
178
|
+
supplier_id: ID of the supplier.
|
|
179
|
+
security_profile_id: ID of the security profile.
|
|
180
|
+
user_id: ID of the user.
|
|
181
|
+
user_group_id: ID of the user group.
|
|
182
|
+
commerce_role: Commerce role of the security profile assignment. Possible values: Buyer, Seller, Supplier.
|
|
183
|
+
level: Level of the security profile assignment. Possible values: User, Group, Company, BuyerGroup.
|
|
184
|
+
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.
|
|
185
|
+
page_size: Number of results to return per page.
|
|
186
|
+
|
|
187
|
+
Returns:
|
|
188
|
+
A paginated list of SecurityProfileAssignment objects.
|
|
189
|
+
"""
|
|
190
|
+
params = self._build_list_params(
|
|
191
|
+
page=page,
|
|
192
|
+
page_size=page_size,
|
|
193
|
+
)
|
|
194
|
+
if buyer_id is not None:
|
|
195
|
+
params["buyerID"] = buyer_id
|
|
196
|
+
if supplier_id is not None:
|
|
197
|
+
params["supplierID"] = supplier_id
|
|
198
|
+
if security_profile_id is not None:
|
|
199
|
+
params["securityProfileID"] = security_profile_id
|
|
200
|
+
if user_id is not None:
|
|
201
|
+
params["userID"] = user_id
|
|
202
|
+
if user_group_id is not None:
|
|
203
|
+
params["userGroupID"] = user_group_id
|
|
204
|
+
if commerce_role is not None:
|
|
205
|
+
params["commerceRole"] = commerce_role
|
|
206
|
+
if level is not None:
|
|
207
|
+
params["level"] = level
|
|
208
|
+
resp = await self._http.get("/securityprofiles/assignments", **params)
|
|
209
|
+
return self._parse_list(resp.json(), SecurityProfileAssignment)
|
|
210
|
+
|
|
211
|
+
async def save_assignment(
|
|
212
|
+
self,
|
|
213
|
+
security_profile_assignment: Union[SecurityProfileAssignment, dict[str, Any]],
|
|
214
|
+
) -> None:
|
|
215
|
+
"""Create or update a security profile assignment
|
|
216
|
+
|
|
217
|
+
Args:
|
|
218
|
+
security_profile_assignment: A ``SecurityProfileAssignment`` model or dict. Required fields: SecurityProfileID.
|
|
219
|
+
"""
|
|
220
|
+
await self._http.post(
|
|
221
|
+
"/securityprofiles/assignments", json=self._serialize(security_profile_assignment)
|
|
222
|
+
)
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# GENERATED by tools/codegen — DO NOT EDIT
|
|
2
|
+
# Source: ordercloud-openapi-v3.json
|
|
3
|
+
"""OrderCloud SellerApprovalRules API resource."""
|
|
4
|
+
|
|
5
|
+
from __future__ import annotations
|
|
6
|
+
from typing import Any, Optional, Union
|
|
7
|
+
|
|
8
|
+
from ..models.approval import SellerApprovalRule
|
|
9
|
+
from ..models.shared import ListPage
|
|
10
|
+
from .base import BaseResource
|
|
11
|
+
|
|
12
|
+
__all__ = ["SellerApprovalRulesResource"]
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class SellerApprovalRulesResource(BaseResource):
|
|
16
|
+
"""Operations on OrderCloud SellerApprovalRules."""
|
|
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[SellerApprovalRule]:
|
|
28
|
+
"""List seller approval rules
|
|
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 SellerApprovalRule 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("/approvalrules", **params)
|
|
50
|
+
return self._parse_list(resp.json(), SellerApprovalRule)
|
|
51
|
+
|
|
52
|
+
async def create(
|
|
53
|
+
self,
|
|
54
|
+
seller_approval_rule: Union[SellerApprovalRule, dict[str, Any]],
|
|
55
|
+
) -> SellerApprovalRule:
|
|
56
|
+
"""Create a seller approval rule
|
|
57
|
+
|
|
58
|
+
Args:
|
|
59
|
+
seller_approval_rule: A ``SellerApprovalRule`` model or dict. Required fields: ApprovalType, ApprovingGroupID, RuleExpression.
|
|
60
|
+
|
|
61
|
+
Returns:
|
|
62
|
+
The SellerApprovalRule object.
|
|
63
|
+
"""
|
|
64
|
+
resp = await self._http.post("/approvalrules", json=self._serialize(seller_approval_rule))
|
|
65
|
+
return SellerApprovalRule(**resp.json())
|
|
66
|
+
|
|
67
|
+
async def get(
|
|
68
|
+
self,
|
|
69
|
+
approval_rule_id: str,
|
|
70
|
+
) -> SellerApprovalRule:
|
|
71
|
+
"""Retrieve a seller approval rule
|
|
72
|
+
|
|
73
|
+
Args:
|
|
74
|
+
approval_rule_id: ID of the approval rule.
|
|
75
|
+
|
|
76
|
+
Returns:
|
|
77
|
+
The SellerApprovalRule object.
|
|
78
|
+
"""
|
|
79
|
+
resp = await self._http.get(f"/approvalrules/{approval_rule_id}")
|
|
80
|
+
return SellerApprovalRule(**resp.json())
|
|
81
|
+
|
|
82
|
+
async def save(
|
|
83
|
+
self,
|
|
84
|
+
approval_rule_id: str,
|
|
85
|
+
seller_approval_rule: Union[SellerApprovalRule, dict[str, Any]],
|
|
86
|
+
) -> SellerApprovalRule:
|
|
87
|
+
"""Create or update a seller approval rule
|
|
88
|
+
|
|
89
|
+
Args:
|
|
90
|
+
approval_rule_id: ID of the approval rule.
|
|
91
|
+
seller_approval_rule: A ``SellerApprovalRule`` model or dict. Required fields: ApprovalType, ApprovingGroupID, RuleExpression.
|
|
92
|
+
|
|
93
|
+
Returns:
|
|
94
|
+
The SellerApprovalRule object.
|
|
95
|
+
"""
|
|
96
|
+
resp = await self._http.put(
|
|
97
|
+
f"/approvalrules/{approval_rule_id}",
|
|
98
|
+
json=self._serialize(seller_approval_rule),
|
|
99
|
+
)
|
|
100
|
+
return SellerApprovalRule(**resp.json())
|
|
101
|
+
|
|
102
|
+
async def delete(
|
|
103
|
+
self,
|
|
104
|
+
approval_rule_id: str,
|
|
105
|
+
) -> None:
|
|
106
|
+
"""Delete a seller approval rule
|
|
107
|
+
|
|
108
|
+
Args:
|
|
109
|
+
approval_rule_id: ID of the approval rule.
|
|
110
|
+
"""
|
|
111
|
+
await self._http.delete(f"/approvalrules/{approval_rule_id}")
|
|
112
|
+
|
|
113
|
+
async def patch(
|
|
114
|
+
self,
|
|
115
|
+
approval_rule_id: str,
|
|
116
|
+
partial: dict[str, Any],
|
|
117
|
+
) -> SellerApprovalRule:
|
|
118
|
+
"""Partially update a seller approval rule
|
|
119
|
+
|
|
120
|
+
Args:
|
|
121
|
+
approval_rule_id: ID of the approval rule.
|
|
122
|
+
partial: A dict of fields to update.
|
|
123
|
+
|
|
124
|
+
Returns:
|
|
125
|
+
The SellerApprovalRule object.
|
|
126
|
+
"""
|
|
127
|
+
resp = await self._http.patch(f"/approvalrules/{approval_rule_id}", json=partial)
|
|
128
|
+
return SellerApprovalRule(**resp.json())
|