kickGroupMember
Feature Introduction
Description
Remove a member from a group.
Note
(1) Group owners and administrators can remove regular members. The group owner can remove both administrators and regular members.
Related Callbacks: onJoinedGroupDeleted onGroupMemberDeleted
- iOS
- Android
- Flutter
- uni-app
- Browser/Electron/MiniProgram
- React-Native
- Unity
Function Prototype
Future<List<GroupInviteResult>> kickGroupMember({
required String groupID,
required List<String> userIDList,
String? reason,
String? operationID,
})
Input Parameters
Parameter Name | Parameter Type | Mandatory | Description |
---|---|---|---|
groupID | String | Yes | Group ID |
reason | Sting | No | Reason for removal |
userIDList | List<String> | Yes | List of userIDs to kick |
Return Results
Parameter Name | Parameter Type | Description |
---|---|---|
~ | GroupInviteResult | Successful return |
GroupInviteResult
Field Name | Field Type | Description |
---|---|---|
userID | String | User ID |
result | Int | Execution result |
Code Example
List<GroupInviteResult> list = await OpenIM.iMManager.groupManager.kickGroupMember(
groupID: 'groupID',
userIDList: [],
reason: ''
);
// todo
Function Prototype
- (void)kickGroupMember:(NSString *)groupID
reason:(NSString * _Nullable)reason
uids:(NSArray *)usersID
onSuccess:(nullable OIMSimpleResultsCallback)onSuccess
onFailure:(nullable OIMFailureCallback)onFailure;
Input Parameters
Parameter Name | Parameter Type | Mandatory | Description |
---|---|---|---|
groupID | NSString | Yes | Group ID |
reason | NSSting | No | Reason for removal |
usersID | NSArray<NSString *> | Yes | List of userIDs to kick |
Return Results
Parameter Name | Parameter Type | Description |
---|---|---|
onSuccess | OIMSimpleResultInfo | Successful return |
onFailure | OIMFailureCallback | Failed return |
OIMSimpleResultInfo
Field Name | Field Type | Description |
---|---|---|
userID | NSString | User ID |
result | NSInteger | Execution result |
Code Example
[OIMManager.manager kickGroupMember:@""
reason:@""
uids:@[@""]
onSuccess:^(NSArray<OIMSimpleResultInfo *> * _Nullable results) {
} onFailure:^(NSInteger code, NSString * _Nullable msg) {
}];
Function Prototype
public void kickGroupMember(OnBase<List<GroupInviteResult>> base, String groupId, List<String> uidList, String reason)
Input Parameters
Parameter Name | Parameter Type | Mandatory | Description |
---|---|---|---|
callBack | OnBase<List<ResultInfo>> | Yes | Callback interface |
groupId | String | Yes | Group ID |
reason | Sting | No | Message |
uidList | List<String> | Yes | List of user IDs |
Return Results
Code Example
OpenIMClient.getInstance().groupManager.kickGroupMember(new OnBase<List<ResultInfo>>() {
@Override
public void onError(int code, String error) {
}
@Override
public void onSuccess(List<GroupInviteResult> data) {
}
}, groupId, uidList, reason)
Function Prototype
IMSDK.kickGroupMember({
groupID: string;
reason: string;
userIDList: string[];
}, operationID?: string): Promise<WsResponse>
Input Parameters
Parameter Name | Parameter Type | Mandatory | Description |
---|---|---|---|
groupID | string | Yes | Group ID |
reason | string | Yes | Reason for removal |
userIDList | string[] | Yes | List of userIDs to be kicked |
Return Results
Parameter Name | Parameter Type | Description |
---|---|---|
Promise.then() | Promise<WsResponse> | Successful callback |
Promise.catch() | Promise<WsResponse> | Failed callback |
Code Example
import { getSDK } from '@openim/wasm-client-sdk';
const IMSDK = getSDK();
// use in electron with ffi
// import { getWithRenderProcess } from '@openim/electron-client-sdk/lib/render';
// const { instance: IMSDK } = getWithRenderProcess();
// use in mini program
// import { getSDK } from '@openim/client-sdk';
// const IMSDK = getSDK();
IMSDK.kickGroupMember({
groupID: '',
reason: '',
userIDList: ['userID'],
})
.then(() => {
// Successful call
})
.catch(({ errCode, errMsg }) => {
// Failed call
});
Function Prototype
IMSDK.asyncApi('kickGroupMember', operationID: string, {
groupID: string;
reason: string;
userIDList: string[];
}): Promise<void>
Input Parameters
Parameter Name | Parameter Type | Required | Description |
---|---|---|---|
operationID | string | Yes | Operation ID, used for issue tracking. Unique; suggested to use current time and random number. |
groupID | string | Yes | Group ID |
reason | string | Yes | Reason for kicking |
userIDList | string[] | Yes | List of user IDs to be kicked |
Return Results
With the
openim-uniapp-polyfill
package, the function is transformed into a Promise. When calling, you need to usethen
andcatch
to determine and handle successful and failed callbacks.
Parameter Name | Parameter Type | Description |
---|---|---|
Promise.then() | Promise<void> | Success callback |
Promise.catch() | Promise<CatchResponse> | Failure callback |
Code Example
import IMSDK from 'openim-uniapp-polyfill';
IMSDK.asyncApi('kickGroupMember', IMSDK.uuid(), {
groupID: '',
reason: '',
userIDList: ['userID'],
})
.then(() => {
// Successful call
})
.catch(({ errCode, errMsg }) => {
// Failed call
});
Function Prototype
OpenIMSDKRN.kickGroupMember({
groupID: string,
reason: string,
userIDList: string[],
}, operationID: string): Promise<void>
Input Parameters
Parameter Name | Parameter Type | Mandatory | Description |
---|---|---|---|
groupID | string | Yes | Group ID |
reason | string | Yes | Reason for kicking |
userIDList | string[] | Yes | List of user IDs to be kicked |
operationID | string | Yes | Operation ID, used for problem location, keep unique, suggest using current time and random number |
Return Result
Parameter Name | Parameter Type | Description |
---|---|---|
Promise.then() | Promise<void> | Callback on successful call |
Promise.catch() | Promise<CatchResponse> | Callback on failed call |
Code Example
import OpenIMSDKRN from "open-im-sdk-rn";
OpenIMSDKRN.kickGroupMember({
groupID: '',
reason: '',
userIDList: ['userID'],
}, 'operationID')
.then(() => {
// Successful call
})
.catch(({ errCode, errMsg }) => {
// Failed call
});
Function Prototype
public static void KickGroupMember(OnBase<bool> cb, string groupId, string reason, string[] userIdList)
Input Parameter
Parameter Name | Parameter Type | Mandatory | Description |
---|---|---|---|
cb | OnBase | Yes | Callback |
groupId | string | Yes | Group ID |
reason | string | No | Info |
userIDList | string[] | Yes | Array of user IDs to be kicked |
Return Result
Code Example
IMSDK.KickGroupMember((suc,errCode,errMsg)=>{
}, groupId, uidList, reason)