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.
Files changed (114) hide show
  1. ordercloud/__init__.py +37 -0
  2. ordercloud/auth.py +136 -0
  3. ordercloud/client.py +211 -0
  4. ordercloud/config.py +42 -0
  5. ordercloud/errors.py +47 -0
  6. ordercloud/http.py +218 -0
  7. ordercloud/middleware.py +66 -0
  8. ordercloud/models/__init__.py +271 -0
  9. ordercloud/models/address.py +47 -0
  10. ordercloud/models/api_client.py +116 -0
  11. ordercloud/models/approval.py +73 -0
  12. ordercloud/models/assignments.py +402 -0
  13. ordercloud/models/auth_models.py +114 -0
  14. ordercloud/models/bundle.py +31 -0
  15. ordercloud/models/buyer.py +271 -0
  16. ordercloud/models/catalog.py +33 -0
  17. ordercloud/models/category.py +35 -0
  18. ordercloud/models/cost_center.py +27 -0
  19. ordercloud/models/credit_card.py +35 -0
  20. ordercloud/models/delivery.py +277 -0
  21. ordercloud/models/discount.py +63 -0
  22. ordercloud/models/integration.py +76 -0
  23. ordercloud/models/inventory_record.py +53 -0
  24. ordercloud/models/line_item.py +95 -0
  25. ordercloud/models/line_item_types.py +89 -0
  26. ordercloud/models/message_sender.py +80 -0
  27. ordercloud/models/misc.py +280 -0
  28. ordercloud/models/open_id_connect.py +47 -0
  29. ordercloud/models/order.py +477 -0
  30. ordercloud/models/order_return.py +92 -0
  31. ordercloud/models/payment.py +77 -0
  32. ordercloud/models/price_schedule.py +76 -0
  33. ordercloud/models/product.py +227 -0
  34. ordercloud/models/product_collection.py +186 -0
  35. ordercloud/models/promotion.py +297 -0
  36. ordercloud/models/security.py +89 -0
  37. ordercloud/models/shared.py +131 -0
  38. ordercloud/models/shipment.py +150 -0
  39. ordercloud/models/spec.py +67 -0
  40. ordercloud/models/spending_account.py +33 -0
  41. ordercloud/models/subscription.py +125 -0
  42. ordercloud/models/supplier.py +43 -0
  43. ordercloud/models/sync.py +172 -0
  44. ordercloud/models/user.py +207 -0
  45. ordercloud/models/user_group.py +27 -0
  46. ordercloud/models/webhook.py +58 -0
  47. ordercloud/py.typed +0 -0
  48. ordercloud/resources/__init__.py +65 -0
  49. ordercloud/resources/addresses.py +228 -0
  50. ordercloud/resources/admin_addresses.py +128 -0
  51. ordercloud/resources/admin_user_groups.py +185 -0
  52. ordercloud/resources/admin_users.py +150 -0
  53. ordercloud/resources/api_clients.py +308 -0
  54. ordercloud/resources/approval_rules.py +144 -0
  55. ordercloud/resources/base.py +145 -0
  56. ordercloud/resources/bundle_line_items.py +59 -0
  57. ordercloud/resources/bundle_subscription_items.py +54 -0
  58. ordercloud/resources/bundles.py +278 -0
  59. ordercloud/resources/buyer_groups.py +128 -0
  60. ordercloud/resources/buyers.py +164 -0
  61. ordercloud/resources/cart.py +613 -0
  62. ordercloud/resources/catalogs.py +311 -0
  63. ordercloud/resources/categories.py +392 -0
  64. ordercloud/resources/cost_centers.py +222 -0
  65. ordercloud/resources/credit_cards.py +227 -0
  66. ordercloud/resources/delivery_configurations.py +132 -0
  67. ordercloud/resources/discounts.py +201 -0
  68. ordercloud/resources/entity_syncs.py +534 -0
  69. ordercloud/resources/error_configs.py +71 -0
  70. ordercloud/resources/forgotten_credentials.py +74 -0
  71. ordercloud/resources/group_orders.py +28 -0
  72. ordercloud/resources/impersonation_configs.py +132 -0
  73. ordercloud/resources/incrementors.py +128 -0
  74. ordercloud/resources/integration_events.py +203 -0
  75. ordercloud/resources/inventory_integrations.py +65 -0
  76. ordercloud/resources/inventory_records.py +484 -0
  77. ordercloud/resources/line_items.py +262 -0
  78. ordercloud/resources/locales.py +203 -0
  79. ordercloud/resources/me.py +1882 -0
  80. ordercloud/resources/message_senders.py +261 -0
  81. ordercloud/resources/open_id_connects.py +128 -0
  82. ordercloud/resources/order_returns.py +306 -0
  83. ordercloud/resources/order_syncs.py +65 -0
  84. ordercloud/resources/orders.py +689 -0
  85. ordercloud/resources/payments.py +176 -0
  86. ordercloud/resources/price_schedules.py +164 -0
  87. ordercloud/resources/product_collections.py +116 -0
  88. ordercloud/resources/product_facets.py +128 -0
  89. ordercloud/resources/product_syncs.py +76 -0
  90. ordercloud/resources/products.py +454 -0
  91. ordercloud/resources/promotion_integrations.py +65 -0
  92. ordercloud/resources/promotions.py +203 -0
  93. ordercloud/resources/security_profiles.py +222 -0
  94. ordercloud/resources/seller_approval_rules.py +128 -0
  95. ordercloud/resources/shipments.py +256 -0
  96. ordercloud/resources/specs.py +313 -0
  97. ordercloud/resources/spending_accounts.py +227 -0
  98. ordercloud/resources/subscription_integrations.py +65 -0
  99. ordercloud/resources/subscription_items.py +146 -0
  100. ordercloud/resources/subscriptions.py +128 -0
  101. ordercloud/resources/supplier_addresses.py +144 -0
  102. ordercloud/resources/supplier_user_groups.py +210 -0
  103. ordercloud/resources/supplier_users.py +170 -0
  104. ordercloud/resources/suppliers.py +190 -0
  105. ordercloud/resources/tracking_events.py +130 -0
  106. ordercloud/resources/user_groups.py +210 -0
  107. ordercloud/resources/users.py +254 -0
  108. ordercloud/resources/webhooks.py +128 -0
  109. ordercloud/resources/xp_indices.py +77 -0
  110. ordercloud/sync_client.py +170 -0
  111. ordercloud_python-2026.4.1.dist-info/METADATA +552 -0
  112. ordercloud_python-2026.4.1.dist-info/RECORD +114 -0
  113. ordercloud_python-2026.4.1.dist-info/WHEEL +4 -0
  114. ordercloud_python-2026.4.1.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,201 @@
