npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

dingtalk_suite

v1.1.7

Published

钉钉套件主动调用api

Downloads

6

Readme

dingtalk suite

钉钉套件主动调用API, 自带cache

回调server API见:dingtalk_suite_callback

配和企业号 API:dingtalk_enterprise可实现ISV套件控制企业号。 ##安装 npm install dingtalk_suite ##示例 构造函数:

var dd_talk = require('dingtalk_suite');
var conf = {
    suiteid: 'suitexpiygdnxxxxx',
    secret: 'C1oXyeJUgH_QXEHYJS4-Um-zxfxxxxxxxxxxxxxxxxxx-6np3fXskv5dGs',
    getTicket: function(callback){ 
      //从数据库中取出Tikcet,返回的data样式为:{value: 'xxxxxxx', expires:1452735301543}
      //ticket从 dingtalk_suite_callback 处获得
      fs.readFile(this.suiteid + 'ticket.txt',function(err, data){
        if(err){
            return callback(err);
        }
        data = JSON.parse(data.toString());
        callback(null, data);
      });
    },
    
    getToken: function(callback){
      //从数据库中取出Token,返回的data样式为:{value: 'xxxxxxx', expires:1452735301543}
      fs.readFile(this.suiteid + 'token.txt',function(err, data){
        if(err){
            return callback(err);
        }
        data = JSON.parse(data.toString());
        callback(null, data);
      });
    },
    
    saveToken: function(data, callback){
      //存储Token到数据库中,data样式为:{value: 'xxxxxxx', expires:1452735301543//过期时间}
      fs.writeFile(this.suiteid + 'token.txt',JSON.stringify(data), callback);
    }
  }
var api = new dd_talk(conf);

:本项目自带cache, token的过期时间默认为1小时59分50秒(防止网络延迟,故比规定2小时少了10秒)。 可以在conf.token_expires_in更改(不可大于2小时)。 ##方法

获取企业号永久授权码

api.getPermanentCode(tmp_auth_code, callback)

tmp_auth_code字符串,由dingtalk_suite_callback处获得。

获取企业号Token

//auth_corpid和permanent_code由上面接口获得。
api.getCorpToken(auth_corpid, permanent_code, callback)

获取企业号信息

api.getAuthInfo(auth_corpid, permanent_code, callback)

获取企业号应用

api.getAgent(agentid, auth_corpid, permanent_code, callback)

激活授权套件

api.activateSuite(auth_corpid, permanent_code, callback)

为授权方的企业单独设置IP白名单

//ip_whitelist为数组格式:["1.2.3.4","5.6.*.*"]
api.setCorpIpwhitelist(auth_corpid, ip_whitelist, callback)

##更多钉钉相关 ISV套件回调server: dingtalk_suite_callback 企业号API: dingtalk_enterprise ISV和企业号免登API: dingtalk_sso