setGroupInfo
Description
info
Set group information, including group avatar, name, notification, introduction, extension fields, etc.
Note
Only administrators and the group owner have permission to set this.
Related Callbacks:
onGroupInfoChanged
- iOS
- Android
- Flutter
- uni-app
- Browser/Electron/MiniProgram
- React-Natvie
- Unity
Function Prototype
Future<dynamic> setGroupInfo(GroupInfo groupInfo,{
String? operationID,
})
Input Parameters
| Parameter Name | Parameter Type | Required | Description |
|---|---|---|---|
| groupID | NSString | Yes | Group ID |
| groupInfo | GroupInfo | Yes | Group Info |
Return Result
| Parameter Name | Parameter Type | Description |
|---|---|---|
| ~ | ~ | Operation successful if no exception thrown |
Code Example
await OpenIM.iMManager.groupManager.setGroupInfo();
// todo
Function Prototype
- (void)setGroupInfo:(OIMGroupInfo *)groupInfo
onSuccess:(nullable OIMSuccessCallback)onSuccess
onFailure:(nullable OIMFailureCallback)onFailure;
Input Parameters
| Parameter Name | Parameter Type | Required | Description |
|---|---|---|---|
| groupID | NSString | Yes | Group ID |
| groupInfo | OIMGroupInfo | Yes | Group Info |
Return Result
| Parameter Name | Parameter Type | Description |
|---|---|---|
| onSuccess | OIMSuccessCallback | Success |
| onFailure | OIMFailureCallback | Failure |
Code Example
OIMGroupInfo *param = [OIMGroupInfo new];
param.introduction = @"";
[OIMManager.manager setGroupInfo:param
onSuccess:^(NSString * _Nullable data) {
} onFailure:^(NSInteger code, NSString * _Nullable msg) {
}];
Function Prototype
public void setGroupInfo(GroupInfo groupInfo, OnBase<String> callBack)
Input Parameters
| Parameter Name | Parameter Type | Required | Description |
|---|---|---|---|
| callBack | OnBase | Yes | Callback interface |
| groupInfo | GroupInfo | Yes | Group Info |
Return Result
Code Example
OpenIMClient.getInstance().groupManager.setGroupInfo(groupInfo, new OnBase<String>() {
@Override
public void onError(int code, String error) {
// todo: handle error info
}
@Override
public void onSuccess(String data) {
// todo: request successful
}
});
Function Prototype
IMSDK.setGroupInfo({
groupID: string;
faceURL?: string;
groupName?: string;
introduction?: string;
notification?: string;
needVerification?: GroupVerificationType;
applyMemberFriend?: AllowType;
lookMemberInfo?: AllowType;
ex?: string;
}, operationID?: string): Promise<WsResponse>
Input Parameters
| Parameter Name | Parameter Type | Required | Description |
|---|---|---|---|
| groupID | string | Yes | Group ID |
| faceURL | string | No | Group avatar |
| groupName | string | No | Group name |
| notification | string | No | Group notification |
| introduction | string | No | Group introduction |
| needVerification | GroupVerification | No | Group join verification method |
| lookMemberInfo | AllowType | No | Allow viewing member info |
| applyMemberFriend | AllowType | No | Allow adding friends in group |
| ex | string | No | Extension field |
Return Result
| Parameter Name | Parameter Type | Description |
|---|---|---|
| Promise.then() | Promise<WsResponse> | Success callback |
| Promise.catch() | Promise<WsResponse> | Failure 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.setGroupInfo({
groupID: 'groupID',
groupName: 'new name',
})
.then(() => {
// Success
})
.catch(({ errCode, errMsg }) => {
// Failure
});
Function Prototype
IMSDK.asyncApi('setGroupInfo', operationID: string, {
groupID: string;
faceURL?: string;
groupName?: string;
introduction?: string;
notification?: string;
needVerification?: GroupVerificationType;
applyMemberFriend?: AllowType;
lookMemberInfo?: AllowType;
ex?: string;
}): Promise<void>
Input Parameters
| Parameter Name | Parameter Type | Required | Description |
|---|---|---|---|
| operationID | string | Yes | Operation ID, used to pinpoint issues, keep unique, prefer time+random |
| groupID | string | Yes | Group ID |
| faceURL | string | No | Group avatar |
| groupName | string | No | Group name |
| notification | string | No | Group notification |
| introduction | string | No | Group introduction |
| needVerification | GroupVerification | No | Group join verification method |
| lookMemberInfo | AllowType | No | Allow viewing member info |
| applyMemberFriend | AllowType | No | Allow adding friends in group |
| ex | string | No | Extension field |
Return Result
Use the
openim-uniapp-polyfillpackage to make the function Promise. When calling, you need to usethenandcatchto determine and handle success and failure 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('setGroupInfo', IMSDK.uuid(), {
groupID: 'groupID',
groupName: 'new name',
})
.then(() => {
// Success
})
.catch(({ errCode, errMsg }) => {
// Failure
});
Function Prototype
OpenIMSDK.setGroupInfo({
groupID: string;
faceURL?: string;
groupName?: string;
introduction?: string;
notification?: string;
needVerification?: GroupVerificationType;
applyMemberFriend?: AllowType;
lookMemberInfo?: AllowType;
ex?: string;
}, operationID?: string): Promise<void>
Input Parameters
| Parameter Name | Parameter Type | Required | Description |
|---|---|---|---|
| operationID | string | No | Operation ID, used to pinpoint issues, keep unique, prefer time+random |
| groupID | string | Yes | Group ID |
| faceURL | string | No | Group avatar |
| groupName | string | No | Group name |
| notification | string | No | Group notification |
| introduction | string | No | Group introduction |
| needVerification | GroupVerification | No | Group join verification method |
| lookMemberInfo | AllowType | No | Allow viewing member info |
| applyMemberFriend | AllowType | No | Allow adding friends in group |
| ex | string | No | Extension field |
Return Result
| Parameter Name | Parameter Type | Description |
|---|---|---|
| Promise.then() | Promise<void> | Success callback |
| Promise.catch() | Promise<OpenIMApiError> | Failure callback |
Code Example
import OpenIMSDK from '@openim/rn-client-sdk';
OpenIMSDK.setGroupInfo(
{
groupID: 'groupID',
groupName: 'new name',
}
)
.then(() => {
// Success
})
.catch((error) => {
// Failure
});