mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 01:56:46 +00:00
39 lines
1.2 KiB
TypeScript
39 lines
1.2 KiB
TypeScript
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: ['get'],
|
|
},
|
|
};
|
|
|
|
export const description = updateDisplayOptions(displayOptions, properties);
|
|
|
|
export async function execute(this: IExecuteFunctions, i: number) {
|
|
//https://docs.microsoft.com/en-us/graph/api/channel-get?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;
|
|
|
|
return await microsoftApiRequest.call(
|
|
this,
|
|
'GET',
|
|
`/v1.0/teams/${teamId}/channels/${channelId}`,
|
|
);
|
|
} catch (error) {
|
|
throw new NodeOperationError(
|
|
this.getNode(),
|
|
"The channel you are trying to get doesn't exist",
|
|
{
|
|
description: "Check that the 'Channel' parameter is correctly set",
|
|
},
|
|
);
|
|
}
|
|
}
|