UNPKG

pancake-client-sdk

Version:
98 lines 2.93 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CRMResource = void 0; const base_1 = require("./base"); class CRMResource extends base_1.BaseResource { /** * Get list of CRM tables */ async listTables() { return this.client.get(this.getShopPath('/crm/tables')); } /** * Get table by ID */ async getTable(tableId) { return this.client.get(this.getShopPath(`/crm/tables/${tableId}`)); } /** * Create new table */ async createTable(data) { return this.client.post(this.getShopPath('/crm/tables'), data); } /** * Update table */ async updateTable(tableId, data) { return this.client.put(this.getShopPath(`/crm/tables/${tableId}`), data); } /** * Delete table */ async deleteTable(tableId) { return this.client.delete(this.getShopPath(`/crm/tables/${tableId}`)); } /** * Get list of records in a table */ async listRecords(tableId, params) { return this.client.get(this.getShopPath(`/crm/tables/${tableId}/records`), params); } /** * Get record by ID */ async getRecord(tableId, recordId) { return this.client.get(this.getShopPath(`/crm/tables/${tableId}/records/${recordId}`)); } /** * Create new record */ async createRecord(tableId, data) { return this.client.post(this.getShopPath(`/crm/tables/${tableId}/records`), data); } /** * Update record */ async updateRecord(tableId, recordId, data) { return this.client.put(this.getShopPath(`/crm/tables/${tableId}/records/${recordId}`), data); } /** * Delete record */ async deleteRecord(tableId, recordId) { return this.client.delete(this.getShopPath(`/crm/tables/${tableId}/records/${recordId}`)); } /** * Get list of CRM profiles */ async listProfiles() { return this.client.get(this.getShopPath('/crm/profiles')); } /** * Get record history */ async getRecordHistory(tableId, recordId) { return this.client.get(this.getShopPath(`/crm/tables/${tableId}/records/${recordId}/history`)); } /** * Get record comments */ async listComments(tableId, recordId) { return this.client.get(this.getShopPath(`/crm/tables/${tableId}/records/${recordId}/comments`)); } /** * Add comment to record */ async createComment(tableId, recordId, data) { return this.client.post(this.getShopPath(`/crm/tables/${tableId}/records/${recordId}/comments`), data); } /** * Delete comment */ async deleteComment(tableId, recordId, commentId) { return this.client.delete(this.getShopPath(`/crm/tables/${tableId}/records/${recordId}/comments/${commentId}`)); } } exports.CRMResource = CRMResource; //# sourceMappingURL=crm.js.map