Skip to content

Commit 1377e21

Browse files
authored
fix(Mattermost Node): Change loadOptions to fetch all items (#9413)
1 parent 92a1d65 commit 1377e21

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

packages/nodes-base/nodes/Mattermost/v1/methods/loadOptions.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import type { IDataObject, ILoadOptionsFunctions, INodePropertyOptions } from 'n8n-workflow';
22
import { NodeOperationError } from 'n8n-workflow';
33

4-
import { apiRequest } from '../transport';
4+
import { apiRequestAllItems } from '../transport';
55

66
// Get all the available channels
77
export async function getChannels(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
88
const endpoint = 'channels';
9-
const responseData = await apiRequest.call(this, 'GET', endpoint, {});
9+
const responseData = await apiRequestAllItems.call(this, 'GET', endpoint, {});
1010

1111
if (responseData === undefined) {
1212
throw new NodeOperationError(this.getNode(), 'No data got returned');
@@ -25,7 +25,7 @@ export async function getChannels(this: ILoadOptionsFunctions): Promise<INodePro
2525

2626
returnData.push({
2727
name,
28-
value: data.id,
28+
value: data.id as string,
2929
});
3030
}
3131

@@ -48,7 +48,7 @@ export async function getChannelsInTeam(
4848
): Promise<INodePropertyOptions[]> {
4949
const teamId = this.getCurrentNodeParameter('teamId');
5050
const endpoint = `users/me/teams/${teamId}/channels`;
51-
const responseData = await apiRequest.call(this, 'GET', endpoint, {});
51+
const responseData = await apiRequestAllItems.call(this, 'GET', endpoint, {});
5252

5353
if (responseData === undefined) {
5454
throw new NodeOperationError(this.getNode(), 'No data got returned');
@@ -72,7 +72,7 @@ export async function getChannelsInTeam(
7272

7373
returnData.push({
7474
name,
75-
value: data.id,
75+
value: data.id as string,
7676
});
7777
}
7878

@@ -91,7 +91,7 @@ export async function getChannelsInTeam(
9191

9292
export async function getTeams(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
9393
const endpoint = 'users/me/teams';
94-
const responseData = await apiRequest.call(this, 'GET', endpoint, {});
94+
const responseData = await apiRequestAllItems.call(this, 'GET', endpoint, {});
9595

9696
if (responseData === undefined) {
9797
throw new NodeOperationError(this.getNode(), 'No data got returned');
@@ -108,7 +108,7 @@ export async function getTeams(this: ILoadOptionsFunctions): Promise<INodeProper
108108

109109
returnData.push({
110110
name,
111-
value: data.id,
111+
value: data.id as string,
112112
});
113113
}
114114

@@ -127,7 +127,7 @@ export async function getTeams(this: ILoadOptionsFunctions): Promise<INodeProper
127127

128128
export async function getUsers(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
129129
const endpoint = 'users';
130-
const responseData = await apiRequest.call(this, 'GET', endpoint, {});
130+
const responseData = await apiRequestAllItems.call(this, 'GET', endpoint, {});
131131

132132
if (responseData === undefined) {
133133
throw new NodeOperationError(this.getNode(), 'No data got returned');
@@ -140,8 +140,8 @@ export async function getUsers(this: ILoadOptionsFunctions): Promise<INodeProper
140140
}
141141

142142
returnData.push({
143-
name: data.username,
144-
value: data.id,
143+
name: data.username as string,
144+
value: data.id as string,
145145
});
146146
}
147147

0 commit comments

Comments
 (0)