omnisend-node-sdk
Version:
🔹 Typesafe Omnisend API SDK for Node.js
61 lines (60 loc) • 3.04 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.Products = void 0;
const http_client_1 = require("../http-client");
class Products {
constructor(http) {
/**
* No description
*
* @tags Products
* @name GetProductsProductId
* @summary Get product's info
* @request GET:/products/{productID}
* @secure
*/
this.getProductsProductId = (productId, params = {}) => this.http.request(Object.assign({ path: `/products/${productId}`, method: "GET", secure: true, format: "json" }, params));
/**
* @description Replace product. Pass all product info. Not passed fields will be deleted. **Variants** At least one variant is required for each product. A variant can use the same **ID** (`productID`) and **title** (`title`) as the parent product.
*
* @tags Products
* @name PutProductsProductId
* @summary Replace product
* @request PUT:/products/{productID}
* @secure
*/
this.putProductsProductId = (productId, data, params = {}) => this.http.request(Object.assign({ path: `/products/${productId}`, method: "PUT", body: data, secure: true, type: http_client_1.ContentType.Json, format: "json" }, params));
/**
* @description **Curl example:** ```php curl -X DELETE "https://api.omnisend.com/v3/products/prod478541" ```
*
* @tags Products
* @name DeleteProductsProductId
* @summary Delete product
* @request DELETE:/products/{productID}
* @secure
*/
this.deleteProductsProductId = (productId, params = {}) => this.http.request(Object.assign({ path: `/products/${productId}`, method: "DELETE", secure: true }, params));
/**
* @description **Sorting:** | **Parameter** | **Sort order** | **Description** | | --- | ---| --- | | createdAt | DESC | Product creation date - recent first | | updatedAt | DESC | Product update date - recent first |
*
* @tags Products
* @name GetProducts
* @summary List products
* @request GET:/products
* @secure
*/
this.getProducts = (query, params = {}) => this.http.request(Object.assign({ path: `/products`, method: "GET", query, secure: true, format: "json" }, params));
/**
* @description Create new product. **Variants** At least one variant is required for each product. A variant can use the same **ID** (`productID`) and **title** (`title`) as the parent product.
*
* @tags Products
* @name PostProducts
* @summary Create product
* @request POST:/products
* @secure
*/
this.postProducts = (data, params = {}) => this.http.request(Object.assign({ path: `/products`, method: "POST", body: data, secure: true, type: http_client_1.ContentType.Json, format: "json" }, params));
this.http = http;
}
}
exports.Products = Products;