mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-25 12:44:07 -08:00
🔀 Merge branch 'RicardoE105-feature/mattermost-node'
This commit is contained in:
commit
373bb66ce4
|
@ -49,6 +49,10 @@ export class Mattermost implements INodeType {
|
|||
name: 'Message',
|
||||
value: 'message',
|
||||
},
|
||||
{
|
||||
name: 'User',
|
||||
value: 'user',
|
||||
},
|
||||
],
|
||||
default: 'message',
|
||||
description: 'The resource to operate on.',
|
||||
|
@ -81,11 +85,15 @@ export class Mattermost implements INodeType {
|
|||
value: 'create',
|
||||
description: 'Create a new channel',
|
||||
},
|
||||
{
|
||||
name: 'Statistics',
|
||||
value: 'statistics',
|
||||
description: 'Get statistics for a channel.',
|
||||
},
|
||||
],
|
||||
default: 'create',
|
||||
description: 'The operation to perform.',
|
||||
},
|
||||
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
|
@ -98,6 +106,11 @@ export class Mattermost implements INodeType {
|
|||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Delete',
|
||||
value: 'delete',
|
||||
description: 'Soft deletes a post, by marking the post as deleted in the database.',
|
||||
},
|
||||
{
|
||||
name: 'Post',
|
||||
value: 'post',
|
||||
|
@ -253,13 +266,58 @@ export class Mattermost implements INodeType {
|
|||
},
|
||||
description: 'The ID of the user to invite into channel.',
|
||||
},
|
||||
|
||||
|
||||
// ----------------------------------
|
||||
// channel:statistics
|
||||
// ----------------------------------
|
||||
{
|
||||
displayName: 'Channel ID',
|
||||
name: 'channelId',
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getChannels',
|
||||
},
|
||||
options: [],
|
||||
default: '',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'statistics'
|
||||
],
|
||||
resource: [
|
||||
'channel',
|
||||
],
|
||||
},
|
||||
},
|
||||
description: 'The ID of the channel to get the statistics from.',
|
||||
},
|
||||
|
||||
// ----------------------------------
|
||||
// message
|
||||
// ----------------------------------
|
||||
|
||||
// ----------------------------------
|
||||
// message:delete
|
||||
// ----------------------------------
|
||||
{
|
||||
displayName: 'Post ID',
|
||||
name: 'postId',
|
||||
type: 'string',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'message',
|
||||
],
|
||||
operation: [
|
||||
'delete',
|
||||
],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
description: 'ID of the post to delete',
|
||||
},
|
||||
|
||||
// ----------------------------------
|
||||
// message:post
|
||||
// ----------------------------------
|
||||
|
@ -520,6 +578,51 @@ export class Mattermost implements INodeType {
|
|||
},
|
||||
],
|
||||
},
|
||||
// ----------------------------------
|
||||
// user
|
||||
// ----------------------------------
|
||||
{
|
||||
displayName: 'Operation',
|
||||
name: 'operation',
|
||||
type: 'options',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'user',
|
||||
],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: 'Desactive',
|
||||
value: 'desactive',
|
||||
description: 'Deactivates the user and revokes all its sessions by archiving its user object.',
|
||||
},
|
||||
],
|
||||
default: '',
|
||||
description: 'The operation to perform.',
|
||||
},
|
||||
// ----------------------------------
|
||||
// user:desactivate
|
||||
// ----------------------------------
|
||||
{
|
||||
displayName: 'User ID',
|
||||
name: 'userId',
|
||||
type: 'string',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'user',
|
||||
],
|
||||
operation: [
|
||||
'desactive',
|
||||
],
|
||||
},
|
||||
},
|
||||
default: '',
|
||||
description: 'User GUID'
|
||||
},
|
||||
|
||||
],
|
||||
};
|
||||
|
@ -663,9 +766,25 @@ export class Mattermost implements INodeType {
|
|||
|
||||
endpoint = `channels/${channelId}/members`;
|
||||
|
||||
} else if (operation === 'statistics') {
|
||||
// ----------------------------------
|
||||
// channel:statistics
|
||||
// ----------------------------------
|
||||
|
||||
requestMethod = 'GET';
|
||||
const channelId = this.getNodeParameter('channelId', i) as string;
|
||||
endpoint = `channels/${channelId}/stats`;
|
||||
}
|
||||
} else if (resource === 'message') {
|
||||
if (operation === 'post') {
|
||||
if (operation === 'delete') {
|
||||
// ----------------------------------
|
||||
// message:delete
|
||||
// ----------------------------------
|
||||
|
||||
const postId = this.getNodeParameter('postId', i) as string;
|
||||
requestMethod = 'DELETE';
|
||||
endpoint = `posts/${postId}`;
|
||||
} else if (operation === 'post') {
|
||||
// ----------------------------------
|
||||
// message:post
|
||||
// ----------------------------------
|
||||
|
@ -701,7 +820,17 @@ export class Mattermost implements INodeType {
|
|||
const otherOptions = this.getNodeParameter('otherOptions', i) as IDataObject;
|
||||
Object.assign(body, otherOptions);
|
||||
}
|
||||
} else {
|
||||
} else if (resource === 'user') {
|
||||
if (operation === 'desactive') {
|
||||
// ----------------------------------
|
||||
// user:desactive
|
||||
// ----------------------------------
|
||||
const userId = this.getNodeParameter('userId', i) as string;
|
||||
requestMethod = 'DELETE';
|
||||
endpoint = `users/${userId}`;
|
||||
}
|
||||
}
|
||||
else {
|
||||
throw new Error(`The resource "${resource}" is not known!`);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue