setGroupInfo
Feature Introduction
Note
Set group information, including group avatar, name, announcement, introduction, extended fields, etc.
Caution
Only administrators and group owners have permission to set.
Related Callback: onGroupInfoChanged
- iOS
- Android
- Flutter
- uni-app
- Browser/Electron/MiniProgram
- React-Native
- Unity
Function Prototype
 Future<dynamic> setGroupInfo(GroupInfo groupInfo,{
    String? operationID,
  })
Input Parameters
| Parameter Name | Parameter Type | Mandatory | Description | 
|---|---|---|---|
| groupID | NSString | Yes | Group ID | 
| groupInfo | GroupInfo | Yes | Group Info | 
Return Value
| Parameter Name | Parameter Type | Description | 
|---|---|---|
| ~ | ~ | Operation successful if no exceptions are 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 | Mandatory | Description | 
|---|---|---|---|
| groupID | NSString | Yes | Group ID | 
| groupInfo | OIMGroupInfo | Yes | Group Info | 
Return Value
| 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 | Mandatory | Description | 
|---|---|---|---|
| callBack | OnBase | Yes | Callback | 
| groupInfo | GroupInfo | Yes | Group Info | 
Return Value
Code Example
        OpenIMClient.getInstance().groupManager.setGroupInfo(groupInfo,new OnBase<String>() {
            @Override
            public void onError(int code, String error) {
            }
            @Override
            public void onSuccess(String data) {
            }
        });
Function Prototype
IMSDK.setGroupInfo({
  groupID: string;
  groupName?: string;
  introduction?: string;
  notification?: string;
  faceURL?: string;
  ex?: string;
}, operationID?: string): Promise<WsResponse>
Input Parameters
| Parameter Name | Parameter Type | Mandatory | Description | 
|---|---|---|---|
| groupID | string | Yes | Group ID | 
| groupInfo | Partial<GroupBaseInfo> | Yes | Basic Group Info | 
Return Value
| 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: '',
  introduction: '',
  notification: '',
  faceURL: '',
  ex: '',
})
  .then(() => {
    // Success
  })
  .catch(({ errCode, errMsg }) => {
    // Failure
  });
Function Prototype
IMSDK.asyncApi('setGroupInfo', operationID: string, {
  groupID: string;
  groupName?: string;
  introduction?: string;
  notification?: string;
  faceURL?: string;
  ex?: string;
}): Promise<void>
Input Parameters
| Parameter Name | Parameter Type | Mandatory | Description | 
|---|---|---|---|
| operationID | string | Yes | Unique operation ID, recommended using current time and random number | 
| groupID | string | Yes | Group ID | 
| groupInfo | Partial<GroupBaseInfo> | Yes | Basic Group Info | 
Return Value
By using the
openim-uniapp-polyfillpackage, the function becomes Promise-based. Usethenandcatchto 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: '',
  groupName: '',
  introduction: '',
  notification: '',
  faceURL: '',
  ex: '',
})
  .then(() => {
    // Success
  })
  .catch(({ errCode, errMsg }) => {
    // Failure
  });
Function Prototype
OpenIMSDKRN.setGroupInfo({
  groupID: string;
  groupName?: string;
  introduction?: string;
  notification?: string;
  faceURL?: string;
  ex?: string; 
}, operationID: string): Promise<void>
Input Parameters
| Parameter Name | Parameter Type | Mandatory | Description | 
|---|---|---|---|
| operationID | string | Yes | Operation ID, used for problem location, keep unique, suggest using current time and random number | 
| groupID | string | Yes | Group ID | 
| groupInfo | Partial<GroupBaseInfo> | Yes | Basic Group Info | 
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.setGroupInfo({
  groupID: '',
  groupName: '',
  introduction: '',
  notification: '',
  faceURL: '',
  ex: '',
}, 'operationID')
  .then(() => {
    // Success
  })
  .catch(({ errCode, errMsg }) => {
    // Failure
  });