Channel Participation

Members Query

1
import { queryChannelMembers, createQuery, runQuery } from '@amityco/ts-sdk';
2
const query = createQuery(queryChannelMembers, {
3
channelId: string
4
membership: 'all' | 'muted' | 'banned' | 'member&banned',
5
roles: ['role1', 'role2'],
6
sortBy: 'firstCreated' | 'lastCreated'
7
});
8
9
runQuery(query, result => console.log(result));
Copied!

Manage Members

TypeScript SDK also provides methods to add and remove members.
1
import { addChannelUsers, removeChannelUsers, createQuery, runQuery } from '@amityco/ts-sdk';
2
3
// add members
4
const query = createQuery(addChannelUsers, 'channelId', ['userId1', 'userId2']);
5
runQuery(query, result => console.log(result));
6
7
// remove members
8
const query = createQuery(removeChannelUsers, 'channelId', ['userId1', 'userId2']);
9
runQuery(query, result => console.log(result));
10
Copied!
Last modified 1mo ago
Export as PDF
Copy link