joinGroup
Description
info
Apply to join a group.
Note
Determine the result of the group join application based on the group verification option.
Related Callbacks:
onJoinedGroupAdded
onGroupMemberAdded
onGroupApplicationAdded
- iOS
- Android
- Flutter
- uni-app
- Browser/Electron/MiniProgram
- React-Native
- Unity
Function Prototype
Future<dynamic> joinGroup({
required String groupID,
String? reason,
String? operationID,
int joinSource = 3,
})
Input Parameters
| Parameter Name | Parameter Type | Required | Description |
|---|---|---|---|
| groupID | String | Yes | Group ID |
| reason | Sting | No | Request information |
| joinSource | int | Yes | Request source 2: By invitation 3: By search 4: By QR code |
Return Result
| Parameter Name | Parameter Type | Description |
|---|---|---|
| ~ | ~ | Successful if no exception is thrown |
Code Example
await OpenIM.iMManager.groupManager.joinGroup(
groupID: '',
reason: '',
joinSource: 2,
);
// todo
Function Prototype
- (void)joinGroup:(NSString *)groupID
reqMsg:(NSString *)reqMsg
joinSource:(OIMJoinType)joinSource
onSuccess:(OIMSuccessCallback)onSuccess
onFailure:(OIMFailureCallback)onFailure;
Input Parameters
| Parameter Name | Parameter Type | Required | Description |
|---|---|---|---|
| groupID | NSString | Yes | Group ID |
| reqMsg | NSSting | No | Request information |
| joinSource | OIMJoinType | Yes | Join method |
Return Result
| Parameter Name | Parameter Type | Description |
|---|---|---|
| onSuccess | OIMSuccessCallback | Success |
| onFailure | OIMFailureCallback | Failure |
Code Example
[OIMManager.manager joinGroup:@""
reqMsg:nil
onSuccess:^(NSString * _Nullable data) {
} onFailure:^(NSInteger code, NSString * _Nullable msg) {
}];
Function Prototype
public void joinGroup(OnBase<String> callBack, String gid, String reason, int joinSource)
Input Parameters
| Parameter Name | Parameter Type | Required | Description |
|---|---|---|---|
| callBack | OnBase | Yes | Callback interface |
| gid | String | Yes | Group ID |
| reason | Sting | No | Request information |
| joinSource | int | Yes | JoinSource Request source |
Return Result
Code Example
OpenIMClient.getInstance().groupManager.joinGroup(new OnBase<String>() {
@Override
public void onError(int code, String error) {
}
@Override
public void onSuccess(String data) {
}
}, gid, reason, joinSource);
Function Prototype
IMSDK.joinGroup({
groupID: string;
reqMsg: string;
joinSource: GroupJoinSource;
}, operationID?: string): Promise<WsResponse>
Input Parameters
| Parameter Name | Parameter Type | Required | Description |
|---|---|---|---|
| groupID | string | Yes | Group ID |
| reqMsg | string | Yes | Group join application information |
| joinSource | GroupJoinSource | Yes | Join method |
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';
import { GroupJoinSource } from '@openim/wasm-client-sdk/lib/types/enum';
const IMSDK = getSDK();
IMSDK.joinGroup({
groupID: '',
reqMsg: '',
joinSource: GroupJoinSource.Search,
})
.then(() => {
// Success
})
.catch(({ errCode, errMsg }) => {
// Failure
});
Function Prototype
IMSDK.asyncApi('joinGroup', operationID: string, {
groupID: string;
reqMsg: string;
joinSource: GroupJoinSource;
}): 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 |
| reqMsg | string | Yes | Group join application information |
| joinSource | GroupJoinSource | Yes | Join method |
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, { GroupJoinSource } from 'openim-uniapp-polyfill';
IMSDK.asyncApi('joinGroup', IMSDK.uuid(), {
groupID: '',
reqMsg: '',
joinSource: GroupJoinSource.Search,
})
.then(() => {
// Success
})
.catch(({ errCode, errMsg }) => {
// Failure
});
Function Prototype
OpenIMSDK.joinGroup({
groupID: string,
reqMsg: string,
joinSource: GroupJoinSource.Search,
}, operationID?: string): Promise<void>
Input Parameters
| Parameter Name | Parameter Type | Required | Description |
|---|---|---|---|
| groupID | string | Yes | Group ID |
| reqMsg | string | Yes | Group join application information |
| joinSource | GroupJoinSource | Yes | Join method |
| operationID | string | No | Operation ID, used to pinpoint issues, keep unique, prefer time+random |
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.joinGroup({
groupID: '',
reqMsg: '',
joinSource: GroupJoinSource.Search,
})
.then(() => {
// Success
})
.catch((error) => {
// Failure
});
Function Prototype
public static void JoinGroup(OnBase<bool> cb, string groupId, string reqMsg, JoinSource joinSource, string ex)
Input Parameters
| Parameter Name | Parameter Type | Required | Description |
|---|---|---|---|
| cb | OnBase | Yes | Callback |
| groupId | string | Yes | Group ID |
| reqMsg | string | No | Request information |
| joinSource | JoinSource | Yes | Request source |
| ex | string | Yes | Extension field |
Return Result
Code Example
IMSDK.JoinGroup((suc,errCode,errMsg)=>{
},groupId,reqMsg,joinSource,ex);