UNPKG

@batlify/mscms2-api

Version:

MineStoreCMS v3 API package

64 lines (63 loc) 1.97 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 Packages extends context_1.default { async add(id, promoted, payment_type) { return this.request(true, 'POST', `/cart/add/${id}?promoted=${promoted}&payment_type=${payment_type}`) .then((response) => { return response; }) .catch((e) => { throw e; }); } async remove(id) { return this.request(true, 'POST', `/cart/remove/${id}`) .then((response) => { return response; }) .catch((e) => { throw e; }); } async quantity(id, quantity) { return this.request(true, 'POST', `/cart/reload/${id}?count=${quantity}`) .then((response) => { return response; }) .catch((e) => { throw e; }); } async price(id, price) { return this.request(true, 'POST', `/cart/changePrice/${id}`, { price: price }) .then((response) => { return response; }) .catch((e) => { throw e; }); } async variable(id, variable, value) { return this.request(true, 'POST', `/cart/setVariable/${id}`, { var_id: variable, var_value: value }) .then((response) => { return response; }) .catch((e) => { throw e; }); } async selectServer(id, server) { return this.request(true, 'POST', `/cart/setSelectedServer/${id}`, { server_id: server }) .then((response) => { return response; }) .catch((e) => { throw e; }); } } exports.default = Packages;