添加频道sdk

This commit is contained in:
heavyrain.lee
2020-01-04 17:04:43 +08:00
parent 998f01a584
commit e4da3780f5
11 changed files with 327 additions and 15 deletions
@@ -48,8 +48,12 @@ public interface APIPath {
String Get_System_Setting = "/admin/system/get_setting";
String Put_System_Setting = "/admin/system/put_setting";
String Channel_User_Info = "/channel/user_info";
String Channel_Update_Profile = "/channel/update_profile";
String Channel_Message_Send = "/channel/message/send";
String Channel_Subscribe = "/channel/subscribe";
String Channel_Unsubscribe = "/channel/unsubscribe";
String Channel_Subscriber_List = "/channel/subscriber_list";
String Robot_User_Info = "/robot/user_info";
String Robot_Message_Send = "/robot/message/send";
@@ -0,0 +1,36 @@
/*
* This file is part of the Wildfire Chat package.
* (c) Heavyrain2012 <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
package cn.wildfirechat.pojos;
import cn.wildfirechat.proto.ProtoConstants;
import cn.wildfirechat.proto.WFCMessage;
import java.util.ArrayList;
import java.util.List;
public class InputChannelSubscribe {
private List<String> targets;
private int subscribe; //1,订阅;0,取消订阅
public List<String> getTargets() {
return targets;
}
public void setTargets(List<String> targets) {
this.targets = targets;
}
public int getSubscribe() {
return subscribe;
}
public void setSubscribe(int subscribe) {
this.subscribe = subscribe;
}
}
@@ -0,0 +1,36 @@
/*
* This file is part of the Wildfire Chat package.
* (c) Heavyrain2012 <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
package cn.wildfirechat.pojos;
import cn.wildfirechat.proto.WFCMessage;
import io.netty.util.internal.StringUtil;
import java.util.Arrays;
public class InputModifyChannelInfo {
private int type;
private String value;
public int getType() {
return type;
}
public void setType(int type) {
this.type = type;
}
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
}
@@ -13,9 +13,11 @@ import cn.wildfirechat.proto.WFCMessage;
public class OutputCreateChannel {
private String targetId;
private String secret;
public OutputCreateChannel(String targetId) {
public OutputCreateChannel(String targetId, String secret) {
this.targetId = targetId;
this.secret = secret;
}
public String getTargetId() {
@@ -25,4 +27,12 @@ public class OutputCreateChannel {
public void setTargetId(String targetId) {
this.targetId = targetId;
}
public String getSecret() {
return secret;
}
public void setSecret(String secret) {
this.secret = secret;
}
}
@@ -0,0 +1,66 @@
/*
* This file is part of the Wildfire Chat package.
* (c) Heavyrain2012 <[email protected]>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
package cn.wildfirechat.pojos;
import cn.wildfirechat.proto.ProtoConstants;
import cn.wildfirechat.proto.WFCMessage;
import io.netty.util.internal.StringUtil;
import java.util.ArrayList;
import java.util.List;
public class SendChannelMessageData {
private List<String> targets;
private int line;
private MessagePayload payload;
public List<String> getTargets() {
return targets;
}
public void setTargets(List<String> targets) {
this.targets = targets;
}
public int getLine() {
return line;
}
public void setLine(int line) {
this.line = line;
}
public MessagePayload getPayload() {
return payload;
}
public void setPayload(MessagePayload payload) {
this.payload = payload;
}
public static boolean isValide(SendChannelMessageData sendMessageData) {
if(sendMessageData == null ||
sendMessageData.getPayload() == null) {
return false;
}
return true;
}
public WFCMessage.Message toProtoMessage(String channelId, String channelOwner) {
if (targets == null) {
targets = new ArrayList<>();
}
return WFCMessage.Message.newBuilder().setFromUser(channelOwner)
.setConversation(WFCMessage.Conversation.newBuilder().setType(ProtoConstants.ConversationType.ConversationType_Channel).setTarget(channelId).setLine(line))
.addAllTo(targets)
.setContent(payload.toProtoMessageContent())
.build();
}
}
@@ -4,6 +4,7 @@ public class UserOnlineStatus {
public static final int ONLINE = 0;
public static final int OFFLINE = 1;
public static final int LOGOUT = -1;
public String userId;
public String clientId;
public int platform;