2020-10-12 01:05:16 -07:00
|
|
|
import {
|
|
|
|
INodeProperties,
|
|
|
|
} from 'n8n-workflow';
|
|
|
|
|
2021-12-03 00:44:16 -08:00
|
|
|
export const roomOperations: INodeProperties[] = [
|
2020-10-12 01:05:16 -07:00
|
|
|
{
|
|
|
|
displayName: 'Operation',
|
|
|
|
name: 'operation',
|
|
|
|
type: 'options',
|
2022-05-20 14:47:24 -07:00
|
|
|
noDataExpression: true,
|
2020-10-12 01:05:16 -07:00
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'room',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
name: 'Create',
|
|
|
|
value: 'create',
|
|
|
|
description: 'New chat room with defined settings',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Invite',
|
|
|
|
value: 'invite',
|
|
|
|
description: 'Invite a user to a room',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Join',
|
|
|
|
value: 'join',
|
|
|
|
description: 'Join a new room',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Kick',
|
|
|
|
value: 'kick',
|
|
|
|
description: 'Kick a user from a room',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Leave',
|
|
|
|
value: 'leave',
|
|
|
|
description: 'Leave a room',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
default: 'create',
|
|
|
|
},
|
2021-12-03 00:44:16 -08:00
|
|
|
];
|
2020-10-12 01:05:16 -07:00
|
|
|
|
|
|
|
|
2021-12-03 00:44:16 -08:00
|
|
|
export const roomFields: INodeProperties[] = [
|
2020-10-12 01:05:16 -07:00
|
|
|
/* -------------------------------------------------------------------------- */
|
|
|
|
/* room:create */
|
|
|
|
/* -------------------------------------------------------------------------- */
|
|
|
|
{
|
|
|
|
displayName: 'Room Name',
|
|
|
|
name: 'roomName',
|
|
|
|
type: 'string',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'room',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'create',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
default: '',
|
|
|
|
placeholder: 'My new room',
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Preset',
|
|
|
|
name: 'preset',
|
|
|
|
type: 'options',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'room',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'create',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
name: 'Private Chat',
|
|
|
|
value: 'private_chat',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Public Chat',
|
|
|
|
value: 'public_chat',
|
|
|
|
description: 'Open and public chat',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
default: 'public_chat',
|
|
|
|
placeholder: 'My new room',
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Room Alias',
|
|
|
|
name: 'roomAlias',
|
|
|
|
type: 'string',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'room',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'create',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
default: '',
|
|
|
|
placeholder: 'coolest-room-around',
|
|
|
|
},
|
|
|
|
/* -------------------------------------------------------------------------- */
|
|
|
|
/* room:join */
|
|
|
|
/* -------------------------------------------------------------------------- */
|
|
|
|
|
|
|
|
{
|
|
|
|
displayName: 'Room ID or Alias',
|
|
|
|
name: 'roomIdOrAlias',
|
|
|
|
type: 'string',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'room',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'join',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
default: '',
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------------- */
|
|
|
|
/* room:leave */
|
|
|
|
/* -------------------------------------------------------------------------- */
|
|
|
|
{
|
2022-06-03 10:23:49 -07:00
|
|
|
displayName: 'Room Name or ID',
|
2020-10-12 01:05:16 -07:00
|
|
|
name: 'roomId',
|
|
|
|
type: 'options',
|
2022-06-20 07:54:01 -07:00
|
|
|
description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/nodes/expressions.html#expressions">expression</a>',
|
2020-10-12 01:05:16 -07:00
|
|
|
typeOptions: {
|
|
|
|
loadOptionsMethod: 'getChannels',
|
|
|
|
},
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'room',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'leave',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
default: '',
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------------- */
|
|
|
|
/* room:invite */
|
|
|
|
/* -------------------------------------------------------------------------- */
|
|
|
|
{
|
2022-06-03 10:23:49 -07:00
|
|
|
displayName: 'Room Name or ID',
|
2020-10-12 01:05:16 -07:00
|
|
|
name: 'roomId',
|
|
|
|
type: 'options',
|
2022-06-20 07:54:01 -07:00
|
|
|
description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/nodes/expressions.html#expressions">expression</a>',
|
2020-10-12 01:05:16 -07:00
|
|
|
typeOptions: {
|
|
|
|
loadOptionsMethod: 'getChannels',
|
|
|
|
},
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'room',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'invite',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
default: '',
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
|
|
|
|
{
|
|
|
|
displayName: 'User ID',
|
|
|
|
name: 'userId',
|
|
|
|
type: 'string',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'room',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'invite',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
default: '',
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'The fully qualified user ID of the invitee',
|
2020-10-12 01:05:16 -07:00
|
|
|
placeholder: '@cheeky_monkey:matrix.org',
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
|
|
/* -------------------------------------------------------------------------- */
|
|
|
|
/* room:kick */
|
|
|
|
/* -------------------------------------------------------------------------- */
|
|
|
|
{
|
2022-06-03 10:23:49 -07:00
|
|
|
displayName: 'Room Name or ID',
|
2020-10-12 01:05:16 -07:00
|
|
|
name: 'roomId',
|
|
|
|
type: 'options',
|
2022-06-20 07:54:01 -07:00
|
|
|
description: 'Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/nodes/expressions.html#expressions">expression</a>',
|
2020-10-12 01:05:16 -07:00
|
|
|
typeOptions: {
|
|
|
|
loadOptionsMethod: 'getChannels',
|
|
|
|
},
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'room',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'kick',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
default: '',
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'User ID',
|
|
|
|
name: 'userId',
|
|
|
|
type: 'string',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'room',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'kick',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
default: '',
|
2022-05-06 14:01:25 -07:00
|
|
|
description: 'The fully qualified user ID',
|
2020-10-12 01:05:16 -07:00
|
|
|
placeholder: '@cheeky_monkey:matrix.org',
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Reason',
|
|
|
|
name: 'reason',
|
|
|
|
type: 'string',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
resource: [
|
|
|
|
'room',
|
|
|
|
],
|
|
|
|
operation: [
|
|
|
|
'kick',
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
default: '',
|
|
|
|
description: 'Reason for kick',
|
|
|
|
placeholder: 'Telling unfunny jokes',
|
|
|
|
},
|
2021-12-03 00:44:16 -08:00
|
|
|
];
|