1
+ # GENERATED by tools/codegen — DO NOT EDIT
2
+ # Source: ordercloud-openapi-v3.json
3
+ """OrderCloud Discounts API resource."""
4
+
5
+ from __future__ import annotations
6
+ from typing import Any, Optional, Union
7
+
8
+ from ..models.assignments import DiscountAssignment
9
+ from ..models.discount import Discount
10
+ from ..models.shared import ListPage
11
+ from .base import BaseResource
12
+
13
+ __all__ = ["DiscountsResource"]
14
+
15
+
16
+ class DiscountsResource(BaseResource):
17
+ """Operations on OrderCloud Discounts."""
18
+
19
+ async def list(
20
+ self,
21
+ *,
22
+ sort_by: Optional[str] = None,
23
+ page: Optional[int] = None,
24
+ page_size: Optional[int] = None,
25
+ filters: Optional[dict[str, Any]] = None,
26
+ ) -> ListPage[Discount]:
27
+ """List discounts
28
+
29
+ Args:
30
+ sort_by: Comma-delimited list of fields to sort by.
31
+ 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.
32
+ page_size: Number of results to return per page.
33
+ 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.???'
34
+
35
+ Returns:
36
+ A paginated list of Discount objects.
37
+ """
38
+ params = self._build_list_params(
39
+ sort_by=sort_by,
40
+ page=page,
41
+ page_size=page_size,
42
+ filters=filters,
43
+ )
44
+ resp = await self._http.get("/discounts", **params)
45
+ return self._parse_list(resp.json(), Discount)
46
+
47
+ async def create(
48
+ self,
49
+ discount: Union[Discount, dict[str, Any]],
50
+ ) -> Discount:
51
+ """Create a discount
52
+
53
+ Args:
54
+ discount: A ``Discount`` model or dict. Required fields: DiscountBreaks.
55
+
56
+ Returns:
57
+ The Discount object.
58
+ """
59
+ resp = await self._http.post("/discounts", json=self._serialize(discount))
60
+ return Discount(**resp.json())
61
+
62
+ async def get(
63
+ self,
64
+ discount_id: str,
65
+ ) -> Discount:
66
+ """Retrieve a discount
67
+
68
+ Args:
69
+ discount_id: ID of the discount.
70
+
71
+ Returns:
72
+ The Discount object.
73
+ """
74
+ resp = await self._http.get(f"/discounts/{discount_id}")
75
+ return Discount(**resp.json())
76
+
77
+ async def save(
78
+ self,
79
+ discount_id: str,
80
+ discount: Union[Discount, dict[str, Any]],
81
+ ) -> Discount:
82
+ """Create or update a discount
83
+
84
+ Args:
85
+ discount_id: ID of the discount.
86
+ discount: A ``Discount`` model or dict. Required fields: DiscountBreaks.
87
+
88
+ Returns:
89
+ The Discount object.
90
+ """
91
+ resp = await self._http.put(
92
+ f"/discounts/{discount_id}",
93
+ json=self._serialize(discount),
94
+ )
95
+ return Discount(**resp.json())
96
+
97
+ async def delete(
98
+ self,
99
+ discount_id: str,
100
+ ) -> None:
101
+ """Delete a discount
102
+
103
+ Args:
104
+ discount_id: ID of the discount.
105
+ """
106
+ await self._http.delete(f"/discounts/{discount_id}")
107
+
108
+ async def patch(
109
+ self,
110
+ discount_id: str,
111
+ partial: dict[str, Any],
112
+ ) -> Discount:
113
+ """Partially update a discount
114
+
115
+ Args:
116
+ discount_id: ID of the discount.
117
+ partial: A dict of fields to update.
118
+
119
+ Returns:
120
+ The Discount object.
121
+ """
122
+ resp = await self._http.patch(f"/discounts/{discount_id}", json=partial)
123
+ return Discount(**resp.json())
124
+
125
+ async def delete_assignment(
126
+ self,
127
+ discount_id: str,
128
+ *,
129
+ buyer_id: Optional[str] = None,
130
+ user_group_id: Optional[str] = None,
131
+ buyer_group_id: Optional[str] = None,
132
+ ) -> None:
133
+ """Delete a discount assignment
134
+
135
+ Args:
136
+ discount_id: ID of the discount.
137
+ buyer_id: ID of the buyer.
138
+ user_group_id: ID of the user group.
139
+ buyer_group_id: ID of the buyer group.
140
+ """
141
+ _params: dict[str, Any] = {}
142
+ if buyer_id is not None:
143
+ _params["buyerID"] = buyer_id
144
+ if user_group_id is not None:
145
+ _params["userGroupID"] = user_group_id
146
+ if buyer_group_id is not None:
147
+ _params["buyerGroupID"] = buyer_group_id
148
+ await self._http.delete(f"/discounts/{discount_id}/assignments", **_params)
149
+
150
+ async def list_assignments(
151
+ self,
152
+ *,
153
+ discount_id: Optional[str] = None,
154
+ buyer_id: Optional[str] = None,
155
+ user_group_id: Optional[str] = None,
156
+ buyer_group_id: Optional[str] = None,
157
+ level: Optional[str] = None,
158
+ page: Optional[int] = None,
159
+ page_size: Optional[int] = None,
160
+ ) -> ListPage[DiscountAssignment]:
161
+ """List discount assignments
162
+
163
+ Args:
164
+ discount_id: ID of the discount.
165
+ buyer_id: ID of the buyer.
166
+ user_group_id: ID of the user group.
167
+ buyer_group_id: ID of the buyer group.
168
+ level: Level of the discount assignment. Possible values: Group, Company, BuyerGroup.
169
+ 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.
170
+ page_size: Number of results to return per page.
171
+
172
+ Returns:
173
+ A paginated list of DiscountAssignment objects.
174
+ """
175
+ params = self._build_list_params(
176
+ page=page,
177
+ page_size=page_size,
178
+ )
179
+ if discount_id is not None:
180
+ params["discountID"] = discount_id
181
+ if buyer_id is not None:
182
+ params["buyerID"] = buyer_id
183
+ if user_group_id is not None:
184
+ params["userGroupID"] = user_group_id
185
+ if buyer_group_id is not None:
186
+ params["buyerGroupID"] = buyer_group_id
187
+ if level is not None:
188
+ params["level"] = level
189
+ resp = await self._http.get("/discounts/assignments", **params)
190
+ return self._parse_list(resp.json(), DiscountAssignment)
191
+
192
+ async def save_assignment(
193
+ self,
194
+ discount_assignment: Union[DiscountAssignment, dict[str, Any]],
195
+ ) -> None:
196
+ """Create or update a discount assignment
197
+
198
+ Args:
199
+ discount_assignment: A ``DiscountAssignment`` model or dict. Required fields: DiscountID.
200
+ """
201
+ await self._http.post("/discounts/assignments", json=self._serialize(discount_assignment))