UNPKG

@batlify/mscms2-api

Version:

MineStoreCMS v3 API package

57 lines (56 loc) 1.52 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const context_1 = __importDefault(require("../../../core/context")); class ProductsAuthorized extends context_1.default { /* * Get product by id * @Note Authorization is needed * @param id Product id * @returns response * @throws Error */ async get(id) { return this.request(true, 'POST', `/items/get/${id}`) .then((response) => { return response; }) .catch((e) => { throw e; }); } /* * Get products by category * @Note Authorization is needed * @param path Category path * @returns response * @throws Error */ async getFromCategory(path) { return this.request(true, 'POST', `/categories/get/${path}`) .then((response) => { return response; }) .catch((e) => { throw e; }); } /* * Get featured products * @Note Authorization is needed * @returns response * @throws Error */ async getFeatured() { return this.request(true, 'POST', `/items/getFeaturedDeals `) .then((response) => { return response; }) .catch((e) => { throw e; }); } } exports.default = ProductsAuthorized;