ce-storefront 0.5.0 → 0.5.2

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 (144) hide show
  1. package/README.md +12 -11
  2. package/docs/sdks/carts/README.md +480 -5
  3. package/docs/sdks/customers/README.md +4 -0
  4. package/esm/funcs/cartsApplyCoupon.d.ts +16 -0
  5. package/esm/funcs/cartsApplyCoupon.d.ts.map +1 -0
  6. package/esm/funcs/{checkoutApplyCoupon.js → cartsApplyCoupon.js} +12 -6
  7. package/esm/funcs/cartsApplyCoupon.js.map +1 -0
  8. package/esm/funcs/{checkoutCreateCheckoutAddress.d.ts → cartsCreateCartAddress.d.ts} +2 -2
  9. package/esm/funcs/cartsCreateCartAddress.d.ts.map +1 -0
  10. package/esm/funcs/{checkoutCreateCheckoutAddress.js → cartsCreateCartAddress.js} +16 -12
  11. package/esm/funcs/cartsCreateCartAddress.js.map +1 -0
  12. package/esm/funcs/cartsDeleteCart.js +2 -2
  13. package/esm/funcs/cartsDeleteCart.js.map +1 -1
  14. package/esm/funcs/cartsGetCart.d.ts +1 -1
  15. package/esm/funcs/cartsGetCart.js +3 -3
  16. package/esm/funcs/cartsGetCart.js.map +1 -1
  17. package/esm/funcs/cartsGetUserCart.d.ts +16 -0
  18. package/esm/funcs/cartsGetUserCart.d.ts.map +1 -0
  19. package/esm/funcs/cartsGetUserCart.js +85 -0
  20. package/esm/funcs/cartsGetUserCart.js.map +1 -0
  21. package/esm/funcs/{checkoutRemoveCoupon.d.ts → cartsRemoveCoupon.d.ts} +2 -2
  22. package/esm/funcs/cartsRemoveCoupon.d.ts.map +1 -0
  23. package/esm/funcs/{checkoutRemoveCoupon.js → cartsRemoveCoupon.js} +12 -7
  24. package/esm/funcs/{checkoutRemoveCoupon.js.map → cartsRemoveCoupon.js.map} +1 -1
  25. package/esm/funcs/{checkoutApplyCoupon.d.ts → cartsRemoveUserCart.d.ts} +4 -4
  26. package/esm/funcs/{checkoutApplyCoupon.d.ts.map → cartsRemoveUserCart.d.ts.map} +1 -1
  27. package/esm/funcs/cartsRemoveUserCart.js +85 -0
  28. package/esm/funcs/cartsRemoveUserCart.js.map +1 -0
  29. package/esm/lib/config.d.ts +3 -3
  30. package/esm/lib/config.js +3 -3
  31. package/esm/models/components/cart.d.ts +4 -4
  32. package/esm/models/components/cart.d.ts.map +1 -1
  33. package/esm/models/components/cart.js +4 -4
  34. package/esm/models/components/cart.js.map +1 -1
  35. package/esm/models/components/cartitem.d.ts +0 -5
  36. package/esm/models/components/cartitem.d.ts.map +1 -1
  37. package/esm/models/components/cartitem.js +0 -2
  38. package/esm/models/components/cartitem.js.map +1 -1
  39. package/esm/models/components/customeraddress.d.ts +7 -4
  40. package/esm/models/components/customeraddress.d.ts.map +1 -1
  41. package/esm/models/components/customeraddress.js +4 -4
  42. package/esm/models/components/customeraddress.js.map +1 -1
  43. package/esm/models/components/customeraddressinput.d.ts +7 -2
  44. package/esm/models/components/customeraddressinput.d.ts.map +1 -1
  45. package/esm/models/components/customeraddressinput.js +4 -2
  46. package/esm/models/components/customeraddressinput.js.map +1 -1
  47. package/esm/models/operations/applycoupon.d.ts +30 -2
  48. package/esm/models/operations/applycoupon.d.ts.map +1 -1
  49. package/esm/models/operations/applycoupon.js +35 -4
  50. package/esm/models/operations/applycoupon.js.map +1 -1
  51. package/esm/models/operations/createaddress.d.ts +7 -2
  52. package/esm/models/operations/createaddress.d.ts.map +1 -1
  53. package/esm/models/operations/createaddress.js +4 -2
  54. package/esm/models/operations/createaddress.js.map +1 -1
  55. package/esm/models/operations/createcartaddress.d.ts +183 -0
  56. package/esm/models/operations/createcartaddress.d.ts.map +1 -0
  57. package/esm/models/operations/createcartaddress.js +214 -0
  58. package/esm/models/operations/createcartaddress.js.map +1 -0
  59. package/esm/models/operations/deletecart.d.ts +3 -3
  60. package/esm/models/operations/deletecart.d.ts.map +1 -1
  61. package/esm/models/operations/deletecart.js +2 -11
  62. package/esm/models/operations/deletecart.js.map +1 -1
  63. package/esm/models/operations/deleteusercart.d.ts +63 -0
  64. package/esm/models/operations/deleteusercart.d.ts.map +1 -0
  65. package/esm/models/operations/deleteusercart.js +77 -0
  66. package/esm/models/operations/deleteusercart.js.map +1 -0
  67. package/esm/models/operations/getaddressdetail.d.ts +7 -4
  68. package/esm/models/operations/getaddressdetail.d.ts.map +1 -1
  69. package/esm/models/operations/getaddressdetail.js +4 -4
  70. package/esm/models/operations/getaddressdetail.js.map +1 -1
  71. package/esm/models/operations/getcart.d.ts +3 -3
  72. package/esm/models/operations/getcart.d.ts.map +1 -1
  73. package/esm/models/operations/getcart.js +2 -11
  74. package/esm/models/operations/getcart.js.map +1 -1
  75. package/esm/models/operations/getusercart.d.ts +94 -0
  76. package/esm/models/operations/getusercart.d.ts.map +1 -0
  77. package/esm/models/operations/getusercart.js +105 -0
  78. package/esm/models/operations/getusercart.js.map +1 -0
  79. package/esm/models/operations/index.d.ts +3 -1
  80. package/esm/models/operations/index.d.ts.map +1 -1
  81. package/esm/models/operations/index.js +3 -1
  82. package/esm/models/operations/index.js.map +1 -1
  83. package/esm/models/operations/listaddresses.d.ts +7 -4
  84. package/esm/models/operations/listaddresses.d.ts.map +1 -1
  85. package/esm/models/operations/listaddresses.js +4 -4
  86. package/esm/models/operations/listaddresses.js.map +1 -1
  87. package/esm/models/operations/removecoupon.d.ts +18 -17
  88. package/esm/models/operations/removecoupon.d.ts.map +1 -1
  89. package/esm/models/operations/removecoupon.js +15 -28
  90. package/esm/models/operations/removecoupon.js.map +1 -1
  91. package/esm/models/operations/updateaddressdetail.d.ts +7 -2
  92. package/esm/models/operations/updateaddressdetail.d.ts.map +1 -1
  93. package/esm/models/operations/updateaddressdetail.js +4 -2
  94. package/esm/models/operations/updateaddressdetail.js.map +1 -1
  95. package/esm/sdk/carts.d.ts +36 -1
  96. package/esm/sdk/carts.d.ts.map +1 -1
  97. package/esm/sdk/carts.js +51 -1
  98. package/esm/sdk/carts.js.map +1 -1
  99. package/esm/sdk/sdk.d.ts +0 -3
  100. package/esm/sdk/sdk.d.ts.map +1 -1
  101. package/esm/sdk/sdk.js +0 -4
  102. package/esm/sdk/sdk.js.map +1 -1
  103. package/jsr.json +1 -1
  104. package/package.json +1 -1
  105. package/src/funcs/{checkoutApplyCoupon.ts → cartsApplyCoupon.ts} +13 -6
  106. package/src/funcs/{checkoutCreateCheckoutAddress.ts → cartsCreateCartAddress.ts} +19 -15
  107. package/src/funcs/cartsDeleteCart.ts +2 -2
  108. package/src/funcs/cartsGetCart.ts +3 -3
  109. package/src/funcs/cartsGetUserCart.ts +149 -0
  110. package/src/funcs/{checkoutRemoveCoupon.ts → cartsRemoveCoupon.ts} +13 -7
  111. package/src/funcs/cartsRemoveUserCart.ts +149 -0
  112. package/src/lib/config.ts +3 -3
  113. package/src/models/components/cart.ts +9 -9
  114. package/src/models/components/cartitem.ts +0 -7
  115. package/src/models/components/customeraddress.ts +11 -8
  116. package/src/models/components/customeraddressinput.ts +11 -4
  117. package/src/models/operations/applycoupon.ts +73 -6
  118. package/src/models/operations/createaddress.ts +11 -4
  119. package/src/models/operations/{createcheckoutaddress.ts → createcartaddress.ts} +152 -85
  120. package/src/models/operations/deletecart.ts +5 -14
  121. package/src/models/operations/deleteusercart.ts +154 -0
  122. package/src/models/operations/getaddressdetail.ts +11 -8
  123. package/src/models/operations/getcart.ts +5 -14
  124. package/src/models/operations/getusercart.ts +220 -0
  125. package/src/models/operations/index.ts +3 -1
  126. package/src/models/operations/listaddresses.ts +11 -8
  127. package/src/models/operations/removecoupon.ts +28 -40
  128. package/src/models/operations/updateaddressdetail.ts +11 -4
  129. package/src/sdk/carts.ts +91 -1
  130. package/src/sdk/sdk.ts +0 -6
  131. package/docs/sdks/checkout/README.md +0 -310
  132. package/esm/funcs/checkoutApplyCoupon.js.map +0 -1
  133. package/esm/funcs/checkoutCreateCheckoutAddress.d.ts.map +0 -1
  134. package/esm/funcs/checkoutCreateCheckoutAddress.js.map +0 -1
  135. package/esm/funcs/checkoutRemoveCoupon.d.ts.map +0 -1
  136. package/esm/models/operations/createcheckoutaddress.d.ts +0 -154
  137. package/esm/models/operations/createcheckoutaddress.d.ts.map +0 -1
  138. package/esm/models/operations/createcheckoutaddress.js +0 -181
  139. package/esm/models/operations/createcheckoutaddress.js.map +0 -1
  140. package/esm/sdk/checkout.d.ts +0 -26
  141. package/esm/sdk/checkout.d.ts.map +0 -1
  142. package/esm/sdk/checkout.js +0 -38
  143. package/esm/sdk/checkout.js.map +0 -1
  144. package/src/sdk/checkout.ts +0 -63
