simpleapps-com-augur-api 0.8.10__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 (96) hide show
  1. augur_api/__init__.py +43 -0
  2. augur_api/client.py +453 -0
  3. augur_api/core/__init__.py +40 -0
  4. augur_api/core/config.py +75 -0
  5. augur_api/core/errors.py +173 -0
  6. augur_api/core/http_client.py +426 -0
  7. augur_api/core/schemas.py +105 -0
  8. augur_api/py.typed +0 -0
  9. augur_api/services/__init__.py +13 -0
  10. augur_api/services/agr_info/__init__.py +47 -0
  11. augur_api/services/agr_info/client.py +326 -0
  12. augur_api/services/agr_info/schemas.py +123 -0
  13. augur_api/services/agr_site/__init__.py +79 -0
  14. augur_api/services/agr_site/client.py +384 -0
  15. augur_api/services/agr_site/schemas.py +268 -0
  16. augur_api/services/agr_work/__init__.py +7 -0
  17. augur_api/services/agr_work/client.py +32 -0
  18. augur_api/services/agr_work/schemas.py +11 -0
  19. augur_api/services/avalara/__init__.py +17 -0
  20. augur_api/services/avalara/client.py +64 -0
  21. augur_api/services/avalara/schemas.py +34 -0
  22. augur_api/services/base.py +54 -0
  23. augur_api/services/basecamp2/__init__.py +65 -0
  24. augur_api/services/basecamp2/client.py +568 -0
  25. augur_api/services/basecamp2/schemas.py +227 -0
  26. augur_api/services/brand_folder/__init__.py +31 -0
  27. augur_api/services/brand_folder/client.py +206 -0
  28. augur_api/services/brand_folder/schemas.py +133 -0
  29. augur_api/services/commerce/__init__.py +56 -0
  30. augur_api/services/commerce/client.py +298 -0
  31. augur_api/services/commerce/schemas.py +167 -0
  32. augur_api/services/customers/__init__.py +69 -0
  33. augur_api/services/customers/client.py +437 -0
  34. augur_api/services/customers/schemas.py +273 -0
  35. augur_api/services/gregorovich/__init__.py +31 -0
  36. augur_api/services/gregorovich/client.py +151 -0
  37. augur_api/services/gregorovich/schemas.py +42 -0
  38. augur_api/services/items/__init__.py +302 -0
  39. augur_api/services/items/client.py +1223 -0
  40. augur_api/services/items/schemas.py +722 -0
  41. augur_api/services/joomla/__init__.py +59 -0
  42. augur_api/services/joomla/client.py +333 -0
  43. augur_api/services/joomla/schemas.py +286 -0
  44. augur_api/services/legacy/__init__.py +66 -0
  45. augur_api/services/legacy/client.py +391 -0
  46. augur_api/services/legacy/schemas.py +115 -0
  47. augur_api/services/logistics/__init__.py +34 -0
  48. augur_api/services/logistics/client.py +116 -0
  49. augur_api/services/logistics/schemas.py +65 -0
  50. augur_api/services/nexus/__init__.py +89 -0
  51. augur_api/services/nexus/client.py +589 -0
  52. augur_api/services/nexus/schemas.py +171 -0
  53. augur_api/services/open_search/__init__.py +58 -0
  54. augur_api/services/open_search/client.py +285 -0
  55. augur_api/services/open_search/schemas.py +146 -0
  56. augur_api/services/orders/__init__.py +51 -0
  57. augur_api/services/orders/client.py +299 -0
  58. augur_api/services/orders/schemas.py +195 -0
  59. augur_api/services/p21_apis/__init__.py +83 -0
  60. augur_api/services/p21_apis/client.py +420 -0
  61. augur_api/services/p21_apis/schemas.py +130 -0
  62. augur_api/services/p21_core/__init__.py +29 -0
  63. augur_api/services/p21_core/client.py +395 -0
  64. augur_api/services/p21_core/schemas.py +221 -0
  65. augur_api/services/p21_pim/__init__.py +51 -0
  66. augur_api/services/p21_pim/client.py +319 -0
  67. augur_api/services/p21_pim/schemas.py +128 -0
  68. augur_api/services/p21_sism/__init__.py +60 -0
  69. augur_api/services/p21_sism/client.py +334 -0
  70. augur_api/services/p21_sism/schemas.py +92 -0
  71. augur_api/services/payments/__init__.py +97 -0
  72. augur_api/services/payments/client.py +508 -0
  73. augur_api/services/payments/schemas.py +166 -0
  74. augur_api/services/pricing/__init__.py +43 -0
  75. augur_api/services/pricing/client.py +175 -0
  76. augur_api/services/pricing/schemas.py +146 -0
  77. augur_api/services/resource.py +141 -0
  78. augur_api/services/shipping/__init__.py +17 -0
  79. augur_api/services/shipping/client.py +68 -0
  80. augur_api/services/shipping/schemas.py +38 -0
  81. augur_api/services/slack/__init__.py +23 -0
  82. augur_api/services/slack/client.py +74 -0
  83. augur_api/services/slack/schemas.py +35 -0
  84. augur_api/services/smarty_streets/__init__.py +19 -0
  85. augur_api/services/smarty_streets/client.py +82 -0
  86. augur_api/services/smarty_streets/schemas.py +32 -0
  87. augur_api/services/ups/__init__.py +17 -0
  88. augur_api/services/ups/client.py +72 -0
  89. augur_api/services/ups/schemas.py +41 -0
  90. augur_api/services/vmi/__init__.py +157 -0
  91. augur_api/services/vmi/client.py +586 -0
  92. augur_api/services/vmi/schemas.py +285 -0
  93. simpleapps_com_augur_api-0.8.10.dist-info/METADATA +177 -0
  94. simpleapps_com_augur_api-0.8.10.dist-info/RECORD +96 -0
  95. simpleapps_com_augur_api-0.8.10.dist-info/WHEEL +4 -0
  96. simpleapps_com_augur_api-0.8.10.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,298 @@
