first commit
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
Security: Sync from Public / sync-from-public (push) Has been cancelled
Test: Benchmark Nightly / build (push) Has been cancelled
Test: Benchmark Nightly / Notify Cats on failure (push) Has been cancelled
CI: Python / Checks (push) Has been cancelled
Test: Evals Python / Workflow Comparison Python (push) Has been cancelled
Util: Check Docs URLs / check-docs-urls (push) Has been cancelled
Test: Visual Storybook / Cloudflare Pages (push) Has been cancelled
Test: E2E Performance / build-and-test-performance (push) Has been cancelled
Test: Workflows Nightly / Run Workflow Tests (push) Has been cancelled
Util: Cleanup CI Docker Images / Delete stale CI images (push) Has been cancelled
Test: Benchmark Destroy Env / build (push) Has been cancelled
Util: Update Node Popularity / update-popularity (push) Has been cancelled
Test: E2E Coverage Weekly / Coverage Tests (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,129 @@
|
||||
import type { TicketProperties } from '../../Interfaces';
|
||||
|
||||
export const ticketCreateDescription: TicketProperties = [
|
||||
{
|
||||
displayName: 'Customer ID',
|
||||
name: 'customerId',
|
||||
type: 'string',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['ticket'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Subject',
|
||||
name: 'subject',
|
||||
type: 'string',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['ticket'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Additional Fields',
|
||||
name: 'additionalFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['ticket'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
default: {},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Asset ID',
|
||||
name: 'assetId',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Assign to Contact',
|
||||
name: 'contactId',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'The ID of the contact you want to assign the ticket to',
|
||||
},
|
||||
// {
|
||||
// displayName: 'Due Date',
|
||||
// name: 'dueDate',
|
||||
// type: 'dateTime',
|
||||
// default: '',
|
||||
// },
|
||||
{
|
||||
displayName: 'Issue Type',
|
||||
name: 'issueType',
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'Contract Work',
|
||||
value: 'Contract Work',
|
||||
},
|
||||
{
|
||||
name: 'Network Project',
|
||||
value: 'Network Project',
|
||||
},
|
||||
{
|
||||
name: 'Other',
|
||||
value: 'Other',
|
||||
},
|
||||
{
|
||||
name: 'Regular Maintenance',
|
||||
value: 'Regular Maintenance',
|
||||
},
|
||||
{
|
||||
name: 'Remote Support',
|
||||
value: 'Remote Support',
|
||||
},
|
||||
],
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
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',
|
||||
description: 'If used along the parameter Search Query, only Search Query will be applied',
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
@@ -0,0 +1,35 @@
|
||||
import type { IExecuteFunctions, IDataObject, INodeExecutionData } from 'n8n-workflow';
|
||||
|
||||
import { apiRequest } from '../../../transport';
|
||||
|
||||
export async function createTicket(
|
||||
this: IExecuteFunctions,
|
||||
index: number,
|
||||
): Promise<INodeExecutionData[]> {
|
||||
const id = this.getNodeParameter('customerId', index) as IDataObject;
|
||||
const subject = this.getNodeParameter('subject', index) as IDataObject;
|
||||
const { assetId, issueType, status, contactId } = this.getNodeParameter(
|
||||
'additionalFields',
|
||||
index,
|
||||
);
|
||||
|
||||
const qs = {} as IDataObject;
|
||||
const requestMethod = 'POST';
|
||||
const endpoint = 'tickets';
|
||||
let body = {} as IDataObject;
|
||||
|
||||
body = {
|
||||
asset_id: assetId,
|
||||
//due_date: dueDate,
|
||||
problem_type: issueType,
|
||||
status,
|
||||
contact_id: contactId,
|
||||
};
|
||||
|
||||
body.customer_id = id;
|
||||
body.subject = subject;
|
||||
|
||||
const responseData = await apiRequest.call(this, requestMethod, endpoint, body, qs);
|
||||
|
||||
return this.helpers.returnJsonArray(responseData.ticket as IDataObject[]);
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
import { ticketCreateDescription as description } from './description';
|
||||
import { createTicket as execute } from './execute';
|
||||
|
||||
export { description, execute };
|
||||
@@ -0,0 +1,18 @@
|
||||
import type { TicketProperties } from '../../Interfaces';
|
||||
|
||||
export const ticketDeleteDescription: TicketProperties = [
|
||||
{
|
||||
displayName: 'Ticket ID',
|
||||
name: 'ticketId',
|
||||
required: true,
|
||||
type: 'string',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['ticket'],
|
||||
operation: ['delete'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
description: 'Delete a specific customer by ID',
|
||||
},
|
||||
];
|
||||
@@ -0,0 +1,18 @@
|
||||
import type { IExecuteFunctions, IDataObject, INodeExecutionData } from 'n8n-workflow';
|
||||
|
||||
import { apiRequest } from '../../../transport';
|
||||
|
||||
export async function deleteTicket(
|
||||
this: IExecuteFunctions,
|
||||
index: number,
|
||||
): Promise<INodeExecutionData[]> {
|
||||
const id = this.getNodeParameter('ticketId', index) as string;
|
||||
|
||||
const qs = {} as IDataObject;
|
||||
const requestMethod = 'DELETE';
|
||||
const endpoint = `tickets/${id}`;
|
||||
const body = {} as IDataObject;
|
||||
|
||||
const responseData = await apiRequest.call(this, requestMethod, endpoint, body, qs);
|
||||
return this.helpers.returnJsonArray(responseData as IDataObject[]);
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
import { ticketDeleteDescription as description } from './description';
|
||||
import { deleteTicket as execute } from './execute';
|
||||
|
||||
export { description, execute };
|
||||
@@ -0,0 +1,17 @@
|
||||
import type { TicketProperties } from '../../Interfaces';
|
||||
|
||||
export const ticketGetDescription: TicketProperties = [
|
||||
{
|
||||
displayName: 'Ticket ID',
|
||||
name: 'ticketId',
|
||||
type: 'string',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['ticket'],
|
||||
operation: ['get'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
description: 'Get specific customer by ID',
|
||||
},
|
||||
];
|
||||
@@ -0,0 +1,18 @@
|
||||
import type { IExecuteFunctions, IDataObject, INodeExecutionData } from 'n8n-workflow';
|
||||
|
||||
import { apiRequest } from '../../../transport';
|
||||
|
||||
export async function getTicket(
|
||||
this: IExecuteFunctions,
|
||||
index: number,
|
||||
): Promise<INodeExecutionData[]> {
|
||||
const id = this.getNodeParameter('ticketId', index) as string;
|
||||
|
||||
const qs = {} as IDataObject;
|
||||
const requestMethod = 'GET';
|
||||
const endpoint = `tickets/${id}`;
|
||||
const body = {} as IDataObject;
|
||||
|
||||
const responseData = await apiRequest.call(this, requestMethod, endpoint, body, qs);
|
||||
return this.helpers.returnJsonArray(responseData.ticket as IDataObject[]);
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
import { ticketGetDescription as description } from './description';
|
||||
import { getTicket as execute } from './execute';
|
||||
|
||||
export { description, execute };
|
||||
@@ -0,0 +1,94 @@
|
||||
import type { 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: 'Whether to return all results or only up to a given limit',
|
||||
},
|
||||
{
|
||||
displayName: 'Limit',
|
||||
name: 'limit',
|
||||
type: 'number',
|
||||
typeOptions: {
|
||||
minValue: 1,
|
||||
},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['ticket'],
|
||||
operation: ['getAll'],
|
||||
returnAll: [false],
|
||||
},
|
||||
},
|
||||
default: 25,
|
||||
description: 'Max number of results to return',
|
||||
},
|
||||
{
|
||||
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,33 @@
|
||||
import type { IExecuteFunctions, 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);
|
||||
const filters = this.getNodeParameter('filters', index);
|
||||
|
||||
let qs = {} as IDataObject;
|
||||
const requestMethod = 'GET';
|
||||
const endpoint = 'tickets';
|
||||
const body = {} as IDataObject;
|
||||
|
||||
if (filters) {
|
||||
qs = filters;
|
||||
}
|
||||
|
||||
if (!returnAll) {
|
||||
qs.per_page = this.getNodeParameter('limit', index);
|
||||
}
|
||||
|
||||
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 as IDataObject[]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
import { ticketGetAllDescription as description } from './description';
|
||||
import { getAll as execute } from './execute';
|
||||
|
||||
export { description, execute };
|
||||
@@ -0,0 +1,61 @@
|
||||
import type { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
import * as create from './create';
|
||||
import * as del from './del';
|
||||
import * as get from './get';
|
||||
import * as getAll from './getAll';
|
||||
import * as update from './update';
|
||||
|
||||
export { getAll, create, get, del as delete, update };
|
||||
|
||||
export const descriptions = [
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
noDataExpression: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['ticket'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Create',
|
||||
value: 'create',
|
||||
description: 'Create new ticket',
|
||||
action: 'Create a ticket',
|
||||
},
|
||||
{
|
||||
name: 'Delete',
|
||||
value: 'delete',
|
||||
description: 'Delete ticket',
|
||||
action: 'Delete a ticket',
|
||||
},
|
||||
{
|
||||
name: 'Get',
|
||||
value: 'get',
|
||||
description: 'Retrieve ticket',
|
||||
action: 'Get a ticket',
|
||||
},
|
||||
{
|
||||
name: 'Get Many',
|
||||
value: 'getAll',
|
||||
description: 'Retrieve many tickets',
|
||||
action: 'Get many tickets',
|
||||
},
|
||||
{
|
||||
name: 'Update',
|
||||
value: 'update',
|
||||
description: 'Update ticket',
|
||||
action: 'Update a ticket',
|
||||
},
|
||||
],
|
||||
default: 'getAll',
|
||||
},
|
||||
...getAll.description,
|
||||
...create.description,
|
||||
...get.description,
|
||||
...del.description,
|
||||
...update.description,
|
||||
] as INodeProperties[];
|
||||
@@ -0,0 +1,127 @@
|
||||
import type { TicketProperties } from '../../Interfaces';
|
||||
|
||||
export const ticketUpdateDescription: TicketProperties = [
|
||||
{
|
||||
displayName: 'Ticket ID',
|
||||
name: 'ticketId',
|
||||
type: 'string',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['ticket'],
|
||||
operation: ['update'],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Update Fields',
|
||||
name: 'updateFields',
|
||||
type: 'collection',
|
||||
placeholder: 'Add Field',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: ['ticket'],
|
||||
operation: ['update'],
|
||||
},
|
||||
},
|
||||
default: {},
|
||||
options: [
|
||||
{
|
||||
displayName: 'Asset ID',
|
||||
name: 'assetId',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Assign to Contact',
|
||||
name: 'contactId',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'The ID of the contact you want to assign the ticket to',
|
||||
},
|
||||
{
|
||||
displayName: 'Customer ID',
|
||||
name: 'customerId',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Due Date',
|
||||
name: 'dueDate',
|
||||
type: 'dateTime',
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
displayName: 'Issue Type',
|
||||
name: 'issueType',
|
||||
type: 'options',
|
||||
options: [
|
||||
{
|
||||
name: 'Contract Work',
|
||||
value: 'Contract Work',
|
||||
},
|
||||
{
|
||||
name: 'Network Project',
|
||||
value: 'Network Project',
|
||||
},
|
||||
{
|
||||
name: 'Other',
|
||||
value: 'Other',
|
||||
},
|
||||
{
|
||||
name: 'Regular Maintenance',
|
||||
value: 'Regular Maintenance',
|
||||
},
|
||||
{
|
||||
name: 'Remote Support',
|
||||
value: 'Remote Support',
|
||||
},
|
||||
],
|
||||
default: '',
|
||||
},
|
||||
{
|
||||
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',
|
||||
},
|
||||
{
|
||||
displayName: 'Subject',
|
||||
name: 'subject',
|
||||
type: 'string',
|
||||
default: '',
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
@@ -0,0 +1,39 @@
|
||||
import type { IExecuteFunctions, IDataObject, INodeExecutionData } from 'n8n-workflow';
|
||||
import { NodeOperationError } from 'n8n-workflow';
|
||||
|
||||
import { apiRequest } from '../../../transport';
|
||||
|
||||
export async function updateTicket(
|
||||
this: IExecuteFunctions,
|
||||
index: number,
|
||||
): Promise<INodeExecutionData[]> {
|
||||
const id = this.getNodeParameter('ticketId', index) as IDataObject;
|
||||
const { assetId, customerId, dueDate, issueType, status, subject, ticketType, contactId } =
|
||||
this.getNodeParameter('updateFields', index);
|
||||
|
||||
const qs = {} as IDataObject;
|
||||
const requestMethod = 'PUT';
|
||||
const endpoint = `tickets/${id}`;
|
||||
let body = {} as IDataObject;
|
||||
|
||||
body = {
|
||||
...(assetId && { asset_id: assetId }),
|
||||
...(customerId && { customer_id: customerId }),
|
||||
...(dueDate && { due_date: dueDate }),
|
||||
...(issueType && { problem_type: issueType }),
|
||||
...(status && { status }),
|
||||
...(subject && { subject }),
|
||||
...(ticketType && { ticket_type: ticketType }),
|
||||
...(contactId && { contact_id: contactId }),
|
||||
};
|
||||
|
||||
if (!Object.keys(body).length) {
|
||||
throw new NodeOperationError(this.getNode(), 'At least one update fields has to be defined', {
|
||||
itemIndex: index,
|
||||
});
|
||||
}
|
||||
|
||||
const responseData = await apiRequest.call(this, requestMethod, endpoint, body, qs);
|
||||
|
||||
return this.helpers.returnJsonArray(responseData.ticket as IDataObject[]);
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
import { ticketUpdateDescription as description } from './description';
|
||||
import { updateTicket as execute } from './execute';
|
||||
|
||||
export { description, execute };
|
||||
Reference in New Issue
Block a user