UNPKG

pancake-client-sdk

Version:
105 lines 2.85 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.TaskResource = void 0; const base_1 = require("./base"); class TaskResource extends base_1.BaseResource { /** * Get list of tasks */ async list(params) { return this.client.get(this.getShopPath('/tasks'), params); } /** * Get task by ID */ async getById(taskId) { return this.client.get(this.getShopPath(`/tasks/${taskId}`)); } /** * Create new task */ async create(data) { return this.client.post(this.getShopPath('/tasks'), data); } /** * Update task */ async update(taskId, data) { return this.client.put(this.getShopPath(`/tasks/${taskId}`), data); } /** * Delete task */ async delete(taskId) { return this.client.delete(this.getShopPath(`/tasks/${taskId}`)); } /** * Complete task */ async complete(taskId, note) { return this.client.post(this.getShopPath(`/tasks/${taskId}/complete`), { note }); } /** * Cancel task */ async cancel(taskId, reason) { return this.client.post(this.getShopPath(`/tasks/${taskId}/cancel`), { reason }); } /** * Get task comments */ async listComments(taskId) { return this.client.get(this.getShopPath(`/tasks/${taskId}/comments`)); } /** * Add comment to task */ async addComment(taskId, data) { return this.client.post(this.getShopPath(`/tasks/${taskId}/comments`), data); } /** * Delete comment */ async deleteComment(taskId, commentId) { return this.client.delete(this.getShopPath(`/tasks/${taskId}/comments/${commentId}`)); } /** * Get tasks statistics */ async getStats(params) { return this.client.get(this.getShopPath('/tasks/stats'), params); } /** * Get tasks by customer */ async getCustomerTasks(customerId, params) { return this.client.get(this.getShopPath(`/customers/${customerId}/tasks`), params); } /** * Get tasks by order */ async getOrderTasks(orderId, params) { return this.client.get(this.getShopPath(`/orders/${orderId}/tasks`), params); } /** * Bulk update task status */ async bulkUpdateStatus(taskIds, status, note) { return this.client.post(this.getShopPath('/tasks/bulk-update-status'), { task_ids: taskIds, status, note }); } /** * Bulk assign tasks */ async bulkAssign(taskIds, assigneeId) { return this.client.post(this.getShopPath('/tasks/bulk-assign'), { task_ids: taskIds, assignee_id: assigneeId }); } } exports.TaskResource = TaskResource; //# sourceMappingURL=task.js.map