changeGroupMemberMute
Feature Introduction
Description
The group owner or group administrators can change the mute status of group members.
Note
A group owner can mute both administrators and regular members, while an administrator can only mute regular members.
Related Callback: onGroupApplicationAccepted
- iOS
- Android
- Flutter
- uni-app
- Browser/Electron/MiniProgram
- React-Native
- Unity
Function Prototype
Future<dynamic> changeGroupMemberMute({
required String groupID,
required String userID,
int seconds = 0,
String? operationID,
})
Input Parameters
Parameter Name | Parameter Type | Required | Description |
---|---|---|---|
groupID | String | Yes | Group ID |
userID | String | Yes | ID of the user to be muted |
seconds | int | Yes | Duration of the mute in seconds. Setting to 0 cancels the mute |
Return Results
Parameter Name | Parameter Type | Description |
---|---|---|
~ | ~ | Successful setting if no exception is thrown |
Code Example
await OpenIM.iMManager.groupManager.changeGroupMemberMute(
groupID: 'groupID',
userID: 'userID',
seconds: 60,
);
// todo
Function Prototype
- (void)changeGroupMemberMute:(NSString *)groupID
userID:(NSString *)userID
mutedSeconds:(NSInteger)mutedSeconds
onSuccess:(nullable OIMSuccessCallback)onSuccess
onFailure:(nullable OIMFailureCallback)onFailure;
Input Parameters
Parameter Name | Parameter Type | Required | Description |
---|---|---|---|
groupID | NSString | Yes | Group ID |
userID | NSString | Yes | ID of the user to be muted |
mutedSeconds | NSInteger | Yes | Duration of the mute in seconds. Setting to 0 cancels the mute |
Return Results
Parameter Name | Parameter Type | Description |
---|---|---|
onSuccess | OIMSuccessCallback | Successful return |
onFailure | OIMFailureCallback | Failed return |
Code Example
[OIMManager.manager changeGroupMemberMute:@""
userID:@""
mutedSeconds:30
onSuccess:^(NSString * _Nullable data) {
} onFailure:^(NSInteger code, NSString * _Nullable msg) {
}];
Function Prototype
public void changeGroupMemberMute(OnBase<String> callBack, String gid, String uid, long seconds)
Input Parameters
Parameter Name | Parameter Type | Required | Description |
---|---|---|---|
callBack | OnBase | Yes | Callback interface |
gid | String | Yes | Group ID |
uid | String | Yes | User ID |
seconds | Long | Yes | Duration of the mute. Setting to 0 cancels the mute |
Return Results
Code Example
OpenIMClient.getInstance().groupManager.changeGroupMemberMute(new OnBase<String>() {
@Override
public void onError(int code, String error) {
}
@Override
public void onSuccess(String data) {
}
},gid,uid,seconds)
Function Prototype
IMSDK.changeGroupMemberMute({
groupID: string;
userID: string;
mutedSeconds: number;
}, operationID?: string): Promise<WsResponse>
Input Parameters
Parameter Name | Parameter Type | Required | Description |
---|---|---|---|
groupID | string | Yes | Group ID |
userID | string | Yes | ID of the group member user to be operated on |
mutedSeconds | number | Yes | Duration of the mute in seconds. Setting to 0 cancels the mute |
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.changeGroupMemberMute({
groupID: '',
userID: '',
mutedSeconds: 7200,
})
.then(() => {
// Successful call
})
.catch(({ errCode, errMsg }) => {
// Failed call
});
### Function Prototype
IMSDK.asyncApi('changeGroupMemberMute', operationID: string, {
groupID: string;
userID: string;
mutedSeconds: number;
}): Promise<void>
Input Parameters
Parameter Name | Parameter Type | Mandatory | Description |
---|---|---|---|
operationID | string | Yes | Operation ID for problem tracking, unique. It's recommended to use the current time combined with a random number. |
groupID | string | Yes | Group ID |
userID | string | Yes | ID of the group member to be operated on |
mutedSeconds | number | Yes | Duration of the mute in seconds. Set to 0 to unmute. |
Return Result
Using the
openim-uniapp-polyfill
package, the function is transformed into a Promise. When calling, usethen
andcatch
to judge and handle successful and failed callbacks respectively.
Parameter Name | Parameter Type | Description |
---|---|---|
Promise.then() | Promise<void> | Successful callback |
Promise.catch() | Promise<CatchResponse> | Failed callback |
Code Sample
import IMSDK from 'openim-uniapp-polyfill';
IMSDK.asyncApi('changeGroupMemberMute', IMSDK.uuid(), {
groupID: '',
userID: '',
mutedSeconds: 7200,
})
.then(() => {
// Successful call
})
.catch(({ errCode, errMsg }) => {
// Call failed
});
Function Prototype
OpenIMSDKRN.changeGroupMemberMute({
groupID: string,
userID: string,
mutedSeconds: number,
}, operationID: string): Promise<void>
Input Parameters
Parameter Name | Parameter Type | Mandatory | Description |
---|---|---|---|
groupID | string | Yes | Group ID |
userID | string | Yes | ID of the group member to be operated on |
mutedSeconds | number | Yes | Duration of the mute in seconds. Set to 0 to unmute. |
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.changeGroupMemberMute({
groupID: '',
userID: '',
mutedSeconds: 7200,
}, 'operationID')
.then(() => {
// Successful call
})
.catch(({ errCode, errMsg }) => {
// Call failed
});
Function Prototype
public static void ChangeGroupMemberMute(OnBase<bool> cb, string groupId, string userId, int mutedSeconds)
Input Parameter
Parameter Name | Parameter Type | Mandatory | Description |
---|---|---|---|
cb | OnBase | Yes | Callback |
groupId | string | Yes | Group ID |
userId | string | Yes | User ID |
mutedSeconds | int | Yes | Duration of the mute in seconds. Set to 0 to unmute. |
Return Result
Code Example
IMSDK.ChangeGroupMemberMute((suc,errCode,errMsg)=>{
},groupID,userID,mutedSeconds);