1.0.2 • Published 3 years ago

gitee-api-v5 v1.0.2

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

用法

npm i gitee-api-v5 -S
import GiteeApi from 'gitee-api-v5'

const giteeApi = new GiteeApi({ owner: 'zclzone', repo: 'res' })

// 创建文件,入参:access_token,fileName,content,message(可选,提交信息)
giteeApi.createFile('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', '123.txt', 'Hello').then(res => {
  console.log(res)
}

// 修改文件,入参:access_token,fileName,content,message(可选,提交信息)
giteeApi.updateFile('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', '123.txt', 'Hello 123').then(res => {
  console.log(res)
}

// 删除文件,入参:access_token,fileName,message(可选,提交信息)
giteeApi.removeFile('xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', '123.txt').then(res => {
  console.log(res)
}

// 查看文件,入参:fileName,也可以是一个文件夹名,如果是一个文件夹则返回一个包含文件夹内所有文件的数组
giteeApi.getFileDetail('123.txt').then(res => {
  console.log(res)
}