n8n-nodes-livo
Version:
n8n Livo App integration with triggers and actions for orders, products, customers, and repairs
1,177 lines (1,176 loc) • 55.5 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Livo = void 0;
async function executeOrderOperation(operation, itemIndex, credentials) {
const baseUrl = credentials.environment;
const apiKey = credentials.apiKey;
const requestOptions = {
headers: {
'X-API-Key': apiKey,
'Content-Type': 'application/json',
},
method: 'GET',
url: '',
json: true,
skipSslCertificateValidation: true,
};
switch (operation) {
case 'getOrders':
const pageSize = this.getNodeParameter('pageSize', itemIndex);
const current = this.getNodeParameter('current', itemIndex);
const keyword = this.getNodeParameter('keyword', itemIndex);
const status = this.getNodeParameter('status', itemIndex);
const startDate = this.getNodeParameter('startDate', itemIndex);
const endDate = this.getNodeParameter('endDate', itemIndex);
const sortBy = this.getNodeParameter('sortBy', itemIndex);
requestOptions.url = `${baseUrl}/api/order?Current=${current}&PageSize=${pageSize}&Keyword=${encodeURIComponent(keyword)}&Status=${encodeURIComponent(status)}&StartDate=${encodeURIComponent(startDate)}&EndDate=${encodeURIComponent(endDate)}&SortBy=${encodeURIComponent(sortBy)}`;
break;
case 'getOrderDetail':
const orderId = this.getNodeParameter('orderId', itemIndex);
requestOptions.url = `${baseUrl}/api/order?Id=${orderId}`;
break;
case 'createOrder':
requestOptions.method = 'POST';
requestOptions.url = `${baseUrl}/api/order`;
requestOptions.body = {
customerId: this.getNodeParameter('customerId', itemIndex),
items: JSON.parse(this.getNodeParameter('items', itemIndex)),
totalAmount: this.getNodeParameter('totalAmount', itemIndex),
notes: this.getNodeParameter('notes', itemIndex),
};
break;
case 'updateOrder':
const updateOrderId = this.getNodeParameter('orderId', itemIndex);
requestOptions.method = 'PUT';
requestOptions.url = `${baseUrl}/api/order`;
requestOptions.body = {
id: updateOrderId,
customerId: this.getNodeParameter('customerId', itemIndex),
items: JSON.parse(this.getNodeParameter('items', itemIndex)),
totalAmount: this.getNodeParameter('totalAmount', itemIndex),
notes: this.getNodeParameter('notes', itemIndex),
};
break;
case 'payOrder':
const payOrderId = this.getNodeParameter('orderId', itemIndex);
const paymentMethod = this.getNodeParameter('paymentMethod', itemIndex);
requestOptions.method = 'POST';
requestOptions.url = `${baseUrl}/api/order/payment-update`;
requestOptions.body = {
orderId: payOrderId,
paymentMethod: paymentMethod,
};
break;
}
return await this.helpers.httpRequest(requestOptions);
}
async function executeProductOperation(operation, itemIndex, credentials) {
const baseUrl = credentials.environment;
const apiKey = credentials.apiKey;
const requestOptions = {
headers: {
'X-API-Key': apiKey,
'Content-Type': 'application/json',
},
method: 'GET',
url: '',
json: true,
skipSslCertificateValidation: true,
};
switch (operation) {
case 'getProducts':
const pageSize = this.getNodeParameter('pageSize', itemIndex);
const current = this.getNodeParameter('current', itemIndex);
const keyword = this.getNodeParameter('keyword', itemIndex);
const isLoadMore = this.getNodeParameter('isLoadMore', itemIndex);
requestOptions.url = `${baseUrl}/api/ecommerce/product?Current=${current}&PageSize=${pageSize}&Keyword=${encodeURIComponent(keyword)}&isLoadMore=${isLoadMore}`;
break;
case 'getProductDetail':
const productId = this.getNodeParameter('productId', itemIndex);
requestOptions.url = `${baseUrl}/api/ecommerce/product/${productId}`;
break;
case 'createProduct':
requestOptions.method = 'POST';
requestOptions.url = `${baseUrl}/api/ecommerce/product`;
requestOptions.body = {
name: this.getNodeParameter('productName', itemIndex),
sku: this.getNodeParameter('sku', itemIndex),
price: this.getNodeParameter('price', itemIndex),
category: this.getNodeParameter('category', itemIndex),
description: this.getNodeParameter('description', itemIndex),
};
break;
case 'updateProduct':
const updateProductId = this.getNodeParameter('productId', itemIndex);
requestOptions.method = 'PUT';
requestOptions.url = `${baseUrl}/api/ecommerce/product/${updateProductId}`;
requestOptions.body = {
name: this.getNodeParameter('productName', itemIndex),
sku: this.getNodeParameter('sku', itemIndex),
price: this.getNodeParameter('price', itemIndex),
category: this.getNodeParameter('category', itemIndex),
description: this.getNodeParameter('description', itemIndex),
};
break;
case 'deleteProduct':
const deleteProductId = this.getNodeParameter('productId', itemIndex);
requestOptions.method = 'DELETE';
requestOptions.url = `${baseUrl}/api/ecommerce/product/${deleteProductId}`;
break;
}
return await this.helpers.httpRequest(requestOptions);
}
async function executeRepairOperation(operation, itemIndex, credentials) {
const baseUrl = credentials.environment;
const apiKey = credentials.apiKey;
const requestOptions = {
headers: {
'X-API-Key': apiKey,
'Content-Type': 'application/json',
},
method: 'GET',
url: '',
json: true,
skipSslCertificateValidation: true,
};
switch (operation) {
case 'getRepairs':
const pageSize = this.getNodeParameter('pageSize', itemIndex);
const current = this.getNodeParameter('current', itemIndex);
const keyword = this.getNodeParameter('keyword', itemIndex);
const status = this.getNodeParameter('status', itemIndex);
const startDate = this.getNodeParameter('startDate', itemIndex);
const endDate = this.getNodeParameter('endDate', itemIndex);
requestOptions.url = `${baseUrl}/api/ecommerce/repairwarrantyticket?Current=${current}&PageSize=${pageSize}&Keyword=${encodeURIComponent(keyword)}&Status=${encodeURIComponent(status)}&StartDate=${encodeURIComponent(startDate)}&EndDate=${encodeURIComponent(endDate)}`;
break;
case 'getRepairDetail':
const repairId = this.getNodeParameter('repairId', itemIndex);
requestOptions.url = `${baseUrl}/api/ecommerce/repairwarrantyticket/${repairId}`;
break;
case 'createRepair':
requestOptions.method = 'POST';
requestOptions.url = `${baseUrl}/api/ecommerce/repairwarrantyticket`;
requestOptions.body = {
ticketType: this.getNodeParameter('ticketType', itemIndex),
type: this.getNodeParameter('repairType', itemIndex),
customerId: this.getNodeParameter('repairCustomerId', itemIndex),
brankId: this.getNodeParameter('brankId', itemIndex),
repairDevice: {
name: this.getNodeParameter('deviceName', itemIndex),
deviceCategoryId: this.getNodeParameter('deviceCategoryId', itemIndex),
serial: this.getNodeParameter('serial', itemIndex),
lockScreen: {
key: this.getNodeParameter('lockScreenKey', itemIndex),
value: this.getNodeParameter('lockScreenValue', itemIndex)
},
repairAccessorys: JSON.parse(this.getNodeParameter('repairAccessorys', itemIndex)),
repairDeviceStates: JSON.parse(this.getNodeParameter('repairDeviceStates', itemIndex)),
repairServices: JSON.parse(this.getNodeParameter('repairServices', itemIndex))
}
};
break;
case 'updateRepair':
const updateRepairId = this.getNodeParameter('repairId', itemIndex);
requestOptions.method = 'PUT';
requestOptions.url = `${baseUrl}/api/ecommerce/repairwarrantyticket/${updateRepairId}`;
requestOptions.body = {
id: updateRepairId,
ticketType: this.getNodeParameter('ticketType', itemIndex),
type: this.getNodeParameter('repairType', itemIndex),
customerId: this.getNodeParameter('repairCustomerId', itemIndex),
brankId: this.getNodeParameter('brankId', itemIndex),
repairDevice: {
name: this.getNodeParameter('deviceName', itemIndex),
deviceCategoryId: this.getNodeParameter('deviceCategoryId', itemIndex),
serial: this.getNodeParameter('serial', itemIndex),
lockScreen: {
key: this.getNodeParameter('lockScreenKey', itemIndex),
value: this.getNodeParameter('lockScreenValue', itemIndex)
},
repairAccessorys: JSON.parse(this.getNodeParameter('repairAccessorys', itemIndex)),
repairDeviceStates: JSON.parse(this.getNodeParameter('repairDeviceStates', itemIndex)),
repairServices: JSON.parse(this.getNodeParameter('repairServices', itemIndex))
}
};
break;
case 'payRepair':
const payRepairId = this.getNodeParameter('repairId', itemIndex);
const repairPaymentMethod = this.getNodeParameter('repairPaymentMethod', itemIndex);
const finalCost = this.getNodeParameter('finalCost', itemIndex);
requestOptions.method = 'POST';
requestOptions.url = `${baseUrl}/api/ecommerce/repairwarrantyticket/payment-update`;
requestOptions.body = {
id: payRepairId,
payment_method: repairPaymentMethod,
final_cost: finalCost,
};
break;
case 'deliverRepair':
const deliverRepairId = this.getNodeParameter('repairId', itemIndex);
requestOptions.method = 'POST';
requestOptions.url = `${baseUrl}/api/ecommerce/repairwarrantyticket/deliveryNote`;
requestOptions.body = {
id: deliverRepairId,
status: 'delivered',
};
break;
}
return await this.helpers.httpRequest(requestOptions);
}
async function executeCustomerOperation(operation, itemIndex, credentials) {
const baseUrl = credentials.environment;
const apiKey = credentials.apiKey;
const requestOptions = {
headers: {
'X-API-Key': apiKey,
'Content-Type': 'application/json',
},
method: 'GET',
url: '',
json: true,
skipSslCertificateValidation: true,
};
switch (operation) {
case 'getCustomers':
const pageSize = this.getNodeParameter('pageSize', itemIndex);
const current = this.getNodeParameter('current', itemIndex);
const keyword = this.getNodeParameter('keyword', itemIndex);
const status = this.getNodeParameter('status', itemIndex);
const startDate = this.getNodeParameter('startDate', itemIndex);
const endDate = this.getNodeParameter('endDate', itemIndex);
const sortBy = this.getNodeParameter('sortBy', itemIndex);
requestOptions.url = `${baseUrl}/api/order/customer?Current=${current}&PageSize=${pageSize}&Keyword=${encodeURIComponent(keyword)}&Status=${encodeURIComponent(status)}&StartDate=${encodeURIComponent(startDate)}&EndDate=${encodeURIComponent(endDate)}&SortBy=${encodeURIComponent(sortBy)}`;
break;
case 'getCustomerDetail':
const customerId = this.getNodeParameter('customerIdParam', itemIndex);
requestOptions.url = `${baseUrl}/api/order/customer?Id=${customerId}`;
break;
case 'createCustomer':
requestOptions.method = 'POST';
requestOptions.url = `${baseUrl}/api/order/customer`;
requestOptions.body = {
name: this.getNodeParameter('customerName', itemIndex),
email: this.getNodeParameter('email', itemIndex),
phone: this.getNodeParameter('phone', itemIndex),
address: this.getNodeParameter('address', itemIndex),
};
break;
case 'updateCustomer':
const updateCustomerId = this.getNodeParameter('customerIdParam', itemIndex);
requestOptions.method = 'PUT';
requestOptions.url = `${baseUrl}/api/order/customer`;
requestOptions.body = {
id: updateCustomerId,
name: this.getNodeParameter('customerName', itemIndex),
email: this.getNodeParameter('email', itemIndex),
phone: this.getNodeParameter('phone', itemIndex),
address: this.getNodeParameter('address', itemIndex),
};
break;
case 'deleteCustomer':
const deleteCustomerId = this.getNodeParameter('customerIdParam', itemIndex);
requestOptions.method = 'DELETE';
requestOptions.url = `${baseUrl}/api/order/customer/${deleteCustomerId}`;
break;
}
return await this.helpers.httpRequest(requestOptions);
}
class Livo {
constructor() {
this.description = {
displayName: 'Livo',
name: 'livo',
icon: 'file:livo.svg',
group: ['input', 'output'],
version: 1,
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
description: 'Interact with Livo API for orders, products, customers, and repairs',
defaults: {
name: 'Livo',
},
inputs: ['main'],
outputs: ['main'],
credentials: [
{
name: 'livoApi',
required: true,
},
],
properties: [
{
displayName: 'Resource',
name: 'resource',
type: 'options',
noDataExpression: true,
options: [
{
name: 'Orders',
value: 'orders',
},
{
name: 'Products',
value: 'products',
},
{
name: 'Repairs',
value: 'repairs',
},
{
name: 'Customers',
value: 'customers',
},
],
default: 'orders',
},
{
displayName: 'Operation',
name: 'operation',
type: 'options',
noDataExpression: true,
displayOptions: {
show: {
resource: ['orders'],
},
},
options: [
{
name: 'Get Orders',
value: 'getOrders',
action: 'Lấy danh sách đơn hàng',
},
{
name: 'Get Order Detail',
value: 'getOrderDetail',
action: 'Lấy chi tiết đơn hàng',
},
{
name: 'Create Order',
value: 'createOrder',
action: 'Tạo đơn hàng',
},
{
name: 'Update Order',
value: 'updateOrder',
action: 'Cập nhật đơn hàng',
},
{
name: 'Pay Order',
value: 'payOrder',
action: 'Thanh toán đơn hàng',
},
],
default: 'getOrders',
},
{
displayName: 'Operation',
name: 'operation',
type: 'options',
noDataExpression: true,
displayOptions: {
show: {
resource: ['products'],
},
},
options: [
{
name: 'Get Products',
value: 'getProducts',
action: 'Lấy danh sách sản phẩm',
},
{
name: 'Get Product Detail',
value: 'getProductDetail',
action: 'Lấy chi tiết sản phẩm',
},
{
name: 'Create Product',
value: 'createProduct',
action: 'Tạo sản phẩm',
},
{
name: 'Update Product',
value: 'updateProduct',
action: 'Cập nhật sản phẩm',
},
{
name: 'Delete Product',
value: 'deleteProduct',
action: 'Xoá sản phẩm',
},
],
default: 'getProducts',
},
{
displayName: 'Operation',
name: 'operation',
type: 'options',
noDataExpression: true,
displayOptions: {
show: {
resource: ['repairs'],
},
},
options: [
{
name: 'Get Repairs',
value: 'getRepairs',
action: 'Lấy danh sách phiếu sửa chữa',
},
{
name: 'Get Repair Detail',
value: 'getRepairDetail',
action: 'Lấy chi tiết phiếu sửa chữa',
},
{
name: 'Create Repair',
value: 'createRepair',
action: 'Tạo phiếu sửa chữa',
},
{
name: 'Update Repair',
value: 'updateRepair',
action: 'Cập nhật phiếu sửa chữa',
},
{
name: 'Pay Repair',
value: 'payRepair',
action: 'Thanh toán phiếu sửa chữa',
},
{
name: 'Deliver Repair',
value: 'deliverRepair',
action: 'Giao trả phiếu sửa chữa',
},
],
default: 'getRepairs',
},
{
displayName: 'Operation',
name: 'operation',
type: 'options',
noDataExpression: true,
displayOptions: {
show: {
resource: ['customers'],
},
},
options: [
{
name: 'Get Customers',
value: 'getCustomers',
action: 'Lấy danh sách khách hàng',
},
{
name: 'Get Customer Detail',
value: 'getCustomerDetail',
action: 'Lấy chi tiết khách hàng',
},
{
name: 'Create Customer',
value: 'createCustomer',
action: 'Tạo khách hàng',
},
{
name: 'Update Customer',
value: 'updateCustomer',
action: 'Cập nhật khách hàng',
},
{
name: 'Delete Customer',
value: 'deleteCustomer',
action: 'Xoá khách hàng',
},
],
default: 'getCustomers',
},
{
displayName: 'Order ID',
name: 'orderId',
type: 'string',
displayOptions: {
show: {
resource: ['orders'],
operation: ['getOrderDetail', 'updateOrder', 'payOrder'],
},
},
default: '',
required: true,
description: 'ID of the order',
},
{
displayName: 'Customer ID',
name: 'customerId',
type: 'string',
displayOptions: {
show: {
resource: ['orders'],
operation: ['createOrder', 'updateOrder'],
},
},
default: '',
required: true,
description: 'ID of the customer',
},
{
displayName: 'Items',
name: 'items',
type: 'json',
displayOptions: {
show: {
resource: ['orders'],
operation: ['createOrder', 'updateOrder'],
},
},
default: '[]',
description: 'Array of order items with product information',
},
{
displayName: 'Total Amount',
name: 'totalAmount',
type: 'number',
displayOptions: {
show: {
resource: ['orders'],
operation: ['createOrder', 'updateOrder'],
},
},
default: 0,
description: 'Total amount of the order',
},
{
displayName: 'Notes',
name: 'notes',
type: 'string',
displayOptions: {
show: {
resource: ['orders'],
operation: ['createOrder', 'updateOrder'],
},
},
default: '',
description: 'Order notes or additional information',
},
{
displayName: 'Payment Method',
name: 'paymentMethod',
type: 'options',
displayOptions: {
show: {
resource: ['orders'],
operation: ['payOrder'],
},
},
options: [
{
name: 'Cash',
value: 'cash',
},
{
name: 'Card',
value: 'card',
},
{
name: 'Bank Transfer',
value: 'bank_transfer',
},
{
name: 'E-Wallet',
value: 'e_wallet',
},
],
default: 'cash',
description: 'Payment method for the order',
},
{
displayName: 'Product ID',
name: 'productId',
type: 'string',
displayOptions: {
show: {
resource: ['products'],
operation: ['getProductDetail', 'updateProduct', 'deleteProduct'],
},
},
default: '',
required: true,
description: 'ID of the product',
},
{
displayName: 'Product Name',
name: 'productName',
type: 'string',
displayOptions: {
show: {
resource: ['products'],
operation: ['createProduct', 'updateProduct'],
},
},
default: '',
required: true,
description: 'Name of the product',
},
{
displayName: 'SKU',
name: 'sku',
type: 'string',
displayOptions: {
show: {
resource: ['products'],
operation: ['createProduct', 'updateProduct'],
},
},
default: '',
description: 'Stock Keeping Unit code',
},
{
displayName: 'Price',
name: 'price',
type: 'number',
displayOptions: {
show: {
resource: ['products'],
operation: ['createProduct', 'updateProduct'],
},
},
default: 0,
description: 'Price of the product',
},
{
displayName: 'Category',
name: 'category',
type: 'string',
displayOptions: {
show: {
resource: ['products'],
operation: ['createProduct', 'updateProduct'],
},
},
default: '',
description: 'Product category',
},
{
displayName: 'Description',
name: 'description',
type: 'string',
displayOptions: {
show: {
resource: ['products'],
operation: ['createProduct', 'updateProduct'],
},
},
default: '',
description: 'Product description',
},
{
displayName: 'Repair ID',
name: 'repairId',
type: 'string',
displayOptions: {
show: {
resource: ['repairs'],
operation: ['getRepairDetail', 'updateRepair', 'payRepair', 'deliverRepair'],
},
},
default: '',
required: true,
description: 'ID of the repair',
},
{
displayName: 'Ticket Type',
name: 'ticketType',
type: 'number',
displayOptions: {
show: {
resource: ['repairs'],
operation: ['createRepair', 'updateRepair'],
},
},
default: 1,
required: true,
description: 'Type of repair ticket (1 for standard)',
},
{
displayName: 'Repair Type',
name: 'repairType',
type: 'options',
displayOptions: {
show: {
resource: ['repairs'],
operation: ['createRepair', 'updateRepair'],
},
},
options: [
{
name: 'Single',
value: 'Single',
},
{
name: 'Multiple',
value: 'Multiple',
},
],
default: 'Single',
description: 'Type of repair (Single or Multiple devices)',
},
{
displayName: 'Customer ID',
name: 'repairCustomerId',
type: 'number',
displayOptions: {
show: {
resource: ['repairs'],
operation: ['createRepair', 'updateRepair'],
},
},
default: 0,
required: true,
description: 'ID of the customer requesting the repair',
},
{
displayName: 'Branch ID',
name: 'brankId',
type: 'number',
displayOptions: {
show: {
resource: ['repairs'],
operation: ['createRepair', 'updateRepair'],
},
},
default: 0,
required: true,
description: 'ID of the branch handling the repair',
},
{
displayName: 'Device Name',
name: 'deviceName',
type: 'string',
displayOptions: {
show: {
resource: ['repairs'],
operation: ['createRepair', 'updateRepair'],
},
},
default: '',
description: 'Name or model of the device',
},
{
displayName: 'Device Category ID',
name: 'deviceCategoryId',
type: 'number',
displayOptions: {
show: {
resource: ['repairs'],
operation: ['createRepair', 'updateRepair'],
},
},
default: 0,
required: true,
description: 'Category ID of the device type',
},
{
displayName: 'Serial Number',
name: 'serial',
type: 'string',
displayOptions: {
show: {
resource: ['repairs'],
operation: ['createRepair', 'updateRepair'],
},
},
default: '',
description: 'Serial number of the device',
},
{
displayName: 'Lock Screen Key',
name: 'lockScreenKey',
type: 'string',
displayOptions: {
show: {
resource: ['repairs'],
operation: ['createRepair', 'updateRepair'],
},
},
default: '1',
description: 'Lock screen key identifier',
},
{
displayName: 'Lock Screen Value',
name: 'lockScreenValue',
type: 'string',
displayOptions: {
show: {
resource: ['repairs'],
operation: ['createRepair', 'updateRepair'],
},
},
default: '',
description: 'Lock screen password/pin/pattern',
},
{
displayName: 'Repair Accessories',
name: 'repairAccessorys',
type: 'json',
displayOptions: {
show: {
resource: ['repairs'],
operation: ['createRepair', 'updateRepair'],
},
},
default: '[]',
description: 'Array of repair accessories [{"id": "39", "name": "Accessory name"}]',
},
{
displayName: 'Device States',
name: 'repairDeviceStates',
type: 'json',
displayOptions: {
show: {
resource: ['repairs'],
operation: ['createRepair', 'updateRepair'],
},
},
default: '[]',
description: 'Array of device states [{"id": "69", "name": "Issue description"}]',
},
{
displayName: 'Repair Services',
name: 'repairServices',
type: 'json',
displayOptions: {
show: {
resource: ['repairs'],
operation: ['createRepair', 'updateRepair'],
},
},
default: '[{"employees": [], "isCustom": true, "serviceId": null, "totalAmount": 0, "name": "", "totalChangeAmount": 0, "repairDeliveryNotes": []}]',
description: 'Array of repair services with pricing and details',
},
{
displayName: 'Payment Method',
name: 'repairPaymentMethod',
type: 'options',
displayOptions: {
show: {
resource: ['repairs'],
operation: ['payRepair'],
},
},
options: [
{
name: 'Cash',
value: 'cash',
},
{
name: 'Card',
value: 'card',
},
{
name: 'Bank Transfer',
value: 'bank_transfer',
},
{
name: 'E-Wallet',
value: 'e_wallet',
},
],
default: 'cash',
description: 'Payment method for the repair',
},
{
displayName: 'Final Cost',
name: 'finalCost',
type: 'number',
displayOptions: {
show: {
resource: ['repairs'],
operation: ['payRepair'],
},
},
default: 0,
description: 'Final cost of the repair',
},
{
displayName: 'Customer ID',
name: 'customerIdParam',
type: 'string',
displayOptions: {
show: {
resource: ['customers'],
operation: ['getCustomerDetail', 'updateCustomer', 'deleteCustomer'],
},
},
default: '',
required: true,
description: 'ID of the customer',
},
{
displayName: 'Customer Name',
name: 'customerName',
type: 'string',
displayOptions: {
show: {
resource: ['customers'],
operation: ['createCustomer', 'updateCustomer'],
},
},
default: '',
required: true,
description: 'Full customer name',
},
{
displayName: 'Email',
name: 'email',
type: 'string',
displayOptions: {
show: {
resource: ['customers'],
operation: ['createCustomer', 'updateCustomer'],
},
},
default: '',
description: 'Customer email address',
},
{
displayName: 'Phone',
name: 'phone',
type: 'string',
displayOptions: {
show: {
resource: ['customers'],
operation: ['createCustomer', 'updateCustomer'],
},
},
default: '',
description: 'Customer phone number',
},
{
displayName: 'Address',
name: 'address',
type: 'string',
displayOptions: {
show: {
resource: ['customers'],
operation: ['createCustomer', 'updateCustomer'],
},
},
default: '',
description: 'Customer address',
},
{
displayName: 'Page Size',
name: 'pageSize',
type: 'number',
displayOptions: {
show: {
resource: ['orders'],
operation: ['getOrders', 'getOrderDetail'],
},
},
default: 20,
description: 'Number of transactions to return per page',
},
{
displayName: 'Current Page',
name: 'current',
type: 'number',
displayOptions: {
show: {
resource: ['orders'],
operation: ['getOrders', 'getOrderDetail'],
},
},
default: 1,
description: 'Current page number',
},
{
displayName: 'Keyword',
name: 'keyword',
type: 'string',
displayOptions: {
show: {
resource: ['orders'],
operation: ['getOrders'],
},
},
default: '',
description: 'Search keyword for filtering transactions',
},
{
displayName: 'Status',
name: 'status',
type: 'string',
displayOptions: {
show: {
resource: ['orders'],
operation: ['getOrders'],
},
},
default: '',
description: 'Filter by transaction status',
},
{
displayName: 'Start Date',
name: 'startDate',
type: 'dateTime',
displayOptions: {
show: {
resource: ['orders'],
operation: ['getOrders', 'getOrderDetail'],
},
},
default: '',
description: 'Start date for filtering transactions',
},
{
displayName: 'End Date',
name: 'endDate',
type: 'dateTime',
displayOptions: {
show: {
resource: ['orders'],
operation: ['getOrders', 'getOrderDetail'],
},
},
default: '',
description: 'End date for filtering transactions',
},
{
displayName: 'Sort By',
name: 'sortBy',
type: 'string',
displayOptions: {
show: {
resource: ['orders'],
operation: ['getOrders'],
},
},
default: '',
description: 'Field to sort orders by',
},
{
displayName: 'Page Size',
name: 'pageSize',
type: 'number',
displayOptions: {
show: {
resource: ['customers'],
operation: ['getCustomers', 'getCustomerDetail'],
},
},
default: 20,
description: 'Number of customer records to return per page',
},
{
displayName: 'Current Page',
name: 'current',
type: 'number',
displayOptions: {
show: {
resource: ['customers'],
operation: ['getCustomers', 'getCustomerDetail'],
},
},
default: 1,
description: 'Current page number',
},
{
displayName: 'Keyword',
name: 'keyword',
type: 'string',
displayOptions: {
show: {
resource: ['customers'],
operation: ['getCustomers'],
},
},
default: '',
description: 'Search keyword for filtering customers',
},
{
displayName: 'Status',
name: 'status',
type: 'string',
displayOptions: {
show: {
resource: ['customers'],
operation: ['getCustomers'],
},
},
default: '',
description: 'Filter by customer status',
},
{
displayName: 'Start Date',
name: 'startDate',
type: 'dateTime',
displayOptions: {
show: {
resource: ['customers'],
operation: ['getCustomers', 'getCustomerDetail'],
},
},
default: '',
description: 'Start date for filtering customer data',
},
{
displayName: 'End Date',
name: 'endDate',
type: 'dateTime',
displayOptions: {
show: {
resource: ['customers'],
operation: ['getCustomers', 'getCustomerDetail'],
},
},
default: '',
description: 'End date for filtering customer data',
},
{
displayName: 'Sort By',
name: 'sortBy',
type: 'string',
displayOptions: {
show: {
resource: ['customers'],
operation: ['getCustomers'],
},
},
default: '',
description: 'Field to sort customers by',
},
{
displayName: 'Page Size',
name: 'pageSize',
type: 'number',
displayOptions: {
show: {
resource: ['products'],
operation: ['getProducts'],
},
},
default: 20,
description: 'Number of products to return per page',
},
{
displayName: 'Current Page',
name: 'current',
type: 'number',
displayOptions: {
show: {
resource: ['products'],
operation: ['getProducts'],
},
},
default: 1,
description: 'Current page number',
},
{
displayName: 'Keyword',
name: 'keyword',
type: 'string',
displayOptions: {
show: {
resource: ['products'],
operation: ['getProducts'],
},
},