1.8.0 • Published 5 months ago

node-cnb v1.8.0

Weekly downloads
-
License
MIT
Repository
-
Last release
5 months ago

介绍

badge badge badge badge badge

node-cnb 是一个用于访问 CNB API 的 node 编写的 SDK。

安装

npm install node-cnb

使用

import { getClient  } from "node-cnb";

// 参数分别为 api url 和 访问令牌
const client = getClient('https://api.cnb.cool', 'xxx');

client.users.pinnedRepos.list({
  username: 'xxx'
}).then((res) => {
  console.log(res);
})
const sdk = require('node-cnb');

// 参数分别为 api url 和 访问令牌
const client = sdk.getClient('https://api.cnb.cool', 'xxx');

client.users.pinnedRepos.list({
  username: 'xxx'
}).then((res) => {
  console.log(res);
})

方法路径

方法路径为由如下几个元素组成:

  1. 第一个 /-/ 前的参数名
  2. 其他非参数名
  3. http method(若 method 为 get 且返回结果为数组则为 list)

例如:

/{repo}/-/git/branches 的路径下 get 请求的方法名为 repo.git.branches.list

/{repo}/-/git/branches/{branch} 的路径下 get 请求方法名为 repo.git.branches.get

对于此规则下方法路径仍然重复的 api,则单独定义在 pathMethodMap.json

完整api路径请参考 client.d.ts

1.8.0

5 months ago

1.7.1

5 months ago

1.7.0

5 months ago

1.6.1

5 months ago

1.6.0

5 months ago

1.5.0

5 months ago

1.4.0

5 months ago

1.3.0

5 months ago

1.2.13

5 months ago

1.2.12

5 months ago

1.2.11

5 months ago

1.2.10

5 months ago

1.2.9

5 months ago

1.2.8

5 months ago

1.0.0

5 months ago