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,35 @@
import { type INodeProperties, type IExecuteFunctions, NodeOperationError } from 'n8n-workflow';
import { updateDisplayOptions } from '@utils/utilities';
import { microsoftApiRequest } from '../../transport';
import { channelRLC, teamRLC } from '../../descriptions';
const properties: INodeProperties[] = [teamRLC, channelRLC];
const displayOptions = {
show: {
resource: ['channel'],
operation: ['deleteChannel'],
},
};
export const description = updateDisplayOptions(displayOptions, properties);
export async function execute(this: IExecuteFunctions, i: number) {
//https://docs.microsoft.com/en-us/graph/api/channel-delete?view=graph-rest-beta&tabs=http
try {
const teamId = this.getNodeParameter('teamId', i, '', { extractValue: true }) as string;
const channelId = this.getNodeParameter('channelId', i, '', { extractValue: true }) as string;
await microsoftApiRequest.call(this, 'DELETE', `/v1.0/teams/${teamId}/channels/${channelId}`);
return { success: true };
} catch (error) {
throw new NodeOperationError(
this.getNode(),
"The channel you are trying to delete doesn't exist",
{
description: "Check that the 'Channel' parameter is correctly set",
},
);
}
}