Skip to content

Commit

Permalink
chore: group InviteJoinOption (#184)
Browse files Browse the repository at this point in the history
add missing property InviteJoinOption for GroupInfo and CreateGroupRequest
  • Loading branch information
joelcho authored Jul 23, 2024
1 parent 44fc285 commit f4ca107
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 2 deletions.
1 change: 1 addition & 0 deletions docs/guide/group.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ CreateGroupRequest request = CreateGroupRequest.builder()
.faceUrl("https://avatars.githubusercontent.com/u/43716716?s=200&v=4")
.maxMemberCount(500)
.applyJoinOption(ApplyJoinOption.FREE_ACCESS)
.inviteJoinOption(InviteJoinOption.DISABLE_INVITE)
.build();

CreateGroupResult result = client.group.createGroup(request);
Expand Down
28 changes: 28 additions & 0 deletions src/main/java/io/github/doocs/im/constant/InviteJoinOption.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
package io.github.doocs.im.constant;

/**
* 邀请加群权限
*
* @author Joel
* @since 2024/07/23 13:48
*/
public class InviteJoinOption {
/**
* 直接邀请用户进群,不需要审批等操作
*/
public static final String FREE_ACCESS = "FreeAccess";

/**
* 需要群管理员或者群主审批
*/
public static final String NEED_PERMISSION = "NeedPermission";

/**
* 不允许 SDK 邀请进群
*/
public static final String DISABLE_INVITE = "DisableInvite";

private InviteJoinOption() {

}
}
26 changes: 25 additions & 1 deletion src/main/java/io/github/doocs/im/model/group/GroupInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,14 @@ public class GroupInfo implements Serializable {
@JsonProperty("ApplyJoinOption")
private String applyJoinOption;

/**
* 邀请加群处理方式。
* 包含 FreeAccess (直接邀请用户进群,不需要审批等操作), NeedPermission 需要群管理员或者群主审批, DisableInvite 不支持 SDK 邀请进群
* 该选项 AVChatRoom 群类型不支持
*/
@JsonProperty("InviteJoinOption")
private String inviteJoinOption;

/**
* 群全员禁言状态
*/
Expand Down Expand Up @@ -136,7 +144,7 @@ public GroupInfo() {
public GroupInfo(String groupId, String type, String name, String introduction, String notification,
String faceUrl, String ownerAccount, Integer createTime, Long infoSeq,
Integer lastInfoTime, Integer lastMsgTime, Long nextMsgSeq, Integer memberNum,
Integer maxMemberNum, String applyJoinOption, String muteAllMember,
Integer maxMemberNum, String applyJoinOption, String inviteJoinOption, String muteAllMember,
List<AppDefinedDataItem> appDefinedData, List<MemberProfile> memberList,
List<AppMemberDefinedDataItem> appMemberDefinedData) {
this.groupId = groupId;
Expand All @@ -154,6 +162,7 @@ public GroupInfo(String groupId, String type, String name, String introduction,
this.memberNum = memberNum;
this.maxMemberNum = maxMemberNum;
this.applyJoinOption = applyJoinOption;
this.inviteJoinOption = inviteJoinOption;
this.muteAllMember = muteAllMember;
this.appDefinedData = appDefinedData;
this.memberList = memberList;
Expand All @@ -176,6 +185,7 @@ private GroupInfo(Builder builder) {
this.memberNum = builder.memberNum;
this.maxMemberNum = builder.maxMemberNum;
this.applyJoinOption = builder.applyJoinOption;
this.inviteJoinOption = builder.inviteJoinOption;
this.muteAllMember = builder.muteAllMember;
this.appDefinedData = builder.appDefinedData;
this.memberList = builder.memberList;
Expand Down Expand Up @@ -306,6 +316,14 @@ public void setApplyJoinOption(String applyJoinOption) {
this.applyJoinOption = applyJoinOption;
}

public String getInviteJoinOption() {
return inviteJoinOption;
}

public void setInviteJoinOption(String inviteJoinOption) {
this.inviteJoinOption = inviteJoinOption;
}

public String getMuteAllMember() {
return muteAllMember;
}
Expand Down Expand Up @@ -355,6 +373,7 @@ public static final class Builder {
private Integer memberNum;
private Integer maxMemberNum;
private String applyJoinOption;
private String inviteJoinOption;
private String muteAllMember;
private List<AppDefinedDataItem> appDefinedData;
private List<MemberProfile> memberList;
Expand Down Expand Up @@ -442,6 +461,11 @@ public Builder applyJoinOption(String applyJoinOption) {
return this;
}

public Builder inviteJoinOption(String inviteJoinOption) {
this.inviteJoinOption = inviteJoinOption;
return this;
}

public Builder muteAllMember(String muteAllMember) {
this.muteAllMember = muteAllMember;
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,14 @@ public class CreateGroupRequest implements Serializable {
@JsonProperty("ApplyJoinOption")
private String applyJoinOption;

/**
* 邀请加群处理方式。
* 包含 FreeAccess (直接邀请用户进群,不需要审批等操作), NeedPermission 需要群管理员或者群主审批, DisableInvite 不支持 SDK 邀请进群
* 该选项 AVChatRoom 群类型不支持
*/
@JsonProperty("InviteJoinOption")
private String inviteJoinOption;

/**
* 群组维度的自定义字段,默认情况是没有的,可以通过 即时通信 IM 控制台 进行配置,详情请参阅 自定义字段
*/
Expand Down Expand Up @@ -108,7 +116,8 @@ public CreateGroupRequest(String type, String name) {
}

public CreateGroupRequest(String ownerAccount, String type, String groupId, String name, String introduction,
String notification, String faceUrl, Integer maxMemberCount, String applyJoinOption,
String notification, String faceUrl, Integer maxMemberCount,
String applyJoinOption, String inviteJoinOption,
List<AppDefinedDataItem> appDefinedData, List<MemberProfile> memberList,
List<AppMemberDefinedDataItem> appMemberDefinedData, Integer supportTopic) {
this.ownerAccount = ownerAccount;
Expand All @@ -120,6 +129,7 @@ public CreateGroupRequest(String ownerAccount, String type, String groupId, Stri
this.faceUrl = faceUrl;
this.maxMemberCount = maxMemberCount;
this.applyJoinOption = applyJoinOption;
this.inviteJoinOption = inviteJoinOption;
this.appDefinedData = appDefinedData;
this.memberList = memberList;
this.appMemberDefinedData = appMemberDefinedData;
Expand All @@ -136,6 +146,7 @@ private CreateGroupRequest(Builder builder) {
this.faceUrl = builder.faceUrl;
this.maxMemberCount = builder.maxMemberCount;
this.applyJoinOption = builder.applyJoinOption;
this.inviteJoinOption = builder.inviteJoinOption;
this.appDefinedData = builder.appDefinedData;
this.memberList = builder.memberList;
this.appMemberDefinedData = builder.appMemberDefinedData;
Expand Down Expand Up @@ -218,6 +229,14 @@ public void setApplyJoinOption(String applyJoinOption) {
this.applyJoinOption = applyJoinOption;
}

public String getInviteJoinOption() {
return inviteJoinOption;
}

public void setInviteJoinOption(String inviteJoinOption) {
this.inviteJoinOption = inviteJoinOption;
}

public List<AppDefinedDataItem> getAppDefinedData() {
return appDefinedData;
}
Expand Down Expand Up @@ -261,6 +280,7 @@ public static final class Builder {
private String faceUrl;
private Integer maxMemberCount;
private String applyJoinOption;
private String inviteJoinOption;
private List<AppDefinedDataItem> appDefinedData;
private List<MemberProfile> memberList;
private List<AppMemberDefinedDataItem> appMemberDefinedData;
Expand Down Expand Up @@ -318,6 +338,11 @@ public Builder applyJoinOption(String applyJoinOption) {
return this;
}

public Builder inviteJoinOption(String inviteJoinOption) {
this.inviteJoinOption = inviteJoinOption;
return this;
}

public Builder appDefinedData(List<AppDefinedDataItem> appDefinedData) {
this.appDefinedData = appDefinedData;
return this;
Expand Down

0 comments on commit f4ca107

Please sign in to comment.