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

@geovis/datacloud-channel-sdk

v1.0.6

Published

datacloud channel sdk nodejs

Downloads

24

Readme

datacloud-sdk-demo-nodejs

  • 本文档用于指导开发者对接数据云个人用户

主要流程 [参考]

第一步、前往 https://datacloud.geovisearth.com 注册datacloud开发者账号。

第二步、提供注册账号信息,联系管理员申请接入需要的 secretId,secretKey和对接的channelId信息

第三步、安装sdk, 使用secretId,secretKey和channelId信息初始化SDK

# npm
npm install @geovis/datacloud-channel-sdk --save
# yarn
yarn add @geovis/datacloud-channel-sdk
const DatacloudChannelSdk = require("@geovis/datacloud-channel-sdk");

const instance = new DatacloudChannelSdk(
    '<your secretId>',
    '<your secretKey>',
    '<your channelId>',
);

// 通过手机号授权并获取访问Token
instance.getTokenByPhone('19912345678').then(r => {
    console.log(JSON.stringify(r, null, 4))
})

// public应用列表
instance.getApplicationList('19912345678').then(r => {
    console.log(JSON.stringify(r, null, 4))
})

// 刷新应用的token
instance.refreshToken('19912345678', 'YZJQ4ggozLp0Mhuy').then(r => {
    console.log(JSON.stringify(r, null, 4))
})

// 获取用量
instance.getUsage('YZJQ4ggozLp0Mhuy').then(r => {
    console.log(JSON.stringify(r, null, 4))
})

API文档

1、通过手机号授权并获取访问Token

方法签名: async getTokenByPhone(phone)
参数:

| 参数名 | 类型 | 必填 | 说明 | |-------|--------|----|-----| | phone | string | 是 | 手机号 |

返回值示例:
{
  "code": 0,
  "data": {
    "createdTime": 1704178611366,
    "updatedTime": 1704247314699,
    "appId": "YZJQ4ggozLp0Mhuy",
    "appName": "测试-专属应用",
    "developerId": "tthCkFxezhrMQT9O2sHhzDm7y-boiN6C",
    "status": "normal",
    "secrecy": "public",
    "token": "8ba29bb3527ddf2970e0c27f9009a1ade64fdc25e79be378ce32096de5765910",
    "referers": "",
    "emptyReferer": false,
    "startTime": 1704247314708,
    "expireTime": 2400000,
    "ssoChannel": "f418a7a8-ed69-4b73-b395-bdddf64d9384"
  }
}

2、获取public应用列表

方法签名: getApplicationList(phone)
参数:

| 参数名 | 类型 | 必填 | 说明 | |-------|--------|----|-----| | phone | string | 是 | 手机号 |

返回值示例:
{
  "code": 0,
  "data": [
    {
      "createdTime": 1704178611366,
      "updatedTime": 1704189839469,
      "appId": "YZJQ4ggozLp0Mhuy",
      "appName": "测试-专属应用",
      "developerId": "tthCkFxezhrMQT9O2sHhzDm7y-boiN6C",
      "status": "normal",
      "secrecy": "public",
      "token": "9cacf8638471b74221616545c765c1f1727338f14aa627c47bc1fdcc40f6fb09",
      "referers": "",
      "emptyReferer": false,
      "startTime": 1704189839467,
      "expireTime": 2400000,
      "ssoChannel": "f418a7a8-ed69-4b73-b395-bdddf64d9384"
    }
  ]
}

3、刷新应用的token

方法签名: async refreshToken(phone, appId)
参数:

| 参数名 | 类型 | 必填 | 说明 | |-------|--------|----|------| | phone | string | 是 | 手机号 | | appId | string | 是 | 应用id |

返回值示例:
{
  "code": 0,
  "data": {
    "createdTime": 1704178611366,
    "updatedTime": 1704247314699,
    "appId": "YZJQ4ggozLp0Mhuy",
    "appName": "测试-专属应用",
    "developerId": "tthCkFxezhrMQT9O2sHhzDm7y-boiN6C",
    "status": "normal",
    "secrecy": "public",
    "referers": "",
    "emptyReferer": false,
    "startTime": 1704247314708,
    "expireTime": 2400000,
    "ssoChannel": "f418a7a8-ed69-4b73-b395-bdddf64d9384",
    "tokens": [
      {
        "createTime": "2024-01-03T02:01:54.708Z",
        "updateTime": "2024-01-03T02:01:54.708Z",
        "token": "8ba29bb3527ddf2970e0c27f9009a1ade64fdc25e79be378ce32096de5765910",
        "status": "normal",
        "flag": null,
        "description": null
      },
      {
        "createTime": "2024-01-02T10:03:59.467Z",
        "updateTime": "2024-01-03T02:01:54.705Z",
        "token": "9cacf8638471b74221616545c765c1f1727338f14aa627c47bc1fdcc40f6fb09",
        "status": "disabled",
        "flag": null,
        "description": null
      }
    ]
  }
}


4、获取用量

方法签名: async getUsage(appId)
参数:

| 参数名 | 类型 | 必填 | 说明 | |-------|--------|----|------| | appId | string | 是 | 应用id |

返回值示例:
{
  "code": 0,
  "data": {
    "id": "znu5oZQXfsjGvVIoSTArDhMu1_yIXwco",
    "createTime": "2023-12-28T07:38:13.062Z",
    "updateTime": "2023-12-28T07:38:13.062Z",
    "deleteTime": null,
    "developerId": "tthCkFxezhrMQT9O2sHhzDm7y-boiN6C",
    "type": 1,
    "trafficSpecify": "self",
    "status": "normal",
    "trafficLevel": "quota/gu/gu1",
    "trafficStartTime": 1703749093082,
    "trafficExpiretime": -1,
    "emptyReferer": false,
    "referers": null,
    "dataPack": {
      "name": "政企免费版",
      "traffic": {
        "interval": 86400,
        "quota": 50000
      },
      "currentUsage": 0
    }
  }
}