-
Notifications
You must be signed in to change notification settings - Fork 7.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Syncromsp node #2477
Merged
Merged
Syncromsp node #2477
Changes from 73 commits
Commits
Show all changes
81 commits
Select commit
Hold shift + click to select a range
267c623
Init Node
Bearbobs 22db145
Added get customer details api for syncomsp-node
Bearbobs 84360a3
Fixed formatting bug :bug:
Bearbobs 15d0d02
Updated description for query params, and removed redundant condition…
Bearbobs 1c3c5ff
Changed default value for page parameter
Bearbobs 5337f1b
:ship: Added tickets API
Bearbobs ad4ed8e
:ship: Added contacts API
Bearbobs 2121777
:ship: Added RMM Alerts API
Bearbobs 975fafd
Add customer API
Bearbobs f65e832
Updates post code review
Bearbobs 0a90641
Merge branch 'syncromsp-node-add-customers' into syncromsp-node
Bearbobs 621b487
Rename SyncroMspAPI.credentials.ts to SyncroMspApi.credentials.ts
Bearbobs 423b9ac
added create and delete method to customers module
Bearbobs c36b586
fix liniting issue
Bearbobs c621a94
Added Update method to customer module
Bearbobs 5220ccb
Merge branch 'syncromsp-node' of https://github.com/n8n-io/n8n into s…
Bearbobs 4c5b25c
Code Review Changes
Bearbobs a03b1ec
:ship: Added CRUD for contacts endpoint
Bearbobs 9366b4d
:ship: Added CRUD for RMM Alert endpoint
Bearbobs 522e1b4
Added options for status field
Bearbobs 59013af
:bug: fix linting issues
Bearbobs bfd68e4
Init Node
Bearbobs 276f069
Added get customer details api for syncomsp-node
Bearbobs acd1c76
Fixed formatting bug :bug:
Bearbobs b912295
Updated description for query params, and removed redundant condition…
Bearbobs 1ad8c45
Changed default value for page parameter
Bearbobs db43999
:ship: Added tickets API
Bearbobs 07465b4
:ship: Added contacts API
Bearbobs f7306f8
:ship: Added RMM Alerts API
Bearbobs e771b50
Updates post code review
Bearbobs e14df3d
Add customer API
Bearbobs b1f423a
added create and delete method to customers module
Bearbobs 6069228
fix liniting issue
Bearbobs d74c748
Added Update method to customer module
Bearbobs 64986d1
Rename SyncroMspAPI.credentials.ts to SyncroMspApi.credentials.ts
Bearbobs eaf996c
Code Review Changes
Bearbobs cf48b4e
:ship: Added CRUD for contacts endpoint
Bearbobs 886d14d
:ship: Added CRUD for RMM Alert endpoint
Bearbobs 9815723
Added options for status field
Bearbobs d675291
:bug: fix linting issues
Bearbobs bf3927f
:ship: Added CRUD for ticket endpoint
Bearbobs e484341
:tag: update get customer module
Bearbobs e564e7a
:tag: update get customer module
Bearbobs f20a398
Fixed conflicts
Bearbobs baf1041
Minor bug fixes
Bearbobs 6746317
Changed response for ticket update
Bearbobs e5a27cb
:shirt: Fix lint issue
Bearbobs b9250a0
Alphabetically ordered all options
Bearbobs 4ac27de
:bug: Fixed build issue
Bearbobs ef5c24b
:bug: Fixed Server.ts build issue, rebased from master
Bearbobs 6a21865
:twisted_rightwards_arrows: Merge branch 'master' into syncromsp-node
janober 0a484d3
:zap: Fix node issues
janober 2044ce0
:zap: Fix more issues
janober fe0f03c
:zap: Fixed all operations with the standard convention
Bearbobs b842b6c
:shirt: Fix lint
Bearbobs 39a0ab8
Fix reviewed changes
Bearbobs 97acb5b
update border color
Bearbobs 2299651
:zap: minor fixes
Bearbobs d502bae
minor fixes
Bearbobs 1f83d7a
Added fallback when port in use
Bearbobs 0e11aca
:zap: Minor Fixes
Bearbobs 30875a1
:zap: Hide addtional paramerts when return all is active
Bearbobs fafd2ea
Merge branch 'feature/n8n-2648-fail-gracefully-when-starting-n8n-and'…
Bearbobs 7415043
Merge branch 'syncromsp-node' of https://github.com/n8n-io/n8n into s…
Bearbobs 485da79
:zap: Fix issues with Tickets
Bearbobs 6e466bf
:zap: Fix issues with Rmm
Bearbobs aedeb87
:zap: Fix issues with Customer
Bearbobs e9dc650
:shirt: Fix lint
Bearbobs 8487bc6
:zap: Fix issues with Contact
Bearbobs ec3dbcc
:shirt: Fixed formatting issue
Bearbobs 172ee8b
:zap: Return 404 in ID not found
Bearbobs 32223b4
:shirt: Fixed formatting issue
Bearbobs 7b95b5a
:zap: Improvements
RicardoE105 2d53184
:zap: Improvements
RicardoE105 19b9b7c
:zap: Improvements
RicardoE105 2d3e545
:zap: Add credentials verification
RicardoE105 fda0f10
🔀 Merge branch 'master' into 'syncromsp-node'
RicardoE105 8be9340
:zap: Improvements
RicardoE105 67cd3a4
:zap: Improvements
RicardoE105 53936f7
:twisted_rightwards_arrows: Merge branch 'master' into syncromsp-node
janober 20c1d26
:zap: Additional improvements
janober File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
packages/nodes-base/credentials/SyncroMspApi.credentials.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { | ||
ICredentialType, | ||
INodeProperties, | ||
} from 'n8n-workflow'; | ||
|
||
export class SyncroMspApi implements ICredentialType { | ||
name = 'syncroMspApi'; | ||
displayName = 'SyncroMSP API'; | ||
documentationUrl = 'syncromsp'; | ||
properties: INodeProperties[] = [ | ||
{ | ||
displayName: 'API Key', | ||
name: 'apiKey', | ||
type: 'string', | ||
default: '', | ||
}, | ||
{ | ||
displayName: 'Subdomain', | ||
name: 'subDomain', | ||
RicardoE105 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
type: 'string', | ||
default: '', | ||
}, | ||
]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { | ||
INodeTypeBaseDescription, | ||
INodeVersionedType, | ||
} from 'n8n-workflow'; | ||
|
||
import { NodeVersionedType } from '../../src/NodeVersionedType'; | ||
|
||
import { SyncroMspV1 } from './v1/SyncroMspV1.node'; | ||
|
||
export class SyncroMsp extends NodeVersionedType { | ||
constructor() { | ||
const baseDescription: INodeTypeBaseDescription = { | ||
displayName: 'SyncroMSP', | ||
name: 'syncroMsp', | ||
icon: 'file:syncromsp.png', | ||
group: ['output'], | ||
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}', | ||
description: 'Manage contacts, tickets and more from Syncro MSP', | ||
defaultVersion: 1, | ||
}; | ||
|
||
const nodeVersions: INodeVersionedType['nodeVersions'] = { | ||
1: new SyncroMspV1(baseDescription), | ||
}; | ||
|
||
super(nodeVersions, baseDescription); | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 31 additions & 0 deletions
31
packages/nodes-base/nodes/SyncroMSP/v1/SyncroMspV1.node.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { | ||
IExecuteFunctions, | ||
} from 'n8n-core'; | ||
|
||
import { | ||
INodeType, | ||
INodeTypeBaseDescription, | ||
INodeTypeDescription, | ||
} from 'n8n-workflow'; | ||
|
||
import { versionDescription } from './actions/versionDescription'; | ||
import { loadOptions } from './methods'; | ||
import { router } from './actions/router'; | ||
|
||
export class SyncroMspV1 implements INodeType { | ||
|
||
description: INodeTypeDescription; | ||
|
||
constructor(baseDescription: INodeTypeBaseDescription) { | ||
this.description = { | ||
...baseDescription, | ||
...versionDescription, | ||
}; | ||
} | ||
|
||
methods = { loadOptions }; | ||
|
||
async execute(this: IExecuteFunctions) { | ||
return await router.call(this); | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
packages/nodes-base/nodes/SyncroMSP/v1/actions/Interfaces.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import { | ||
AllEntities, | ||
Entity, | ||
PropertiesOf, | ||
} from 'n8n-workflow'; | ||
|
||
type SyncroMspMap = { | ||
contact: 'add'|'delete'|'get'|'getAll'|'update'; | ||
customer: 'add'|'delete'|'get'|'getAll'|'update'; | ||
rmm: 'add'|'delete'|'get'|'getAll'|'mute' ; | ||
ticket: 'add'|'delete'|'get'|'getAll'|'update'; | ||
RicardoE105 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}; | ||
|
||
export type SyncroMsp = AllEntities<SyncroMspMap>; | ||
|
||
export type SyncroMspMapContact = Entity<SyncroMspMap, 'contact'>; | ||
export type SyncroMspMapCustomer = Entity<SyncroMspMap, 'customer'>; | ||
export type SyncroMspMapRmm = Entity<SyncroMspMap, 'rmm'>; | ||
export type SyncroMspMapTicket = Entity<SyncroMspMap, 'ticket'>; | ||
|
||
export type ContactProperties = PropertiesOf<SyncroMspMapContact>; | ||
export type CustomerProperties = PropertiesOf<SyncroMspMapCustomer>; | ||
export type RmmProperties = PropertiesOf<SyncroMspMapRmm>; | ||
export type TicketProperties = PropertiesOf<SyncroMspMapTicket>; | ||
|
||
export interface IAttachment { | ||
fields: { | ||
item?: object[]; | ||
}; | ||
actions: { | ||
item?: object[]; | ||
}; | ||
} |
81 changes: 81 additions & 0 deletions
81
packages/nodes-base/nodes/SyncroMSP/v1/actions/contact/add/description.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
import { | ||
ContactProperties, | ||
} from '../../Interfaces'; | ||
|
||
import { | ||
addressFixedCollection | ||
} from '../../../methods/sharedFields'; | ||
|
||
export const contactAddDescription: ContactProperties = [ | ||
{ | ||
displayName: 'Customer ID', | ||
Bearbobs marked this conversation as resolved.
Show resolved
Hide resolved
|
||
name: 'customerId', | ||
RicardoE105 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
type: 'string', | ||
required: true, | ||
displayOptions: { | ||
show: { | ||
resource: [ | ||
'contact', | ||
], | ||
operation: [ | ||
'add', | ||
], | ||
}, | ||
}, | ||
default: '', | ||
}, | ||
{ | ||
displayName: 'Email', | ||
name: 'email', | ||
type: 'string', | ||
displayOptions: { | ||
show: { | ||
resource: [ | ||
'contact', | ||
], | ||
operation: [ | ||
'add', | ||
], | ||
}, | ||
}, | ||
default: '', | ||
}, | ||
{ | ||
displayName: 'Additional Fields', | ||
name: 'additionalFields', | ||
type: 'collection', | ||
placeholder: 'Add Field', | ||
displayOptions: { | ||
show: { | ||
resource: [ | ||
'contact', | ||
], | ||
operation: [ | ||
'add', | ||
], | ||
}, | ||
}, | ||
default: {}, | ||
options: [ | ||
addressFixedCollection, | ||
{ | ||
displayName: 'Name', | ||
name: 'name', | ||
type: 'string', | ||
default: '', | ||
}, | ||
{ | ||
displayName: 'Notes', | ||
name: 'notes', | ||
type: 'string', | ||
default: '', | ||
}, | ||
{ | ||
displayName: 'Phone', | ||
name: 'phone', | ||
type: 'string', | ||
default: '', | ||
}, | ||
], | ||
}, | ||
]; |
44 changes: 44 additions & 0 deletions
44
packages/nodes-base/nodes/SyncroMSP/v1/actions/contact/add/execute.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { | ||
IExecuteFunctions, | ||
} from 'n8n-core'; | ||
|
||
import { | ||
IDataObject, | ||
INodeExecutionData, | ||
} from 'n8n-workflow'; | ||
|
||
import { | ||
apiRequest, | ||
} from '../../../transport'; | ||
|
||
|
||
export async function addContact(this: IExecuteFunctions, index: number): Promise<INodeExecutionData[]> { | ||
const id = this.getNodeParameter('customerId', index) as IDataObject; | ||
const email = this.getNodeParameter('email', index) as IDataObject; | ||
const { address, notes, phone, name } = this.getNodeParameter('additionalFields', index) as IDataObject; | ||
|
||
const qs = {} as IDataObject; | ||
const requestMethod = 'POST'; | ||
const endpoint = 'contacts'; | ||
let body = {} as IDataObject; | ||
let addressData = address as IDataObject; | ||
|
||
if (addressData) { | ||
addressData = addressData['addressFields'] as IDataObject; | ||
addressData.address1 = addressData.address; | ||
} | ||
|
||
body = { | ||
...addressData, | ||
customer_id: id, | ||
email, | ||
name, | ||
notes, | ||
phone, | ||
}; | ||
|
||
let responseData; | ||
responseData = await apiRequest.call(this, requestMethod, endpoint, body, qs); | ||
|
||
return this.helpers.returnJsonArray(responseData); | ||
} |
7 changes: 7 additions & 0 deletions
7
packages/nodes-base/nodes/SyncroMSP/v1/actions/contact/add/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { addContact as execute } from './execute'; | ||
import { contactAddDescription as description } from './description'; | ||
|
||
export { | ||
description, | ||
execute, | ||
}; |
24 changes: 24 additions & 0 deletions
24
packages/nodes-base/nodes/SyncroMSP/v1/actions/contact/del/description.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { | ||
ContactProperties, | ||
} from '../../Interfaces'; | ||
|
||
export const contactDeleteDescription: ContactProperties = [ | ||
{ | ||
displayName: 'Contact ID', | ||
name: 'id', | ||
type: 'string', | ||
required: true, | ||
displayOptions: { | ||
show: { | ||
resource: [ | ||
'contact', | ||
], | ||
operation: [ | ||
'delete', | ||
], | ||
}, | ||
}, | ||
default: '', | ||
description: 'Delete a specific contact by ID', | ||
}, | ||
]; |
26 changes: 26 additions & 0 deletions
26
packages/nodes-base/nodes/SyncroMSP/v1/actions/contact/del/execute.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { | ||
IExecuteFunctions, | ||
} from 'n8n-core'; | ||
|
||
import { | ||
IDataObject, | ||
INodeExecutionData, | ||
} from 'n8n-workflow'; | ||
|
||
import { | ||
apiRequest | ||
} from '../../../transport'; | ||
|
||
|
||
export async function deleteContact(this: IExecuteFunctions, index: number): Promise<INodeExecutionData[]> { | ||
const id = this.getNodeParameter('id', index) as string; | ||
|
||
const qs = {} as IDataObject; | ||
const requestMethod = 'DELETE'; | ||
const endpoint = `contacts/${id}`; | ||
const body = {} as IDataObject; | ||
|
||
let responseData; | ||
responseData = await apiRequest.call(this, requestMethod, endpoint, body, qs); | ||
return this.helpers.returnJsonArray(responseData); | ||
} |
7 changes: 7 additions & 0 deletions
7
packages/nodes-base/nodes/SyncroMSP/v1/actions/contact/del/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { deleteContact as execute } from './execute'; | ||
import { contactDeleteDescription as description } from './description'; | ||
|
||
export { | ||
description, | ||
execute, | ||
}; |
24 changes: 24 additions & 0 deletions
24
packages/nodes-base/nodes/SyncroMSP/v1/actions/contact/get/description.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { | ||
ContactProperties, | ||
} from '../../Interfaces'; | ||
|
||
export const contactGetDescription: ContactProperties = [ | ||
{ | ||
displayName: 'Contact ID', | ||
name: 'id', | ||
type: 'string', | ||
required: true, | ||
displayOptions: { | ||
show: { | ||
resource: [ | ||
'contact', | ||
], | ||
operation: [ | ||
'get', | ||
], | ||
}, | ||
}, | ||
default: '', | ||
description: 'Get specific contact by ID', | ||
}, | ||
]; |
26 changes: 26 additions & 0 deletions
26
packages/nodes-base/nodes/SyncroMSP/v1/actions/contact/get/execute.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { | ||
IExecuteFunctions, | ||
} from 'n8n-core'; | ||
|
||
import { | ||
IDataObject, | ||
INodeExecutionData, | ||
} from 'n8n-workflow'; | ||
|
||
import { | ||
apiRequest | ||
} from '../../../transport'; | ||
|
||
|
||
export async function getContact(this: IExecuteFunctions, index: number): Promise<INodeExecutionData[]> { | ||
const id = this.getNodeParameter('id', index) as string; | ||
|
||
const qs = {} as IDataObject; | ||
const requestMethod = 'GET'; | ||
const endpoint = `contacts/${id}`; | ||
const body = {} as IDataObject; | ||
|
||
let responseData; | ||
responseData = await apiRequest.call(this, requestMethod, endpoint, body, qs); | ||
return this.helpers.returnJsonArray(responseData); | ||
} |
7 changes: 7 additions & 0 deletions
7
packages/nodes-base/nodes/SyncroMSP/v1/actions/contact/get/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { getContact as execute } from './execute'; | ||
import { contactGetDescription as description } from './description'; | ||
|
||
export { | ||
description, | ||
execute, | ||
}; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure why this is here. Code is already in master and gets now added a second time.