Skip to content

Commit f4ca107

Browse files
authored
chore: group InviteJoinOption (#184)
add missing property InviteJoinOption for GroupInfo and CreateGroupRequest
1 parent 44fc285 commit f4ca107

File tree

4 files changed

+80
-2
lines changed

4 files changed

+80
-2
lines changed

docs/guide/group.md

+1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ CreateGroupRequest request = CreateGroupRequest.builder()
5151
.faceUrl("https://avatars.githubusercontent.com/u/43716716?s=200&v=4")
5252
.maxMemberCount(500)
5353
.applyJoinOption(ApplyJoinOption.FREE_ACCESS)
54+
.inviteJoinOption(InviteJoinOption.DISABLE_INVITE)
5455
.build();
5556

5657
CreateGroupResult result = client.group.createGroup(request);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package io.github.doocs.im.constant;
2+
3+
/**
4+
* 邀请加群权限
5+
*
6+
* @author Joel
7+
* @since 2024/07/23 13:48
8+
*/
9+
public class InviteJoinOption {
10+
/**
11+
* 直接邀请用户进群,不需要审批等操作
12+
*/
13+
public static final String FREE_ACCESS = "FreeAccess";
14+
15+
/**
16+
* 需要群管理员或者群主审批
17+
*/
18+
public static final String NEED_PERMISSION = "NeedPermission";
19+
20+
/**
21+
* 不允许 SDK 邀请进群
22+
*/
23+
public static final String DISABLE_INVITE = "DisableInvite";
24+
25+
private InviteJoinOption() {
26+
27+
}
28+
}

src/main/java/io/github/doocs/im/model/group/GroupInfo.java

+25-1
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,14 @@ public class GroupInfo implements Serializable {
106106
@JsonProperty("ApplyJoinOption")
107107
private String applyJoinOption;
108108

109+
/**
110+
* 邀请加群处理方式。
111+
* 包含 FreeAccess (直接邀请用户进群,不需要审批等操作), NeedPermission 需要群管理员或者群主审批, DisableInvite 不支持 SDK 邀请进群
112+
* 该选项 AVChatRoom 群类型不支持
113+
*/
114+
@JsonProperty("InviteJoinOption")
115+
private String inviteJoinOption;
116+
109117
/**
110118
* 群全员禁言状态
111119
*/
@@ -136,7 +144,7 @@ public GroupInfo() {
136144
public GroupInfo(String groupId, String type, String name, String introduction, String notification,
137145
String faceUrl, String ownerAccount, Integer createTime, Long infoSeq,
138146
Integer lastInfoTime, Integer lastMsgTime, Long nextMsgSeq, Integer memberNum,
139-
Integer maxMemberNum, String applyJoinOption, String muteAllMember,
147+
Integer maxMemberNum, String applyJoinOption, String inviteJoinOption, String muteAllMember,
140148
List<AppDefinedDataItem> appDefinedData, List<MemberProfile> memberList,
141149
List<AppMemberDefinedDataItem> appMemberDefinedData) {
142150
this.groupId = groupId;
@@ -154,6 +162,7 @@ public GroupInfo(String groupId, String type, String name, String introduction,
154162
this.memberNum = memberNum;
155163
this.maxMemberNum = maxMemberNum;
156164
this.applyJoinOption = applyJoinOption;
165+
this.inviteJoinOption = inviteJoinOption;
157166
this.muteAllMember = muteAllMember;
158167
this.appDefinedData = appDefinedData;
159168
this.memberList = memberList;
@@ -176,6 +185,7 @@ private GroupInfo(Builder builder) {
176185
this.memberNum = builder.memberNum;
177186
this.maxMemberNum = builder.maxMemberNum;
178187
this.applyJoinOption = builder.applyJoinOption;
188+
this.inviteJoinOption = builder.inviteJoinOption;
179189
this.muteAllMember = builder.muteAllMember;
180190
this.appDefinedData = builder.appDefinedData;
181191
this.memberList = builder.memberList;
@@ -306,6 +316,14 @@ public void setApplyJoinOption(String applyJoinOption) {
306316
this.applyJoinOption = applyJoinOption;
307317
}
308318

319+
public String getInviteJoinOption() {
320+
return inviteJoinOption;
321+
}
322+
323+
public void setInviteJoinOption(String inviteJoinOption) {
324+
this.inviteJoinOption = inviteJoinOption;
325+
}
326+
309327
public String getMuteAllMember() {
310328
return muteAllMember;
311329
}
@@ -355,6 +373,7 @@ public static final class Builder {
355373
private Integer memberNum;
356374
private Integer maxMemberNum;
357375
private String applyJoinOption;
376+
private String inviteJoinOption;
358377
private String muteAllMember;
359378
private List<AppDefinedDataItem> appDefinedData;
360379
private List<MemberProfile> memberList;
@@ -442,6 +461,11 @@ public Builder applyJoinOption(String applyJoinOption) {
442461
return this;
443462
}
444463

464+
public Builder inviteJoinOption(String inviteJoinOption) {
465+
this.inviteJoinOption = inviteJoinOption;
466+
return this;
467+
}
468+
445469
public Builder muteAllMember(String muteAllMember) {
446470
this.muteAllMember = muteAllMember;
447471
return this;

src/main/java/io/github/doocs/im/model/request/CreateGroupRequest.java

+26-1
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,14 @@ public class CreateGroupRequest implements Serializable {
7575
@JsonProperty("ApplyJoinOption")
7676
private String applyJoinOption;
7777

78+
/**
79+
* 邀请加群处理方式。
80+
* 包含 FreeAccess (直接邀请用户进群,不需要审批等操作), NeedPermission 需要群管理员或者群主审批, DisableInvite 不支持 SDK 邀请进群
81+
* 该选项 AVChatRoom 群类型不支持
82+
*/
83+
@JsonProperty("InviteJoinOption")
84+
private String inviteJoinOption;
85+
7886
/**
7987
* 群组维度的自定义字段,默认情况是没有的,可以通过 即时通信 IM 控制台 进行配置,详情请参阅 自定义字段
8088
*/
@@ -108,7 +116,8 @@ public CreateGroupRequest(String type, String name) {
108116
}
109117

110118
public CreateGroupRequest(String ownerAccount, String type, String groupId, String name, String introduction,
111-
String notification, String faceUrl, Integer maxMemberCount, String applyJoinOption,
119+
String notification, String faceUrl, Integer maxMemberCount,
120+
String applyJoinOption, String inviteJoinOption,
112121
List<AppDefinedDataItem> appDefinedData, List<MemberProfile> memberList,
113122
List<AppMemberDefinedDataItem> appMemberDefinedData, Integer supportTopic) {
114123
this.ownerAccount = ownerAccount;
@@ -120,6 +129,7 @@ public CreateGroupRequest(String ownerAccount, String type, String groupId, Stri
120129
this.faceUrl = faceUrl;
121130
this.maxMemberCount = maxMemberCount;
122131
this.applyJoinOption = applyJoinOption;
132+
this.inviteJoinOption = inviteJoinOption;
123133
this.appDefinedData = appDefinedData;
124134
this.memberList = memberList;
125135
this.appMemberDefinedData = appMemberDefinedData;
@@ -136,6 +146,7 @@ private CreateGroupRequest(Builder builder) {
136146
this.faceUrl = builder.faceUrl;
137147
this.maxMemberCount = builder.maxMemberCount;
138148
this.applyJoinOption = builder.applyJoinOption;
149+
this.inviteJoinOption = builder.inviteJoinOption;
139150
this.appDefinedData = builder.appDefinedData;
140151
this.memberList = builder.memberList;
141152
this.appMemberDefinedData = builder.appMemberDefinedData;
@@ -218,6 +229,14 @@ public void setApplyJoinOption(String applyJoinOption) {
218229
this.applyJoinOption = applyJoinOption;
219230
}
220231

232+
public String getInviteJoinOption() {
233+
return inviteJoinOption;
234+
}
235+
236+
public void setInviteJoinOption(String inviteJoinOption) {
237+
this.inviteJoinOption = inviteJoinOption;
238+
}
239+
221240
public List<AppDefinedDataItem> getAppDefinedData() {
222241
return appDefinedData;
223242
}
@@ -261,6 +280,7 @@ public static final class Builder {
261280
private String faceUrl;
262281
private Integer maxMemberCount;
263282
private String applyJoinOption;
283+
private String inviteJoinOption;
264284
private List<AppDefinedDataItem> appDefinedData;
265285
private List<MemberProfile> memberList;
266286
private List<AppMemberDefinedDataItem> appMemberDefinedData;
@@ -318,6 +338,11 @@ public Builder applyJoinOption(String applyJoinOption) {
318338
return this;
319339
}
320340

341+
public Builder inviteJoinOption(String inviteJoinOption) {
342+
this.inviteJoinOption = inviteJoinOption;
343+
return this;
344+
}
345+
321346
public Builder appDefinedData(List<AppDefinedDataItem> appDefinedData) {
322347
this.appDefinedData = appDefinedData;
323348
return this;

0 commit comments

Comments
 (0)