From a2ee2773dbd869001a35e775ce09be5ef2257bfc Mon Sep 17 00:00:00 2001 From: Jan Oberhauser Date: Sun, 13 Sep 2020 11:09:17 +0200 Subject: [PATCH] :zap: Minor improvements to Microsoft Teams Node --- .../Microsoft/Teams/ChannelDescription.ts | 36 ++++++++++-------- .../Teams/ChannelMessageDescription.ts | 14 +++---- .../nodes/Microsoft/Teams/GenericFunctions.ts | 6 +-- .../Microsoft/Teams/MicrosoftTeams.node.ts | 8 ++-- .../nodes/Microsoft/Teams/teams.png | Bin 6376 -> 725 bytes 5 files changed, 34 insertions(+), 30 deletions(-) diff --git a/packages/nodes-base/nodes/Microsoft/Teams/ChannelDescription.ts b/packages/nodes-base/nodes/Microsoft/Teams/ChannelDescription.ts index 5509c5e871..c771fba354 100644 --- a/packages/nodes-base/nodes/Microsoft/Teams/ChannelDescription.ts +++ b/packages/nodes-base/nodes/Microsoft/Teams/ChannelDescription.ts @@ -1,6 +1,6 @@ import { INodeProperties, - } from 'n8n-workflow'; +} from 'n8n-workflow'; export const channelOperations = [ { @@ -48,9 +48,9 @@ export const channelOperations = [ export const channelFields = [ -/* -------------------------------------------------------------------------- */ -/* channel:create */ -/* -------------------------------------------------------------------------- */ + /* -------------------------------------------------------------------------- */ + /* channel:create */ + /* -------------------------------------------------------------------------- */ { displayName: 'Team ID', name: 'teamId', @@ -136,9 +136,10 @@ export const channelFields = [ }, ], }, -/* -------------------------------------------------------------------------- */ -/* channel:delete */ -/* -------------------------------------------------------------------------- */ + + /* -------------------------------------------------------------------------- */ + /* channel:delete */ + /* -------------------------------------------------------------------------- */ { displayName: 'Team ID', name: 'teamId', @@ -183,9 +184,10 @@ export const channelFields = [ default: '', description: 'channel ID', }, -/* -------------------------------------------------------------------------- */ -/* channel:get */ -/* -------------------------------------------------------------------------- */ + + /* -------------------------------------------------------------------------- */ + /* channel:get */ + /* -------------------------------------------------------------------------- */ { displayName: 'Team ID', name: 'teamId', @@ -230,9 +232,10 @@ export const channelFields = [ default: '', description: 'channel ID', }, -/* -------------------------------------------------------------------------- */ -/* channel:getAll */ -/* -------------------------------------------------------------------------- */ + + /* -------------------------------------------------------------------------- */ + /* channel:getAll */ + /* -------------------------------------------------------------------------- */ { displayName: 'Team ID', name: 'teamId', @@ -295,9 +298,10 @@ export const channelFields = [ default: 100, description: 'How many results to return.', }, -/* -------------------------------------------------------------------------- */ -/* channel:update */ -/* -------------------------------------------------------------------------- */ + + /* -------------------------------------------------------------------------- */ + /* channel:update */ + /* -------------------------------------------------------------------------- */ { displayName: 'Team ID', name: 'teamId', diff --git a/packages/nodes-base/nodes/Microsoft/Teams/ChannelMessageDescription.ts b/packages/nodes-base/nodes/Microsoft/Teams/ChannelMessageDescription.ts index dead663eea..61879542ad 100644 --- a/packages/nodes-base/nodes/Microsoft/Teams/ChannelMessageDescription.ts +++ b/packages/nodes-base/nodes/Microsoft/Teams/ChannelMessageDescription.ts @@ -1,6 +1,6 @@ import { INodeProperties, - } from 'n8n-workflow'; +} from 'n8n-workflow'; export const channelMessageOperations = [ { @@ -33,9 +33,9 @@ export const channelMessageOperations = [ export const channelMessageFields = [ -/* -------------------------------------------------------------------------- */ -/* channelMessage:create */ -/* -------------------------------------------------------------------------- */ + /* -------------------------------------------------------------------------- */ + /* channelMessage:create */ + /* -------------------------------------------------------------------------- */ { displayName: 'Team ID', name: 'teamId', @@ -129,9 +129,9 @@ export const channelMessageFields = [ default: '', description: 'The content of the item.', }, -/* -------------------------------------------------------------------------- */ -/* channelMessage:getAll */ -/* -------------------------------------------------------------------------- */ + /* -------------------------------------------------------------------------- */ + /* channelMessage:getAll */ + /* -------------------------------------------------------------------------- */ { displayName: 'Team ID', name: 'teamId', diff --git a/packages/nodes-base/nodes/Microsoft/Teams/GenericFunctions.ts b/packages/nodes-base/nodes/Microsoft/Teams/GenericFunctions.ts index 01ff3b964b..f807dba6e6 100644 --- a/packages/nodes-base/nodes/Microsoft/Teams/GenericFunctions.ts +++ b/packages/nodes-base/nodes/Microsoft/Teams/GenericFunctions.ts @@ -1,6 +1,6 @@ import { OptionsWithUri, - } from 'request'; +} from 'request'; import { IExecuteFunctions, @@ -38,7 +38,7 @@ export async function microsoftApiRequest(this: IExecuteFunctions | IExecuteSing } } -export async function microsoftApiRequestAllItems(this: IExecuteFunctions | ILoadOptionsFunctions, propertyName: string ,method: string, endpoint: string, body: any = {}, query: IDataObject = {}): Promise { // tslint:disable-line:no-any +export async function microsoftApiRequestAllItems(this: IExecuteFunctions | ILoadOptionsFunctions, propertyName: string, method: string, endpoint: string, body: any = {}, query: IDataObject = {}): Promise { // tslint:disable-line:no-any const returnData: IDataObject[] = []; @@ -59,7 +59,7 @@ export async function microsoftApiRequestAllItems(this: IExecuteFunctions | ILoa return returnData; } -export async function microsoftApiRequestAllItemsSkip(this: IExecuteFunctions | ILoadOptionsFunctions, propertyName: string ,method: string, endpoint: string, body: any = {}, query: IDataObject = {}): Promise { // tslint:disable-line:no-any +export async function microsoftApiRequestAllItemsSkip(this: IExecuteFunctions | ILoadOptionsFunctions, propertyName: string, method: string, endpoint: string, body: any = {}, query: IDataObject = {}): Promise { // tslint:disable-line:no-any const returnData: IDataObject[] = []; diff --git a/packages/nodes-base/nodes/Microsoft/Teams/MicrosoftTeams.node.ts b/packages/nodes-base/nodes/Microsoft/Teams/MicrosoftTeams.node.ts index b14142e48c..a8677b96ec 100644 --- a/packages/nodes-base/nodes/Microsoft/Teams/MicrosoftTeams.node.ts +++ b/packages/nodes-base/nodes/Microsoft/Teams/MicrosoftTeams.node.ts @@ -152,11 +152,11 @@ export class MicrosoftTeams implements INodeType { //https://docs.microsoft.com/en-us/graph/api/channel-list?view=graph-rest-beta&tabs=http if (operation === 'getAll') { const teamId = this.getNodeParameter('teamId', i) as string; - const returnAll = this.getNodeParameter('returnAll', 0) as boolean; + const returnAll = this.getNodeParameter('returnAll', i) as boolean; if (returnAll) { responseData = await microsoftApiRequestAllItems.call(this, 'value', 'GET', `/v1.0/teams/${teamId}/channels`); } else { - qs.limit = this.getNodeParameter('limit', 0) as number; + qs.limit = this.getNodeParameter('limit', i) as number; responseData = await microsoftApiRequestAllItems.call(this, 'value', 'GET', `/v1.0/teams/${teamId}/channels`, {}); responseData = responseData.splice(0, qs.limit); } @@ -196,11 +196,11 @@ export class MicrosoftTeams implements INodeType { if (operation === 'getAll') { const teamId = this.getNodeParameter('teamId', i) as string; const channelId = this.getNodeParameter('channelId', i) as string; - const returnAll = this.getNodeParameter('returnAll', 0) as boolean; + const returnAll = this.getNodeParameter('returnAll', i) as boolean; if (returnAll) { responseData = await microsoftApiRequestAllItems.call(this, 'value', 'GET', `/beta/teams/${teamId}/channels/${channelId}/messages`); } else { - qs.limit = this.getNodeParameter('limit', 0) as number; + qs.limit = this.getNodeParameter('limit', i) as number; responseData = await microsoftApiRequestAllItems.call(this, 'value', 'GET', `/beta/teams/${teamId}/channels/${channelId}/messages`, {}); responseData = responseData.splice(0, qs.limit); } diff --git a/packages/nodes-base/nodes/Microsoft/Teams/teams.png b/packages/nodes-base/nodes/Microsoft/Teams/teams.png index 89dcee67ffb78902c8479daeb317c871852aa53c..6ccb7ac5dd7f5b4c53a48673be5145489134c0c2 100644 GIT binary patch literal 725 zcmeAS@N?(olHy`uVBq!ia0vp^HXzKw3=&b&bO2IM0(?STfpkpv0XT}w-VbC)W*>~r zIRs*40?C8XPz490GWSJi9fT+b3P$IEq~Z%s#$|vM15tDqn1o2>9Eiz17?T4+ky!_U ziX#dR0m-C-(+~sWvyKKQ9E-|17?*Pds5de9WLOG_kyLONNdEu-|IND}@817-{pNda z_3`3{llisBfB*S+<;J^1$Di-q|0K2KNPOPGFJFJ(d-&i%}?#hdfucAtO$zxG-}LG;Q5Imw(C@?4b@%83Z^2gEjy=SkUDq;+2eSfy?!`Bb)@e);>X3tbuo?4vC?{!=q9xEE5c6_f! z&Ea{!Umnic*YU^jit(vUO9kTm{v4gu*LHaI1@_A+^Vl5!GHHIf`ohw9PiBbwhIjKH zs;qB3AoNt#?BPYZM;{rvAMn>3-DE0PGR)?#*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