package/README.md CHANGED
@@ -128,9 +128,14 @@ run();
128
128
  ### [carts](docs/sdks/carts/README.md)
129
129
 
130
130
  * [createCart](docs/sdks/carts/README.md#createcart) - Create cart
131
- * [getCart](docs/sdks/carts/README.md#getcart) - Retrieve cart details
131
+ * [getCart](docs/sdks/carts/README.md#getcart) - Retrieve cart detail
132
132
  * [deleteCart](docs/sdks/carts/README.md#deletecart) - Delete cart
133
+ * [getUserCart](docs/sdks/carts/README.md#getusercart) - Retrieve cart using user id
134
+ * [removeUserCart](docs/sdks/carts/README.md#removeusercart) - Delete cart using user id
133
135
  * [updateCart](docs/sdks/carts/README.md#updatecart) - Add/delete cart item
136
+ * [createCartAddress](docs/sdks/carts/README.md#createcartaddress) - Update cart address
137
+ * [applyCoupon](docs/sdks/carts/README.md#applycoupon) - Apply coupon
138
+ * [removeCoupon](docs/sdks/carts/README.md#removecoupon) - Remove coupon
134
139
 
135
140
  ### [catalog](docs/sdks/catalog/README.md)
136
141
 
@@ -148,12 +153,6 @@ run();
148
153
  * [searchProducts](docs/sdks/catalog/README.md#searchproducts) - Search products
149
154
 
150
155
 
151
- ### [checkout](docs/sdks/checkout/README.md)
152
-
153
- * [createCheckoutAddress](docs/sdks/checkout/README.md#createcheckoutaddress) - Update cart address
154
- * [applyCoupon](docs/sdks/checkout/README.md#applycoupon) - Apply coupon
155
- * [removeCoupon](docs/sdks/checkout/README.md#removecoupon) - Remove coupon
156
-
157
156
  ### [common](docs/sdks/common/README.md)
158
157
 
159
158
  * [listCountryPincodes](docs/sdks/common/README.md#listcountrypincodes) - Retrieve pincodes
@@ -214,9 +213,14 @@ To read more about standalone functions, check [FUNCTIONS.md](./FUNCTIONS.md).
214
213
  - [`authUpdateUser`](docs/sdks/auth/README.md#updateuser) - Update a user
215
214
  - [`authVerifyOtp`](docs/sdks/auth/README.md#verifyotp) - Verify OTP
216
215
  - [`campaignsSubscribeNewsletter`](docs/sdks/campaigns/README.md#subscribenewsletter) - Subscribe to newsletter
216
+ - [`cartsApplyCoupon`](docs/sdks/carts/README.md#applycoupon) - Apply coupon
217
217
  - [`cartsCreateCart`](docs/sdks/carts/README.md#createcart) - Create cart
218
+ - [`cartsCreateCartAddress`](docs/sdks/carts/README.md#createcartaddress) - Update cart address
218
219
  - [`cartsDeleteCart`](docs/sdks/carts/README.md#deletecart) - Delete cart
219
- - [`cartsGetCart`](docs/sdks/carts/README.md#getcart) - Retrieve cart details
220
+ - [`cartsGetCart`](docs/sdks/carts/README.md#getcart) - Retrieve cart detail
221
+ - [`cartsGetUserCart`](docs/sdks/carts/README.md#getusercart) - Retrieve cart using user id
222
+ - [`cartsRemoveCoupon`](docs/sdks/carts/README.md#removecoupon) - Remove coupon
223
+ - [`cartsRemoveUserCart`](docs/sdks/carts/README.md#removeusercart) - Delete cart using user id
220
224
  - [`cartsUpdateCart`](docs/sdks/carts/README.md#updatecart) - Add/delete cart item
221
225
  - [`catalogCreateProductReview`](docs/sdks/catalog/README.md#createproductreview) - Create product review
222
226
  - [`catalogGetProductDetail`](docs/sdks/catalog/README.md#getproductdetail) - Retrieve a product detail
@@ -230,9 +234,6 @@ To read more about standalone functions, check [FUNCTIONS.md](./FUNCTIONS.md).
230
234
  - [`catalogListSkus`](docs/sdks/catalog/README.md#listskus) - List all SKUs
231
235
  - [`catalogListUpsellProducts`](docs/sdks/catalog/README.md#listupsellproducts) - Retrieve up-sell products
232
236
  - [`catalogSearchProducts`](docs/sdks/catalog/README.md#searchproducts) - Search products
233
- - [`checkoutApplyCoupon`](docs/sdks/checkout/README.md#applycoupon) - Apply coupon
234
- - [`checkoutCreateCheckoutAddress`](docs/sdks/checkout/README.md#createcheckoutaddress) - Update cart address
235
- - [`checkoutRemoveCoupon`](docs/sdks/checkout/README.md#removecoupon) - Remove coupon
236
237
  - [`commonListCountryPincodes`](docs/sdks/common/README.md#listcountrypincodes) - Retrieve pincodes
237
238
  - [`customersCreateAddress`](docs/sdks/customers/README.md#createaddress) - Create address
238
239
  - [`customersDeleteAddress`](docs/sdks/customers/README.md#deleteaddress) - Remove particular address
@@ -6,9 +6,14 @@
6
6
  ### Available Operations
7
7
 
8
8
  * [createCart](#createcart) - Create cart
9
- * [getCart](#getcart) - Retrieve cart details
9
+ * [getCart](#getcart) - Retrieve cart detail
10
10
  * [deleteCart](#deletecart) - Delete cart
11
+ * [getUserCart](#getusercart) - Retrieve cart using user id
12
+ * [removeUserCart](#removeusercart) - Delete cart using user id
11
13
  * [updateCart](#updatecart) - Add/delete cart item
14
+ * [createCartAddress](#createcartaddress) - Update cart address
15
+ * [applyCoupon](#applycoupon) - Apply coupon
16
+ * [removeCoupon](#removecoupon) - Remove coupon
12
17
 
13
18
  ## createCart
14
19
 
@@ -114,7 +119,7 @@ const ceStorefront = new CeStorefront({
114
119
 
115
120
  async function run() {
116
121
  const result = await ceStorefront.carts.getCart({
117
- userId: "<id>",
122
+ id: "<id>",
118
123
  });
119
124
 
120
125
  // Handle the result
@@ -140,7 +145,7 @@ const ceStorefront = new CeStorefrontCore({
140
145
 
141
146
  async function run() {
142
147
  const res = await cartsGetCart(ceStorefront, {
143
- userId: "<id>",
148
+ id: "<id>",
144
149
  });
145
150
 
146
151
  if (!res.ok) {
@@ -193,7 +198,7 @@ const ceStorefront = new CeStorefront({
193
198
 
194
199
  async function run() {
195
200
  const result = await ceStorefront.carts.deleteCart({
196
- userId: "<id>",
201
+ id: "<id>",
197
202
  });
198
203
 
199
204
  // Handle the result
@@ -219,7 +224,7 @@ const ceStorefront = new CeStorefrontCore({
219
224
 
220
225
  async function run() {
221
226
  const res = await cartsDeleteCart(ceStorefront, {
222
- userId: "<id>",
227
+ id: "<id>",
223
228
  });
224
229
 
225
230
  if (!res.ok) {
@@ -257,6 +262,164 @@ run();
257
262
  | errors.NotFound | 404 | application/json |
258
263
  | errors.CeError | 4XX, 5XX | \*/\* |
259
264
 
265
+ ## getUserCart
266
+
267
+ Retrieve cart detail using user id
268
+
269
+ ### Example Usage
270
+
271
+ ```typescript
272
+ import { CeStorefront } from "ce-storefront";
273
+
274
+ const ceStorefront = new CeStorefront({
275
+ authorization: "<YOUR_BEARER_TOKEN_HERE>",
276
+ });
277
+
278
+ async function run() {
279
+ const result = await ceStorefront.carts.getUserCart({
280
+ userId: "<id>",
281
+ });
282
+
283
+ // Handle the result
284
+ console.log(result);
285
+ }
286
+
287
+ run();
288
+ ```
289
+
290
+ ### Standalone function
291
+
292
+ The standalone function version of this method:
293
+
294
+ ```typescript
295
+ import { CeStorefrontCore } from "ce-storefront/core.js";
296
+ import { cartsGetUserCart } from "ce-storefront/funcs/cartsGetUserCart.js";
297
+
298
+ // Use `CeStorefrontCore` for best tree-shaking performance.
299
+ // You can create one instance of it to use across an application.
300
+ const ceStorefront = new CeStorefrontCore({
301
+ authorization: "<YOUR_BEARER_TOKEN_HERE>",
302
+ });
303
+
304
+ async function run() {
305
+ const res = await cartsGetUserCart(ceStorefront, {
306
+ userId: "<id>",
307
+ });
308
+
309
+ if (!res.ok) {
310
+ throw res.error;
311
+ }
312
+
313
+ const { value: result } = res;
314
+
315
+ // Handle the result
316
+ console.log(result);
317
+ }
318
+
319
+ run();
320
+ ```
321
+
322
+ ### Parameters
323
+
324
+ | Parameter | Type | Required | Description |
325
+ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
326
+ | `request` | [operations.GetUserCartRequest](../../models/operations/getusercartrequest.md) | :heavy_check_mark: | The request object to use for the request. |
327
+ | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
328
+ | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
329
+ | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
330
+ | `options.serverURL` | *string* | :heavy_minus_sign: | An optional server URL to use. |
331
+
332
+ ### Response
333
+
334
+ **Promise\<[operations.GetUserCartResponseBody](../../models/operations/getusercartresponsebody.md)\>**
335
+
336
+ ### Errors
337
+
338
+ | Error Type | Status Code | Content Type |
339
+ | ------------------- | ------------------- | ------------------- |
340
+ | errors.Unauthorized | 401 | application/json |
341
+ | errors.NotFound | 404 | application/json |
342
+ | errors.CeError | 4XX, 5XX | \*/\* |
343
+
344
+ ## removeUserCart
345
+
346
+ delete all items from the cart using user id.
347
+
348
+ ### Example Usage
349
+
350
+ ```typescript
351
+ import { CeStorefront } from "ce-storefront";
352
+
353
+ const ceStorefront = new CeStorefront({
354
+ authorization: "<YOUR_BEARER_TOKEN_HERE>",
355
+ });
356
+
357
+ async function run() {
358
+ const result = await ceStorefront.carts.removeUserCart({
359
+ userId: "<id>",
360
+ });
361
+
362
+ // Handle the result
363
+ console.log(result);
364
+ }
365
+
366
+ run();
367
+ ```
368
+
369
+ ### Standalone function
370
+
371
+ The standalone function version of this method:
372
+
373
+ ```typescript
374
+ import { CeStorefrontCore } from "ce-storefront/core.js";
375
+ import { cartsRemoveUserCart } from "ce-storefront/funcs/cartsRemoveUserCart.js";
376
+
377
+ // Use `CeStorefrontCore` for best tree-shaking performance.
378
+ // You can create one instance of it to use across an application.
379
+ const ceStorefront = new CeStorefrontCore({
380
+ authorization: "<YOUR_BEARER_TOKEN_HERE>",
381
+ });
382
+
383
+ async function run() {
384
+ const res = await cartsRemoveUserCart(ceStorefront, {
385
+ userId: "<id>",
386
+ });
387
+
388
+ if (!res.ok) {
389
+ throw res.error;
390
+ }
391
+
392
+ const { value: result } = res;
393
+
394
+ // Handle the result
395
+ console.log(result);
396
+ }
397
+
398
+ run();
399
+ ```
400
+
401
+ ### Parameters
402
+
403
+ | Parameter | Type | Required | Description |
404
+ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
405
+ | `request` | [operations.DeleteUserCartRequest](../../models/operations/deleteusercartrequest.md) | :heavy_check_mark: | The request object to use for the request. |
406
+ | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
407
+ | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
408
+ | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
409
+ | `options.serverURL` | *string* | :heavy_minus_sign: | An optional server URL to use. |
410
+
411
+ ### Response
412
+
413
+ **Promise\<[operations.DeleteUserCartResponseBody](../../models/operations/deleteusercartresponsebody.md)\>**
414
+
415
+ ### Errors
416
+
417
+ | Error Type | Status Code | Content Type |
418
+ | ------------------- | ------------------- | ------------------- |
419
+ | errors.Unauthorized | 401 | application/json |
420
+ | errors.NotFound | 404 | application/json |
421
+ | errors.CeError | 4XX, 5XX | \*/\* |
422
+
260
423
  ## updateCart
261
424
 
262
425
  Add Item to cart. To delete item from cart, pass quantity = 0
@@ -345,4 +508,316 @@ run();
345
508
  | errors.BadRequest | 400 | application/json |
346
509
  | errors.Unauthorized | 401 | application/json |
347
510
  | errors.NotFound | 404 | application/json |
511
+ | errors.CeError | 4XX, 5XX | \*/\* |
512
+
513
+ ## createCartAddress
514
+
515
+ Update billing and shipping address
516
+
517
+ ### Example Usage
518
+
519
+ ```typescript
520
+ import { CeStorefront } from "ce-storefront";
521
+
522
+ const ceStorefront = new CeStorefront({
523
+ authorization: "<YOUR_BEARER_TOKEN_HERE>",
524
+ });
525
+
526
+ async function run() {
527
+ const result = await ceStorefront.carts.createCartAddress({
528
+ id: "<id>",
529
+ requestBody: {
530
+ billingAddress: {
531
+ id: "<id>",
532
+ firstName: "Shane",
533
+ lastName: "Konopelski",
534
+ countryCode: "RW",
535
+ phone: "361-910-1801",
536
+ email: "Jamel_Hegmann@hotmail.com",
537
+ addressLine1: "32912 Stanton Fords",
538
+ addressLine2: "-",
539
+ landmark: "<value>",
540
+ pincode: "<value>",
541
+ city: "Suzannefort",
542
+ state: "Vermont",
543
+ taxIdentificationNumber: "123456789",
544
+ businessName: "<value>",
545
+ },
546
+ shippingAddress: {
547
+ id: "<id>",
548
+ firstName: "Kasandra",
549
+ lastName: "Sauer",
550
+ countryCode: "GY",
551
+ phone: "(582) 271-0084",
552
+ email: "Lera.Lindgren@yahoo.com",
553
+ addressLine1: "35385 Stanton Harbor",
554
+ addressLine2: "-",
555
+ landmark: "<value>",
556
+ pincode: "<value>",
557
+ city: "Jerrodworth",
558
+ state: "Oregon",
559
+ taxIdentificationNumber: "123456789",
560
+ businessName: "<value>",
561
+ },
562
+ },
563
+ });
564
+
565
+ // Handle the result
566
+ console.log(result);
567
+ }
568
+
569
+ run();
570
+ ```
571
+
572
+ ### Standalone function
573
+
574
+ The standalone function version of this method:
575
+
576
+ ```typescript
577
+ import { CeStorefrontCore } from "ce-storefront/core.js";
578
+ import { cartsCreateCartAddress } from "ce-storefront/funcs/cartsCreateCartAddress.js";
579
+
580
+ // Use `CeStorefrontCore` for best tree-shaking performance.
581
+ // You can create one instance of it to use across an application.
582
+ const ceStorefront = new CeStorefrontCore({
583
+ authorization: "<YOUR_BEARER_TOKEN_HERE>",
584
+ });
585
+
586
+ async function run() {
587
+ const res = await cartsCreateCartAddress(ceStorefront, {
588
+ id: "<id>",
589
+ requestBody: {
590
+ billingAddress: {
591
+ id: "<id>",
592
+ firstName: "Pearl",
593
+ lastName: "Mohr",
594
+ countryCode: "TG",
595
+ phone: "282-955-7215",
596
+ email: "Dudley22@gmail.com",
597
+ addressLine1: "251 Cayla Oval",
598
+ addressLine2: "-",
599
+ landmark: "<value>",
600
+ pincode: "<value>",
601
+ city: "Lake Daryl",
602
+ state: "Virginia",
603
+ taxIdentificationNumber: "IN27AAEPM0111C1ZQ",
604
+ businessName: "<value>",
605
+ },
606
+ shippingAddress: {
607
+ id: "<id>",
608
+ firstName: "Samantha",
609
+ lastName: "Denesik",
610
+ countryCode: "ET",
611
+ phone: "(209) 532-8483 x4282",
612
+ email: "Kelley53@hotmail.com",
613
+ addressLine1: "7485 Conn Pike",
614
+ addressLine2: "-",
615
+ landmark: "<value>",
616
+ pincode: "<value>",
617
+ city: "North Miami",
618
+ state: "Montana",
619
+ taxIdentificationNumber: "123456789",
620
+ businessName: "<value>",
621
+ },
622
+ },
623
+ });
624
+
625
+ if (!res.ok) {
626
+ throw res.error;
627
+ }
628
+
629
+ const { value: result } = res;
630
+
631
+ // Handle the result
632
+ console.log(result);
633
+ }
634
+
635
+ run();
636
+ ```
637
+
638
+ ### Parameters
639
+
640
+ | Parameter | Type | Required | Description |
641
+ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
642
+ | `request` | [operations.CreateCartAddressRequest](../../models/operations/createcartaddressrequest.md) | :heavy_check_mark: | The request object to use for the request. |
643
+ | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
644
+ | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
645
+ | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
646
+ | `options.serverURL` | *string* | :heavy_minus_sign: | An optional server URL to use. |
647
+
648
+ ### Response
649
+
650
+ **Promise\<[operations.CreateCartAddressResponseBody](../../models/operations/createcartaddressresponsebody.md)\>**
651
+
652
+ ### Errors
653
+
654
+ | Error Type | Status Code | Content Type |
655
+ | ------------------- | ------------------- | ------------------- |
656
+ | errors.BadRequest | 400 | application/json |
657
+ | errors.Unauthorized | 401 | application/json |
658
+ | errors.NotFound | 404 | application/json |
659
+ | errors.CeError | 4XX, 5XX | \*/\* |
660
+
661
+ ## applyCoupon
662
+
663
+ Apply coupon
664
+
665
+ ### Example Usage
666
+
667
+ ```typescript
668
+ import { CeStorefront } from "ce-storefront";
669
+
670
+ const ceStorefront = new CeStorefront({
671
+ authorization: "<YOUR_BEARER_TOKEN_HERE>",
672
+ });
673
+
674
+ async function run() {
675
+ const result = await ceStorefront.carts.applyCoupon({
676
+ id: "<id>",
677
+ requestBody: {
678
+ couponCode: "FLAT100OFF",
679
+ },
680
+ });
681
+
682
+ // Handle the result
683
+ console.log(result);
684
+ }
685
+
686
+ run();
687
+ ```
688
+
689
+ ### Standalone function
690
+
691
+ The standalone function version of this method:
692
+
693
+ ```typescript
694
+ import { CeStorefrontCore } from "ce-storefront/core.js";
695
+ import { cartsApplyCoupon } from "ce-storefront/funcs/cartsApplyCoupon.js";
696
+
697
+ // Use `CeStorefrontCore` for best tree-shaking performance.
698
+ // You can create one instance of it to use across an application.
699
+ const ceStorefront = new CeStorefrontCore({
700
+ authorization: "<YOUR_BEARER_TOKEN_HERE>",
701
+ });
702
+
703
+ async function run() {
704
+ const res = await cartsApplyCoupon(ceStorefront, {
705
+ id: "<id>",
706
+ requestBody: {
707
+ couponCode: "FLAT100OFF",
708
+ },
709
+ });
710
+
711
+ if (!res.ok) {
712
+ throw res.error;
713
+ }
714
+
715
+ const { value: result } = res;
716
+
717
+ // Handle the result
718
+ console.log(result);
719
+ }
720
+
721
+ run();
722
+ ```
723
+
724
+ ### Parameters
725
+
726
+ | Parameter | Type | Required | Description |
727
+ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
728
+ | `request` | [operations.ApplyCouponRequest](../../models/operations/applycouponrequest.md) | :heavy_check_mark: | The request object to use for the request. |
729
+ | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
730
+ | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
731
+ | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
732
+ | `options.serverURL` | *string* | :heavy_minus_sign: | An optional server URL to use. |
733
+
734
+ ### Response
735
+
736
+ **Promise\<[operations.ApplyCouponResponseBody](../../models/operations/applycouponresponsebody.md)\>**
737
+
738
+ ### Errors
739
+
740
+ | Error Type | Status Code | Content Type |
741
+ | ------------------- | ------------------- | ------------------- |
742
+ | errors.BadRequest | 400 | application/json |
743
+ | errors.Unauthorized | 401 | application/json |
744
+ | errors.CeError | 4XX, 5XX | \*/\* |
745
+
746
+ ## removeCoupon
747
+
748
+ remove coupon from cart
749
+
750
+ ### Example Usage
751
+
752
+ ```typescript
753
+ import { CeStorefront } from "ce-storefront";
754
+
755
+ const ceStorefront = new CeStorefront({
756
+ authorization: "<YOUR_BEARER_TOKEN_HERE>",
757
+ });
758
+
759
+ async function run() {
760
+ const result = await ceStorefront.carts.removeCoupon({
761
+ id: "<id>",
762
+ });
763
+
764
+ // Handle the result
765
+ console.log(result);
766
+ }
767
+
768
+ run();
769
+ ```
770
+
771
+ ### Standalone function
772
+
773
+ The standalone function version of this method:
774
+
775
+ ```typescript
776
+ import { CeStorefrontCore } from "ce-storefront/core.js";
777
+ import { cartsRemoveCoupon } from "ce-storefront/funcs/cartsRemoveCoupon.js";
778
+
779
+ // Use `CeStorefrontCore` for best tree-shaking performance.
780
+ // You can create one instance of it to use across an application.
781
+ const ceStorefront = new CeStorefrontCore({
782
+ authorization: "<YOUR_BEARER_TOKEN_HERE>",
783
+ });
784
+
785
+ async function run() {
786
+ const res = await cartsRemoveCoupon(ceStorefront, {
787
+ id: "<id>",
788
+ });
789
+
790
+ if (!res.ok) {
791
+ throw res.error;
792
+ }
793
+
794
+ const { value: result } = res;
795
+
796
+ // Handle the result
797
+ console.log(result);
798
+ }
799
+
800
+ run();
801
+ ```
802
+
803
+ ### Parameters
804
+
805
+ | Parameter | Type | Required | Description |
806
+ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
807
+ | `request` | [operations.RemoveCouponRequest](../../models/operations/removecouponrequest.md) | :heavy_check_mark: | The request object to use for the request. |
808
+ | `options` | RequestOptions | :heavy_minus_sign: | Used to set various options for making HTTP requests. |
809
+ | `options.fetchOptions` | [RequestInit](https://developer.mozilla.org/en-US/docs/Web/API/Request/Request#options) | :heavy_minus_sign: | Options that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All `Request` options, except `method` and `body`, are allowed. |
810
+ | `options.retries` | [RetryConfig](../../lib/utils/retryconfig.md) | :heavy_minus_sign: | Enables retrying HTTP requests under certain failure conditions. |
811
+ | `options.serverURL` | *string* | :heavy_minus_sign: | An optional server URL to use. |
812
+
813
+ ### Response
814
+
815
+ **Promise\<[operations.RemoveCouponResponseBody](../../models/operations/removecouponresponsebody.md)\>**
816
+
817
+ ### Errors
818
+
819
+ | Error Type | Status Code | Content Type |
820
+ | ------------------- | ------------------- | ------------------- |
821
+ | errors.BadRequest | 400 | application/json |
822
+ | errors.Unauthorized | 401 | application/json |
348
823
  | errors.CeError | 4XX, 5XX | \*/\* |
@@ -106,6 +106,7 @@ async function run() {
106
106
  const result = await ceStorefront.customers.createAddress({
107
107
  userId: "<id>",
108
108
  requestBody: {
109
+ id: "<id>",
109
110
  firstName: "Lia",
110
111
  lastName: "Kuhic",
111
112
  countryCode: "MZ",
@@ -147,6 +148,7 @@ async function run() {
147
148
  const res = await customersCreateAddress(ceStorefront, {
148
149
  userId: "<id>",
149
150
  requestBody: {
151
+ id: "<id>",
150
152
  firstName: "Lia",
151
153
  lastName: "Kuhic",
152
154
  countryCode: "MZ",
@@ -297,6 +299,7 @@ async function run() {
297
299
  userId: "<id>",
298
300
  addressId: "<id>",
299
301
  requestBody: {
302
+ id: "<id>",
300
303
  firstName: "Aniyah",
301
304
  lastName: "Franey",
302
305
  countryCode: "LT",
@@ -339,6 +342,7 @@ async function run() {
339
342
  userId: "<id>",
340
343
  addressId: "<id>",
341
344
  requestBody: {
345
+ id: "<id>",
342
346
  firstName: "Aniyah",
343
347
  lastName: "Franey",
344
348
  countryCode: "LT",
@@ -0,0 +1,16 @@
1
+ import { CeStorefrontCore } from "../core.js";
2
+ import { RequestOptions } from "../lib/sdks.js";
3
+ import { CeError } from "../models/errors/ceerror.js";
4
+ import { ConnectionError, InvalidRequestError, RequestAbortedError, RequestTimeoutError, UnexpectedClientError } from "../models/errors/httpclienterrors.js";
5
+ import * as errors from "../models/errors/index.js";
6
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
7
+ import * as operations from "../models/operations/index.js";
8
+ import { Result } from "../types/fp.js";
9
+ /**
10
+ * Apply coupon
11
+ *
12
+ * @remarks
13
+ * Apply coupon
14
+ */
15
+ export declare function cartsApplyCoupon(client: CeStorefrontCore, request: operations.ApplyCouponRequest, options?: RequestOptions): Promise<Result<operations.ApplyCouponResponseBody, errors.BadRequest | errors.Unauthorized | CeError | SDKValidationError | UnexpectedClientError | InvalidRequestError | RequestAbortedError | RequestTimeoutError | ConnectionError>>;
16
+ //# sourceMappingURL=cartsApplyCoupon.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cartsApplyCoupon.d.ts","sourceRoot":"","sources":["../../src/funcs/cartsApplyCoupon.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAK9C,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAGhD,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AACtD,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACtB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,KAAK,MAAM,MAAM,2BAA2B,CAAC;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAE5E,OAAO,KAAK,UAAU,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAExC;;;;;GAKG;AACH,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,gBAAgB,EACxB,OAAO,EAAE,UAAU,CAAC,kBAAkB,EACtC,OAAO,CAAC,EAAE,cAAc,GACvB,OAAO,CACR,MAAM,CACJ,UAAU,CAAC,uBAAuB,EAChC,MAAM,CAAC,UAAU,GACjB,MAAM,CAAC,YAAY,GACnB,OAAO,GACP,kBAAkB,GAClB,qBAAqB,GACrB,mBAAmB,GACnB,mBAAmB,GACnB,mBAAmB,GACnB,eAAe,CAClB,CACF,CAoGA"}