Minor improvements to Microsoft Teams Node

This commit is contained in:
Jan Oberhauser 2020-09-13 11:09:17 +02:00
parent 38ddcbe703
commit a2ee2773db
5 changed files with 34 additions and 30 deletions

View file

@ -136,6 +136,7 @@ export const channelFields = [
}, },
], ],
}, },
/* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */
/* channel:delete */ /* channel:delete */
/* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */
@ -183,6 +184,7 @@ export const channelFields = [
default: '', default: '',
description: 'channel ID', description: 'channel ID',
}, },
/* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */
/* channel:get */ /* channel:get */
/* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */
@ -230,6 +232,7 @@ export const channelFields = [
default: '', default: '',
description: 'channel ID', description: 'channel ID',
}, },
/* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */
/* channel:getAll */ /* channel:getAll */
/* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */
@ -295,6 +298,7 @@ export const channelFields = [
default: 100, default: 100,
description: 'How many results to return.', description: 'How many results to return.',
}, },
/* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */
/* channel:update */ /* channel:update */
/* -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- */

View file

@ -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 //https://docs.microsoft.com/en-us/graph/api/channel-list?view=graph-rest-beta&tabs=http
if (operation === 'getAll') { if (operation === 'getAll') {
const teamId = this.getNodeParameter('teamId', i) as string; 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) { if (returnAll) {
responseData = await microsoftApiRequestAllItems.call(this, 'value', 'GET', `/v1.0/teams/${teamId}/channels`); responseData = await microsoftApiRequestAllItems.call(this, 'value', 'GET', `/v1.0/teams/${teamId}/channels`);
} else { } 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 = await microsoftApiRequestAllItems.call(this, 'value', 'GET', `/v1.0/teams/${teamId}/channels`, {});
responseData = responseData.splice(0, qs.limit); responseData = responseData.splice(0, qs.limit);
} }
@ -196,11 +196,11 @@ export class MicrosoftTeams implements INodeType {
if (operation === 'getAll') { if (operation === 'getAll') {
const teamId = this.getNodeParameter('teamId', i) as string; const teamId = this.getNodeParameter('teamId', i) as string;
const channelId = this.getNodeParameter('channelId', 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) { if (returnAll) {
responseData = await microsoftApiRequestAllItems.call(this, 'value', 'GET', `/beta/teams/${teamId}/channels/${channelId}/messages`); responseData = await microsoftApiRequestAllItems.call(this, 'value', 'GET', `/beta/teams/${teamId}/channels/${channelId}/messages`);
} else { } 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 = await microsoftApiRequestAllItems.call(this, 'value', 'GET', `/beta/teams/${teamId}/channels/${channelId}/messages`, {});
responseData = responseData.splice(0, qs.limit); responseData = responseData.splice(0, qs.limit);
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.2 KiB

After

Width:  |  Height:  |  Size: 725 B