• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

bmamlin/GitHubApi.groovy: A simple Groovy script to provide Groovy access to the ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

bmamlin/GitHubApi.groovy

开源软件地址:

https://github.com/bmamlin/GitHubApi.groovy

开源编程语言:

Groovy 100.0%

开源软件介绍:

GitHubApi.groovy

A simple Groovy script to provide Groovy access to the GitHub API. I'm not making any claims to be the best Groovy programmer around. I just tend to use Groovy for scripting on occasion and wanted to be able to script against the GitHub API.

The API object provided by this script will fetch all data requested, even if the data are paged. It will also respect GitHub's rate limits and sleep when necessary to avoid exceding those limits. The personal access token is necessary, since GitHub understandably limits the number of anonymous REST calls allowed.

Installation

While you could clone this repository, that's not necessary. You can simply copy the contents of the raw GitHubApi.groovy file into an editor and save it as GitHubApi.groovy wherever you keep your Groovy scripts.

Setup

To use this script, you need to have (or create) a personal access token (GitHub Settings > Personal access tokens) and place it into a file named .github.token in your home folder (i.e., ~/.github.token).

Usage

#!/usr/bin/env groovy

def github = new GitHubApi()

// Find all OpenMRS repositories whose name starts with "openmrs-module-"
repos = github.get('/orgs/openmrs/repos').findAll {
	it.name.startsWith('openmrs-module-')
}

// List names of repositories
println repos.collect{ it.name }.join(', ')

Methods

Method Description
.get(path[, query]) Get resource at path without option parameters in query hash
.put(path, body) Put the contents of body to a resource at path
.patch(path, body) Patch the resource at path with the contents of body

The GitHub API is well-documented here.




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap