1.0.2 • Published 1 year ago

ylzcc-sdk-tools v1.0.2

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

github rest api ts-node版

简介

此版本基于ts-node开发,集成github rest api进行封装

1.0.0版

支持

  • 为经过身份验证的用户创建一个新的存储库
  • 删除仓库
  • 在存储库中创建新文件或替换现有文件
  • 删除文件
  • 获取存储库目录
  • 获取文件内容
  • 创建站点

示例

import GithudRestApi from 'ylzcc-sdk-githubapi'

const config = {
  accept: '*******' 
}

const api = new GithudRestApi(config)

// 删除仓库
api.deleteARepository({
    owner: '***',
    repo: '***'
  }).then(res => {
    console.log(res);
  })

// 创建仓库
api.createARepositoryForTheAuthenticatedUser({
  name: '***'
}).then(res => {
  console.log(res);
})

// 新增/修改
api.createOrUpdateFileContents({
  owner: '***',
  repo: '***',
  path: '***',
  message: '***',
  content: '***',
  sha: '***'
}).then(res => {
  console.log(res);
})

// 获取目录
api.getRepositoryContent({
  owner: '***',
  repo: '***',
  path: '***'
}).then(res => {
  console.log(res);
})

// 删除文件
api.deleteAFile({
  owner: '***',
  repo: '***',
  path: '***',
  message: '***',
  sha: '***'
}).then(res => {
  console.log(res);
})

// 获取文件内容
api.getFileContent('***').then(res => {
  console.log(res);
})

// 创建站点
api.createAGitHubPagesSite({
  owner: '***',
  repo: '***',
  source: {
    branch: '***'
  }
}).then(res => {
    console.log(res);
})
1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago