本文整理汇总了Java中com.jcabi.github.RtGithub类的典型用法代码示例。如果您正苦于以下问题:Java RtGithub类的具体用法?Java RtGithub怎么用?Java RtGithub使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RtGithub类属于com.jcabi.github包,在下文中一共展示了RtGithub类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: main
import com.jcabi.github.RtGithub; //导入依赖的package包/类
/**
* Main entry point.
* @param args Command line arguments
*/
public static void main(final String[] args) throws Exception {
final Github github = new RtGithub();
final JsonResponse resp = github.entry()
.uri().path("/search/repositories")
.queryParam("q", "java").back()
.fetch()
.as(JsonResponse.class);
final List<JsonObject> items = resp.json().readObject()
.getJsonArray("items")
.getValuesAs(JsonObject.class);
for (final JsonObject item : items) {
System.out.println(
String.format(
"repository found: %s",
item.get("full_name").toString()
)
);
}
}
开发者ID:cvrebert,项目名称:typed-github,代码行数:24,代码来源:Main.java
示例2: handleNotifications
import com.jcabi.github.RtGithub; //导入依赖的package包/类
/**
* Handles notifications, starts one action thread for each of them.
* @param notifications List of notifications.
* @return true if actions were started successfully; false otherwise.
*/
private boolean handleNotifications(final Notifications notifications) {
final String authToken = System.getProperty(GITHUB_API_TOKEN);
boolean handled;
if(authToken == null || authToken.isEmpty()) {
LOG.error(
"Missing comdor.auth.token; "
+ "Please specify the Github api access token!"
);
handled = false;
} else {
final Github github = new RtGithub(
new RtGithub(authToken).entry().through(RetryWire.class)
);
try {
for(final Notification notification : notifications) {
this.take(
new VigilantAction(
new Chat(
github.repos().get(
new Coordinates.Simple(
notification.repoFullName()
)
).issues().get(notification.issueNumber()),
new GithubSocialSteps()
),
github
)
);
}
handled = true;
} catch (final IOException ex) {
LOG.error("IOException when getting the Github Issue", ex);
handled = false;
}
}
return handled;
}
开发者ID:amihaiemil,项目名称:comdor,代码行数:43,代码来源:ChatResource.java
示例3: handleNotifications
import com.jcabi.github.RtGithub; //导入依赖的package包/类
/**
* Handles notifications, starts one action thread for each of them.
* @param notifications List of notifications.
* @return true if actions were started successfully; false otherwise.
*/
private boolean handleNotifications(final Notifications notifications) {
String authToken = System.getProperty("github.auth.token");
if(authToken == null || authToken.isEmpty()) {
LOG.error("Missing github.auth.token. Please specify a Github api access token!");
return false;
} else {
Github gh = new RtGithub(
new RtGithub(
authToken
).entry().through(RetryWire.class)
);
try {
for(final Notification notification : notifications) {
this.take(
new Action(
gh.repos().get(
new Coordinates.Simple(notification.repoFullName())
).issues().get(notification.issueNumber())
)
);
}
return true;
} catch (IOException ex) {
LOG.error("IOException while getting the Issue from Github API");
return false;
}
}
}
开发者ID:opencharles,项目名称:charles-rest,代码行数:34,代码来源:NotificationsResource.java
示例4: fetchesLabelsFromGithub
import com.jcabi.github.RtGithub; //导入依赖的package包/类
/**
* Fetches labels from Github.
* @throws Exception If fails
*/
@Test
public void fetchesLabelsFromGithub() throws Exception {
final Github github = new RtGithub();
final Repo repo = github.repos().get(
new Coordinates.Simple("jcabi/jcabi-github")
);
MatcherAssert.assertThat(
repo.labels().iterate().iterator().hasNext(),
Matchers.equalTo(true)
);
}
开发者ID:cvrebert,项目名称:typed-github,代码行数:16,代码来源:SampleTest.java
示例5: build
import com.jcabi.github.RtGithub; //导入依赖的package包/类
@NotNull
public GithubFacade build(Configuration configuration) {
Patchset patchset = PatchsetBuilder.build(configuration);
String oAuthKey = configuration.getProperty(GeneralOption.GITHUB_API_KEY);
Github github = new RtGithub(
new RtGithub(oAuthKey)
.entry()
.through(RetryWire.class)
);
Repo repo = github.repos().get(new Coordinates.Simple(patchset.getProjectPath()));
return new GithubFacade(repo, patchset);
}
开发者ID:TouK,项目名称:sputnik,代码行数:16,代码来源:GithubFacadeBuilder.java
示例6: GithubMilestones
import com.jcabi.github.RtGithub; //导入依赖的package包/类
GithubMilestones(ReleaserProperties properties) {
this.github = new RtGithub(new RtGithub(
properties.getGit().getOauthToken()).entry().through(RetryWire.class));
this.properties = properties;
}
开发者ID:spring-cloud,项目名称:spring-cloud-release-tools,代码行数:6,代码来源:GithubMilestones.java
示例7: push
import com.jcabi.github.RtGithub; //导入依赖的package包/类
@Override
public String push(final Events events) throws IOException {
final Github github = new RtGithub(this.config.getString("token"));
final String since = DateFormatUtils.formatUTC(
DateUtils.addMinutes(new Date(), -Tv.THREE),
"yyyy-MM-dd'T'HH:mm:ss'Z'"
);
final Request req = github.entry()
.uri().path("/notifications").back();
final Iterable<JsonObject> list = new RtPagination<>(
req.uri().queryParam("participating", "true")
.queryParam("since", since)
.queryParam("all", Boolean.toString(true))
.back(),
RtPagination.COPYING
);
final Collection<String> done = new LinkedList<>();
for (final JsonObject event : AgGithub.safe(list)) {
final String reason = event.getString("reason");
if (!"mention".equals(reason)) {
continue;
}
this.push(github, event, events);
done.add(event.getString("id"));
}
req.uri()
.queryParam("last_read_at", since).back()
.method(Request.PUT)
.body().set("{}").back()
.fetch()
.as(RestResponse.class)
.assertStatus(HttpURLConnection.HTTP_RESET);
if (!done.isEmpty()) {
Logger.info(
this, "%d GitHub events for @%s processed: %s",
done.size(), github.users().self().login(), done
);
}
return String.format(
"%d events for @%s at %s",
done.size(), github.users().self().login(),
DateFormatUtils.formatUTC(new Date(), "yyyy-MM-dd HH:mm:ss")
);
}
开发者ID:yegor256,项目名称:wring,代码行数:45,代码来源:AgGithub.java
示例8: GitHubImpl
import com.jcabi.github.RtGithub; //导入依赖的package包/类
/**
* Constructor which does not authenticate.
*/
GitHubImpl() {
connector = new RtGithub(new RtGithub().entry().through(RetryCarefulWire.class, 50));
}
开发者ID:sudiamanj,项目名称:fogbugz-to-github,代码行数:7,代码来源:GitHubImpl.java
注:本文中的com.jcabi.github.RtGithub类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论