# ming-github

> github客户端

Latest version **1.0.4** (published 2019-05-25) · ISC license · 0 weekly downloads

## Install

```sh
npm install ming-github
pnpm add ming-github
yarn add ming-github
bun add ming-github
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.4 |
| Published | 2019-05-25 |
| First published | 2019-05-18 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Unpacked size | 13.9 KB |
| Known vulnerabilities | 0 (+26 in 2 direct dependencies) |
| Install scripts | no |
| GitHub stars | 1 |
| Maintainers | minglie |

## Links

- npm: https://www.npmjs.com/package/ming-github
- Repository: https://github.com/minglie/ming-github
- Homepage: https://github.com/minglie/ming-github#readme
- Issues: https://github.com/minglie/ming-github/issues
- npm.io page: https://npm.io/package/ming-github

## Dependencies (5)

- [axios](https://npm.io/package/axios.md) ^0.18.0
- [crypto-js](https://npm.io/package/crypto-js.md) ^3.1.9-1
- [ming_node](https://npm.io/package/ming_node.md) ^0.1.5
- [urlencode](https://npm.io/package/urlencode.md) ^1.1.0
- [querystring](https://npm.io/package/querystring.md) ^0.2.0

## Recent versions

- 1.0.4 (latest) — 2019-05-25
- 1.0.3 — 2019-05-20
- 1.0.2 — 2019-05-18
- 1.0.1 — 2019-05-18

## README

# ming-github
github客户端


参考文档地址
https://segmentfault.com/a/1190000015144126?utm_source=tag-newest



#1. 普通页面使用ming-github


```html
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<script src="https://minglie.github.io/js//M_github.js"></script>
<body>

<button id="btn">执行</button>
<script>
    github=new Github({token:"2ff060ad1f68fd0a16beb73e608c3853da472737",username: 'minglie'});
    btn.onclick=async function () {
     //  github.reposListAll().then(d=>console.log(d))
      //  github.fileContents("ming_node","/index.js").then(d=>console.log(d))
       // github.createContent("ming_node","/wang/a14.js","网朋飞").then(d=>console.log(d),e=>console.log(e))
        github.updateContent("ming_node","/wang/a14.js","QQQQQQQQ").then(d=>console.log(d.commit.sha),e=>console.log(e))

    }


</script>

</body>
</html>
```


#2. node环境使用ming_github

```javascript

const Github = require('ming-github');

github=new Github({token:"2ff060ad1f68fd0a16beb73e608c3853da472737",username: 'minglie'});


/**
 * 个人主要信息
 */
if(1)
github.getUser().then(d=>console.log(d.data))


/**
 * 个人所有仓库
 */
if(0)
github.reposListAll().then(d=>console.log(d.data))


/**
 * 仓库详情
 */
if(0)
github.reposDetails("ming_node").then(d=>console.log(d.data))


/**
 * 获取某个repo的内容列表,或文件信息
 */
if(0)
github.reposContents("ming_node","/a3.js").then(d=>console.log(d.data))


/**
 * 获取某文件的原始内容
 */
if(0)
github.fileContents("ming_node","/index.js").then(d=>console.log(d.data))



/**
 * repo中所有的commits列表
 * sha="/c15c91a059f7ea83964fda621f8edf990727616e"
 */
if(0)
github.commitList("ming_node","/a527d9b8b9d7085dbf87b90f6f247c4fe54fe4fe").then(d=>console.log(d.data))



/**
 * issues列表
 * issueNum="/1"
 */
if(0)
github.issuesList("ming_node").then(d=>console.log(d.data))



if(0)
github.test("ming_node").then(d=>console.log(d.data),e=>console.log(e))


/**
 * 创建新文件 Create content
 */
if(0)
github.createContent("ming_node","/wang/a3.js","网朋sdfsdf飞").then(d=>console.log(d.data.commit.sha),e=>console.log(e))




/**
 * 更新文件 Update content
 */
if(0)
github.updateContent("ming_node","/wang/a3.js","段舍得坊").then(d=>console.log(d.data.commit.sha),e=>console.log(e))


/**
 * 删除文件 Delete content
 */
if(0)
github.deleteContent("ming_node","/wang").then(d=>console.log(d.data),e=>console.log(e))



/**
 * 增加一条issue
 */
if(0)
github.createIssue("ming_node",{
    "title": "Creating issue from API",
    "body": "Posting a issue from Insomnia"
}).then(d=>console.log(d.data),e=>console.log(e))


/**
 * 更改某条issue
 */
if(0)
github.updateIssue("ming_node",1,{
    "title": "AAAA",
    "body": "Addf a issue from Insomnia",
    "state": "open"
}).then(d=>console.log(d.data),e=>console.log(e))



/**
 * 锁住某条issue
 */
if(0)
github.lockIssue("ming_node",1).then(d=>console.log(d.data),e=>console.log(e))



/**
 * 解锁某条issue
 */
if(0)
github.unlockIssue("ming_node",1).then(d=>console.log(d.data),e=>console.log(e))


/**
 * 增加comment
 */
if(0)
github.createComment("ming_node",1, "BBB").then(d=>console.log(d.data),e=>console.log(e))

/**
 * 更改comment
 */
if(0)
github.updateComment("ming_node", "493643757","VWBBB").then(d=>console.log(d.data),e=>console.log(e))


/**
 * 删除comment
 */
if(0)
github.deleteComment("ming_node", "493643757").then(d=>console.log(d.data),e=>console.log(e))

 ```

---
_Source: https://npm.io/package/ming-github · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
