mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +00:00
n8n-3867-progressively-apply-prettier-to-all (#3873)
* 🔨 formatting nodes with prettier
This commit is contained in:
@@ -1,6 +1,4 @@
|
||||
import {
|
||||
INodeProperties,
|
||||
} from 'n8n-workflow';
|
||||
import { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
export const channelOperations: INodeProperties[] = [
|
||||
{
|
||||
@@ -10,9 +8,7 @@ export const channelOperations: INodeProperties[] = [
|
||||
noDataExpression: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'channel',
|
||||
],
|
||||
resource: ['channel'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
@@ -77,16 +73,13 @@ export const channelFields: INodeProperties[] = [
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: [
|
||||
'channel',
|
||||
],
|
||||
operation: ['create'],
|
||||
resource: ['channel'],
|
||||
},
|
||||
},
|
||||
required: true,
|
||||
description: 'The ID of the workspace. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
description:
|
||||
'The ID of the workspace. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Name',
|
||||
@@ -95,12 +88,8 @@ export const channelFields: INodeProperties[] = [
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: [
|
||||
'channel',
|
||||
],
|
||||
operation: ['create'],
|
||||
resource: ['channel'],
|
||||
},
|
||||
},
|
||||
required: true,
|
||||
@@ -114,12 +103,8 @@ export const channelFields: INodeProperties[] = [
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'channel',
|
||||
],
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: ['channel'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
@@ -208,12 +193,11 @@ export const channelFields: INodeProperties[] = [
|
||||
type: 'multiOptions',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getUsers',
|
||||
loadOptionsDependsOn: [
|
||||
'workspaceId',
|
||||
],
|
||||
loadOptionsDependsOn: ['workspaceId'],
|
||||
},
|
||||
default: [],
|
||||
description: 'The users that will participate in the channel. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
description:
|
||||
'The users that will participate in the channel. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -228,15 +212,8 @@ export const channelFields: INodeProperties[] = [
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'archive',
|
||||
'delete',
|
||||
'get',
|
||||
'unarchive',
|
||||
],
|
||||
resource: [
|
||||
'channel',
|
||||
],
|
||||
operation: ['archive', 'delete', 'get', 'unarchive'],
|
||||
resource: ['channel'],
|
||||
},
|
||||
},
|
||||
required: true,
|
||||
@@ -256,16 +233,13 @@ export const channelFields: INodeProperties[] = [
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: [
|
||||
'channel',
|
||||
],
|
||||
operation: ['getAll'],
|
||||
resource: ['channel'],
|
||||
},
|
||||
},
|
||||
required: true,
|
||||
description: 'The ID of the workspace. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
description:
|
||||
'The ID of the workspace. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Return All',
|
||||
@@ -273,12 +247,8 @@ export const channelFields: INodeProperties[] = [
|
||||
type: 'boolean',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'channel',
|
||||
],
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: ['channel'],
|
||||
operation: ['getAll'],
|
||||
},
|
||||
},
|
||||
default: false,
|
||||
@@ -290,15 +260,9 @@ export const channelFields: INodeProperties[] = [
|
||||
type: 'number',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'channel',
|
||||
],
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
returnAll: [
|
||||
false,
|
||||
],
|
||||
resource: ['channel'],
|
||||
operation: ['getAll'],
|
||||
returnAll: [false],
|
||||
},
|
||||
},
|
||||
typeOptions: {
|
||||
@@ -316,12 +280,8 @@ export const channelFields: INodeProperties[] = [
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'channel',
|
||||
],
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: ['channel'],
|
||||
operation: ['getAll'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
@@ -345,12 +305,8 @@ export const channelFields: INodeProperties[] = [
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'update',
|
||||
],
|
||||
resource: [
|
||||
'channel',
|
||||
],
|
||||
operation: ['update'],
|
||||
resource: ['channel'],
|
||||
},
|
||||
},
|
||||
required: true,
|
||||
@@ -364,12 +320,8 @@ export const channelFields: INodeProperties[] = [
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'channel',
|
||||
],
|
||||
operation: [
|
||||
'update',
|
||||
],
|
||||
resource: ['channel'],
|
||||
operation: ['update'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import {
|
||||
INodeProperties,
|
||||
} from 'n8n-workflow';
|
||||
import { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
export const commentOperations: INodeProperties[] = [
|
||||
{
|
||||
@@ -10,9 +8,7 @@ export const commentOperations: INodeProperties[] = [
|
||||
noDataExpression: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'comment',
|
||||
],
|
||||
resource: ['comment'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
@@ -62,12 +58,8 @@ export const commentFields: INodeProperties[] = [
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: [
|
||||
'comment',
|
||||
],
|
||||
operation: ['create'],
|
||||
resource: ['comment'],
|
||||
},
|
||||
},
|
||||
required: true,
|
||||
@@ -80,12 +72,8 @@ export const commentFields: INodeProperties[] = [
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: [
|
||||
'comment',
|
||||
],
|
||||
operation: ['create'],
|
||||
resource: ['comment'],
|
||||
},
|
||||
},
|
||||
required: true,
|
||||
@@ -99,12 +87,8 @@ export const commentFields: INodeProperties[] = [
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'comment',
|
||||
],
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: ['comment'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
@@ -156,10 +140,7 @@ export const commentFields: INodeProperties[] = [
|
||||
type: 'string',
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: [
|
||||
'send_reply',
|
||||
'prefill_message',
|
||||
],
|
||||
action: ['send_reply', 'prefill_message'],
|
||||
},
|
||||
},
|
||||
description: 'The text for the action button',
|
||||
@@ -169,7 +150,8 @@ export const commentFields: INodeProperties[] = [
|
||||
displayName: 'Type',
|
||||
name: 'type',
|
||||
type: 'options',
|
||||
description: 'The type of the button. (Currently only <code>action</code> is available).',
|
||||
description:
|
||||
'The type of the button. (Currently only <code>action</code> is available).',
|
||||
options: [
|
||||
{
|
||||
name: 'Action',
|
||||
@@ -184,9 +166,7 @@ export const commentFields: INodeProperties[] = [
|
||||
type: 'string',
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: [
|
||||
'open_url',
|
||||
],
|
||||
action: ['open_url'],
|
||||
},
|
||||
},
|
||||
description: 'URL to redirect',
|
||||
@@ -201,7 +181,8 @@ export const commentFields: INodeProperties[] = [
|
||||
name: 'binaryProperties',
|
||||
type: 'string',
|
||||
default: 'data',
|
||||
description: 'Name of the property that holds the binary data. Multiple can be defined separated by comma.',
|
||||
description:
|
||||
'Name of the property that holds the binary data. Multiple can be defined separated by comma.',
|
||||
},
|
||||
{
|
||||
displayName: 'Direct Mention Names or IDs',
|
||||
@@ -209,12 +190,11 @@ export const commentFields: INodeProperties[] = [
|
||||
type: 'multiOptions',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getUsers',
|
||||
loadOptionsDependsOn: [
|
||||
'workspaceId',
|
||||
],
|
||||
loadOptionsDependsOn: ['workspaceId'],
|
||||
},
|
||||
default: [],
|
||||
description: 'The users that are directly mentioned. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
description:
|
||||
'The users that are directly mentioned. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Mark Thread Position',
|
||||
@@ -229,12 +209,11 @@ export const commentFields: INodeProperties[] = [
|
||||
type: 'multiOptions',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getUsers',
|
||||
loadOptionsDependsOn: [
|
||||
'workspaceId',
|
||||
],
|
||||
loadOptionsDependsOn: ['workspaceId'],
|
||||
},
|
||||
default: [],
|
||||
description: 'The users that will attached to the comment. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
description:
|
||||
'The users that will attached to the comment. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Temporary ID',
|
||||
@@ -263,13 +242,8 @@ export const commentFields: INodeProperties[] = [
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'get',
|
||||
'delete',
|
||||
],
|
||||
resource: [
|
||||
'comment',
|
||||
],
|
||||
operation: ['get', 'delete'],
|
||||
resource: ['comment'],
|
||||
},
|
||||
},
|
||||
required: true,
|
||||
@@ -286,12 +260,8 @@ export const commentFields: INodeProperties[] = [
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: [
|
||||
'comment',
|
||||
],
|
||||
operation: ['getAll'],
|
||||
resource: ['comment'],
|
||||
},
|
||||
},
|
||||
required: true,
|
||||
@@ -303,12 +273,8 @@ export const commentFields: INodeProperties[] = [
|
||||
type: 'boolean',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'comment',
|
||||
],
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: ['comment'],
|
||||
operation: ['getAll'],
|
||||
},
|
||||
},
|
||||
default: false,
|
||||
@@ -320,15 +286,9 @@ export const commentFields: INodeProperties[] = [
|
||||
type: 'number',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'comment',
|
||||
],
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
returnAll: [
|
||||
false,
|
||||
],
|
||||
resource: ['comment'],
|
||||
operation: ['getAll'],
|
||||
returnAll: [false],
|
||||
},
|
||||
},
|
||||
typeOptions: {
|
||||
@@ -346,12 +306,8 @@ export const commentFields: INodeProperties[] = [
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'comment',
|
||||
],
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: ['comment'],
|
||||
operation: ['getAll'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
@@ -420,12 +376,8 @@ export const commentFields: INodeProperties[] = [
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'update',
|
||||
],
|
||||
resource: [
|
||||
'comment',
|
||||
],
|
||||
operation: ['update'],
|
||||
resource: ['comment'],
|
||||
},
|
||||
},
|
||||
required: true,
|
||||
@@ -439,12 +391,8 @@ export const commentFields: INodeProperties[] = [
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'comment',
|
||||
],
|
||||
operation: [
|
||||
'update',
|
||||
],
|
||||
resource: ['comment'],
|
||||
operation: ['update'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
@@ -496,10 +444,7 @@ export const commentFields: INodeProperties[] = [
|
||||
type: 'string',
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: [
|
||||
'send_reply',
|
||||
'prefill_message',
|
||||
],
|
||||
action: ['send_reply', 'prefill_message'],
|
||||
},
|
||||
},
|
||||
description: 'The text for the action button',
|
||||
@@ -509,7 +454,8 @@ export const commentFields: INodeProperties[] = [
|
||||
displayName: 'Type',
|
||||
name: 'type',
|
||||
type: 'options',
|
||||
description: 'The type of the button. (Currently only <code>action</code> is available).',
|
||||
description:
|
||||
'The type of the button. (Currently only <code>action</code> is available).',
|
||||
options: [
|
||||
{
|
||||
name: 'Action',
|
||||
@@ -524,9 +470,7 @@ export const commentFields: INodeProperties[] = [
|
||||
type: 'string',
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: [
|
||||
'open_url',
|
||||
],
|
||||
action: ['open_url'],
|
||||
},
|
||||
},
|
||||
description: 'URL to redirect',
|
||||
@@ -541,7 +485,8 @@ export const commentFields: INodeProperties[] = [
|
||||
name: 'binaryProperties',
|
||||
type: 'string',
|
||||
default: 'data',
|
||||
description: 'Name of the property that holds the binary data. Multiple can be defined separated by comma.',
|
||||
description:
|
||||
'Name of the property that holds the binary data. Multiple can be defined separated by comma.',
|
||||
},
|
||||
{
|
||||
displayName: 'Content',
|
||||
@@ -556,12 +501,11 @@ export const commentFields: INodeProperties[] = [
|
||||
type: 'multiOptions',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getUsers',
|
||||
loadOptionsDependsOn: [
|
||||
'workspaceId',
|
||||
],
|
||||
loadOptionsDependsOn: ['workspaceId'],
|
||||
},
|
||||
default: [],
|
||||
description: 'The users that are directly mentioned. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
description:
|
||||
'The users that are directly mentioned. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
@@ -1,18 +1,19 @@
|
||||
import {
|
||||
OptionsWithUri,
|
||||
} from 'request';
|
||||
import { OptionsWithUri } from 'request';
|
||||
|
||||
import {
|
||||
IExecuteFunctions,
|
||||
ILoadOptionsFunctions,
|
||||
} from 'n8n-core';
|
||||
import { IExecuteFunctions, ILoadOptionsFunctions } from 'n8n-core';
|
||||
|
||||
import {
|
||||
IDataObject, NodeApiError,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
export async function twistApiRequest(this: IExecuteFunctions | ILoadOptionsFunctions, method: string, endpoint: string, body: any = {}, qs: IDataObject = {}, option: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
||||
import { IDataObject, NodeApiError } from 'n8n-workflow';
|
||||
|
||||
export async function twistApiRequest(
|
||||
this: IExecuteFunctions | ILoadOptionsFunctions,
|
||||
method: string,
|
||||
endpoint: string,
|
||||
// tslint:disable-next-line:no-any
|
||||
body: any = {},
|
||||
qs: IDataObject = {},
|
||||
option: IDataObject = {},
|
||||
// tslint:disable-next-line:no-any
|
||||
): Promise<any> {
|
||||
const options: OptionsWithUri = {
|
||||
method,
|
||||
body,
|
||||
@@ -34,7 +35,6 @@ export async function twistApiRequest(this: IExecuteFunctions | ILoadOptionsFunc
|
||||
try {
|
||||
//@ts-ignore
|
||||
return await this.helpers.requestOAuth2.call(this, 'twistOAuth2Api', options);
|
||||
|
||||
} catch (error) {
|
||||
throw new NodeApiError(this.getNode(), error);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import {
|
||||
INodeProperties
|
||||
} from 'n8n-workflow';
|
||||
import { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
export const messageConversationOperations: INodeProperties[] = [
|
||||
{
|
||||
@@ -10,9 +8,7 @@ export const messageConversationOperations: INodeProperties[] = [
|
||||
noDataExpression: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'messageConversation',
|
||||
],
|
||||
resource: ['messageConversation'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
@@ -52,7 +48,6 @@ export const messageConversationOperations: INodeProperties[] = [
|
||||
];
|
||||
|
||||
export const messageConversationFields: INodeProperties[] = [
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
/* messageConversation:create */
|
||||
/* -------------------------------------------------------------------------- */
|
||||
@@ -66,16 +61,13 @@ export const messageConversationFields: INodeProperties[] = [
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: [
|
||||
'messageConversation',
|
||||
],
|
||||
operation: ['create'],
|
||||
resource: ['messageConversation'],
|
||||
},
|
||||
},
|
||||
required: true,
|
||||
description: 'The ID of the workspace. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
description:
|
||||
'The ID of the workspace. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Conversation Name or ID',
|
||||
@@ -83,23 +75,18 @@ export const messageConversationFields: INodeProperties[] = [
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getConversations',
|
||||
loadOptionsDependsOn: [
|
||||
'workspaceId',
|
||||
],
|
||||
loadOptionsDependsOn: ['workspaceId'],
|
||||
},
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: [
|
||||
'messageConversation',
|
||||
],
|
||||
operation: ['create'],
|
||||
resource: ['messageConversation'],
|
||||
},
|
||||
},
|
||||
required: true,
|
||||
description: 'The ID of the conversation. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
description:
|
||||
'The ID of the conversation. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Content',
|
||||
@@ -108,15 +95,12 @@ export const messageConversationFields: INodeProperties[] = [
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: [
|
||||
'messageConversation',
|
||||
],
|
||||
operation: ['create'],
|
||||
resource: ['messageConversation'],
|
||||
},
|
||||
},
|
||||
description: 'The content of the new message. Mentions can be used as <code>[Name](twist-mention://user_id)</code> for users or <code>[Group name](twist-group-mention://group_id)</code> for groups.',
|
||||
description:
|
||||
'The content of the new message. Mentions can be used as <code>[Name](twist-mention://user_id)</code> for users or <code>[Group name](twist-group-mention://group_id)</code> for groups.',
|
||||
},
|
||||
{
|
||||
displayName: 'Additional Fields',
|
||||
@@ -124,12 +108,8 @@ export const messageConversationFields: INodeProperties[] = [
|
||||
type: 'collection',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: [
|
||||
'messageConversation',
|
||||
],
|
||||
operation: ['create'],
|
||||
resource: ['messageConversation'],
|
||||
},
|
||||
},
|
||||
default: {},
|
||||
@@ -184,10 +164,7 @@ export const messageConversationFields: INodeProperties[] = [
|
||||
type: 'string',
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: [
|
||||
'send_reply',
|
||||
'prefill_message',
|
||||
],
|
||||
action: ['send_reply', 'prefill_message'],
|
||||
},
|
||||
},
|
||||
description: 'The text for the action button',
|
||||
@@ -197,7 +174,8 @@ export const messageConversationFields: INodeProperties[] = [
|
||||
displayName: 'Type',
|
||||
name: 'type',
|
||||
type: 'options',
|
||||
description: 'The type of the button. (Currently only <code>action</code> is available).',
|
||||
description:
|
||||
'The type of the button. (Currently only <code>action</code> is available).',
|
||||
options: [
|
||||
{
|
||||
name: 'Action',
|
||||
@@ -212,9 +190,7 @@ export const messageConversationFields: INodeProperties[] = [
|
||||
type: 'string',
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: [
|
||||
'open_url',
|
||||
],
|
||||
action: ['open_url'],
|
||||
},
|
||||
},
|
||||
description: 'URL to redirect',
|
||||
@@ -229,7 +205,8 @@ export const messageConversationFields: INodeProperties[] = [
|
||||
name: 'binaryProperties',
|
||||
type: 'string',
|
||||
default: 'data',
|
||||
description: 'Name of the property that holds the binary data. Multiple can be defined separated by comma.',
|
||||
description:
|
||||
'Name of the property that holds the binary data. Multiple can be defined separated by comma.',
|
||||
},
|
||||
{
|
||||
displayName: 'Direct Mention Names or IDs',
|
||||
@@ -239,7 +216,8 @@ export const messageConversationFields: INodeProperties[] = [
|
||||
loadOptionsMethod: 'getUsers',
|
||||
},
|
||||
default: [],
|
||||
description: 'The users that are directly mentioned. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
description:
|
||||
'The users that are directly mentioned. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
},
|
||||
// {
|
||||
// displayName: 'Direct Group Mentions ',
|
||||
@@ -267,16 +245,13 @@ export const messageConversationFields: INodeProperties[] = [
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: [
|
||||
'messageConversation',
|
||||
],
|
||||
operation: ['getAll'],
|
||||
resource: ['messageConversation'],
|
||||
},
|
||||
},
|
||||
required: true,
|
||||
description: 'The ID of the workspace. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
description:
|
||||
'The ID of the workspace. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Conversation Name or ID',
|
||||
@@ -284,23 +259,18 @@ export const messageConversationFields: INodeProperties[] = [
|
||||
type: 'options',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getConversations',
|
||||
loadOptionsDependsOn: [
|
||||
'workspaceId',
|
||||
],
|
||||
loadOptionsDependsOn: ['workspaceId'],
|
||||
},
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: [
|
||||
'messageConversation',
|
||||
],
|
||||
operation: ['getAll'],
|
||||
resource: ['messageConversation'],
|
||||
},
|
||||
},
|
||||
required: true,
|
||||
description: 'The ID of the conversation. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
description:
|
||||
'The ID of the conversation. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Additional Fields',
|
||||
@@ -308,12 +278,8 @@ export const messageConversationFields: INodeProperties[] = [
|
||||
type: 'collection',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: [
|
||||
'messageConversation',
|
||||
],
|
||||
operation: ['getAll'],
|
||||
resource: ['messageConversation'],
|
||||
},
|
||||
},
|
||||
default: {},
|
||||
@@ -373,13 +339,8 @@ export const messageConversationFields: INodeProperties[] = [
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'delete',
|
||||
'get',
|
||||
],
|
||||
resource: [
|
||||
'messageConversation',
|
||||
],
|
||||
operation: ['delete', 'get'],
|
||||
resource: ['messageConversation'],
|
||||
},
|
||||
},
|
||||
required: true,
|
||||
@@ -396,12 +357,8 @@ export const messageConversationFields: INodeProperties[] = [
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'update',
|
||||
],
|
||||
resource: [
|
||||
'messageConversation',
|
||||
],
|
||||
operation: ['update'],
|
||||
resource: ['messageConversation'],
|
||||
},
|
||||
},
|
||||
required: true,
|
||||
@@ -413,12 +370,8 @@ export const messageConversationFields: INodeProperties[] = [
|
||||
type: 'collection',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'update',
|
||||
],
|
||||
resource: [
|
||||
'messageConversation',
|
||||
],
|
||||
operation: ['update'],
|
||||
resource: ['messageConversation'],
|
||||
},
|
||||
},
|
||||
default: {},
|
||||
@@ -472,10 +425,7 @@ export const messageConversationFields: INodeProperties[] = [
|
||||
type: 'string',
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: [
|
||||
'send_reply',
|
||||
'prefill_message',
|
||||
],
|
||||
action: ['send_reply', 'prefill_message'],
|
||||
},
|
||||
},
|
||||
description: 'The text for the action button',
|
||||
@@ -485,7 +435,8 @@ export const messageConversationFields: INodeProperties[] = [
|
||||
displayName: 'Type',
|
||||
name: 'type',
|
||||
type: 'options',
|
||||
description: 'The type of the button. (Currently only <code>action</code> is available).',
|
||||
description:
|
||||
'The type of the button. (Currently only <code>action</code> is available).',
|
||||
options: [
|
||||
{
|
||||
name: 'Action',
|
||||
@@ -500,9 +451,7 @@ export const messageConversationFields: INodeProperties[] = [
|
||||
type: 'string',
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: [
|
||||
'open_url',
|
||||
],
|
||||
action: ['open_url'],
|
||||
},
|
||||
},
|
||||
description: 'URL to redirect',
|
||||
@@ -517,14 +466,16 @@ export const messageConversationFields: INodeProperties[] = [
|
||||
name: 'binaryProperties',
|
||||
type: 'string',
|
||||
default: 'data',
|
||||
description: 'Name of the property that holds the binary data. Multiple can be defined separated by comma.',
|
||||
description:
|
||||
'Name of the property that holds the binary data. Multiple can be defined separated by comma.',
|
||||
},
|
||||
{
|
||||
displayName: 'Content',
|
||||
name: 'content',
|
||||
type: 'string',
|
||||
default: '',
|
||||
description: 'The content of the new message. Mentions can be used as <code>[Name](twist-mention://user_id)</code> for users or <code>[Group name](twist-group-mention://group_id)</code> for groups.',
|
||||
description:
|
||||
'The content of the new message. Mentions can be used as <code>[Name](twist-mention://user_id)</code> for users or <code>[Group name](twist-group-mention://group_id)</code> for groups.',
|
||||
},
|
||||
{
|
||||
displayName: 'Direct Mention Names or IDs',
|
||||
@@ -534,7 +485,8 @@ export const messageConversationFields: INodeProperties[] = [
|
||||
loadOptionsMethod: 'getUsers',
|
||||
},
|
||||
default: [],
|
||||
description: 'The users that are directly mentioned. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
description:
|
||||
'The users that are directly mentioned. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import {
|
||||
INodeProperties,
|
||||
} from 'n8n-workflow';
|
||||
import { INodeProperties } from 'n8n-workflow';
|
||||
|
||||
export const threadOperations: INodeProperties[] = [
|
||||
{
|
||||
@@ -10,9 +8,7 @@ export const threadOperations: INodeProperties[] = [
|
||||
noDataExpression: true,
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'thread',
|
||||
],
|
||||
resource: ['thread'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
@@ -62,12 +58,8 @@ export const threadFields: INodeProperties[] = [
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: [
|
||||
'thread',
|
||||
],
|
||||
operation: ['create'],
|
||||
resource: ['thread'],
|
||||
},
|
||||
},
|
||||
required: true,
|
||||
@@ -80,12 +72,8 @@ export const threadFields: INodeProperties[] = [
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: [
|
||||
'thread',
|
||||
],
|
||||
operation: ['create'],
|
||||
resource: ['thread'],
|
||||
},
|
||||
},
|
||||
required: true,
|
||||
@@ -98,12 +86,8 @@ export const threadFields: INodeProperties[] = [
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: [
|
||||
'thread',
|
||||
],
|
||||
operation: ['create'],
|
||||
resource: ['thread'],
|
||||
},
|
||||
},
|
||||
required: true,
|
||||
@@ -117,12 +101,8 @@ export const threadFields: INodeProperties[] = [
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'thread',
|
||||
],
|
||||
operation: [
|
||||
'create',
|
||||
],
|
||||
resource: ['thread'],
|
||||
operation: ['create'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
@@ -174,10 +154,7 @@ export const threadFields: INodeProperties[] = [
|
||||
type: 'string',
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: [
|
||||
'send_reply',
|
||||
'prefill_message',
|
||||
],
|
||||
action: ['send_reply', 'prefill_message'],
|
||||
},
|
||||
},
|
||||
description: 'The text for the action button',
|
||||
@@ -187,7 +164,8 @@ export const threadFields: INodeProperties[] = [
|
||||
displayName: 'Type',
|
||||
name: 'type',
|
||||
type: 'options',
|
||||
description: 'The type of the button. (Currently only <code>action</code> is available).',
|
||||
description:
|
||||
'The type of the button. (Currently only <code>action</code> is available).',
|
||||
options: [
|
||||
{
|
||||
name: 'Action',
|
||||
@@ -202,9 +180,7 @@ export const threadFields: INodeProperties[] = [
|
||||
type: 'string',
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: [
|
||||
'open_url',
|
||||
],
|
||||
action: ['open_url'],
|
||||
},
|
||||
},
|
||||
description: 'URL to redirect',
|
||||
@@ -219,7 +195,8 @@ export const threadFields: INodeProperties[] = [
|
||||
name: 'binaryProperties',
|
||||
type: 'string',
|
||||
default: 'data',
|
||||
description: 'Name of the property that holds the binary data. Multiple can be defined separated by comma.',
|
||||
description:
|
||||
'Name of the property that holds the binary data. Multiple can be defined separated by comma.',
|
||||
},
|
||||
{
|
||||
displayName: 'Direct Mention Names or IDs',
|
||||
@@ -227,12 +204,11 @@ export const threadFields: INodeProperties[] = [
|
||||
type: 'multiOptions',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getUsers',
|
||||
loadOptionsDependsOn: [
|
||||
'workspaceId',
|
||||
],
|
||||
loadOptionsDependsOn: ['workspaceId'],
|
||||
},
|
||||
default: [],
|
||||
description: 'The users that are directly mentioned. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
description:
|
||||
'The users that are directly mentioned. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Recipient Names or IDs',
|
||||
@@ -240,12 +216,11 @@ export const threadFields: INodeProperties[] = [
|
||||
type: 'multiOptions',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getUsers',
|
||||
loadOptionsDependsOn: [
|
||||
'workspaceId',
|
||||
],
|
||||
loadOptionsDependsOn: ['workspaceId'],
|
||||
},
|
||||
default: [],
|
||||
description: 'The users that will attached to the thread. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
description:
|
||||
'The users that will attached to the thread. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Send as Integration',
|
||||
@@ -273,13 +248,8 @@ export const threadFields: INodeProperties[] = [
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'get',
|
||||
'delete',
|
||||
],
|
||||
resource: [
|
||||
'thread',
|
||||
],
|
||||
operation: ['get', 'delete'],
|
||||
resource: ['thread'],
|
||||
},
|
||||
},
|
||||
required: true,
|
||||
@@ -295,12 +265,8 @@ export const threadFields: INodeProperties[] = [
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: [
|
||||
'thread',
|
||||
],
|
||||
operation: ['getAll'],
|
||||
resource: ['thread'],
|
||||
},
|
||||
},
|
||||
required: true,
|
||||
@@ -312,12 +278,8 @@ export const threadFields: INodeProperties[] = [
|
||||
type: 'boolean',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'thread',
|
||||
],
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: ['thread'],
|
||||
operation: ['getAll'],
|
||||
},
|
||||
},
|
||||
default: false,
|
||||
@@ -329,15 +291,9 @@ export const threadFields: INodeProperties[] = [
|
||||
type: 'number',
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'thread',
|
||||
],
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
returnAll: [
|
||||
false,
|
||||
],
|
||||
resource: ['thread'],
|
||||
operation: ['getAll'],
|
||||
returnAll: [false],
|
||||
},
|
||||
},
|
||||
typeOptions: {
|
||||
@@ -355,12 +311,8 @@ export const threadFields: INodeProperties[] = [
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'thread',
|
||||
],
|
||||
operation: [
|
||||
'getAll',
|
||||
],
|
||||
resource: ['thread'],
|
||||
operation: ['getAll'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
@@ -390,7 +342,8 @@ export const threadFields: INodeProperties[] = [
|
||||
},
|
||||
],
|
||||
default: '',
|
||||
description: 'A filter can be one of <code>attached_to_me</code>, <code>everyone</code> and <code>is_starred</code>',
|
||||
description:
|
||||
'A filter can be one of <code>attached_to_me</code>, <code>everyone</code> and <code>is_starred</code>',
|
||||
},
|
||||
{
|
||||
displayName: 'Newer Than',
|
||||
@@ -419,12 +372,8 @@ export const threadFields: INodeProperties[] = [
|
||||
default: '',
|
||||
displayOptions: {
|
||||
show: {
|
||||
operation: [
|
||||
'update',
|
||||
],
|
||||
resource: [
|
||||
'thread',
|
||||
],
|
||||
operation: ['update'],
|
||||
resource: ['thread'],
|
||||
},
|
||||
},
|
||||
required: true,
|
||||
@@ -438,12 +387,8 @@ export const threadFields: INodeProperties[] = [
|
||||
default: {},
|
||||
displayOptions: {
|
||||
show: {
|
||||
resource: [
|
||||
'thread',
|
||||
],
|
||||
operation: [
|
||||
'update',
|
||||
],
|
||||
resource: ['thread'],
|
||||
operation: ['update'],
|
||||
},
|
||||
},
|
||||
options: [
|
||||
@@ -495,10 +440,7 @@ export const threadFields: INodeProperties[] = [
|
||||
type: 'string',
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: [
|
||||
'send_reply',
|
||||
'prefill_message',
|
||||
],
|
||||
action: ['send_reply', 'prefill_message'],
|
||||
},
|
||||
},
|
||||
description: 'The text for the action button',
|
||||
@@ -508,7 +450,8 @@ export const threadFields: INodeProperties[] = [
|
||||
displayName: 'Type',
|
||||
name: 'type',
|
||||
type: 'options',
|
||||
description: 'The type of the button. (Currently only <code>action</code> is available).',
|
||||
description:
|
||||
'The type of the button. (Currently only <code>action</code> is available).',
|
||||
options: [
|
||||
{
|
||||
name: 'Action',
|
||||
@@ -523,9 +466,7 @@ export const threadFields: INodeProperties[] = [
|
||||
type: 'string',
|
||||
displayOptions: {
|
||||
show: {
|
||||
action: [
|
||||
'open_url',
|
||||
],
|
||||
action: ['open_url'],
|
||||
},
|
||||
},
|
||||
description: 'URL to redirect',
|
||||
@@ -540,7 +481,8 @@ export const threadFields: INodeProperties[] = [
|
||||
name: 'binaryProperties',
|
||||
type: 'string',
|
||||
default: 'data',
|
||||
description: 'Name of the property that holds the binary data. Multiple can be defined separated by comma.',
|
||||
description:
|
||||
'Name of the property that holds the binary data. Multiple can be defined separated by comma.',
|
||||
},
|
||||
{
|
||||
displayName: 'Content',
|
||||
@@ -555,12 +497,11 @@ export const threadFields: INodeProperties[] = [
|
||||
type: 'multiOptions',
|
||||
typeOptions: {
|
||||
loadOptionsMethod: 'getUsers',
|
||||
loadOptionsDependsOn: [
|
||||
'workspaceId',
|
||||
],
|
||||
loadOptionsDependsOn: ['workspaceId'],
|
||||
},
|
||||
default: [],
|
||||
description: 'The users that are directly mentioned. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
description:
|
||||
'The users that are directly mentioned. Choose from the list, or specify IDs using an <a href="https://docs.n8n.io/code-examples/expressions/">expression</a>.',
|
||||
},
|
||||
{
|
||||
displayName: 'Title',
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
import {
|
||||
IExecuteFunctions,
|
||||
} from 'n8n-core';
|
||||
import { IExecuteFunctions } from 'n8n-core';
|
||||
|
||||
import {
|
||||
IBinaryData,
|
||||
@@ -14,28 +12,17 @@ import {
|
||||
NodeOperationError,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
twistApiRequest,
|
||||
} from './GenericFunctions';
|
||||
import { twistApiRequest } from './GenericFunctions';
|
||||
|
||||
import {
|
||||
channelFields,
|
||||
channelOperations,
|
||||
} from './ChannelDescription';
|
||||
import { channelFields, channelOperations } from './ChannelDescription';
|
||||
|
||||
import {
|
||||
messageConversationFields,
|
||||
messageConversationOperations,
|
||||
} from './MessageConversationDescription';
|
||||
|
||||
import {
|
||||
threadFields,
|
||||
threadOperations
|
||||
} from './ThreadDescription';
|
||||
import {
|
||||
commentFields,
|
||||
commentOperations
|
||||
} from './CommentDescription';
|
||||
import { threadFields, threadOperations } from './ThreadDescription';
|
||||
import { commentFields, commentOperations } from './CommentDescription';
|
||||
import { v4 as uuid } from 'uuid';
|
||||
import moment from 'moment';
|
||||
|
||||
@@ -268,35 +255,40 @@ export class Twist implements INodeType {
|
||||
const attachments: IDataObject[] = [];
|
||||
|
||||
for (const binaryProperty of binaryProperties) {
|
||||
|
||||
const item = items[i].binary as IBinaryKeyData;
|
||||
|
||||
const binaryData = item[binaryProperty] as IBinaryData;
|
||||
|
||||
if (binaryData === undefined) {
|
||||
throw new NodeOperationError(this.getNode(), `No binary data property "${binaryProperty}" does not exists on item!`, { itemIndex: i });
|
||||
throw new NodeOperationError(
|
||||
this.getNode(),
|
||||
`No binary data property "${binaryProperty}" does not exists on item!`,
|
||||
{ itemIndex: i },
|
||||
);
|
||||
}
|
||||
|
||||
const dataBuffer = await this.helpers.getBinaryDataBuffer(i, binaryProperty);
|
||||
|
||||
attachments.push(await twistApiRequest.call(
|
||||
this,
|
||||
'POST',
|
||||
'/attachments/upload',
|
||||
{},
|
||||
{},
|
||||
{
|
||||
formData: {
|
||||
file_name: {
|
||||
value: dataBuffer,
|
||||
options: {
|
||||
filename: binaryData.fileName,
|
||||
attachments.push(
|
||||
await twistApiRequest.call(
|
||||
this,
|
||||
'POST',
|
||||
'/attachments/upload',
|
||||
{},
|
||||
{},
|
||||
{
|
||||
formData: {
|
||||
file_name: {
|
||||
value: dataBuffer,
|
||||
options: {
|
||||
filename: binaryData.fileName,
|
||||
},
|
||||
},
|
||||
attachment_id: uuid(),
|
||||
},
|
||||
attachment_id: uuid(),
|
||||
},
|
||||
},
|
||||
));
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
body.attachments = attachments;
|
||||
@@ -345,7 +337,7 @@ export class Twist implements INodeType {
|
||||
|
||||
responseData = await twistApiRequest.call(this, 'GET', '/comments/get', {}, qs);
|
||||
if (qs.as_ids) {
|
||||
responseData = (responseData as number[]).map(id => ({ ID: id }));
|
||||
responseData = (responseData as number[]).map((id) => ({ ID: id }));
|
||||
}
|
||||
}
|
||||
//https://developer.twist.com/v3/#update-comment
|
||||
@@ -372,35 +364,40 @@ export class Twist implements INodeType {
|
||||
const attachments: IDataObject[] = [];
|
||||
|
||||
for (const binaryProperty of binaryProperties) {
|
||||
|
||||
const item = items[i].binary as IBinaryKeyData;
|
||||
|
||||
const binaryData = item[binaryProperty] as IBinaryData;
|
||||
|
||||
if (binaryData === undefined) {
|
||||
throw new NodeOperationError(this.getNode(), `No binary data property "${binaryProperty}" does not exists on item!`, { itemIndex: i });
|
||||
throw new NodeOperationError(
|
||||
this.getNode(),
|
||||
`No binary data property "${binaryProperty}" does not exists on item!`,
|
||||
{ itemIndex: i },
|
||||
);
|
||||
}
|
||||
|
||||
const dataBuffer = await this.helpers.getBinaryDataBuffer(i, binaryProperty);
|
||||
|
||||
attachments.push(await twistApiRequest.call(
|
||||
this,
|
||||
'POST',
|
||||
'/attachments/upload',
|
||||
{},
|
||||
{},
|
||||
{
|
||||
formData: {
|
||||
file_name: {
|
||||
value: dataBuffer,
|
||||
options: {
|
||||
filename: binaryData.fileName,
|
||||
attachments.push(
|
||||
await twistApiRequest.call(
|
||||
this,
|
||||
'POST',
|
||||
'/attachments/upload',
|
||||
{},
|
||||
{},
|
||||
{
|
||||
formData: {
|
||||
file_name: {
|
||||
value: dataBuffer,
|
||||
options: {
|
||||
filename: binaryData.fileName,
|
||||
},
|
||||
},
|
||||
attachment_id: uuid(),
|
||||
},
|
||||
attachment_id: uuid(),
|
||||
},
|
||||
},
|
||||
));
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
body.attachments = attachments;
|
||||
@@ -446,35 +443,40 @@ export class Twist implements INodeType {
|
||||
const attachments: IDataObject[] = [];
|
||||
|
||||
for (const binaryProperty of binaryProperties) {
|
||||
|
||||
const item = items[i].binary as IBinaryKeyData;
|
||||
|
||||
const binaryData = item[binaryProperty] as IBinaryData;
|
||||
|
||||
if (binaryData === undefined) {
|
||||
throw new NodeOperationError(this.getNode(), `No binary data property "${binaryProperty}" does not exists on item!`, { itemIndex: i });
|
||||
throw new NodeOperationError(
|
||||
this.getNode(),
|
||||
`No binary data property "${binaryProperty}" does not exists on item!`,
|
||||
{ itemIndex: i },
|
||||
);
|
||||
}
|
||||
|
||||
const dataBuffer = await this.helpers.getBinaryDataBuffer(i, binaryProperty);
|
||||
|
||||
attachments.push(await twistApiRequest.call(
|
||||
this,
|
||||
'POST',
|
||||
'/attachments/upload',
|
||||
{},
|
||||
{},
|
||||
{
|
||||
formData: {
|
||||
file_name: {
|
||||
value: dataBuffer,
|
||||
options: {
|
||||
filename: binaryData.fileName,
|
||||
attachments.push(
|
||||
await twistApiRequest.call(
|
||||
this,
|
||||
'POST',
|
||||
'/attachments/upload',
|
||||
{},
|
||||
{},
|
||||
{
|
||||
formData: {
|
||||
file_name: {
|
||||
value: dataBuffer,
|
||||
options: {
|
||||
filename: binaryData.fileName,
|
||||
},
|
||||
},
|
||||
attachment_id: uuid(),
|
||||
},
|
||||
attachment_id: uuid(),
|
||||
},
|
||||
},
|
||||
));
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
body.attachments = attachments;
|
||||
@@ -496,13 +498,24 @@ export class Twist implements INodeType {
|
||||
// body.content = `${directGroupMentions.join(' ')} ${body.content}`;
|
||||
// }
|
||||
|
||||
responseData = await twistApiRequest.call(this, 'POST', '/conversation_messages/add', body);
|
||||
responseData = await twistApiRequest.call(
|
||||
this,
|
||||
'POST',
|
||||
'/conversation_messages/add',
|
||||
body,
|
||||
);
|
||||
}
|
||||
//https://developer.twist.com/v3/#get-message
|
||||
if (operation === 'get') {
|
||||
qs.id = this.getNodeParameter('id', i) as string;
|
||||
|
||||
responseData = await twistApiRequest.call(this, 'GET', '/conversation_messages/getone', {}, qs);
|
||||
responseData = await twistApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
'/conversation_messages/getone',
|
||||
{},
|
||||
qs,
|
||||
);
|
||||
}
|
||||
//https://developer.twist.com/v3/#get-all-messages
|
||||
if (operation === 'getAll') {
|
||||
@@ -511,13 +524,25 @@ export class Twist implements INodeType {
|
||||
qs.conversation_id = conversationId;
|
||||
Object.assign(qs, additionalFields);
|
||||
|
||||
responseData = await twistApiRequest.call(this, 'GET', '/conversation_messages/get', {}, qs);
|
||||
responseData = await twistApiRequest.call(
|
||||
this,
|
||||
'GET',
|
||||
'/conversation_messages/get',
|
||||
{},
|
||||
qs,
|
||||
);
|
||||
}
|
||||
//https://developer.twist.com/v3/#remove-message-from-conversation
|
||||
if (operation === 'delete') {
|
||||
qs.id = this.getNodeParameter('id', i) as string;
|
||||
|
||||
responseData = await twistApiRequest.call(this, 'POST', '/conversation_messages/remove', {}, qs);
|
||||
responseData = await twistApiRequest.call(
|
||||
this,
|
||||
'POST',
|
||||
'/conversation_messages/remove',
|
||||
{},
|
||||
qs,
|
||||
);
|
||||
}
|
||||
//https://developer.twist.com/v3/#update-message-in-conversation
|
||||
if (operation === 'update') {
|
||||
@@ -543,35 +568,40 @@ export class Twist implements INodeType {
|
||||
const attachments: IDataObject[] = [];
|
||||
|
||||
for (const binaryProperty of binaryProperties) {
|
||||
|
||||
const item = items[i].binary as IBinaryKeyData;
|
||||
|
||||
const binaryData = item[binaryProperty] as IBinaryData;
|
||||
|
||||
if (binaryData === undefined) {
|
||||
throw new NodeOperationError(this.getNode(), `No binary data property "${binaryProperty}" does not exists on item!`, { itemIndex: i });
|
||||
throw new NodeOperationError(
|
||||
this.getNode(),
|
||||
`No binary data property "${binaryProperty}" does not exists on item!`,
|
||||
{ itemIndex: i },
|
||||
);
|
||||
}
|
||||
|
||||
const dataBuffer = await this.helpers.getBinaryDataBuffer(i, binaryProperty);
|
||||
|
||||
attachments.push(await twistApiRequest.call(
|
||||
this,
|
||||
'POST',
|
||||
'/attachments/upload',
|
||||
{},
|
||||
{},
|
||||
{
|
||||
formData: {
|
||||
file_name: {
|
||||
value: dataBuffer,
|
||||
options: {
|
||||
filename: binaryData.fileName,
|
||||
attachments.push(
|
||||
await twistApiRequest.call(
|
||||
this,
|
||||
'POST',
|
||||
'/attachments/upload',
|
||||
{},
|
||||
{},
|
||||
{
|
||||
formData: {
|
||||
file_name: {
|
||||
value: dataBuffer,
|
||||
options: {
|
||||
filename: binaryData.fileName,
|
||||
},
|
||||
},
|
||||
attachment_id: uuid(),
|
||||
},
|
||||
attachment_id: uuid(),
|
||||
},
|
||||
},
|
||||
));
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
body.attachments = attachments;
|
||||
@@ -585,7 +615,12 @@ export class Twist implements INodeType {
|
||||
body.content = `${directMentions.join(' ')} ${body.content}`;
|
||||
}
|
||||
|
||||
responseData = await twistApiRequest.call(this, 'POST', '/conversation_messages/update', body);
|
||||
responseData = await twistApiRequest.call(
|
||||
this,
|
||||
'POST',
|
||||
'/conversation_messages/update',
|
||||
body,
|
||||
);
|
||||
}
|
||||
}
|
||||
if (resource === 'thread') {
|
||||
@@ -617,35 +652,40 @@ export class Twist implements INodeType {
|
||||
const attachments: IDataObject[] = [];
|
||||
|
||||
for (const binaryProperty of binaryProperties) {
|
||||
|
||||
const item = items[i].binary as IBinaryKeyData;
|
||||
|
||||
const binaryData = item[binaryProperty] as IBinaryData;
|
||||
|
||||
if (binaryData === undefined) {
|
||||
throw new NodeOperationError(this.getNode(), `No binary data property "${binaryProperty}" does not exists on item!`, { itemIndex: i });
|
||||
throw new NodeOperationError(
|
||||
this.getNode(),
|
||||
`No binary data property "${binaryProperty}" does not exists on item!`,
|
||||
{ itemIndex: i },
|
||||
);
|
||||
}
|
||||
|
||||
const dataBuffer = await this.helpers.getBinaryDataBuffer(i, binaryProperty);
|
||||
|
||||
attachments.push(await twistApiRequest.call(
|
||||
this,
|
||||
'POST',
|
||||
'/attachments/upload',
|
||||
{},
|
||||
{},
|
||||
{
|
||||
formData: {
|
||||
file_name: {
|
||||
value: dataBuffer,
|
||||
options: {
|
||||
filename: binaryData.fileName,
|
||||
attachments.push(
|
||||
await twistApiRequest.call(
|
||||
this,
|
||||
'POST',
|
||||
'/attachments/upload',
|
||||
{},
|
||||
{},
|
||||
{
|
||||
formData: {
|
||||
file_name: {
|
||||
value: dataBuffer,
|
||||
options: {
|
||||
filename: binaryData.fileName,
|
||||
},
|
||||
},
|
||||
attachment_id: uuid(),
|
||||
},
|
||||
attachment_id: uuid(),
|
||||
},
|
||||
},
|
||||
));
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
body.attachments = attachments;
|
||||
@@ -693,7 +733,7 @@ export class Twist implements INodeType {
|
||||
|
||||
responseData = await twistApiRequest.call(this, 'GET', '/threads/get', {}, qs);
|
||||
if (qs.as_ids) {
|
||||
responseData = (responseData as number[]).map(id => ({ ID: id }));
|
||||
responseData = (responseData as number[]).map((id) => ({ ID: id }));
|
||||
}
|
||||
}
|
||||
//https://developer.twist.com/v3/#update-thread
|
||||
@@ -720,35 +760,40 @@ export class Twist implements INodeType {
|
||||
const attachments: IDataObject[] = [];
|
||||
|
||||
for (const binaryProperty of binaryProperties) {
|
||||
|
||||
const item = items[i].binary as IBinaryKeyData;
|
||||
|
||||
const binaryData = item[binaryProperty] as IBinaryData;
|
||||
|
||||
if (binaryData === undefined) {
|
||||
throw new NodeOperationError(this.getNode(), `No binary data property "${binaryProperty}" does not exists on item!`, { itemIndex: i });
|
||||
throw new NodeOperationError(
|
||||
this.getNode(),
|
||||
`No binary data property "${binaryProperty}" does not exists on item!`,
|
||||
{ itemIndex: i },
|
||||
);
|
||||
}
|
||||
|
||||
const dataBuffer = await this.helpers.getBinaryDataBuffer(i, binaryProperty);
|
||||
|
||||
attachments.push(await twistApiRequest.call(
|
||||
this,
|
||||
'POST',
|
||||
'/attachments/upload',
|
||||
{},
|
||||
{},
|
||||
{
|
||||
formData: {
|
||||
file_name: {
|
||||
value: dataBuffer,
|
||||
options: {
|
||||
filename: binaryData.fileName,
|
||||
attachments.push(
|
||||
await twistApiRequest.call(
|
||||
this,
|
||||
'POST',
|
||||
'/attachments/upload',
|
||||
{},
|
||||
{},
|
||||
{
|
||||
formData: {
|
||||
file_name: {
|
||||
value: dataBuffer,
|
||||
options: {
|
||||
filename: binaryData.fileName,
|
||||
},
|
||||
},
|
||||
attachment_id: uuid(),
|
||||
},
|
||||
attachment_id: uuid(),
|
||||
},
|
||||
},
|
||||
));
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
body.attachments = attachments;
|
||||
|
||||
Reference in New Issue
Block a user