✨ Add Syncromsp node (#2477)
* Init Node * Added get customer details api for syncomsp-node * Fixed formatting bug 🐛 * Updated description for query params, and removed redundant condition in router * Changed default value for page parameter * 🚢 Added tickets API * 🚢 Added contacts API * 🚢 Added RMM Alerts API * Add customer API * Updates post code review * Rename SyncroMspAPI.credentials.ts to SyncroMspApi.credentials.ts * added create and delete method to customers module * fix liniting issue * Added Update method to customer module * Code Review Changes * 🚢 Added CRUD for contacts endpoint * 🚢 Added CRUD for RMM Alert endpoint * Added options for status field * 🐛 fix linting issues * Init Node * Added get customer details api for syncomsp-node * Fixed formatting bug 🐛 * Updated description for query params, and removed redundant condition in router * Changed default value for page parameter * 🚢 Added tickets API * 🚢 Added contacts API * 🚢 Added RMM Alerts API * Updates post code review * Add customer API * added create and delete method to customers module * fix liniting issue * Added Update method to customer module * Rename SyncroMspAPI.credentials.ts to SyncroMspApi.credentials.ts * Code Review Changes * 🚢 Added CRUD for contacts endpoint * 🚢 Added CRUD for RMM Alert endpoint * Added options for status field * 🐛 fix linting issues * 🚢 Added CRUD for ticket endpoint * :tag: update get customer module * :tag: update get customer module * Minor bug fixes * Changed response for ticket update * 👕 Fix lint issue * Alphabetically ordered all options * 🐛 Fixed build issue * 🐛 Fixed Server.ts build issue, rebased from master * ⚡ Fix node issues * ⚡ Fix more issues * ⚡ Fixed all operations with the standard convention * 👕 Fix lint * Fix reviewed changes * update border color * ⚡ minor fixes * minor fixes * Added fallback when port in use * ⚡ Minor Fixes * ⚡ Hide addtional paramerts when return all is active * ⚡ Fix issues with Tickets * ⚡ Fix issues with Rmm * ⚡ Fix issues with Customer * 👕 Fix lint * ⚡ Fix issues with Contact * 👕 Fixed formatting issue * ⚡ Return 404 in ID not found * 👕 Fixed formatting issue * ⚡ Improvements * ⚡ Improvements * ⚡ Improvements * ⚡ Add credentials verification * ⚡ Improvements * ⚡ Improvements * ⚡ Additional improvements Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com> Co-authored-by: ricardo <ricardoespinoza105@gmail.com>
This commit is contained in:
@@ -0,0 +1,107 @@
|
||||
import {
|
||||
TicketProperties,
|
||||
} from '../../Interfaces';
|
||||
|
||||
export const ticketGetAllDescription: TicketProperties = [
|
||||
{
|
||||
displayName: 'Return All',
|
||||
name: 'returnAll',
|
||||
type: 'boolean',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'ticket',
|
||||
],
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
},
|
||||
},
|
||||
default: false,
|
||||
noDataExpression: true,
|
||||
description: 'If all results should be returned or only up to a given limit',
|
||||
},
|
||||
{
|
||||
displayName: 'Limit',
|
||||
name: 'limit',
|
||||
type: 'number',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'ticket',
|
||||
],
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
returnAll: [
|
||||
false,
|
||||
],
|
||||
},
|
||||
},
|
||||
default: 25,
|
||||
description: 'Limit the number of rows returned',
|
||||
},
|
||||
{
|
||||
displayName: 'Filters',
|
||||
name: 'filters',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Filter',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'ticket',
|
||||
],
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
},
|
||||
},
|
||||
default: {},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Search Query',
|
||||
name: 'query',
|
||||
type: 'string',
|
||||
default: '',
|
||||
placeholder: 'John Doe',
|
||||
description: 'Search query, it can be anything related to ticket data like user etc.',
|
||||
},
|
||||
{
|
||||
displayName: 'Status',
|
||||
name: 'status',
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'Customer Reply',
|
||||
value: 'Customer Reply',
|
||||
},
|
||||
{
|
||||
name: 'In Progress',
|
||||
value: 'In Progress',
|
||||
},
|
||||
{
|
||||
name: 'New',
|
||||
value: 'New',
|
||||
},
|
||||
{
|
||||
name: 'Resolved',
|
||||
value: 'Resolved',
|
||||
},
|
||||
{
|
||||
name: 'Scheduled',
|
||||
value: 'Scheduled',
|
||||
},
|
||||
{
|
||||
name: 'Waiting for Parts',
|
||||
value: 'Waiting for Parts',
|
||||
},
|
||||
{
|
||||
name: 'Waiting on Customer',
|
||||
value: 'Waiting on Customer',
|
||||
},
|
||||
],
|
||||
default: 'New',
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
@@ -0,0 +1,40 @@
|
||||
import {
|
||||
IExecuteFunctions,
|
||||
} from 'n8n-core';
|
||||
|
||||
import {
|
||||
IDataObject,
|
||||
INodeExecutionData,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
apiRequest, apiRequestAllItems
|
||||
} from '../../../transport';
|
||||
|
||||
|
||||
export async function getAll(this: IExecuteFunctions, index: number): Promise<INodeExecutionData[]> {
|
||||
const returnAll = this.getNodeParameter('returnAll', index) as boolean;
|
||||
const filters = this.getNodeParameter('filters', index) as IDataObject;
|
||||
|
||||
let qs = {} as IDataObject;
|
||||
const requestMethod = 'GET';
|
||||
const endpoint = 'tickets';
|
||||
const body = {} as IDataObject;
|
||||
|
||||
if (filters) {
|
||||
qs = filters;
|
||||
}
|
||||
|
||||
if (returnAll === false) {
|
||||
qs.per_page = this.getNodeParameter('limit', index) as number;
|
||||
}
|
||||
|
||||
let responseData;
|
||||
if (returnAll) {
|
||||
responseData = await apiRequestAllItems.call(this, requestMethod, endpoint, body, qs);
|
||||
return this.helpers.returnJsonArray(responseData);
|
||||
} else {
|
||||
responseData = await apiRequest.call(this, requestMethod, endpoint, body, qs);
|
||||
return this.helpers.returnJsonArray(responseData.tickets);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
import { getAll as execute } from './execute';
|
||||
import { ticketGetAllDescription as description } from './description';
|
||||
|
||||
export {
|
||||
description,
|
||||
execute,
|
||||
};
|
||||
Reference in New Issue
Block a user