mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-10 14:44:05 -08:00
⚡ Make it possible to soft-delete and restore Mattermost-Channels
This commit is contained in:
parent
c78916af5f
commit
c174f6cc70
|
@ -85,6 +85,16 @@ export class Mattermost implements INodeType {
|
|||
value: 'create',
|
||||
description: 'Create a new channel',
|
||||
},
|
||||
{
|
||||
name: 'Delete',
|
||||
value: 'delete',
|
||||
description: 'Soft-deletes a channel',
|
||||
},
|
||||
{
|
||||
name: 'Restore',
|
||||
value: 'restore',
|
||||
description: 'Restores a soft-deleted channel',
|
||||
},
|
||||
{
|
||||
name: 'Statistics',
|
||||
value: 'statistics',
|
||||
|
@ -219,6 +229,56 @@ export class Mattermost implements INodeType {
|
|||
},
|
||||
|
||||
|
||||
// ----------------------------------
|
||||
// channel:delete
|
||||
// ----------------------------------
|
||||
{
|
||||
displayName: 'Channel ID',
|
||||
name: 'channelId',
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getChannels',
|
||||
},
|
||||
options: [],
|
||||
default: '',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'delete'
|
||||
],
|
||||
resource: [
|
||||
'channel',
|
||||
],
|
||||
},
|
||||
},
|
||||
description: 'The ID of the channel to soft-delete.',
|
||||
},
|
||||
|
||||
|
||||
// ----------------------------------
|
||||
// channel:restore
|
||||
// ----------------------------------
|
||||
{
|
||||
displayName: 'Channel ID',
|
||||
name: 'channelId',
|
||||
type: 'string',
|
||||
default: '',
|
||||
required: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'restore'
|
||||
],
|
||||
resource: [
|
||||
'channel',
|
||||
],
|
||||
},
|
||||
},
|
||||
description: 'The ID of the channel to restore.',
|
||||
},
|
||||
|
||||
|
||||
// ----------------------------------
|
||||
// channel:addUser
|
||||
// ----------------------------------
|
||||
|
@ -266,6 +326,8 @@ export class Mattermost implements INodeType {
|
|||
},
|
||||
description: 'The ID of the user to invite into channel.',
|
||||
},
|
||||
|
||||
|
||||
// ----------------------------------
|
||||
// channel:statistics
|
||||
// ----------------------------------
|
||||
|
@ -629,8 +691,7 @@ export class Mattermost implements INodeType {
|
|||
|
||||
methods = {
|
||||
loadOptions: {
|
||||
// Get all the available workspaces to display them to user so that he can
|
||||
// select them easily
|
||||
// Get all the available channels
|
||||
async getChannels(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||
const endpoint = 'channels';
|
||||
const responseData = await apiRequest.call(this, 'GET', endpoint, {});
|
||||
|
@ -754,6 +815,24 @@ export class Mattermost implements INodeType {
|
|||
const type = this.getNodeParameter('type', i) as string;
|
||||
body.type = type === 'public' ? 'O' : 'P';
|
||||
|
||||
} else if (operation === 'delete') {
|
||||
// ----------------------------------
|
||||
// channel:delete
|
||||
// ----------------------------------
|
||||
|
||||
requestMethod = 'DELETE';
|
||||
const channelId = this.getNodeParameter('channelId', i) as string;
|
||||
endpoint = `channels/${channelId}`;
|
||||
|
||||
} else if (operation === 'restore') {
|
||||
// ----------------------------------
|
||||
// channel:restore
|
||||
// ----------------------------------
|
||||
|
||||
requestMethod = 'POST';
|
||||
const channelId = this.getNodeParameter('channelId', i) as string;
|
||||
endpoint = `channels/${channelId}/restore`;
|
||||
|
||||
} else if (operation === 'addUser') {
|
||||
// ----------------------------------
|
||||
// channel:addUser
|
||||
|
|
Loading…
Reference in a new issue