UNPKG

pancake-client-sdk

Version:
92 lines 2.65 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ReviewResource = void 0; const base_1 = require("./base"); class ReviewResource extends base_1.BaseResource { /** * Get list of reviews */ async list(params) { return this.client.get(this.getShopPath('/reviews'), params); } /** * Get review by ID */ async getById(reviewId) { return this.client.get(this.getShopPath(`/reviews/${reviewId}`)); } /** * Create new review */ async create(data) { return this.client.post(this.getShopPath('/reviews'), data); } /** * Update review */ async update(reviewId, data) { return this.client.put(this.getShopPath(`/reviews/${reviewId}`), data); } /** * Delete review */ async delete(reviewId) { return this.client.delete(this.getShopPath(`/reviews/${reviewId}`)); } /** * Reply to review */ async reply(reviewId, reply) { return this.client.post(this.getShopPath(`/reviews/${reviewId}/reply`), { reply }); } /** * Get product review summary */ async getProductSummary(productId) { return this.client.get(this.getShopPath(`/products/${productId}/review-summary`)); } /** * Get product reviews */ async getProductReviews(productId, params) { return this.client.get(this.getShopPath(`/products/${productId}/reviews`), params); } /** * Get customer reviews */ async getCustomerReviews(customerId, params) { return this.client.get(this.getShopPath(`/customers/${customerId}/reviews`), params); } /** * Import platform reviews */ async importPlatformReviews(platform, force) { return this.client.post(this.getShopPath(`/reviews/import/${platform}`), { force }); } /** * Sync platform reviews */ async syncPlatformReviews(platform) { return this.client.post(this.getShopPath(`/reviews/sync/${platform}`), {}); } /** * Get review analytics */ async getAnalytics(params) { return this.client.get(this.getShopPath('/reviews/analytics'), params); } /** * Export reviews */ async export(params) { return this.client.post(this.getShopPath('/reviews/export'), params || {}); } /** * Moderate review */ async moderate(reviewId, action, reason) { return this.client.post(this.getShopPath(`/reviews/${reviewId}/moderate`), { action, reason }); } } exports.ReviewResource = ReviewResource; //# sourceMappingURL=review.js.map