1
+ """Commerce service client for e-commerce cart and checkout operations."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import TYPE_CHECKING, Any, List
6
+
7
+ if TYPE_CHECKING:
8
+ from augur_api.core.http_client import HTTPClient
9
+ from augur_api.core.schemas import BaseResponse
10
+ from augur_api.services.base import BaseServiceClient
11
+ from augur_api.services.commerce.schemas import (
12
+ AlsoBoughtItem,
13
+ AlsoBoughtParams,
14
+ CartHdr,
15
+ CartHdrListParams,
16
+ CartHdrLookupParams,
17
+ CartLine,
18
+ CartLineDeleteResponse,
19
+ Checkout,
20
+ CheckoutDoc,
21
+ CheckoutDocParams,
22
+ Prophet21Hdr,
23
+ Prophet21Line,
24
+ )
25
+ from augur_api.services.resource import BaseResource
26
+
27
+
28
+ class CartHdrResource(BaseResource):
29
+ """Resource for /cart-hdr endpoints."""
30
+
31
+ def __init__(self, http: HTTPClient) -> None:
32
+ """Initialize the resource."""
33
+ super().__init__(http, "/cart-hdr")
34
+
35
+ def list(self, params: CartHdrListParams) -> BaseResponse[List[CartHdr]]:
36
+ """List cart headers for a user.
37
+
38
+ Args:
39
+ params: Query parameters including user_id (required).
40
+
41
+ Returns:
42
+ BaseResponse containing a list of CartHdr items.
43
+ """
44
+ response = self._get("/list", params=params)
45
+ return BaseResponse[List[CartHdr]].model_validate(response)
46
+
47
+ def lookup(self, params: CartHdrLookupParams) -> BaseResponse[CartHdr]:
48
+ """Lookup existing cart or create new one.
49
+
50
+ Args:
51
+ params: Lookup parameters including user_id, customer_id, contact_id.
52
+
53
+ Returns:
54
+ BaseResponse containing the CartHdr.
55
+ """
56
+ response = self._get("/lookup", params=params)
57
+ return BaseResponse[CartHdr].model_validate(response)
58
+
59
+ def get_also_bought(
60
+ self, cart_hdr_uid: int, params: AlsoBoughtParams | None = None
61
+ ) -> BaseResponse[List[AlsoBoughtItem]]:
62
+ """Get product recommendations based on cart contents.
63
+
64
+ Args:
65
+ cart_hdr_uid: The cart header UID.
66
+ params: Optional pagination parameters.
67
+
68
+ Returns:
69
+ BaseResponse containing a list of recommended items.
70
+ """
71
+ response = self._get(f"/{cart_hdr_uid}/also-bought", params=params)
72
+ return BaseResponse[List[AlsoBoughtItem]].model_validate(response)
73
+
74
+
75
+ class CartLineResource(BaseResource):
76
+ """Resource for /cart-line endpoints."""
77
+
78
+ def __init__(self, http: HTTPClient) -> None:
79
+ """Initialize the resource."""
80
+ super().__init__(http, "/cart-line")
81
+
82
+ def get(self, cart_hdr_uid: int) -> BaseResponse[List[CartLine]]:
83
+ """Get all line items for a cart.
84
+
85
+ Args:
86
+ cart_hdr_uid: The cart header UID.
87
+
88
+ Returns:
89
+ BaseResponse containing a list of CartLine items.
90
+ """
91
+ response = self._get(f"/{cart_hdr_uid}")
92
+ return BaseResponse[List[CartLine]].model_validate(response)
93
+
94
+ def delete_all(self, cart_hdr_uid: int) -> BaseResponse[CartLineDeleteResponse]:
95
+ """Remove all line items from a cart.
96
+
97
+ Args:
98
+ cart_hdr_uid: The cart header UID.
99
+
100
+ Returns:
101
+ BaseResponse containing deletion status.
102
+ """
103
+ response = self._delete(f"/{cart_hdr_uid}")
104
+ return BaseResponse[CartLineDeleteResponse].model_validate(response)
105
+
106
+ def add(self, cart_hdr_uid: int, items: Any) -> BaseResponse[bool]:
107
+ """Add items to cart.
108
+
109
+ Args:
110
+ cart_hdr_uid: The cart header UID.
111
+ items: List of items to add.
112
+
113
+ Returns:
114
+ BaseResponse containing success status.
115
+ """
116
+ response = self._http.post(
117
+ f"{self._path}/{cart_hdr_uid}/add",
118
+ data=items,
119
+ )
120
+ return BaseResponse[bool].model_validate(response)
121
+
122
+ def delete_line(self, cart_hdr_uid: int, line_no: int) -> BaseResponse[CartLineDeleteResponse]:
123
+ """Remove a specific line item from cart.
124
+
125
+ Args:
126
+ cart_hdr_uid: The cart header UID.
127
+ line_no: The line number to delete.
128
+
129
+ Returns:
130
+ BaseResponse containing deletion status.
131
+ """
132
+ response = self._delete(f"/{cart_hdr_uid}/lines/{line_no}")
133
+ return BaseResponse[CartLineDeleteResponse].model_validate(response)
134
+
135
+ def update(self, cart_hdr_uid: int, items: Any) -> BaseResponse[bool]:
136
+ """Update cart line items.
137
+
138
+ Args:
139
+ cart_hdr_uid: The cart header UID.
140
+ items: List of items to update.
141
+
142
+ Returns:
143
+ BaseResponse containing success status.
144
+ """
145
+ response = self._http.post(
146
+ f"{self._path}/{cart_hdr_uid}/update",
147
+ data=items,
148
+ )
149
+ return BaseResponse[bool].model_validate(response)
150
+
151
+
152
+ class CheckoutResource(BaseResource):
153
+ """Resource for /checkout endpoints."""
154
+
155
+ def __init__(self, http: HTTPClient) -> None:
156
+ """Initialize the resource."""
157
+ super().__init__(http, "/checkout")
158
+
159
+ def create(self, data: Any) -> BaseResponse[Checkout]:
160
+ """Create a new checkout session.
161
+
162
+ Args:
163
+ data: Checkout creation parameters.
164
+
165
+ Returns:
166
+ BaseResponse containing the created Checkout.
167
+ """
168
+ response = self._post(data=data)
169
+ return BaseResponse[Checkout].model_validate(response)
170
+
171
+ def get(self, checkout_uid: int) -> BaseResponse[Checkout]:
172
+ """Get checkout by UID.
173
+
174
+ Args:
175
+ checkout_uid: The checkout UID.
176
+
177
+ Returns:
178
+ BaseResponse containing the Checkout.
179
+ """
180
+ response = self._get(f"/{checkout_uid}")
181
+ return BaseResponse[Checkout].model_validate(response)
182
+
183
+ def activate(self, checkout_uid: int) -> BaseResponse[Checkout]:
184
+ """Activate and process checkout.
185
+
186
+ Args:
187
+ checkout_uid: The checkout UID.
188
+
189
+ Returns:
190
+ BaseResponse containing the activated Checkout.
191
+ """
192
+ response = self._put(f"/{checkout_uid}/activate")
193
+ return BaseResponse[Checkout].model_validate(response)
194
+
195
+ def get_doc(
196
+ self, checkout_uid: int, params: CheckoutDocParams | None = None
197
+ ) -> BaseResponse[CheckoutDoc]:
198
+ """Get formatted checkout document.
199
+
200
+ Args:
201
+ checkout_uid: The checkout UID.
202
+ params: Optional document parameters.
203
+
204
+ Returns:
205
+ BaseResponse containing the CheckoutDoc.
206
+ """
207
+ response = self._get(f"/{checkout_uid}/doc", params=params)
208
+ return BaseResponse[CheckoutDoc].model_validate(response)
209
+
210
+ def validate(self, checkout_uid: int) -> BaseResponse[Checkout]:
211
+ """Validate checkout data.
212
+
213
+ Args:
214
+ checkout_uid: The checkout UID.
215
+
216
+ Returns:
217
+ BaseResponse containing the validated Checkout.
218
+ """
219
+ response = self._put(f"/{checkout_uid}/validate")
220
+ return BaseResponse[Checkout].model_validate(response)
221
+
222
+ def create_prophet21_hdr(self, checkout_uid: int) -> BaseResponse[Prophet21Hdr]:
223
+ """Create Prophet21 checkout header.
224
+
225
+ Args:
226
+ checkout_uid: The checkout UID.
227
+
228
+ Returns:
229
+ BaseResponse containing the Prophet21Hdr.
230
+ """
231
+ response = self._post(f"/{checkout_uid}/prophet21-hdr")
232
+ return BaseResponse[Prophet21Hdr].model_validate(response)
233
+
234
+ def create_prophet21_line(
235
+ self, checkout_uid: int, prophet21_hdr_uid: int
236
+ ) -> BaseResponse[List[Prophet21Line]]:
237
+ """Add Prophet21 checkout lines.
238
+
239
+ Args:
240
+ checkout_uid: The checkout UID.
241
+ prophet21_hdr_uid: The Prophet21 header UID.
242
+
243
+ Returns:
244
+ BaseResponse containing the Prophet21Line items.
245
+ """
246
+ response = self._post(f"/{checkout_uid}/prophet21-hdr/{prophet21_hdr_uid}/prophet21-line")
247
+ return BaseResponse[List[Prophet21Line]].model_validate(response)
248
+
249
+
250
+ class CommerceClient(BaseServiceClient):
251
+ """Client for the Commerce service.
252
+
253
+ Provides access to e-commerce cart and checkout endpoints including:
254
+ - Health check (health_check)
255
+ - Cart headers (cart_hdr)
256
+ - Cart lines (cart_line)
257
+ - Checkout (checkout)
258
+
259
+ Example:
260
+ >>> from augur_api import AugurAPI
261
+ >>> api = AugurAPI(token="...", site_id="...")
262
+ >>> cart = api.commerce.cart_hdr.lookup(CartHdrLookupParams(
263
+ ... user_id=1, customer_id=100, contact_id=50
264
+ ... ))
265
+ >>> print(cart.data.cart_hdr_uid)
266
+ """
267
+
268
+ def __init__(self, http_client: HTTPClient) -> None:
269
+ """Initialize the Commerce client.
270
+
271
+ Args:
272
+ http_client: HTTP client for making requests.
273
+ """
274
+ super().__init__(http_client)
275
+ self._cart_hdr: CartHdrResource | None = None
276
+ self._cart_line: CartLineResource | None = None
277
+ self._checkout: CheckoutResource | None = None
278
+
279
+ @property
280
+ def cart_hdr(self) -> CartHdrResource:
281
+ """Access cart header endpoints."""
282
+ if self._cart_hdr is None:
283
+ self._cart_hdr = CartHdrResource(self._http)
284
+ return self._cart_hdr
285
+
286
+ @property
287
+ def cart_line(self) -> CartLineResource:
288
+ """Access cart line endpoints."""
289
+ if self._cart_line is None:
290
+ self._cart_line = CartLineResource(self._http)
291
+ return self._cart_line
292
+
293
+ @property
294
+ def checkout(self) -> CheckoutResource:
295
+ """Access checkout endpoints."""
296
+ if self._checkout is None:
297
+ self._checkout = CheckoutResource(self._http)
298
+ return self._checkout
@@ -0,0 +1,167 @@
1
+ """Schemas for the Commerce service."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Any
6
+
7
+ from pydantic import BaseModel
8
+
9
+ from augur_api.core.schemas import CamelCaseModel, EdgeCacheParams
10
+
11
+
12
+ # Health Check
13
+ class HealthCheckData(CamelCaseModel):
14
+ """Health check response data."""
15
+
16
+ site_hash: str | None = None
17
+ site_id: str | None = None
18
+
19
+
20
+ # Cart Header
21
+ class CartHdrListParams(EdgeCacheParams):
22
+ """Parameters for listing cart headers."""
23
+
24
+ user_id: int
25
+
26
+
27
+ class CartHdrLookupParams(EdgeCacheParams):
28
+ """Parameters for cart lookup."""
29
+
30
+ user_id: int
31
+ customer_id: int
32
+ contact_id: int
33
+ cart_token: str | None = None
34
+ user_cart_no: str | None = None
35
+
36
+
37
+ class CartHdr(CamelCaseModel):
38
+ """Cart header entity."""
39
+
40
+ cart_hdr_uid: int | None = None
41
+ user_id: int | None = None
42
+ customer_id: int | None = None
43
+ contact_id: int | None = None
44
+ cart_token: str | None = None
45
+ user_cart_no: str | None = None
46
+ status_cd: int | None = None
47
+ created_at: str | None = None
48
+ updated_at: str | None = None
49
+
50
+
51
+ class AlsoBoughtParams(EdgeCacheParams):
52
+ """Parameters for also-bought recommendations."""
53
+
54
+ limit: int | None = None
55
+ offset: int | None = None
56
+
57
+
58
+ class AlsoBoughtItem(CamelCaseModel):
59
+ """Also-bought recommendation item."""
60
+
61
+ inv_mast_uid: int | None = None
62
+ item_id: str | None = None
63
+ item_desc: str | None = None
64
+ score: float | None = None
65
+
66
+
67
+ # Cart Line
68
+ class CartLine(CamelCaseModel):
69
+ """Cart line entity."""
70
+
71
+ cart_line_uid: int | None = None
72
+ cart_hdr_uid: int | None = None
73
+ line_no: int | None = None
74
+ inv_mast_uid: int | None = None
75
+ item_id: str | None = None
76
+ quantity: float | None = None
77
+ unit_price: float | None = None
78
+ extended_price: float | None = None
79
+ unit_of_measure: str | None = None
80
+
81
+
82
+ class CartLineAddItem(BaseModel):
83
+ """Item to add to cart."""
84
+
85
+ inv_mast_uid: int | None = None
86
+ item_id: str | None = None
87
+ quantity: float
88
+ unit_of_measure: str | None = None
89
+
90
+
91
+ class CartLineUpdateItem(BaseModel):
92
+ """Item to update in cart."""
93
+
94
+ line_no: int
95
+ quantity: float | None = None
96
+ unit_of_measure: str | None = None
97
+
98
+
99
+ class CartLineDeleteResponse(CamelCaseModel):
100
+ """Response for cart line deletion."""
101
+
102
+ success: bool | None = None
103
+ message: str | None = None
104
+
105
+
106
+ # Checkout
107
+ class CheckoutCreateParams(BaseModel):
108
+ """Parameters for creating checkout."""
109
+
110
+ cart_hdr_uid: int | None = None
111
+ customer_id: int | None = None
112
+ contact_id: int | None = None
113
+ ship_to_id: int | None = None
114
+ po_no: str | None = None
115
+ notes: str | None = None
116
+
117
+
118
+ class Checkout(CamelCaseModel):
119
+ """Checkout entity."""
120
+
121
+ checkout_uid: int | None = None
122
+ cart_hdr_uid: int | None = None
123
+ customer_id: int | None = None
124
+ contact_id: int | None = None
125
+ ship_to_id: int | None = None
126
+ status_cd: int | None = None
127
+ po_no: str | None = None
128
+ order_no: int | None = None
129
+ created_at: str | None = None
130
+ updated_at: str | None = None
131
+
132
+
133
+ class CheckoutDocParams(EdgeCacheParams):
134
+ """Parameters for checkout document."""
135
+
136
+ cart_hdr_uid: int | None = None
137
+ limit: int | None = None
138
+ offset: int | None = None
139
+
140
+
141
+ class CheckoutDoc(CamelCaseModel):
142
+ """Checkout document."""
143
+
144
+ checkout_uid: int | None = None
145
+ order_no: int | None = None
146
+ customer_id: int | None = None
147
+ contact_id: int | None = None
148
+ lines: list[Any] | None = None
149
+
150
+
151
+ class Prophet21Hdr(CamelCaseModel):
152
+ """Prophet21 header entity."""
153
+
154
+ prophet21_hdr_uid: int | None = None
155
+ checkout_uid: int | None = None
156
+ order_no: int | None = None
157
+ status_cd: int | None = None
158
+
159
+
160
+ class Prophet21Line(CamelCaseModel):
161
+ """Prophet21 line entity."""
162
+
163
+ prophet21_line_uid: int | None = None
164
+ prophet21_hdr_uid: int | None = None
165
+ line_no: int | None = None
166
+ inv_mast_uid: int | None = None
167
+ quantity: float | None = None
@@ -0,0 +1,69 @@
1
+ """Customers service exports."""
2
+
3
+ from augur_api.services.customers.client import (
4
+ ContactsResource,
5
+ ContactsUdResource,
6
+ CustomerResource,
7
+ CustomersClient,
8
+ OeContactsCustomerResource,
9
+ ShipToResource,
10
+ )
11
+ from augur_api.services.customers.schemas import (
12
+ Address,
13
+ AddressParams,
14
+ Contact,
15
+ ContactCreateParams,
16
+ ContactDoc,
17
+ ContactListParams,
18
+ ContactUd,
19
+ Customer,
20
+ CustomerDoc,
21
+ CustomerListParams,
22
+ CustomerLookupParams,
23
+ HealthCheckData,
24
+ Invoice,
25
+ InvoiceListParams,
26
+ Order,
27
+ OrderListParams,
28
+ PurchasedItem,
29
+ PurchasedItemsParams,
30
+ Quote,
31
+ QuoteListParams,
32
+ ShipTo,
33
+ ShipToCreateParams,
34
+ ShipToListParams,
35
+ WebAllowance,
36
+ )
37
+
38
+ __all__ = [
39
+ "Address",
40
+ "AddressParams",
41
+ "Contact",
42
+ "ContactCreateParams",
43
+ "ContactDoc",
44
+ "ContactListParams",
45
+ "ContactsResource",
46
+ "ContactsUdResource",
47
+ "ContactUd",
48
+ "Customer",
49
+ "CustomerDoc",
50
+ "CustomerListParams",
51
+ "CustomerLookupParams",
52
+ "CustomerResource",
53
+ "CustomersClient",
54
+ "HealthCheckData",
55
+ "Invoice",
56
+ "InvoiceListParams",
57
+ "OeContactsCustomerResource",
58
+ "Order",
59
+ "OrderListParams",
60
+ "PurchasedItem",
61
+ "PurchasedItemsParams",
62
+ "Quote",
63
+ "QuoteListParams",
64
+ "ShipTo",
65
+ "ShipToCreateParams",
66
+ "ShipToListParams",
67
+ "ShipToResource",
68
+ "WebAllowance",
69
+ ]