Unverified Commit b1c87cb2 authored by Yang Libin's avatar Yang Libin Committed by GitHub

chore: add constants and update unit tests (#59)

parent 8a8ce7ce
...@@ -22,7 +22,7 @@ Add the Maven dependency: ...@@ -22,7 +22,7 @@ Add the Maven dependency:
<dependency> <dependency>
<groupId>io.github.doocs</groupId> <groupId>io.github.doocs</groupId>
<artifactId>im-server-sdk-java</artifactId> <artifactId>im-server-sdk-java</artifactId>
<version>0.2.5</version> <version>0.2.6</version>
</dependency> </dependency>
``` ```
...@@ -63,7 +63,7 @@ try { ...@@ -63,7 +63,7 @@ try {
## Contributing ## Contributing
Contributions are always welcomed! Contributions are always welcomed!
We use the `dev` branch as the development branch, which indicates that this is a unstable branch. We use the `dev` branch as the development branch, which indicates that this is a unstable branch.
......
# 介绍 # 介绍
本文档基于腾讯云 IM Server SDK Java <Badge type="tip" text="v0.2.5" vertical="top" /> 编写。 本文档基于腾讯云 IM Server SDK Java <Badge type="tip" text="v0.2.6" vertical="top" /> 编写。
## 前提条件 ## 前提条件
......
...@@ -124,8 +124,8 @@ ModifyGroupBaseInfoRequest request = ModifyGroupBaseInfoRequest.builder() ...@@ -124,8 +124,8 @@ ModifyGroupBaseInfoRequest request = ModifyGroupBaseInfoRequest.builder()
.notification("hello world!") .notification("hello world!")
.faceUrl("https://avatars.githubusercontent.com/u/43716716?s=200&v=4") .faceUrl("https://avatars.githubusercontent.com/u/43716716?s=200&v=4")
.maxMemberNum(500) .maxMemberNum(500)
.applyJoinOption("NeedPermission") .applyJoinOption(ApplyJoinOption.NEED_PERMISSION)
.shutUpAllMember("Off") .shutUpAllMember(ShutUpAllMember.OFF)
.build(); .build();
ModifyGroupBaseInfoResult result = client.group.modifyGroupBaseInfo(request); ModifyGroupBaseInfoResult result = client.group.modifyGroupBaseInfo(request);
...@@ -331,9 +331,10 @@ Private(即新版本中的 Work,好友工作群)类型不支持禁言。 ...@@ -331,9 +331,10 @@ Private(即新版本中的 Work,好友工作群)类型不支持禁言。
使用示例: 使用示例:
```java ```java
List<String> membersAccount = Collections.singletonList("doocs");
ForbidSendMsgRequest request = ForbidSendMsgRequest.builder() ForbidSendMsgRequest request = ForbidSendMsgRequest.builder()
.groupId("MyFirstGroup") .groupId("MyFirstGroup")
.membersAccount(Collections.singletonList("doocs")) .membersAccount(membersAccount)
.shutUpTime(200) .shutUpTime(200)
.build(); .build();
......
...@@ -102,6 +102,7 @@ AdminGetRoamMsgRequest request = AdminGetRoamMsgRequest.builder() ...@@ -102,6 +102,7 @@ AdminGetRoamMsgRequest request = AdminGetRoamMsgRequest.builder()
.minTime(1631934000) .minTime(1631934000)
.maxTime(1631934060) .maxTime(1631934060)
.build(); .build();
AdminRoamMsgResult result = client.message.getRoamMsg(request); AdminRoamMsgResult result = client.message.getRoamMsg(request);
List<MsgListItem> msgList = result.getMsgList(); List<MsgListItem> msgList = result.getMsgList();
...@@ -173,6 +174,8 @@ App 后台可以通过该接口查询特定账号的单聊总未读数(包含 ...@@ -173,6 +174,8 @@ App 后台可以通过该接口查询特定账号的单聊总未读数(包含
```java ```java
GetC2cUnreadMsgRequest request = new GetC2cUnreadMsgRequest("test2"); GetC2cUnreadMsgRequest request = new GetC2cUnreadMsgRequest("test2");
request.setPeerAccount(Arrays.asList("test1", "bingo")); List<String> peerAccount = Arrays.asList("test1", "bingo");
request.setPeerAccount(peerAccount);
C2cUnreadMsgNumResult result = client.message.getC2cUnreadMsgNum(request); C2cUnreadMsgNumResult result = client.message.getC2cUnreadMsgNum(request);
``` ```
...@@ -10,14 +10,14 @@ ...@@ -10,14 +10,14 @@
<dependency> <dependency>
<groupId>io.github.doocs</groupId> <groupId>io.github.doocs</groupId>
<artifactId>im-server-sdk-java</artifactId> <artifactId>im-server-sdk-java</artifactId>
<version>0.2.5</version> <version>0.2.6</version>
</dependency> </dependency>
``` ```
### Gradle ### Gradle
```gradle ```gradle
implementation group: 'io.github.doocs', name: 'im-server-sdk-java', version: '0.2.5' implementation group: 'io.github.doocs', name: 'im-server-sdk-java', version: '0.2.6'
``` ```
### 下载 jar ### 下载 jar
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<groupId>io.github.doocs</groupId> <groupId>io.github.doocs</groupId>
<artifactId>im-server-sdk-java</artifactId> <artifactId>im-server-sdk-java</artifactId>
<version>0.2.5</version> <version>0.2.6</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>qcloud-im-server-sdk-java</name> <name>qcloud-im-server-sdk-java</name>
......
package io.github.doocs.im.constant;
/**
* 管理员禁止加好友标识
*
* @author bingo
* @since 2021/11/8 15:53
*/
public class AdminForbidType {
/**
* 默认值,允许加好友
*/
public static final String NONE = "AdminForbid_Type_None";
/**
* 禁止该用户发起加好友请求
*/
public static final String SEND_OUT = "AdminForbid_Type_SendOut";
private AdminForbidType() {
}
}
package io.github.doocs.im.constant;
/**
* 加好友验证方式
*
* @author bingo
* @since 2021/11/8 15:50
*/
public class AllowType {
/**
* 需要经过自己确认对方才能添加自己为好友
*/
public static final String NEED_CONFIRM = "AllowType_Type_NeedConfirm";
/**
* 允许任何人添加自己为好友
*/
public static final String ALLOW_ANY = "AllowType_Type_AllowAny";
/**
* 不允许任何人添加自己为好友
*/
public static final String DENY_ANY = "AllowType_Type_DenyAny";
private AllowType() {
}
}
package io.github.doocs.im.constant;
/**
* 性别
*
* @author bingo
* @since 2021/11/8 15:47
*/
public class GenderType {
/**
* 没设置性别
*/
public static final String UNKNOWN = "Gender_Type_Unknown";
/**
* 女性
*/
public static final String FEMALE = "Gender_Type_Female";
/**
* 男性
*/
public static final String MALE = "Gender_Type_Male";
private GenderType() {
}
}
...@@ -182,9 +182,10 @@ public class GroupTest { ...@@ -182,9 +182,10 @@ public class GroupTest {
@Test @Test
public void testForbidSendMsg() throws IOException { public void testForbidSendMsg() throws IOException {
List<String> membersAccount = Collections.singletonList("doocs");
ForbidSendMsgRequest request = ForbidSendMsgRequest.builder() ForbidSendMsgRequest request = ForbidSendMsgRequest.builder()
.groupId("MyFirstGroup") .groupId("MyFirstGroup")
.membersAccount(Collections.singletonList("doocs")) .membersAccount(membersAccount)
.shutUpTime(200) .shutUpTime(200)
.build(); .build();
......
...@@ -146,7 +146,9 @@ public class MessageTest { ...@@ -146,7 +146,9 @@ public class MessageTest {
@Test @Test
public void testGetC2CUnreadMsgNum() throws IOException { public void testGetC2CUnreadMsgNum() throws IOException {
GetC2cUnreadMsgRequest request = new GetC2cUnreadMsgRequest("test2"); GetC2cUnreadMsgRequest request = new GetC2cUnreadMsgRequest("test2");
request.setPeerAccount(Arrays.asList("test1", "bingo")); List<String> peerAccount = Arrays.asList("test1", "bingo");
request.setPeerAccount(peerAccount);
C2cUnreadMsgNumResult result = client.message.getC2cUnreadMsgNum(request); C2cUnreadMsgNumResult result = client.message.getC2cUnreadMsgNum(request);
System.out.println(result); System.out.println(result);
Assert.assertEquals("OK", result.getActionStatus()); Assert.assertEquals("OK", result.getActionStatus());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment