pancake-client-sdk
Version:
Official TypeScript SDK for Pancake POS API
104 lines • 3.37 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MarketplaceResource = void 0;
const base_1 = require("./base");
class MarketplaceResource extends base_1.BaseResource {
/**
* Get list of connected marketplace accounts
*/
async listAccounts() {
return this.client.get(this.getShopPath('/marketplace/accounts'));
}
/**
* Get marketplace account by ID
*/
async getAccount(accountId) {
return this.client.get(this.getShopPath(`/marketplace/accounts/${accountId}`));
}
/**
* Connect new marketplace account
*/
async connect(data) {
return this.client.post(this.getShopPath('/marketplace/accounts'), data);
}
/**
* Disconnect marketplace account
*/
async disconnect(accountId) {
return this.client.delete(this.getShopPath(`/marketplace/accounts/${accountId}`));
}
/**
* Update marketplace settings
*/
async updateSettings(accountId, settings) {
return this.client.put(this.getShopPath(`/marketplace/accounts/${accountId}/settings`), settings);
}
/**
* Start sync process
*/
async startSync(accountId, type, params) {
return this.client.post(this.getShopPath(`/marketplace/accounts/${accountId}/sync`), { type, ...params });
}
/**
* Get sync status
*/
async getSyncStatus(syncId) {
return this.client.get(this.getShopPath(`/marketplace/sync/${syncId}`));
}
/**
* List marketplace products
*/
async listProducts(accountId, params) {
return this.client.get(this.getShopPath(`/marketplace/accounts/${accountId}/products`), params);
}
/**
* Update marketplace product
*/
async updateProduct(accountId, platformProductId, data) {
return this.client.put(this.getShopPath(`/marketplace/accounts/${accountId}/products/${platformProductId}`), data);
}
/**
* List marketplace orders
*/
async listOrders(accountId, params) {
return this.client.get(this.getShopPath(`/marketplace/accounts/${accountId}/orders`), params);
}
/**
* Get logistics settings
*/
async getLogistics(accountId) {
return this.client.get(this.getShopPath(`/marketplace/accounts/${accountId}/logistics`));
}
/**
* Update logistics settings
*/
async updateLogistics(accountId, data) {
return this.client.put(this.getShopPath(`/marketplace/accounts/${accountId}/logistics`), data);
}
/**
* Get platform categories
*/
async getCategories(platform, params) {
return this.client.get(this.getShopPath(`/marketplace/${platform}/categories`), params);
}
/**
* Get marketplace statistics
*/
async getStats(params) {
return this.client.get(this.getShopPath('/marketplace/stats'), params);
}
/**
* Map local product to marketplace
*/
async mapProduct(accountId, data) {
return this.client.post(this.getShopPath(`/marketplace/accounts/${accountId}/map-product`), data);
}
/**
* Get OAuth authorization URL
*/
async getAuthUrl(platform) {
return this.client.get(this.getShopPath(`/marketplace/${platform}/auth-url`));
}
}
exports.MarketplaceResource = MarketplaceResource;
//# sourceMappingURL=marketplace.js.map