Giter VIP home page Giter VIP logo

dtjava's Introduction

DtJava

介绍

DtJava(DingTalk Java SDK-钉钉SDK) 封装了钉钉凭证、通讯录管理、消息通知等服务端接口,让开发者可以使用简单的配置,提供简洁的 API 以供方便快速地调用钉钉接口。

注意:目前SDK主要是以企业内建应用为主,ISV应用后面会陆续支持。

文档

查看wiki首页

Demo示例可 查看DEMO项目 ,包括事件消息回调处理等等。

安装

  • 通过Maven方式安装使用
<dependency>
    <groupId>com.github.tingyugetc520</groupId>
    <artifactId>dt-java</artifactId>
    <version>0.1.2</version>
</dependency>

目前已发布0.1.2版本

  • 直接下载源码使用
git clone https://github.com/tingyugetc520/DtJava.git

源码下载完成后,放置在您的项目中使用,同时请注意相关依赖的问题。

使用

可前往查看DEMO项目

// 钉钉应用配置
DtDefaultConfigImpl config = new DtDefaultConfigImpl();
config.setCorpId("corpId");
config.setAgentId(agentId);
config.setAppKey("appKey");
config.setAppSecret("appSecret");

// DtService为SDK使用入口,后续接口使用均需要DtService
DtServiceImpl dtService = new DtServiceImpl();
dtService.setDtConfigStorage(config);

// 查询用户
DtUser user = dtService.getUserService().getById(userId);
log.info("dt user:{}", user);

// 发送工作消息通知
DtCorpConversationMessage message = DtCorpConversationMessage.builder()
			.agentId(config.getAgentId())
			.userIds(Lists.newArrayList("userId"))
			.msg(DtMessage.TEXT().content("this is content").build())
			.build();
dtService.getCorpConversationMsgService().send(message);

更多的示例可 查看DEMO项目 ,包括事件消息回调处理等等。

封装进度(企业内建应用)

  • HTTP代理,支持正向代理与反向代理
  • 获取凭证
  • 身份验证
  • 通讯录管理(只读)
  • 消息通知-工作消息通知
  • HTTP事件回调

dtjava's People

Contributors

tingyugetc520 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

dtjava's Issues

异步路由是否需要返回结果?

下方的代码都调用了future.get()方法来阻塞获取结果,但实际上有必要吗?万一我们的其中一个异步处理超过了钉钉规定的1500ms响应时间,那异步的作用就不是很大,仅仅是多个回调之间会并行,我看wxjava中之所以调用是因为它要结束session调用sessionEndAccess方法,而钉钉的没有这些,是否有必要管异步路由的结果?

if (futures.size() > 0) {
this.executorService.submit(() -> {
for (Future<Boolean> future : futures) {
try {
future.get();
} catch (InterruptedException e) {
log.error("Error happened when wait task finish", e);
Thread.currentThread().interrupt();
} catch (ExecutionException e) {
log.error("Error happened when wait task finish", e);
}
}
});
}


又考虑了下,如果全部设置成异步不判定结果都返回true的也有个麻烦,就是如果异步失败的话需要自己记录失败,而无法仅仅通过获取推送失败的事件列表这个接口来获取全部失败的推送,需要加上自己记录的失败才是全部的失败记录。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.