Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
6d621e5
feat(#open source) : init
Sep 20, 2023
4d2f8b0
Merge branch 'main' of github.com:open-dingtalk/dingtalk-stream-sdk-j…
Sep 20, 2023
7974d35
fix(#init) : init
Sep 20, 2023
b7ac889
feat: 支持自动化构建
chzealot Sep 21, 2023
0cf5203
feat: 升级至 1.0.8-SNAPSHOT
chzealot Sep 21, 2023
ec40f4e
feat: 更换 JDK 为 temurin
chzealot Sep 21, 2023
1e001e7
fix: 修复 GPG 签名问题
chzealot Sep 21, 2023
1148011
fix: 修复 GPG 签名问题
chzealot Sep 21, 2023
195a683
debug: 调试 gpg 流程
chzealot Sep 21, 2023
5db6d62
feat: 支持 settings 文件用于 maven deploy
chzealot Sep 21, 2023
aea4a76
fix: 修复 maven deploy 错误,指定 settings
chzealot Sep 21, 2023
21e6f01
feat: 增加 release 触发构建
chzealot Sep 21, 2023
08b03f5
Merge branch 'main' into develop
chzealot Sep 21, 2023
1529dd0
feat: 定义机器人消息类型
chzealot Sep 21, 2023
9a02e64
feat: 优化 workflow:如果是develop分支,仅当当前的maven 模块版本号以 SNAPSHOT 后缀时候才执行,否则不…
chzealot Sep 21, 2023
7cd531c
feat: 非 main 分支仅构建 SNAPSHOT 分支
chzealot Sep 21, 2023
313c7f7
fix: 添加 getter / setter
chzealot Sep 21, 2023
6e1ef66
fix: implement Serializable
chzealot Sep 21, 2023
6294aa6
feat: 为 MessageContent 字段补充 getter 和 setter
chzealot Sep 21, 2023
f0c7367
feat: 严格遵守协议,null 值一样输出
chzealot Sep 21, 2023
0eeefcf
feat: 升级版本号为 1.0.9
chzealot Sep 22, 2023
51b1ebc
Merge branch 'main' into develop
chzealot Sep 22, 2023
754915c
feat(#graph) : basic model
Sep 22, 2023
dbbe6ae
feat(#graph) : add callback topics
Sep 22, 2023
e694abf
feat(#graph) : refactor
Sep 22, 2023
8162fab
feat(#graph) : refactor
Sep 22, 2023
b39d4a5
feat(#graph) : 1.1.0
Sep 22, 2023
54f1448
feat(#graph) : 升级到正式 1.1.0
Sep 22, 2023
cbccfb5
Merge branch 'develop' into feature/graph_api
Sep 22, 2023
3bb7789
feat(#graph) : 升级到正式 1.1.0
Sep 22, 2023
1332740
feat(#graph) : fix header names
Sep 22, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app-stream-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>open-app-stream-client</artifactId>
<groupId>com.dingtalk.open</groupId>
<version>1.0.9</version>
<version>1.1.0</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.dingtalk.open.app.api.callback;

/**
* @author feiyin
* @date 2023/9/22
*/
public class DingTalkStreamTopics {
/**
* 机器人回调topic
*/
public static final String BOT_MESSAGE_TOPIC = "/v1.0/im/bot/messages/get";
/**
* 卡片回调topic
*/
public static final String CARD_CALLBACK_TOPIC = "/v1.0/card/instances/callback";
/**
* 卡片数据源topic
*/
public static final String CARD_DYNAMIC_TOPIC = "/v1.0/card/dynamicData/get";
/**
* graph接口回调
*/
public static final String GRAPH_API_TOPIC = "/v1.0/graph/api/invoke";
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
* @author feiyin
* @date 2023/4/3
*/
public interface OpenDingTalkCallbackListener<Input, Output> extends Serializable {
public interface OpenDingTalkCallbackListener<Request, Response> extends Serializable {

/**
* 执行回调
*
* @param param
* @param request
* @return
*/
Output execute(Input param);
Response execute(Request request);
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,18 @@ private static boolean isDecoratingProxy(Object candidate) {

private static boolean instanceOf(Class clazz, String interfaceName) {
Class<?>[] superInterfaces = clazz.getInterfaces();
for (Class<?> interf : superInterfaces) {
if (interf.getCanonicalName().equals(interfaceName)) {
for (Class<?> interfaceClass : superInterfaces) {
if (interfaceClass.getCanonicalName().equals(interfaceName)) {
return true;
}
}
return false;
}

@SuppressWarnings("unchecked")
private static Object invoke(Object object, String clazzName, String methodName, Object... args) {
try {
Class klass = Class.forName(clazzName);
Class<?> klass = Class.forName(clazzName);
Method method = klass.getDeclaredMethod(methodName);
method.setAccessible(true);
return method.invoke(object, args);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package com.dingtalk.open.app.api.graph;

import com.alibaba.fastjson.annotation.JSONField;

import java.util.Map;

/**
* @author feiyin
* @date 2023/9/22
*/
class GraphAPIMessage {
private Map<String, String> headers;
private String body;

public Map<String, String> getHeaders() {
return headers;
}

public void setHeaders(Map<String, String> headers) {
this.headers = headers;
}

public String getBody() {
return body;
}

public void setBody(String body) {
this.body = body;
}

@JSONField(serialize = false)
public String getHeader(String name) {
if (name == null || headers == null || headers.isEmpty()) {
return null;
}
return headers.get(name);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.dingtalk.open.app.api.graph;

/**
* @author feiyin
* @date 2023/9/22
*/
public enum GraphAPIMethod {
GET,

POST
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.dingtalk.open.app.api.graph;

/**
* @author feiyin
* @date 2023/9/22
*/
public class GraphAPIRequest extends GraphAPIMessage {

private RequestLine requestLine;

public RequestLine getRequestLine() {
return requestLine;
}

public void setRequestLine(RequestLine requestLine) {
this.requestLine = requestLine;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package com.dingtalk.open.app.api.graph;

/**
* @author feiyin
* @date 2023/9/22
*/
public class GraphAPIResponse extends GraphAPIMessage {

private StatusLine statusLine;

public StatusLine getStatusLine() {
return statusLine;
}

public void setStatusLine(StatusLine statusLine) {
this.statusLine = statusLine;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.dingtalk.open.app.api.graph;

/**
* @author feiyin
* @date 2023/9/22
*/
public class GraphHeaders {


public static final String CONTENT_TYPE_NAME = "content-type";

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.dingtalk.open.app.api.graph;

/**
* @author feiyin
* @date 2023/9/22
*/
public class MediaType {


public final static String APPLICATION_JSON_VALUE = "application/json";


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
package com.dingtalk.open.app.api.graph;

import com.alibaba.fastjson.annotation.JSONField;

import java.net.URI;

/**
* @author feiyin
* @date 2023/9/22
*/
public class RequestLine {
/**
* 请求方法
*/
private GraphAPIMethod method;
/**
* 请求uri
*/
private URI uri;
public GraphAPIMethod getMethod() {
return method;
}
public void setMethod(GraphAPIMethod method) {
this.method = method;
}
public URI getUri() {
return uri;
}
public void setUri(URI uri) {
this.uri = uri;
}

/**
* 获取请求路径
* @return
*/
@JSONField(serialize = false)
public String getPath() {
return uri == null ? "" : uri.getPath();
}

/**
* 获取请求参数
* @return
*/
@JSONField(serialize = false)
public String getQuery() {
return uri == null ? "" : uri.getQuery();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package com.dingtalk.open.app.api.graph;

/**
* @author feiyin
* @date 2023/9/22
*/
public class StatusLine {

public static final StatusLine OK = new StatusLine(200, "OK");

public static final StatusLine NOT_FOUND = new StatusLine(404, "NOT FOUND");

public static final StatusLine INTERNAL_ERROR = new StatusLine(500, "INTERNAL ERROR");

private Integer code;

private String reasonPhrase;

public StatusLine() {

}

public StatusLine(Integer code, String reasonPhrase) {
this.code = code;
this.reasonPhrase = reasonPhrase;
}

public Integer getCode() {
return code;
}

public void setCode(Integer code) {
this.code = code;
}

public String getReasonPhrase() {
return reasonPhrase;
}

public void setReasonPhrase(String reasonPhrase) {
this.reasonPhrase = reasonPhrase;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package com.dingtalk.open.app.api.models.ai;

/**
* @author feiyin
* @date 2023/9/22
*/
public class AIPluginHeaders {
/**
* plugin identity
*/
public static final String PLUGIN_ID_NAME = "x-plugin-id";
/**
* plugin version
*/
public static final String PLUGIN_VERSION_NAME = "x-plugin-version";
/**
* ability identity
*/
public static final String ABILITY_KEY_NAME = "x-ability-key";

}
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,7 @@
* @date 2023/3/1
*/
public class HttpConstants {

public static final String METHOD_POST = "POST";

public static final int CONNECTION_TIME_OUT = 3000;

public static final int READ_TIME_OUT = 3000;

public static final int STATUS_OK = 200;
public static final String HEADER_CONTENT_TYPE = "Content-Type";
public static final String HEADER_ACCEPT = "Accept";
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package com.dingtalk.open.app.api.util;

import com.alibaba.fastjson.JSON;
import com.dingtalk.open.app.api.graph.GraphAPIResponse;
import com.dingtalk.open.app.api.graph.GraphHeaders;
import com.dingtalk.open.app.api.graph.MediaType;
import com.dingtalk.open.app.api.graph.StatusLine;

import java.util.HashMap;
import java.util.Map;

/**
* @author feiyin
* @date 2023/9/22
*/
public class GraphUtils {

/**
* 返回成功json
*
* @param result
* @return
*/
public static GraphAPIResponse successJson(Object result) {
GraphAPIResponse response = baseResponse(StatusLine.OK);
response.setBody(JSON.toJSONString(result));
return response;
}

public static GraphAPIResponse failed(StatusLine statusLine) {
return baseResponse(statusLine);
}

private static GraphAPIResponse baseResponse(StatusLine statusLine) {
Map<String, String> headers = new HashMap<>();
headers.put(GraphHeaders.CONTENT_TYPE_NAME, MediaType.APPLICATION_JSON_VALUE);
GraphAPIResponse response = new GraphAPIResponse();
response.setHeaders(headers);
response.setStatusLine(statusLine);
return response;
}
}
4 changes: 2 additions & 2 deletions app-stream-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
<parent>
<groupId>com.dingtalk.open</groupId>
<artifactId>open-app-stream-client</artifactId>
<version>1.0.9</version>
<version>1.1.0</version>
<relativePath>../pom.xml</relativePath>
</parent>

<artifactId>app-stream-client</artifactId>
<packaging>jar</packaging>
<version>1.0.9</version>
<version>1.1.0</version>
<name>app-stream-client</name>

<dependencies>
Expand Down
4 changes: 2 additions & 2 deletions app-stream-network/app-stream-network-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
<parent>
<groupId>com.dingtalk.open</groupId>
<artifactId>app-stream-network</artifactId>
<version>1.0.9</version>
<version>1.1.0</version>
<relativePath>../pom.xml</relativePath>
</parent>

<artifactId>app-stream-network-api</artifactId>
<version>1.0.9</version>
<version>1.1.0</version>
<packaging>jar</packaging>

<name>app-stream-network-api</name>
Expand Down
Loading