mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-24 20:24:05 -08:00
⚡ Minor improvements to Microsoft Teams Node
This commit is contained in:
parent
38ddcbe703
commit
a2ee2773db
|
@ -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',
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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<any> { // tslint:disable-line:no-any
|
||||
export async function microsoftApiRequestAllItems(this: IExecuteFunctions | ILoadOptionsFunctions, propertyName: string, method: string, endpoint: string, body: any = {}, query: IDataObject = {}): Promise<any> { // 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<any> { // tslint:disable-line:no-any
|
||||
export async function microsoftApiRequestAllItemsSkip(this: IExecuteFunctions | ILoadOptionsFunctions, propertyName: string, method: string, endpoint: string, body: any = {}, query: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
||||
|
||||
const returnData: IDataObject[] = [];
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 725 B |
Loading…
Reference in a new issue