omnisend-node-sdk
Version:
🔹 Typesafe Omnisend API SDK for Node.js
111 lines (110 loc) • 5.74 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Carts = void 0;
const http_client_1 = require("../http-client");
class Carts {
constructor(http) {
/**
* No description
*
* @tags Carts
* @name GetCartsCartId
* @summary Get cart
* @request GET:/carts/{cartID}
* @secure
*/
this.getCartsCartId = (cartId, params = {}) => this.http.request(Object.assign({ path: `/carts/${cartId}`, method: "GET", secure: true, format: "json" }, params));
/**
* @description Replace (update) existing cart. All stored cart data will be overwriten with request data. This method used to replace cart with all its products - use it if you are posting full cart data.
*
* @tags Carts
* @name PutCartsCartId
* @summary Replace existing cart
* @request PUT:/carts/{cartID}
* @secure
*/
this.putCartsCartId = (cartId, data, params = {}) => this.http.request(Object.assign({ path: `/carts/${cartId}`, method: "PUT", body: data, secure: true, type: http_client_1.ContentType.Json, format: "json" }, params));
/**
* @description Update cart. Use to update cart info - add products or update existing in cart products.
*
* @tags Carts
* @name PatchCartsCartId
* @summary Update cart
* @request PATCH:/carts/{cartID}
* @secure
*/
this.patchCartsCartId = (cartId, data, params = {}) => this.http.request(Object.assign({ path: `/carts/${cartId}`, method: "PATCH", body: data, secure: true, type: http_client_1.ContentType.Json, format: "json" }, params));
/**
* @description Delete cart. **Curl example:** ```php curl -X DELETE "https://api.omnisend.com/v3/carts/47841398" ```
*
* @tags Carts
* @name DeleteCartsCartId
* @summary Delete cart
* @request DELETE:/carts/{cartID}
* @secure
*/
this.deleteCartsCartId = (cartId, params = {}) => this.http.request(Object.assign({ path: `/carts/${cartId}`, method: "DELETE", secure: true }, params));
/**
* @description **Sorting:** | **Parameter** | **Sort order** | **Description** | | --- | ---| --- | | createdAt | DESC | sort by cart creation date - newest first | | updatedAt | DESC | sort by cart update date - newest first | | cartSum | DESC | sort by cart total sum - biggest on top |
*
* @tags Carts
* @name GetCarts
* @summary List carts
* @request GET:/carts
* @secure
*/
this.getCarts = (query, params = {}) => this.http.request(Object.assign({ path: `/carts`, method: "GET", query, secure: true, format: "json" }, params));
/**
* @description While posting new cart `email` or/and `contactID` must be provided.
*
* @tags Carts
* @name PostCarts
* @summary Create new cart
* @request POST:/carts
* @secure
*/
this.postCarts = (data, params = {}) => this.http.request(Object.assign({ path: `/carts`, method: "POST", body: data, secure: true, type: http_client_1.ContentType.Json, format: "json" }, params));
/**
* @description Add product to cart.
*
* @tags Carts
* @name PostCartsCartIdProducts
* @summary Add product to cart
* @request POST:/carts/{cartID}/products
* @secure
*/
this.postCartsCartIdProducts = (cartId, data, params = {}) => this.http.request(Object.assign({ path: `/carts/${cartId}/products`, method: "POST", body: data, secure: true, type: http_client_1.ContentType.Json, format: "json" }, params));
/**
* @description Replace existing product (change quantity, price or whole product)
*
* @tags Carts
* @name PutCartsCartIdProductsCartProductId
* @summary Replace product
* @request PUT:/carts/{cartID}/products/{cartProductID}
* @secure
*/
this.putCartsCartIdProductsCartProductId = (cartId, cartProductId, data, params = {}) => this.http.request(Object.assign({ path: `/carts/${cartId}/products/${cartProductId}`, method: "PUT", body: data, secure: true, type: http_client_1.ContentType.Json, format: "json" }, params));
/**
* @description Update product in cart - change quantity, price, etc. Pass only fields, you want to update.
*
* @tags Carts
* @name PatchCartsCartIdProductsCartProductId
* @summary Update product
* @request PATCH:/carts/{cartID}/products/{cartProductID}
* @secure
*/
this.patchCartsCartIdProductsCartProductId = (cartId, cartProductId, data, params = {}) => this.http.request(Object.assign({ path: `/carts/${cartId}/products/${cartProductId}`, method: "PATCH", body: data, secure: true, type: http_client_1.ContentType.Json, format: "json" }, params));
/**
* @description Remove product from cart. **Curl example:** ```php curl -X DELETE "https://api.omnisend.com/v3/carts/47841398/products/prod478541" ```
*
* @tags Carts
* @name DeleteCartsCartIdProductsCartProductId
* @summary Remove product from cart
* @request DELETE:/carts/{cartID}/products/{cartProductID}
* @secure
*/
this.deleteCartsCartIdProductsCartProductId = (cartId, cartProductId, params = {}) => this.http.request(Object.assign({ path: `/carts/${cartId}/products/${cartProductId}`, method: "DELETE", secure: true }, params));
this.http = http;
}
}
exports.Carts = Carts;