feat(Microsoft Teams Node): Overhaul (#7477)

Co-authored-by: Giulio Andreini <andreini@netseven.it>
This commit is contained in:
Michael Kret
2024-01-22 18:35:09 +02:00
committed by GitHub
parent 44f6ef2ed7
commit 2c146cca62
68 changed files with 6284 additions and 664 deletions

View File

@@ -0,0 +1,43 @@
import type { INodeProperties, IExecuteFunctions } from 'n8n-workflow';
import { updateDisplayOptions } from '@utils/utilities';
import { returnAllOrLimit } from '@utils/descriptions';
import { microsoftApiRequestAllItems } from '../../transport';
import { channelRLC, teamRLC } from '../../descriptions';
const properties: INodeProperties[] = [teamRLC, channelRLC, ...returnAllOrLimit];
const displayOptions = {
show: {
resource: ['channelMessage'],
operation: ['getAll'],
},
};
export const description = updateDisplayOptions(displayOptions, properties);
export async function execute(this: IExecuteFunctions, i: number) {
//https://docs.microsoft.com/en-us/graph/api/channel-list-messages?view=graph-rest-beta&tabs=http
const teamId = this.getNodeParameter('teamId', i, '', { extractValue: true }) as string;
const channelId = this.getNodeParameter('channelId', i, '', { extractValue: true }) as string;
const returnAll = this.getNodeParameter('returnAll', i);
if (returnAll) {
return await microsoftApiRequestAllItems.call(
this,
'value',
'GET',
`/beta/teams/${teamId}/channels/${channelId}/messages`,
);
} else {
const limit = this.getNodeParameter('limit', i);
const responseData = await microsoftApiRequestAllItems.call(
this,
'value',
'GET',
`/beta/teams/${teamId}/channels/${channelId}/messages`,
{},
);
return responseData.splice(0, limit);
}
}