diff --git a/packages/nodes-base/nodes/Twitter/GenericFunctions.ts b/packages/nodes-base/nodes/Twitter/GenericFunctions.ts index 3c1904312e..71d0aabeac 100644 --- a/packages/nodes-base/nodes/Twitter/GenericFunctions.ts +++ b/packages/nodes-base/nodes/Twitter/GenericFunctions.ts @@ -12,7 +12,8 @@ import { import { IBinaryKeyData, - IDataObject, INodeExecutionData, + IDataObject, + INodeExecutionData, } from 'n8n-workflow'; export async function twitterApiRequest(this: IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions | IHookFunctions, method: string, resource: string, body: any = {}, qs: IDataObject = {}, uri?: string, option: IDataObject = {}): Promise { // tslint:disable-line:no-any @@ -68,7 +69,7 @@ export async function twitterApiRequestAllItems(this: IExecuteFunctions | ILoadO return returnData; } -export function chunks (buffer: Buffer, chunkSize: number) { +export function chunks(buffer: Buffer, chunkSize: number) { const result = []; const len = buffer.length; let i = 0; @@ -81,9 +82,9 @@ export function chunks (buffer: Buffer, chunkSize: number) { } export async function uploadAttachments(this: IExecuteFunctions, binaryProperties: string[], items: INodeExecutionData[], i: number) { - + const uploadUri = 'https://upload.twitter.com/1.1/media/upload.json'; - + const media: IDataObject[] = []; for (const binaryPropertyName of binaryProperties) { @@ -129,7 +130,7 @@ export async function uploadAttachments(this: IExecuteFunctions, binaryPropertie media_type: binaryData[binaryPropertyName].mimeType, }; - response = await twitterApiRequest.call(this, 'POST', '', {}, {}, uploadUri, { form: attachmentBody }); + response = await twitterApiRequest.call(this, 'POST', '', {}, {}, uploadUri, { form: attachmentBody }); const mediaId = response.media_id_string; @@ -174,10 +175,10 @@ export async function uploadAttachments(this: IExecuteFunctions, binaryPropertie }, (check_after_secs as number) * 1000); }); } - + media.push(response); } return media; } -} \ No newline at end of file +} diff --git a/packages/nodes-base/nodes/Twitter/TweetDescription.ts b/packages/nodes-base/nodes/Twitter/TweetDescription.ts index cd3a517e15..9005cbbc0a 100644 --- a/packages/nodes-base/nodes/Twitter/TweetDescription.ts +++ b/packages/nodes-base/nodes/Twitter/TweetDescription.ts @@ -42,9 +42,9 @@ export const tweetOperations = [ ] as INodeProperties[]; export const tweetFields = [ -/* -------------------------------------------------------------------------- */ -/* tweet:create */ -/* -------------------------------------------------------------------------- */ + /* -------------------------------------------------------------------------- */ + /* tweet:create */ + /* -------------------------------------------------------------------------- */ { displayName: 'Text', name: 'text', @@ -145,9 +145,10 @@ export const tweetFields = [ }, ], }, -/* -------------------------------------------------------------------------- */ -/* tweet:search */ -/* -------------------------------------------------------------------------- */ + + /* -------------------------------------------------------------------------- */ + /* tweet:search */ + /* -------------------------------------------------------------------------- */ { displayName: 'Search Text', name: 'searchText', @@ -338,9 +339,10 @@ export const tweetFields = [ }, ], }, -/* -------------------------------------------------------------------------- */ -/* tweet:like */ -/* -------------------------------------------------------------------------- */ + + /* -------------------------------------------------------------------------- */ + /* tweet:like */ + /* -------------------------------------------------------------------------- */ { displayName: 'Tweet ID', name: 'tweetId', @@ -385,9 +387,10 @@ export const tweetFields = [ }, ], }, -/* -------------------------------------------------------------------------- */ -/* tweet:retweet */ -/* -------------------------------------------------------------------------- */ + + /* -------------------------------------------------------------------------- */ + /* tweet:retweet */ + /* -------------------------------------------------------------------------- */ { displayName: 'Tweet ID', name: 'tweetId', diff --git a/packages/nodes-base/nodes/Twitter/Twitter.node.ts b/packages/nodes-base/nodes/Twitter/Twitter.node.ts index e242c921fe..7a526b91f2 100644 --- a/packages/nodes-base/nodes/Twitter/Twitter.node.ts +++ b/packages/nodes-base/nodes/Twitter/Twitter.node.ts @@ -157,7 +157,7 @@ export class Twitter implements INodeType { const body: ITweet = { status: text, }; - + if (additionalFields.inReplyToStatusId) { body.in_reply_to_status_id = additionalFields.inReplyToStatusId as string; body.auto_populate_reply_metadata = true; @@ -172,7 +172,7 @@ export class Twitter implements INodeType { }); const medias = await uploadAttachments.call(this, attachmentProperties, items, i); - + body.media_ids = (medias as IDataObject[]).map((media: IDataObject) => media.media_id_string).join(','); }