transferGroupOwner
Function Introduction
Description
Transfer the group owner status.
Note
(1) Each group can only have one owner. (2) The caller must be the current group owner.
Related Callbacks: onGroupInfoChanged onGroupMemberInfoChanged
- iOS
- Android
- Flutter
- uni-app
- Browser/Electron/MiniProgram
- React-Native
- Unity
Function Prototype
Future<dynamic> transferGroupOwner({
required String groupID,
required String userID,
String? operationID,
})
Input Parameters
Parameter Name | Data Type | Required | Description |
---|---|---|---|
groupID | String | Yes | Group ID |
userID | Sting | No | New owner's User ID |
Return Result
Parameter Name | Data Type | Description |
---|---|---|
~ | ~ | Operation successful if no exceptions |
Code Example
await OpenIM.iMManager.groupManager.transferGroupOwner(
groupID: '',
userID: '',
);
// todo
Function Prototype
- (void)transferGroupOwner:(NSString *)groupID
newOwner:(NSString *)userID
onSuccess:(nullable OIMSuccessCallback)onSuccess
onFailure:(nullable OIMFailureCallback)onFailure;
Input Parameters
Parameter Name | Data Type | Required | Description |
---|---|---|---|
groupID | NSString | Yes | Group ID |
userID | NSSting | No | New owner's User ID |
Return Result
Parameter Name | Data Type | Description |
---|---|---|
onSuccess | OIMSuccessCallback | Successful return |
onFailure | OIMFailureCallback | Failure return |
Code Example
[OIMManager.manager transferGroupOwner:@""
newOwner:@""
onSuccess:^(NSString * _Nullable data) {
} onFailure:^(NSInteger code, NSString * _Nullable msg) {
}];
Function Prototype
public void transferGroupOwner(OnBase<String> base, String gid, String uid)
Input Parameters
Parameter Name | Data Type | Required | Description |
---|---|---|---|
callBack | OnBase | Yes | Callback |
gid | String | Yes | Group ID |
uid | Sting | No | User ID |
Return Result
Code Example
OpenIMClient.getInstance().groupManager.transferGroupOwner(new OnBase<String>() {
@Override
public void onError(int code, String error) {
}
@Override
public void onSuccess(String data) {
}
}, gid, uid);
Function Prototype
IMSDK.transferGroupOwner({
groupID: string;
newOwnerUserID: string;
}, operationID?: string): Promise<WsResponse>
Input Parameters
Parameter Name | Data Type | Required | Description |
---|---|---|---|
groupID | string | Yes | Group ID |
newOwnerUserID | string | Yes | New owner's User ID |
Return Result
Parameter Name | Data Type | Description |
---|---|---|
Promise.then() | Promise<WsResponse> | Successful 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.transferGroupOwner({
groupID: '',
newOwnerUserID: '',
})
.then(() => {
// Successful invocation
})
.catch(({ errCode, errMsg }) => {
// Invocation failed
});
Function Prototype
IMSDK.asyncApi('transferGroupOwner', operationID: string, {
groupID: string;
newOwnerUserID: string;
}): Promise<void>
Input Parameters
Parameter Name | Data Type | Required | Description |
---|---|---|---|
operationID | string | Yes | Operation ID, used for problem tracing, should be unique. It's recommended to use the current time and a random number |
groupID | string | Yes | Group ID |
newOwnerUserID | string | Yes | New owner's User ID |
Return Result
Through the
openim-uniapp-polyfill
package, the function becomes Promise-based. You need to usethen
andcatch
to judge and handle successful and failed callbacks.
Parameter Name | Data Type | Description |
---|---|---|
Promise.then() | Promise<void> | Successful callback |
Promise.catch() | Promise<CatchResponse> | Failure callback |
Here's the translated content:
Code Example
import IMSDK from 'openim-uniapp-polyfill';
IMSDK.asyncApi('transferGroupOwner', IMSDK.uuid(), {
groupID: '',
newOwnerUserID: '',
})
.then(() => {
// Call succeeded
})
.catch(({ errCode, errMsg }) => {
// Call failed
});
Function Prototype
OpenIMSDKRN.transferGroupOwner({
groupID: string,
newOwnerUserID: string,
}, operationID: string): Promise<void>
Input Parameters
Parameter Name | Parameter Type | Mandatory | Description |
---|---|---|---|
groupID | string | Yes | Group ID |
newOwnerUserID | string | Yes | New owner's User ID |
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.transferGroupOwner({
groupID: '',
newOwnerUserID: '',
}, 'operationID')
.then(() => {
// Call succeeded
})
.catch(({ errCode, errMsg }) => {
// Call failed
});
Function Prototype
public static void TransferGroupOwner(OnBase<bool> cb, string groupId, string newOwnerUserId)
Input Parameter
Parameter Name | Parameter Type | Mandatory | Description |
---|---|---|---|
cb | OnBase | Yes | Callback |
groupId | string | Yes | Group ID |
newOwnerUserId | sting | No | User ID |
Return Result
Code Example
IMSDK.TransferGroupOwner((suc,errCode,errMsg)=>{
}, groupId, newOwnerUserId);