mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -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',
|
value: 'create',
|
||||||
description: 'Create a new channel',
|
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',
|
name: 'Statistics',
|
||||||
value: '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
|
// channel:addUser
|
||||||
// ----------------------------------
|
// ----------------------------------
|
||||||
|
@ -266,6 +326,8 @@ export class Mattermost implements INodeType {
|
||||||
},
|
},
|
||||||
description: 'The ID of the user to invite into channel.',
|
description: 'The ID of the user to invite into channel.',
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
// ----------------------------------
|
// ----------------------------------
|
||||||
// channel:statistics
|
// channel:statistics
|
||||||
// ----------------------------------
|
// ----------------------------------
|
||||||
|
@ -629,8 +691,7 @@ export class Mattermost implements INodeType {
|
||||||
|
|
||||||
methods = {
|
methods = {
|
||||||
loadOptions: {
|
loadOptions: {
|
||||||
// Get all the available workspaces to display them to user so that he can
|
// Get all the available channels
|
||||||
// select them easily
|
|
||||||
async getChannels(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
async getChannels(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
|
||||||
const endpoint = 'channels';
|
const endpoint = 'channels';
|
||||||
const responseData = await apiRequest.call(this, 'GET', endpoint, {});
|
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;
|
const type = this.getNodeParameter('type', i) as string;
|
||||||
body.type = type === 'public' ? 'O' : 'P';
|
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') {
|
} else if (operation === 'addUser') {
|
||||||
// ----------------------------------
|
// ----------------------------------
|
||||||
// channel:addUser
|
// channel:addUser
|
||||||
|
|
Loading…
Reference in a new issue