mirror of
https://github.com/jlengrand/github-api.git
synced 2026-03-11 08:21:23 +00:00
Compare commits
109 Commits
github-api
...
github-api
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cda7607e1c | ||
|
|
0c3c490d58 | ||
|
|
99da6fb66f | ||
|
|
fa2601386c | ||
|
|
122833b0e3 | ||
|
|
8618dbf0d5 | ||
|
|
a0baf33459 | ||
|
|
0ee66ea928 | ||
|
|
f68d4aaf5b | ||
|
|
888abc9e2a | ||
|
|
c8115b1c10 | ||
|
|
137d4f591f | ||
|
|
337d49770d | ||
|
|
614c5578b0 | ||
|
|
d456e60800 | ||
|
|
064206fb9a | ||
|
|
a68fe3b39d | ||
|
|
1904c82941 | ||
|
|
6fc9dd4b30 | ||
|
|
158a31e924 | ||
|
|
b70b924db4 | ||
|
|
9018d72e97 | ||
|
|
5c395138ed | ||
|
|
af157adc1b | ||
|
|
1db4fca9db | ||
|
|
013f475859 | ||
|
|
b5bc38fa52 | ||
|
|
bd0e0cdfa4 | ||
|
|
dade4c4cc4 | ||
|
|
acc5a89dff | ||
|
|
b7af635a9a | ||
|
|
dc33e28452 | ||
|
|
9da4781759 | ||
|
|
0c6959cb4a | ||
|
|
ff3136df70 | ||
|
|
326c627221 | ||
|
|
075f382a8f | ||
|
|
dabb8fe49e | ||
|
|
90489e4392 | ||
|
|
ad45a74f87 | ||
|
|
60c045a713 | ||
|
|
f6c75e1f99 | ||
|
|
dd9245f6f2 | ||
|
|
7310a70743 | ||
|
|
82276837ac | ||
|
|
bd68252b44 | ||
|
|
6b1258e33a | ||
|
|
0400032923 | ||
|
|
d9563322f1 | ||
|
|
ab965969dd | ||
|
|
2f32e034d8 | ||
|
|
1cf7931f43 | ||
|
|
edc697dd73 | ||
|
|
54a059ff68 | ||
|
|
289282e235 | ||
|
|
825c36c15e | ||
|
|
1234c2e99e | ||
|
|
b8fae1308d | ||
|
|
dddcf624e6 | ||
|
|
b33fe9f7fe | ||
|
|
5a799400a9 | ||
|
|
76919a819f | ||
|
|
9c30f846b2 | ||
|
|
9230f51988 | ||
|
|
712035dc9a | ||
|
|
32e5c5b4ad | ||
|
|
134a6fab7e | ||
|
|
82e27cb962 | ||
|
|
8bcad7b3f9 | ||
|
|
d767575f76 | ||
|
|
7214c7d393 | ||
|
|
205e5ab03d | ||
|
|
6576beae76 | ||
|
|
001f8f1f50 | ||
|
|
3b694a87ef | ||
|
|
84dd06d769 | ||
|
|
c5cb16abfb | ||
|
|
79fb34324d | ||
|
|
303aef3548 | ||
|
|
fd278f8c32 | ||
|
|
53041a4117 | ||
|
|
9b3fe3b13a | ||
|
|
5c6c5081e9 | ||
|
|
e087ea0ac7 | ||
|
|
71c44dc805 | ||
|
|
c5c8596664 | ||
|
|
92a86f4d1c | ||
|
|
8098b68b8e | ||
|
|
7356001723 | ||
|
|
aba60587ab | ||
|
|
936a6a04fb | ||
|
|
9675126298 | ||
|
|
6a5886ea1c | ||
|
|
648c6a5a8f | ||
|
|
14b7bf4753 | ||
|
|
0e310fa96a | ||
|
|
0f6c282c80 | ||
|
|
4c3a0d329b | ||
|
|
7c495c2177 | ||
|
|
2f86a9e534 | ||
|
|
12c3a0b1fa | ||
|
|
58c069ec5c | ||
|
|
7916600a7b | ||
|
|
3e4f160c5d | ||
|
|
ad683fee89 | ||
|
|
3bf8baee85 | ||
|
|
8792213594 | ||
|
|
9ab8bdfe4a | ||
|
|
90301ae9ee |
2
.github/PULL_REQUEST_TEMPLATE.md
vendored
2
.github/PULL_REQUEST_TEMPLATE.md
vendored
@@ -7,4 +7,4 @@ We love getting PRs, but we hate asking people for the same basic changes every
|
||||
- [ ] Push your changes to a branch other than `master`. Create your PR from that branch.
|
||||
- [ ] Add JavaDocs and other comments
|
||||
- [ ] Write tests that run and pass in CI. See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to capture snapshot data.
|
||||
- [ ] Run `mvn -P ci install site` locally. This may reformat your code, commit those changes. If this command doesn't succeed, your change will not pass CI.
|
||||
- [ ] Run `mvn -D enable-ci clean install site` locally. This may reformat your code, commit those changes. If this command doesn't succeed, your change will not pass CI.
|
||||
|
||||
64
.github/workflows/maven-build.yml
vendored
64
.github/workflows/maven-build.yml
vendored
@@ -1,22 +1,72 @@
|
||||
name: Java CI Build and Test
|
||||
name: CI
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
||||
name: build-only (Java ${{ matrix.java }})
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
java: [ '1.8.0', '11.0.x', '13.0.x' ]
|
||||
java: [ 11 ]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up JDK
|
||||
uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: ${{ matrix.java }}
|
||||
- name: Cached .m2
|
||||
uses: actions/cache@v1
|
||||
with:
|
||||
path: ~/.m2/repository
|
||||
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-maven-
|
||||
- name: Maven Install (skipTests)
|
||||
run: mvn -B install -DskipTests -D enable-ci --file pom.xml
|
||||
site:
|
||||
name: site (Java ${{ matrix.java }})
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
java: [ 11 ]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up JDK
|
||||
uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: ${{ matrix.java }}
|
||||
- uses: actions/cache@v1
|
||||
with:
|
||||
path: ~/.m2/repository
|
||||
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-maven-
|
||||
- name: Maven Site
|
||||
run: mvn -B site -D enable-ci --file pom.xml
|
||||
test:
|
||||
name: test (${{ matrix.os }}, Java ${{ matrix.java }})
|
||||
runs-on: ${{ matrix.os }}-latest
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ ubuntu, windows ]
|
||||
java: [ 8, 11, 13 ]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Set up JDK
|
||||
uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: ${{ matrix.java }}
|
||||
- name: Maven Download all dependencies
|
||||
run: mvn -B org.apache.maven.plugins:maven-dependency-plugin:3.1.1:go-offline -P ci
|
||||
- name: Maven Build
|
||||
run: mvn -B install site -P ci --file pom.xml
|
||||
- uses: actions/cache@v1
|
||||
with:
|
||||
path: ~/.m2/repository
|
||||
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-maven-
|
||||
- name: Maven Install without Code Coverage
|
||||
if: matrix.os == 'windows'
|
||||
run: mvn -B install --file pom.xml
|
||||
- name: Maven Install with Code Coverage
|
||||
if: matrix.os != 'windows'
|
||||
run: mvn -B install -D enable-ci --file pom.xml
|
||||
|
||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -9,3 +9,5 @@ target
|
||||
.DS_Store
|
||||
|
||||
dependency-reduced-pom.xml
|
||||
.factorypath
|
||||
.vscode/settings.json
|
||||
|
||||
102
pom.xml
102
pom.xml
@@ -2,7 +2,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.kohsuke</groupId>
|
||||
<artifactId>github-api</artifactId>
|
||||
<version>1.106</version>
|
||||
<version>1.107</version>
|
||||
<name>GitHub API for Java</name>
|
||||
<url>https://github-api.kohsuke.org/</url>
|
||||
<description>GitHub API for Java</description>
|
||||
@@ -11,7 +11,7 @@
|
||||
<connection>scm:git:git@github.com/github-api/${project.artifactId}.git</connection>
|
||||
<developerConnection>scm:git:ssh://git@github.com/github-api/${project.artifactId}.git</developerConnection>
|
||||
<url>https://${project.artifactId}.kohsuke.org/</url>
|
||||
<tag>github-api-1.106</tag>
|
||||
<tag>github-api-1.107</tag>
|
||||
</scm>
|
||||
|
||||
<distributionManagement>
|
||||
@@ -34,10 +34,10 @@
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<spotbugs-maven-plugin.version>3.1.12.2</spotbugs-maven-plugin.version>
|
||||
<spotbugs.version>3.1.12</spotbugs.version>
|
||||
<spotbugs.version>4.0.0</spotbugs.version>
|
||||
<spotbugs-maven-plugin.failOnError>true</spotbugs-maven-plugin.failOnError>
|
||||
<hamcrest.version>2.2</hamcrest.version>
|
||||
<okhttp3.version>4.3.1</okhttp3.version>
|
||||
<okhttp3.version>4.4.0</okhttp3.version>
|
||||
<okio.version>2.4.3</okio.version>
|
||||
<formatter-maven-plugin.goal>format</formatter-maven-plugin.goal>
|
||||
<impsort-maven-plugin.goal>sort</impsort-maven-plugin.goal>
|
||||
@@ -79,54 +79,6 @@
|
||||
</testResources>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.2.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>shaded-jar</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<relocations>
|
||||
<relocation>
|
||||
<pattern>com.fasterxml.jackson</pattern>
|
||||
<shadedPattern>hidden.com.fasterxml.jackson</shadedPattern>
|
||||
</relocation>
|
||||
<relocation>
|
||||
<pattern>org.apache</pattern>
|
||||
<shadedPattern>hidden.org.apache</shadedPattern>
|
||||
</relocation>
|
||||
</relocations>
|
||||
<artifactSet>
|
||||
<excludes>
|
||||
<exclude>com.infradna.tool:bridge-method-annotation</exclude>
|
||||
<exclude>org.jenkins-ci:annotation-indexer</exclude>
|
||||
<exclude>com.squareup.*:*</exclude>
|
||||
<exclude>org.jetbrains*:*</exclude>
|
||||
<exclude>com.github.spotbugs:*</exclude>
|
||||
<exclude>com.google.code.findbugs:*</exclude>
|
||||
</excludes>
|
||||
</artifactSet>
|
||||
<shadedArtifactAttached>true</shadedArtifactAttached>
|
||||
<filters>
|
||||
<filter>
|
||||
<artifact>*:*</artifact>
|
||||
<excludes>
|
||||
<exclude>module-info.class</exclude>
|
||||
<exclude>META-INF/*.SF</exclude>
|
||||
<exclude>META-INF/*.DSA</exclude>
|
||||
<exclude>META-INF/*.RSA</exclude>
|
||||
</excludes>
|
||||
</filter>
|
||||
</filters>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
@@ -203,16 +155,18 @@
|
||||
<exclude>org.kohsuke.github.GHPerson.1</exclude>
|
||||
<exclude>org.kohsuke.github.GHPerson.1.1</exclude>
|
||||
|
||||
<!-- These fail coverage on windows because tests are disabled -->
|
||||
<exclude>org.kohsuke.github.GHAsset</exclude>
|
||||
<exclude>org.kohsuke.github.GHReleaseBuilder</exclude>
|
||||
<exclude>org.kohsuke.github.GHRelease</exclude>
|
||||
|
||||
<!-- TODO: These still need test coverage -->
|
||||
<exclude>org.kohsuke.github.GitHub.GHApiInfo</exclude>
|
||||
<exclude>org.kohsuke.github.GitHubClient.GHApiInfo</exclude>
|
||||
<exclude>org.kohsuke.github.GHBranchProtection.RequiredSignatures</exclude>
|
||||
<exclude>org.kohsuke.github.GHBranchProtectionBuilder.Restrictions</exclude>
|
||||
<exclude>org.kohsuke.github.GHBranchProtection.Restrictions</exclude>
|
||||
<exclude>org.kohsuke.github.GHCommentAuthorAssociation</exclude>
|
||||
<exclude>org.kohsuke.github.GHCommitBuilder.UserInfo</exclude>
|
||||
<exclude>org.kohsuke.github.GHCommitSearchBuilder.CommitSearchResult</exclude>
|
||||
<exclude>org.kohsuke.github.GHCommitSearchBuilder.Sort</exclude>
|
||||
<exclude>org.kohsuke.github.GHCommitSearchBuilder</exclude>
|
||||
<exclude>org.kohsuke.github.GHCommitState</exclude>
|
||||
<exclude>org.kohsuke.github.GHCompare.Commit</exclude>
|
||||
<exclude>org.kohsuke.github.GHCompare.InnerCommit</exclude>
|
||||
@@ -230,9 +184,6 @@
|
||||
<exclude>org.kohsuke.github.GHHook</exclude>
|
||||
<exclude>org.kohsuke.github.GHHooks.OrgContext</exclude>
|
||||
<exclude>org.kohsuke.github.GHInvitation</exclude>
|
||||
<exclude>org.kohsuke.github.GHIssueSearchBuilder.IssueSearchResult</exclude>
|
||||
<exclude>org.kohsuke.github.GHIssueSearchBuilder.Sort</exclude>
|
||||
<exclude>org.kohsuke.github.GHIssueSearchBuilder</exclude>
|
||||
<exclude>org.kohsuke.github.GHMilestoneState</exclude>
|
||||
<exclude>org.kohsuke.github.GHOrgHook</exclude>
|
||||
<exclude>org.kohsuke.github.GHProject.ProjectStateFilter</exclude>
|
||||
@@ -494,7 +445,7 @@
|
||||
<dependency>
|
||||
<groupId>org.kohsuke.stapler</groupId>
|
||||
<artifactId>stapler</artifactId>
|
||||
<version>1.258</version>
|
||||
<version>1.259</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
@@ -506,7 +457,7 @@
|
||||
<dependency>
|
||||
<groupId>org.eclipse.jgit</groupId>
|
||||
<artifactId>org.eclipse.jgit</artifactId>
|
||||
<version>5.6.0.201912101111-r</version>
|
||||
<version>5.6.1.202002131546-r</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
@@ -556,7 +507,7 @@
|
||||
<dependency>
|
||||
<groupId>com.github.tomakehurst</groupId>
|
||||
<artifactId>wiremock-jre8-standalone</artifactId>
|
||||
<version>2.25.1</version>
|
||||
<version>2.26.0</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
@@ -580,23 +531,32 @@
|
||||
</pluginRepositories>
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>ci</id>
|
||||
<id>ci-non-windows</id>
|
||||
<activation>
|
||||
<property>
|
||||
<name>enable-ci</name>
|
||||
</property>
|
||||
<os>
|
||||
<family>!windows</family>
|
||||
</os>
|
||||
</activation>
|
||||
<properties>
|
||||
<formatter-maven-plugin.goal>validate</formatter-maven-plugin.goal>
|
||||
<impsort-maven-plugin.goal>check</impsort-maven-plugin.goal>
|
||||
</properties>
|
||||
</profile>
|
||||
<profile>
|
||||
<id>ci-all</id>
|
||||
<activation>
|
||||
<property>
|
||||
<name>enable-ci</name>
|
||||
</property>
|
||||
</activation>
|
||||
<properties>
|
||||
<formatter-maven-plugin.goal>validate</formatter-maven-plugin.goal>
|
||||
<impsort-maven-plugin.goal>check</impsort-maven-plugin.goal>
|
||||
<jacoco.haltOnFailure>true</jacoco.haltOnFailure>
|
||||
</properties>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.jacoco</groupId>
|
||||
<artifactId>jacoco-maven-plugin</artifactId>
|
||||
@@ -612,10 +572,6 @@
|
||||
</properties>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-gpg-plugin</artifactId>
|
||||
|
||||
@@ -7,7 +7,6 @@ import java.net.HttpURLConnection;
|
||||
/**
|
||||
* Pluggable strategy to determine what to do when the API abuse limit is hit.
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
* @see GitHubBuilder#withAbuseLimitHandler(AbuseLimitHandler) GitHubBuilder#withAbuseLimitHandler(AbuseLimitHandler)
|
||||
* @see <a href="https://developer.github.com/v3/#abuse-rate-limits">documentation</a>
|
||||
* @see RateLimitHandler
|
||||
@@ -29,6 +28,9 @@ public abstract class AbuseLimitHandler {
|
||||
* @throws IOException
|
||||
* on failure
|
||||
* @see <a href="https://developer.github.com/v3/#abuse-rate-limits">API documentation from GitHub</a>
|
||||
* @see <a href=
|
||||
* "https://developer.github.com/v3/guides/best-practices-for-integrators/#dealing-with-abuse-rate-limits">Dealing
|
||||
* with abuse rate limits</a>
|
||||
*/
|
||||
public abstract void onError(IOException e, HttpURLConnection uc) throws IOException;
|
||||
|
||||
|
||||
@@ -26,8 +26,7 @@ package org.kohsuke.github;
|
||||
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||
|
||||
/**
|
||||
* @author Kohsuke Kawaguchi
|
||||
*/
|
||||
*/
|
||||
@SuppressFBWarnings(value = "UUF_UNUSED_PUBLIC_OR_PROTECTED_FIELD",
|
||||
justification = "Being constructed by JSON deserialization")
|
||||
class DeleteToken {
|
||||
|
||||
@@ -4,8 +4,6 @@ import java.util.Locale;
|
||||
|
||||
/**
|
||||
* This was added during preview API period but it has changed since then.
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
*/
|
||||
@Deprecated
|
||||
public enum EnforcementLevel {
|
||||
|
||||
@@ -10,7 +10,6 @@ import static org.kohsuke.github.Previews.MACHINE_MAN;
|
||||
/**
|
||||
* A Github App.
|
||||
*
|
||||
* @author Paulo Miguel Almeida
|
||||
* @see GitHub#getApp() GitHub#getApp()
|
||||
*/
|
||||
public class GHApp extends GHObject {
|
||||
@@ -140,7 +139,7 @@ public class GHApp extends GHObject {
|
||||
}
|
||||
|
||||
public URL getHtmlUrl() {
|
||||
return GitHub.parseURL(htmlUrl);
|
||||
return GitHubClient.parseURL(htmlUrl);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -10,7 +10,6 @@ import static org.kohsuke.github.Previews.MACHINE_MAN;
|
||||
/**
|
||||
* Creates a access token for a GitHub App Installation
|
||||
*
|
||||
* @author Paulo Miguel Almeida
|
||||
* @see GHAppInstallation#createToken(Map) GHAppInstallation#createToken(Map)
|
||||
* @see GHAppInstallation#createToken() GHAppInstallation#createToken()
|
||||
*/
|
||||
@@ -63,7 +62,7 @@ public class GHAppCreateTokenBuilder {
|
||||
public GHAppCreateTokenBuilder permissions(Map<String, GHPermissionType> permissions) {
|
||||
Map<String, String> retMap = new HashMap<>();
|
||||
for (Map.Entry<String, GHPermissionType> entry : permissions.entrySet()) {
|
||||
retMap.put(entry.getKey(), Requester.transformEnum(entry.getValue()));
|
||||
retMap.put(entry.getKey(), GitHubRequest.transformEnum(entry.getValue()));
|
||||
}
|
||||
builder.with("permissions", retMap);
|
||||
return this;
|
||||
|
||||
@@ -12,7 +12,6 @@ import static org.kohsuke.github.Previews.GAMBIT;
|
||||
/**
|
||||
* A Github App Installation.
|
||||
*
|
||||
* @author Paulo Miguel Almeida
|
||||
* @see GHApp#listInstallations() GHApp#listInstallations()
|
||||
* @see GHApp#getInstallationById(long) GHApp#getInstallationById(long)
|
||||
* @see GHApp#getInstallationByOrganization(String) GHApp#getInstallationByOrganization(String)
|
||||
@@ -42,7 +41,7 @@ public class GHAppInstallation extends GHObject {
|
||||
private String htmlUrl;
|
||||
|
||||
public URL getHtmlUrl() {
|
||||
return GitHub.parseURL(htmlUrl);
|
||||
return GitHubClient.parseURL(htmlUrl);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -11,7 +11,6 @@ import java.util.Map;
|
||||
/**
|
||||
* A Github App Installation Token.
|
||||
*
|
||||
* @author Paulo Miguel Almeida
|
||||
* @see GHAppInstallation#createToken(Map) GHAppInstallation#createToken(Map)
|
||||
*/
|
||||
public class GHAppInstallationToken {
|
||||
@@ -127,7 +126,7 @@ public class GHAppInstallationToken {
|
||||
*/
|
||||
@WithBridgeMethods(value = String.class, adapterMethod = "expiresAtStr")
|
||||
public Date getExpiresAt() throws IOException {
|
||||
return GitHub.parseDate(expires_at);
|
||||
return GitHubClient.parseDate(expires_at);
|
||||
}
|
||||
|
||||
@SuppressFBWarnings(value = "UPM_UNCALLED_PRIVATE_METHOD", justification = "Bridge method of getExpiresAt")
|
||||
|
||||
@@ -9,7 +9,6 @@ import java.util.List;
|
||||
/**
|
||||
* Generated OAuth token
|
||||
*
|
||||
* @author janinko
|
||||
* @see GitHub#createToken(Collection, String, String) GitHub#createToken(Collection, String, String)
|
||||
* @see <a href="http://developer.github.com/v3/oauth/#create-a-new-authorization">API documentation</a>
|
||||
*/
|
||||
@@ -96,7 +95,7 @@ public class GHAuthorization extends GHObject {
|
||||
* @return the app url
|
||||
*/
|
||||
public URL getAppUrl() {
|
||||
return GitHub.parseURL(app.url);
|
||||
return GitHubClient.parseURL(app.url);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -115,7 +114,7 @@ public class GHAuthorization extends GHObject {
|
||||
*/
|
||||
@SuppressFBWarnings(value = "NM_CONFUSING", justification = "It's a part of the library API, cannot be changed")
|
||||
public URL getApiURL() {
|
||||
return GitHub.parseURL(url);
|
||||
return GitHubClient.parseURL(url);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -141,7 +140,7 @@ public class GHAuthorization extends GHObject {
|
||||
* @return the note url
|
||||
*/
|
||||
public URL getNoteUrl() {
|
||||
return GitHub.parseURL(note_url);
|
||||
return GitHubClient.parseURL(note_url);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -8,7 +8,6 @@ import java.util.Base64;
|
||||
/**
|
||||
* The type GHBlob.
|
||||
*
|
||||
* @author Kanstantsin Shautsou
|
||||
* @author Kohsuke Kawaguchi
|
||||
* @see GHTreeEntry#asBlob() GHTreeEntry#asBlob()
|
||||
* @see GHRepository#getBlob(String) GHRepository#getBlob(String)
|
||||
@@ -24,7 +23,7 @@ public class GHBlob {
|
||||
* @return API URL of this blob.
|
||||
*/
|
||||
public URL getUrl() {
|
||||
return GitHub.parseURL(url);
|
||||
return GitHubClient.parseURL(url);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -11,8 +11,6 @@ import java.util.Objects;
|
||||
|
||||
/**
|
||||
* A branch in a repository.
|
||||
*
|
||||
* @author Yusuke Kokubo
|
||||
*/
|
||||
@SuppressFBWarnings(
|
||||
value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD",
|
||||
@@ -90,7 +88,7 @@ public class GHBranch {
|
||||
@Preview
|
||||
@Deprecated
|
||||
public URL getProtectionUrl() {
|
||||
return GitHub.parseURL(protection_url);
|
||||
return GitHubClient.parseURL(protection_url);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -6,7 +6,7 @@ import java.io.IOException;
|
||||
import java.net.URL;
|
||||
|
||||
/**
|
||||
* Represents a deployment
|
||||
* Represents a check run.
|
||||
*
|
||||
* @see <a href="https://developer.github.com/v3/checks/runs/">documentation</a>
|
||||
*/
|
||||
@@ -20,6 +20,7 @@ public class GHCheckRun extends GHObject {
|
||||
private String status;
|
||||
private String conclusion;
|
||||
private String name;
|
||||
private String headSha;
|
||||
private GHPullRequest[] pullRequests;
|
||||
|
||||
GHCheckRun wrap(GHRepository owner) {
|
||||
@@ -52,6 +53,15 @@ public class GHCheckRun extends GHObject {
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the HEAD SHA.
|
||||
*
|
||||
* @return sha for the HEAD commit
|
||||
*/
|
||||
public String getHeadSha() {
|
||||
return headSha;
|
||||
}
|
||||
|
||||
GHPullRequest[] getPullRequests() throws IOException {
|
||||
if (pullRequests != null && pullRequests.length != 0) {
|
||||
for (GHPullRequest singlePull : pullRequests) {
|
||||
|
||||
@@ -2,8 +2,6 @@ package org.kohsuke.github;
|
||||
|
||||
/**
|
||||
* How is an user associated with a repository?
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
*/
|
||||
public enum GHCommentAuthorAssociation {
|
||||
/**
|
||||
|
||||
@@ -14,7 +14,6 @@ import java.util.List;
|
||||
/**
|
||||
* A commit in a repository.
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
* @see GHRepository#getCommit(String) GHRepository#getCommit(String)
|
||||
* @see GHCommitComment#getCommit() GHCommitComment#getCommit()
|
||||
*/
|
||||
@@ -61,7 +60,7 @@ public class GHCommit {
|
||||
* @return the authored date
|
||||
*/
|
||||
public Date getAuthoredDate() {
|
||||
return GitHub.parseDate(author.date);
|
||||
return GitHubClient.parseDate(author.date);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -80,7 +79,7 @@ public class GHCommit {
|
||||
* @return the commit date
|
||||
*/
|
||||
public Date getCommitDate() {
|
||||
return GitHub.parseDate(committer.date);
|
||||
return GitHubClient.parseDate(committer.date);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -201,7 +200,7 @@ public class GHCommit {
|
||||
* resolves to the actual content of the file.
|
||||
*/
|
||||
public URL getRawUrl() {
|
||||
return GitHub.parseURL(raw_url);
|
||||
return GitHubClient.parseURL(raw_url);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -212,7 +211,7 @@ public class GHCommit {
|
||||
* that resolves to the HTML page that describes this file.
|
||||
*/
|
||||
public URL getBlobUrl() {
|
||||
return GitHub.parseURL(blob_url);
|
||||
return GitHubClient.parseURL(blob_url);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -326,7 +325,7 @@ public class GHCommit {
|
||||
* "https://github.com/kohsuke/sandbox-ant/commit/8ae38db0ea5837313ab5f39d43a6f73de3bd9000"
|
||||
*/
|
||||
public URL getHtmlUrl() {
|
||||
return GitHub.parseURL(html_url);
|
||||
return GitHubClient.parseURL(html_url);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -10,7 +10,6 @@ import static org.kohsuke.github.Previews.*;
|
||||
/**
|
||||
* A comment attached to a commit (or a specific line in a specific file of a commit.)
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
* @see GHRepository#listCommitComments() GHRepository#listCommitComments()
|
||||
* @see GHCommit#listComments() GHCommit#listComments()
|
||||
* @see GHCommit#createComment(String, String, Integer, Integer) GHCommit#createComment(String, String, Integer,
|
||||
@@ -41,7 +40,7 @@ public class GHCommitComment extends GHObject implements Reactable {
|
||||
* show this commit comment in a browser.
|
||||
*/
|
||||
public URL getHtmlUrl() {
|
||||
return GitHub.parseURL(html_url);
|
||||
return GitHubClient.parseURL(html_url);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -27,8 +27,6 @@ import java.io.IOException;
|
||||
|
||||
/**
|
||||
* Identifies a commit in {@link GHPullRequest}.
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
*/
|
||||
public class GHCommitPointer {
|
||||
private String ref, sha, label;
|
||||
|
||||
@@ -15,7 +15,6 @@ import java.util.Date;
|
||||
* }
|
||||
* </pre>
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
* @see GHRepository#queryCommits() GHRepository#queryCommits()
|
||||
*/
|
||||
public class GHCommitQueryBuilder {
|
||||
@@ -83,7 +82,7 @@ public class GHCommitQueryBuilder {
|
||||
* @return the gh commit query builder
|
||||
*/
|
||||
public GHCommitQueryBuilder since(Date dt) {
|
||||
req.with("since", GitHub.printDate(dt));
|
||||
req.with("since", GitHubClient.printDate(dt));
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -106,7 +105,7 @@ public class GHCommitQueryBuilder {
|
||||
* @return the gh commit query builder
|
||||
*/
|
||||
public GHCommitQueryBuilder until(Date dt) {
|
||||
req.with("until", GitHub.printDate(dt));
|
||||
req.with("until", GitHubClient.printDate(dt));
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,6 @@ import java.io.IOException;
|
||||
/**
|
||||
* Search commits.
|
||||
*
|
||||
* @author Marc de Verdelhan
|
||||
* @see GitHub#searchCommits() GitHub#searchCommits()
|
||||
*/
|
||||
@Preview
|
||||
@@ -259,7 +258,7 @@ public class GHCommitSearchBuilder extends GHSearchBuilder<GHCommit> {
|
||||
if (StringUtils.isBlank(commitUrl)) {
|
||||
return null;
|
||||
}
|
||||
int indexOfUsername = (GitHub.GITHUB_URL + "/repos/").length();
|
||||
int indexOfUsername = (GitHubClient.GITHUB_URL + "/repos/").length();
|
||||
String[] tokens = commitUrl.substring(indexOfUsername).split("/", 3);
|
||||
return tokens[0] + '/' + tokens[1];
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@ package org.kohsuke.github;
|
||||
/**
|
||||
* Represents the state of commit
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
* @see GHCommitStatus
|
||||
*/
|
||||
public enum GHCommitState {
|
||||
|
||||
@@ -6,7 +6,6 @@ import java.net.URL;
|
||||
/**
|
||||
* Represents a status of a commit.
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
* @see GHRepository#getLastCommitStatus(String) GHRepository#getLastCommitStatus(String)
|
||||
* @see GHCommit#getLastStatus() GHCommit#getLastStatus()
|
||||
* @see GHRepository#createCommitStatus(String, GHCommitState, String, String) GHRepository#createCommitStatus(String,
|
||||
|
||||
@@ -7,8 +7,6 @@ import java.net.URL;
|
||||
|
||||
/**
|
||||
* The model user for comparing 2 commits in the GitHub API.
|
||||
*
|
||||
* @author Michael Clarke
|
||||
*/
|
||||
public class GHCompare {
|
||||
|
||||
@@ -27,7 +25,7 @@ public class GHCompare {
|
||||
* @return the url
|
||||
*/
|
||||
public URL getUrl() {
|
||||
return GitHub.parseURL(url);
|
||||
return GitHubClient.parseURL(url);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -36,7 +34,7 @@ public class GHCompare {
|
||||
* @return the html url
|
||||
*/
|
||||
public URL getHtmlUrl() {
|
||||
return GitHub.parseURL(html_url);
|
||||
return GitHubClient.parseURL(html_url);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -45,7 +43,7 @@ public class GHCompare {
|
||||
* @return the permalink url
|
||||
*/
|
||||
public URL getPermalinkUrl() {
|
||||
return GitHub.parseURL(permalink_url);
|
||||
return GitHubClient.parseURL(permalink_url);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -54,7 +52,7 @@ public class GHCompare {
|
||||
* @return the diff url
|
||||
*/
|
||||
public URL getDiffUrl() {
|
||||
return GitHub.parseURL(diff_url);
|
||||
return GitHubClient.parseURL(diff_url);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -63,7 +61,7 @@ public class GHCompare {
|
||||
* @return the patch url
|
||||
*/
|
||||
public URL getPatchUrl() {
|
||||
return GitHub.parseURL(patch_url);
|
||||
return GitHubClient.parseURL(patch_url);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -11,7 +11,6 @@ import java.util.Base64;
|
||||
/**
|
||||
* A Content of a repository.
|
||||
*
|
||||
* @author Alexandre COLLIGNON
|
||||
* @see GHRepository#getFileContent(String) GHRepository#getFileContent(String)
|
||||
*/
|
||||
@SuppressWarnings({ "UnusedDeclaration" })
|
||||
|
||||
@@ -10,7 +10,6 @@ import java.util.Base64;
|
||||
* <p>
|
||||
* Call various methods to build up parameters, then call {@link #commit()} to make the change effective.
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
* @see GHRepository#createContent() GHRepository#createContent()
|
||||
*/
|
||||
public final class GHContentBuilder {
|
||||
|
||||
@@ -3,7 +3,6 @@ package org.kohsuke.github;
|
||||
/**
|
||||
* Search code for {@link GHContent}.
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
* @see GitHub#searchContent() GitHub#searchContent()
|
||||
*/
|
||||
public class GHContentSearchBuilder extends GHSearchBuilder<GHContent> {
|
||||
|
||||
@@ -3,7 +3,6 @@ package org.kohsuke.github;
|
||||
/**
|
||||
* {@link GHContent} with license information.
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
* @see <a href="https://developer.github.com/v3/licenses/#get-a-repositorys-license">documentation</a>
|
||||
* @see GHRepository#getLicense()
|
||||
*/
|
||||
|
||||
@@ -5,8 +5,6 @@ import java.net.URL;
|
||||
|
||||
/**
|
||||
* Creates a repository
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
*/
|
||||
public class GHCreateRepositoryBuilder {
|
||||
private final GitHub root;
|
||||
|
||||
@@ -38,7 +38,7 @@ public class GHDeployment extends GHObject {
|
||||
* @return the statuses url
|
||||
*/
|
||||
public URL getStatusesUrl() {
|
||||
return GitHub.parseURL(statuses_url);
|
||||
return GitHubClient.parseURL(statuses_url);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -47,7 +47,7 @@ public class GHDeployment extends GHObject {
|
||||
* @return the repository url
|
||||
*/
|
||||
public URL getRepositoryUrl() {
|
||||
return GitHub.parseURL(repository_url);
|
||||
return GitHubClient.parseURL(repository_url);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -37,7 +37,7 @@ public class GHDeploymentStatus extends GHObject {
|
||||
* @return the target url
|
||||
*/
|
||||
public URL getTargetUrl() {
|
||||
return GitHub.parseURL(target_url);
|
||||
return GitHubClient.parseURL(target_url);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -46,7 +46,7 @@ public class GHDeploymentStatus extends GHObject {
|
||||
* @return the deployment url
|
||||
*/
|
||||
public URL getDeploymentUrl() {
|
||||
return GitHub.parseURL(deployment_url);
|
||||
return GitHubClient.parseURL(deployment_url);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -55,7 +55,7 @@ public class GHDeploymentStatus extends GHObject {
|
||||
* @return the repository url
|
||||
*/
|
||||
public URL getRepositoryUrl() {
|
||||
return GitHub.parseURL(repository_url);
|
||||
return GitHubClient.parseURL(repository_url);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,8 +2,6 @@ package org.kohsuke.github;
|
||||
|
||||
/**
|
||||
* Sort direction
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
*/
|
||||
public enum GHDirection {
|
||||
ASC, DESC
|
||||
|
||||
@@ -27,8 +27,6 @@ import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||
|
||||
/**
|
||||
* Represents an email of GitHub.
|
||||
*
|
||||
* @author Kelly Campbell
|
||||
*/
|
||||
@SuppressFBWarnings(
|
||||
value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD",
|
||||
|
||||
@@ -5,7 +5,6 @@ import java.util.Locale;
|
||||
/**
|
||||
* Hook event type.
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
* @see GHEventInfo
|
||||
* @see <a href="https://developer.github.com/v3/activity/events/types/">Event type reference</a>
|
||||
*/
|
||||
|
||||
@@ -8,8 +8,6 @@ import java.util.Date;
|
||||
|
||||
/**
|
||||
* Represents an event.
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
*/
|
||||
@SuppressFBWarnings(value = "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", justification = "JSON API")
|
||||
public class GHEventInfo {
|
||||
@@ -78,7 +76,7 @@ public class GHEventInfo {
|
||||
* @return the created at
|
||||
*/
|
||||
public Date getCreatedAt() {
|
||||
return GitHub.parseDate(created_at);
|
||||
return GitHubClient.parseDate(created_at);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -144,7 +142,7 @@ public class GHEventInfo {
|
||||
* if payload cannot be parsed
|
||||
*/
|
||||
public <T extends GHEventPayload> T getPayload(Class<T> type) throws IOException {
|
||||
T v = GitHub.MAPPER.readValue(payload.traverse(), type);
|
||||
T v = GitHubClient.MAPPER.readValue(payload.traverse(), type);
|
||||
v.wrapUp(root);
|
||||
return v;
|
||||
}
|
||||
|
||||
@@ -1428,6 +1428,107 @@ public abstract class GHEventPayload {
|
||||
organization.wrapUp(root);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A git commit status was changed.
|
||||
*
|
||||
* @see <a href="https://developer.github.com/v3/activity/events/types/#statusevent">authoritative source</a>
|
||||
*/
|
||||
@SuppressFBWarnings(value = { "UWF_UNWRITTEN_FIELD" }, justification = "Constructed by JSON deserialization")
|
||||
public static class Status extends GHEventPayload {
|
||||
private String context;
|
||||
private String description;
|
||||
private GHCommitState state;
|
||||
private GHCommit commit;
|
||||
private GHRepository repository;
|
||||
|
||||
/**
|
||||
* Gets the status content.
|
||||
*
|
||||
* @return status content
|
||||
*/
|
||||
public String getContext() {
|
||||
return context;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the status description.
|
||||
*
|
||||
* @return status description
|
||||
*/
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the status state.
|
||||
*
|
||||
* @return status state
|
||||
*/
|
||||
public GHCommitState getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the status stage.
|
||||
*
|
||||
* @param state
|
||||
* status state
|
||||
*/
|
||||
public void setState(GHCommitState state) {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the commit associated with the status event.
|
||||
*
|
||||
* @return commit
|
||||
*/
|
||||
public GHCommit getCommit() {
|
||||
return commit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the commit associated with the status event.
|
||||
*
|
||||
* @param commit
|
||||
* commit
|
||||
*/
|
||||
public void setCommit(GHCommit commit) {
|
||||
this.commit = commit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the repository associated with the status event.
|
||||
*
|
||||
* @return repository
|
||||
*/
|
||||
public GHRepository getRepository() {
|
||||
return repository;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the repository associated with the status event.
|
||||
*
|
||||
* @param repository
|
||||
* repository
|
||||
*/
|
||||
public void setRepository(GHRepository repository) {
|
||||
this.repository = repository;
|
||||
}
|
||||
|
||||
@Override
|
||||
void wrapUp(GitHub root) {
|
||||
super.wrapUp(root);
|
||||
if (state == null) {
|
||||
throw new IllegalStateException(
|
||||
"Expected status payload, but got something else. Maybe we've got another type of event?");
|
||||
}
|
||||
if (repository != null) {
|
||||
repository.wrap(root);
|
||||
commit.wrapUp(repository);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,6 @@ package org.kohsuke.github;
|
||||
|
||||
/**
|
||||
* The type GHException.
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
*/
|
||||
public class GHException extends RuntimeException {
|
||||
/**
|
||||
|
||||
@@ -1,16 +1,14 @@
|
||||
package org.kohsuke.github;
|
||||
|
||||
import java.io.FileNotFoundException;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.CheckForNull;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* Request/responce contains useful metadata. Custom exception allows store info for next diagnostics.
|
||||
*
|
||||
* @author Kanstantsin Shautsou
|
||||
*/
|
||||
public class GHFileNotFoundException extends FileNotFoundException {
|
||||
protected Map<String, List<String>> responseHeaderFields;
|
||||
@@ -24,11 +22,24 @@ public class GHFileNotFoundException extends FileNotFoundException {
|
||||
/**
|
||||
* Instantiates a new Gh file not found exception.
|
||||
*
|
||||
* @param s
|
||||
* the s
|
||||
* @param message
|
||||
* the message
|
||||
*/
|
||||
public GHFileNotFoundException(String s) {
|
||||
super(s);
|
||||
public GHFileNotFoundException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Instantiates a new Gh file not found exception.
|
||||
*
|
||||
* @param message
|
||||
* the message
|
||||
* @param cause
|
||||
* the cause
|
||||
*/
|
||||
public GHFileNotFoundException(String message, Throwable cause) {
|
||||
super(message);
|
||||
this.initCause(cause);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -41,8 +52,8 @@ public class GHFileNotFoundException extends FileNotFoundException {
|
||||
return responseHeaderFields;
|
||||
}
|
||||
|
||||
GHFileNotFoundException withResponseHeaderFields(HttpURLConnection urlConnection) {
|
||||
this.responseHeaderFields = urlConnection.getHeaderFields();
|
||||
GHFileNotFoundException withResponseHeaderFields(@Nonnull Map<String, List<String>> headerFields) {
|
||||
this.responseHeaderFields = headerFields;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,6 @@ import java.util.Map.Entry;
|
||||
/**
|
||||
* Gist
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
* @see GHUser#listGists() GHUser#listGists()
|
||||
* @see GitHub#getGist(String) GitHub#getGist(String)
|
||||
* @see GitHub#createGist() GitHub#createGist()
|
||||
@@ -84,7 +83,7 @@ public class GHGist extends GHObject {
|
||||
}
|
||||
|
||||
public URL getHtmlUrl() {
|
||||
return GitHub.parseURL(html_url);
|
||||
return GitHubClient.parseURL(html_url);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -7,7 +7,6 @@ import java.util.LinkedHashMap;
|
||||
/**
|
||||
* Builder pattern for creating a new Gist.
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
* @see GitHub#createGist() GitHub#createGist()
|
||||
*/
|
||||
public class GHGistBuilder {
|
||||
|
||||
@@ -3,7 +3,6 @@ package org.kohsuke.github;
|
||||
/**
|
||||
* A file inside {@link GHGist}
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
* @see GHGist#getFile(String) GHGist#getFile(String)
|
||||
* @see GHGist#getFiles() GHGist#getFiles()
|
||||
*/
|
||||
|
||||
@@ -6,8 +6,6 @@ import java.util.LinkedHashMap;
|
||||
|
||||
/**
|
||||
* Builder pattern for updating a Gist.
|
||||
*
|
||||
* @author Martin van Zijl
|
||||
*/
|
||||
public class GHGistUpdater {
|
||||
private final GHGist base;
|
||||
|
||||
@@ -12,8 +12,6 @@ import java.util.Map;
|
||||
|
||||
/**
|
||||
* The type GHHook.
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
*/
|
||||
@SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD" },
|
||||
justification = "JSON API")
|
||||
|
||||
@@ -1,16 +1,14 @@
|
||||
package org.kohsuke.github;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.CheckForNull;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* Request/responce contains useful metadata. Custom exception allows store info for next diagnostics.
|
||||
*
|
||||
* @author Kanstantsin Shautsou
|
||||
*/
|
||||
public class GHIOException extends IOException {
|
||||
protected Map<String, List<String>> responseHeaderFields;
|
||||
@@ -31,6 +29,20 @@ public class GHIOException extends IOException {
|
||||
super(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a {@code GHIOException} with the specified detail message and cause.
|
||||
*
|
||||
* @param message
|
||||
* The detail message (which is saved for later retrieval by the {@link #getMessage()} method)
|
||||
*
|
||||
* @param cause
|
||||
* The cause (which is saved for later retrieval by the {@link #getCause()} method). (A null value is
|
||||
* permitted, and indicates that the cause is nonexistent or unknown.)
|
||||
*/
|
||||
public GHIOException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets response header fields.
|
||||
*
|
||||
@@ -41,8 +53,8 @@ public class GHIOException extends IOException {
|
||||
return responseHeaderFields;
|
||||
}
|
||||
|
||||
GHIOException withResponseHeaderFields(HttpURLConnection urlConnection) {
|
||||
this.responseHeaderFields = urlConnection.getHeaderFields();
|
||||
GHIOException withResponseHeaderFields(@Nonnull Map<String, List<String>> headerFields) {
|
||||
this.responseHeaderFields = headerFields;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,6 +51,6 @@ public class GHInvitation extends GHObject {
|
||||
|
||||
@Override
|
||||
public URL getHtmlUrl() {
|
||||
return GitHub.parseURL(html_url);
|
||||
return GitHubClient.parseURL(html_url);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ package org.kohsuke.github;
|
||||
|
||||
import com.infradna.tool.bridge_method_injector.WithBridgeMethods;
|
||||
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
@@ -42,7 +43,6 @@ import static org.kohsuke.github.Previews.SQUIRREL_GIRL;
|
||||
/**
|
||||
* Represents an issue on GitHub.
|
||||
*
|
||||
* @author Eric Maupin
|
||||
* @author Kohsuke Kawaguchi
|
||||
* @see GHRepository#getIssue(int) GHRepository#getIssue(int)
|
||||
* @see GitHub#searchIssues() GitHub#searchIssues()
|
||||
@@ -137,7 +137,7 @@ public class GHIssue extends GHObject implements Reactable {
|
||||
* The HTML page of this issue, like https://github.com/jenkinsci/jenkins/issues/100
|
||||
*/
|
||||
public URL getHtmlUrl() {
|
||||
return GitHub.parseURL(html_url);
|
||||
return GitHubClient.parseURL(html_url);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -187,7 +187,7 @@ public class GHIssue extends GHObject implements Reactable {
|
||||
* @return the closed at
|
||||
*/
|
||||
public Date getClosedAt() {
|
||||
return GitHub.parseDate(closed_at);
|
||||
return GitHubClient.parseDate(closed_at);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -196,7 +196,7 @@ public class GHIssue extends GHObject implements Reactable {
|
||||
* @return the api url
|
||||
*/
|
||||
public URL getApiURL() {
|
||||
return GitHub.parseURL(url);
|
||||
return GitHubClient.parseURL(url);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -453,7 +453,7 @@ public class GHIssue extends GHObject implements Reactable {
|
||||
@Preview
|
||||
@Deprecated
|
||||
public GHReaction createReaction(ReactionContent content) throws IOException {
|
||||
return owner.root.createRequest()
|
||||
return root.createRequest()
|
||||
.method("POST")
|
||||
.withPreview(SQUIRREL_GIRL)
|
||||
.with("content", content.getContent())
|
||||
@@ -465,10 +465,10 @@ public class GHIssue extends GHObject implements Reactable {
|
||||
@Preview
|
||||
@Deprecated
|
||||
public PagedIterable<GHReaction> listReactions() {
|
||||
return owner.root.createRequest()
|
||||
return root.createRequest()
|
||||
.withPreview(SQUIRREL_GIRL)
|
||||
.withUrlPath(getApiRoute() + "/reactions")
|
||||
.toIterable(GHReaction[].class, item -> item.wrap(owner.root));
|
||||
.toIterable(GHReaction[].class, item -> item.wrap(root));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -571,6 +571,10 @@ public class GHIssue extends GHObject implements Reactable {
|
||||
* @return the issues api route
|
||||
*/
|
||||
protected String getIssuesApiRoute() {
|
||||
if (owner == null) {
|
||||
// Issues returned from search to do not have an owner. Attempt to use url.
|
||||
return StringUtils.prependIfMissing(getUrl().toString().replace(root.getApiUrl(), ""), "/");
|
||||
}
|
||||
return "/repos/" + owner.getOwnerName() + "/" + owner.getName() + "/issues/" + number;
|
||||
}
|
||||
|
||||
@@ -677,7 +681,7 @@ public class GHIssue extends GHObject implements Reactable {
|
||||
* @return the diff url
|
||||
*/
|
||||
public URL getDiffUrl() {
|
||||
return GitHub.parseURL(diff_url);
|
||||
return GitHubClient.parseURL(diff_url);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -686,7 +690,7 @@ public class GHIssue extends GHObject implements Reactable {
|
||||
* @return the patch url
|
||||
*/
|
||||
public URL getPatchUrl() {
|
||||
return GitHub.parseURL(patch_url);
|
||||
return GitHubClient.parseURL(patch_url);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -695,7 +699,7 @@ public class GHIssue extends GHObject implements Reactable {
|
||||
* @return the url
|
||||
*/
|
||||
public URL getUrl() {
|
||||
return GitHub.parseURL(html_url);
|
||||
return GitHubClient.parseURL(html_url);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,8 +6,6 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
* The type GHIssueBuilder.
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
*/
|
||||
public class GHIssueBuilder {
|
||||
private final GHRepository repo;
|
||||
|
||||
@@ -31,7 +31,6 @@ import static org.kohsuke.github.Previews.*;
|
||||
/**
|
||||
* Comment to the issue
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
* @see GHIssue#comment(String) GHIssue#comment(String)
|
||||
* @see GHIssue#listComments() GHIssue#listComments()
|
||||
*/
|
||||
@@ -87,7 +86,7 @@ public class GHIssueComment extends GHObject implements Reactable {
|
||||
|
||||
@Override
|
||||
public URL getHtmlUrl() {
|
||||
return GitHub.parseURL(html_url);
|
||||
return GitHubClient.parseURL(html_url);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -4,8 +4,6 @@ import java.util.Date;
|
||||
|
||||
/**
|
||||
* The type GHIssueEvent.
|
||||
*
|
||||
* @author Martin van Zijl
|
||||
*/
|
||||
public class GHIssueEvent {
|
||||
private GitHub root;
|
||||
@@ -90,7 +88,7 @@ public class GHIssueEvent {
|
||||
* @return the created at
|
||||
*/
|
||||
public Date getCreatedAt() {
|
||||
return GitHub.parseDate(created_at);
|
||||
return GitHubClient.parseDate(created_at);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,7 +3,6 @@ package org.kohsuke.github;
|
||||
/**
|
||||
* Search issues.
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
* @see GitHub#searchIssues() GitHub#searchIssues()
|
||||
*/
|
||||
public class GHIssueSearchBuilder extends GHSearchBuilder<GHIssue> {
|
||||
|
||||
@@ -5,8 +5,6 @@ import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
|
||||
/**
|
||||
* SSH public key.
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
*/
|
||||
@SuppressFBWarnings(value = "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", justification = "JSON API")
|
||||
public class GHKey {
|
||||
|
||||
@@ -9,7 +9,6 @@ import java.util.Objects;
|
||||
/**
|
||||
* The type GHLabel.
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
* @see GHIssue#getLabels() GHIssue#getLabels()
|
||||
* @see GHRepository#listLabels() GHRepository#listLabels()
|
||||
*/
|
||||
|
||||
@@ -35,7 +35,6 @@ import java.util.List;
|
||||
/**
|
||||
* The GitHub Preview API's license information
|
||||
*
|
||||
* @author Duncan Dickinson
|
||||
* @see GitHub#getLicense(String) GitHub#getLicense(String)
|
||||
* @see GHRepository#getLicense() GHRepository#getLicense()
|
||||
* @see <a href="https://developer.github.com/v3/licenses/">https://developer.github.com/v3/licenses/</a>
|
||||
@@ -83,7 +82,7 @@ public class GHLicense extends GHObject {
|
||||
*/
|
||||
@WithBridgeMethods(value = String.class, adapterMethod = "urlToString")
|
||||
public URL getUrl() {
|
||||
return GitHub.parseURL(url);
|
||||
return GitHubClient.parseURL(url);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -100,7 +99,7 @@ public class GHLicense extends GHObject {
|
||||
|
||||
public URL getHtmlUrl() throws IOException {
|
||||
populate();
|
||||
return GitHub.parseURL(html_url);
|
||||
return GitHubClient.parseURL(html_url);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,7 +5,6 @@ import java.net.URL;
|
||||
/**
|
||||
* Base class for Github Marketplace Account.
|
||||
*
|
||||
* @author Paulo Miguel Almeida
|
||||
* @see GitHub#getMyMarketplacePurchases()
|
||||
* @see GHMarketplaceListAccountBuilder#createRequest()
|
||||
*/
|
||||
@@ -37,7 +36,7 @@ public class GHMarketplaceAccount {
|
||||
* @return the url
|
||||
*/
|
||||
public URL getUrl() {
|
||||
return GitHub.parseURL(url);
|
||||
return GitHubClient.parseURL(url);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,7 +5,6 @@ import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||
/**
|
||||
* A Github Marketplace Account Plan.
|
||||
*
|
||||
* @author Paulo Miguel Almeida
|
||||
* @see GHMarketplaceListAccountBuilder#createRequest()
|
||||
*/
|
||||
public class GHMarketplaceAccountPlan extends GHMarketplaceAccount {
|
||||
|
||||
@@ -7,7 +7,6 @@ import java.util.Locale;
|
||||
/**
|
||||
* GitHub Marketplace Account type.
|
||||
*
|
||||
* @author Paulo Miguel Almeida
|
||||
* @see GHMarketplaceAccount
|
||||
*/
|
||||
public enum GHMarketplaceAccountType {
|
||||
|
||||
@@ -5,7 +5,6 @@ import java.io.IOException;
|
||||
/**
|
||||
* Returns any accounts associated with a plan, including free plans
|
||||
*
|
||||
* @author Paulo Miguel Almeida
|
||||
* @see GHMarketplacePlan#listAccounts()
|
||||
*/
|
||||
public class GHMarketplaceListAccountBuilder {
|
||||
|
||||
@@ -7,7 +7,6 @@ import java.util.Date;
|
||||
/**
|
||||
* A Github Marketplace purchase pending change.
|
||||
*
|
||||
* @author Paulo Miguel Almeida
|
||||
* @see GHMarketplaceListAccountBuilder#createRequest()
|
||||
*/
|
||||
public class GHMarketplacePendingChange {
|
||||
@@ -68,7 +67,7 @@ public class GHMarketplacePendingChange {
|
||||
* @return the effective date
|
||||
*/
|
||||
public Date getEffectiveDate() {
|
||||
return GitHub.parseDate(effectiveDate);
|
||||
return GitHubClient.parseDate(effectiveDate);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,7 +8,6 @@ import java.util.List;
|
||||
/**
|
||||
* A Github Marketplace plan.
|
||||
*
|
||||
* @author Paulo Miguel Almeida
|
||||
* @see GitHub#listMarketplacePlans()
|
||||
*/
|
||||
public class GHMarketplacePlan {
|
||||
@@ -47,7 +46,7 @@ public class GHMarketplacePlan {
|
||||
* @return the url
|
||||
*/
|
||||
public URL getUrl() {
|
||||
return GitHub.parseURL(url);
|
||||
return GitHubClient.parseURL(url);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,7 +5,6 @@ import com.fasterxml.jackson.annotation.JsonValue;
|
||||
/**
|
||||
* GitHub Marketplace plan pricing model.
|
||||
*
|
||||
* @author Paulo Miguel Almeida
|
||||
* @see GHMarketplacePlan
|
||||
*/
|
||||
public enum GHMarketplacePriceModel {
|
||||
|
||||
@@ -7,7 +7,6 @@ import java.util.Date;
|
||||
/**
|
||||
* A Github Marketplace purchase.
|
||||
*
|
||||
* @author Paulo Miguel Almeida
|
||||
* @see GHMarketplaceListAccountBuilder#createRequest() GHMarketplaceListAccountBuilder#createRequest()
|
||||
*/
|
||||
public class GHMarketplacePurchase {
|
||||
@@ -52,7 +51,7 @@ public class GHMarketplacePurchase {
|
||||
* @return the next billing date
|
||||
*/
|
||||
public Date getNextBillingDate() {
|
||||
return GitHub.parseDate(nextBillingDate);
|
||||
return GitHubClient.parseDate(nextBillingDate);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -70,7 +69,7 @@ public class GHMarketplacePurchase {
|
||||
* @return the free trial ends on
|
||||
*/
|
||||
public Date getFreeTrialEndsOn() {
|
||||
return GitHub.parseDate(freeTrialEndsOn);
|
||||
return GitHubClient.parseDate(freeTrialEndsOn);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -88,7 +87,7 @@ public class GHMarketplacePurchase {
|
||||
* @return the updated at
|
||||
*/
|
||||
public Date getUpdatedAt() {
|
||||
return GitHub.parseDate(updatedAt);
|
||||
return GitHubClient.parseDate(updatedAt);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -7,7 +7,6 @@ import java.util.Date;
|
||||
/**
|
||||
* Github Marketplace User Purchase
|
||||
*
|
||||
* @author Paulo Miguel Almeida
|
||||
* @see GitHub#getMyMarketplacePurchases()
|
||||
*/
|
||||
public class GHMarketplaceUserPurchase {
|
||||
@@ -54,7 +53,7 @@ public class GHMarketplaceUserPurchase {
|
||||
* @return the next billing date
|
||||
*/
|
||||
public Date getNextBillingDate() {
|
||||
return GitHub.parseDate(nextBillingDate);
|
||||
return GitHubClient.parseDate(nextBillingDate);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -72,7 +71,7 @@ public class GHMarketplaceUserPurchase {
|
||||
* @return the free trial ends on
|
||||
*/
|
||||
public Date getFreeTrialEndsOn() {
|
||||
return GitHub.parseDate(freeTrialEndsOn);
|
||||
return GitHubClient.parseDate(freeTrialEndsOn);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -90,7 +89,7 @@ public class GHMarketplaceUserPurchase {
|
||||
* @return the updated at
|
||||
*/
|
||||
public Date getUpdatedAt() {
|
||||
return GitHub.parseDate(updatedAt);
|
||||
return GitHubClient.parseDate(updatedAt);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -7,7 +7,6 @@ import java.util.Locale;
|
||||
/**
|
||||
* Represents a membership of a user in an organization.
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
* @see GHMyself#listOrgMemberships() GHMyself#listOrgMemberships()
|
||||
*/
|
||||
public class GHMembership /* extends GHObject --- but it doesn't have id, created_at, etc. */ {
|
||||
@@ -25,7 +24,7 @@ public class GHMembership /* extends GHObject --- but it doesn't have id, create
|
||||
* @return the url
|
||||
*/
|
||||
public URL getUrl() {
|
||||
return GitHub.parseURL(url);
|
||||
return GitHubClient.parseURL(url);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -9,7 +9,6 @@ import java.util.List;
|
||||
/**
|
||||
* Class that wraps the list of GitHub's IP addresses.
|
||||
*
|
||||
* @author Paulo Miguel Almeida
|
||||
* @see GitHub#getMeta() GitHub#getMeta()
|
||||
* @see <a href="https://developer.github.com/v3/meta/#meta">Get Meta</a>
|
||||
*/
|
||||
|
||||
@@ -7,8 +7,6 @@ import java.util.Locale;
|
||||
|
||||
/**
|
||||
* The type GHMilestone.
|
||||
*
|
||||
* @author Yusuke Kokubo
|
||||
*/
|
||||
public class GHMilestone extends GHObject {
|
||||
GitHub root;
|
||||
@@ -56,7 +54,7 @@ public class GHMilestone extends GHObject {
|
||||
public Date getDueOn() {
|
||||
if (due_on == null)
|
||||
return null;
|
||||
return GitHub.parseDate(due_on);
|
||||
return GitHubClient.parseDate(due_on);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -67,7 +65,7 @@ public class GHMilestone extends GHObject {
|
||||
* the io exception
|
||||
*/
|
||||
public Date getClosedAt() throws IOException {
|
||||
return GitHub.parseDate(closed_at);
|
||||
return GitHubClient.parseDate(closed_at);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -116,7 +114,7 @@ public class GHMilestone extends GHObject {
|
||||
}
|
||||
|
||||
public URL getHtmlUrl() {
|
||||
return GitHub.parseURL(html_url);
|
||||
return GitHubClient.parseURL(html_url);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -195,7 +193,7 @@ public class GHMilestone extends GHObject {
|
||||
* the io exception
|
||||
*/
|
||||
public void setDueOn(Date dueOn) throws IOException {
|
||||
edit("due_on", GitHub.printDate(dueOn));
|
||||
edit("due_on", GitHubClient.printDate(dueOn));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,8 +2,6 @@ package org.kohsuke.github;
|
||||
|
||||
/**
|
||||
* The enum GHMilestoneState.
|
||||
*
|
||||
* @author Yusuke Kokubo
|
||||
*/
|
||||
public enum GHMilestoneState {
|
||||
OPEN, CLOSED
|
||||
|
||||
@@ -12,8 +12,6 @@ import java.util.TreeMap;
|
||||
|
||||
/**
|
||||
* Represents the account that's logging into GitHub.
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
*/
|
||||
public class GHMyself extends GHUser {
|
||||
|
||||
|
||||
@@ -19,7 +19,6 @@ import java.util.NoSuchElementException;
|
||||
* In the non-blocking mode, the iterator will only report the set of notifications initially retrieved from GitHub,
|
||||
* then quit. This is useful for a batch application to process the current set of notifications.
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
* @see GitHub#listNotifications() GitHub#listNotifications()
|
||||
* @see GHRepository#listNotifications() GHRepository#listNotifications()
|
||||
*/
|
||||
@@ -79,7 +78,7 @@ public class GHNotificationStream implements Iterable<GHThread> {
|
||||
* @return the gh notification stream
|
||||
*/
|
||||
public GHNotificationStream since(Date dt) {
|
||||
since = GitHub.printDate(dt);
|
||||
since = GitHubClient.printDate(dt);
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -180,7 +179,11 @@ public class GHNotificationStream implements Iterable<GHThread> {
|
||||
|
||||
req.setHeader("If-Modified-Since", lastModified);
|
||||
|
||||
threads = req.withUrlPath(apiUrl).fetchArray(GHThread[].class);
|
||||
Requester requester = req.withUrlPath(apiUrl);
|
||||
GitHubResponse<GHThread[]> response = ((GitHubPageContentsIterable<GHThread>) requester
|
||||
.toIterable(requester.client, GHThread[].class, null)).toResponse();
|
||||
threads = response.body();
|
||||
|
||||
if (threads == null) {
|
||||
threads = EMPTY_ARRAY; // if unmodified, we get empty array
|
||||
} else {
|
||||
@@ -189,18 +192,16 @@ public class GHNotificationStream implements Iterable<GHThread> {
|
||||
}
|
||||
idx = threads.length - 1;
|
||||
|
||||
nextCheckTime = calcNextCheckTime();
|
||||
lastModified = req.getResponseHeader("Last-Modified");
|
||||
nextCheckTime = calcNextCheckTime(response);
|
||||
lastModified = response.headerField("Last-Modified");
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (InterruptedException e) {
|
||||
} catch (IOException | InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
private long calcNextCheckTime() {
|
||||
String v = req.getResponseHeader("X-Poll-Interval");
|
||||
private long calcNextCheckTime(GitHubResponse<GHThread[]> response) {
|
||||
String v = response.headerField("X-Poll-Interval");
|
||||
if (v == null)
|
||||
v = "60";
|
||||
long seconds = Integer.parseInt(v);
|
||||
@@ -234,7 +235,7 @@ public class GHNotificationStream implements Iterable<GHThread> {
|
||||
public void markAsRead(long timestamp) throws IOException {
|
||||
final Requester req = root.createRequest();
|
||||
if (timestamp >= 0)
|
||||
req.with("last_read_at", GitHub.printDate(new Date(timestamp)));
|
||||
req.with("last_read_at", GitHubClient.printDate(new Date(timestamp)));
|
||||
req.withUrlPath(apiUrl).fetchHttpStatusCode();
|
||||
}
|
||||
|
||||
|
||||
@@ -2,8 +2,6 @@ package org.kohsuke.github;
|
||||
|
||||
/**
|
||||
* This exception is thrown when GitHub is requesting an OTP from the user
|
||||
*
|
||||
* @author Kevin Harrington mad.hephaestus@gmail.com
|
||||
*/
|
||||
public class GHOTPRequiredException extends GHIOException {
|
||||
// ...
|
||||
|
||||
@@ -60,7 +60,7 @@ public abstract class GHObject {
|
||||
*/
|
||||
@WithBridgeMethods(value = String.class, adapterMethod = "createdAtStr")
|
||||
public Date getCreatedAt() throws IOException {
|
||||
return GitHub.parseDate(created_at);
|
||||
return GitHubClient.parseDate(created_at);
|
||||
}
|
||||
|
||||
@SuppressFBWarnings(value = "UPM_UNCALLED_PRIVATE_METHOD", justification = "Bridge method of getCreatedAt")
|
||||
@@ -75,7 +75,7 @@ public abstract class GHObject {
|
||||
*/
|
||||
@WithBridgeMethods(value = String.class, adapterMethod = "urlToString")
|
||||
public URL getUrl() {
|
||||
return GitHub.parseURL(url);
|
||||
return GitHubClient.parseURL(url);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -96,7 +96,7 @@ public abstract class GHObject {
|
||||
* on error
|
||||
*/
|
||||
public Date getUpdatedAt() throws IOException {
|
||||
return GitHub.parseDate(updated_at);
|
||||
return GitHubClient.parseDate(updated_at);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -14,8 +14,6 @@ import static org.kohsuke.github.Previews.INERTIA;
|
||||
|
||||
/**
|
||||
* The type GHOrganization.
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
*/
|
||||
public class GHOrganization extends GHPerson {
|
||||
GHOrganization wrapUp(GitHub root) {
|
||||
|
||||
@@ -2,8 +2,6 @@ package org.kohsuke.github;
|
||||
|
||||
/**
|
||||
* The enum GHPermissionType.
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
*/
|
||||
public enum GHPermissionType {
|
||||
ADMIN, WRITE, READ, NONE
|
||||
|
||||
@@ -9,12 +9,11 @@ import java.util.Date;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.TreeMap;
|
||||
|
||||
/**
|
||||
* Common part of {@link GHUser} and {@link GHOrganization}.
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
*/
|
||||
public abstract class GHPerson extends GHObject {
|
||||
/* package almost final */ GitHub root;
|
||||
@@ -28,6 +27,9 @@ public abstract class GHPerson extends GHObject {
|
||||
protected int followers, following, public_repos, public_gists;
|
||||
protected boolean site_admin;
|
||||
|
||||
// other fields (that only show up in full data) that require privileged scope
|
||||
protected Integer total_private_repos;
|
||||
|
||||
GHPerson wrapUp(GitHub root) {
|
||||
this.root = root;
|
||||
return this;
|
||||
@@ -114,9 +116,9 @@ public abstract class GHPerson extends GHObject {
|
||||
public synchronized Iterable<List<GHRepository>> iterateRepositories(final int pageSize) {
|
||||
return new Iterable<List<GHRepository>>() {
|
||||
public Iterator<List<GHRepository>> iterator() {
|
||||
final Iterator<GHRepository[]> pager = root.createRequest()
|
||||
.withUrlPath("users", login, "repos")
|
||||
.asIterator(GHRepository[].class, pageSize);
|
||||
final Iterator<GHRepository[]> pager = GitHubPageIterator.create(root.getClient(),
|
||||
GHRepository[].class,
|
||||
root.createRequest().withUrlPath("users", login, "repos").withPageSize(pageSize));
|
||||
|
||||
return new Iterator<List<GHRepository>>() {
|
||||
public boolean hasNext() {
|
||||
@@ -260,7 +262,7 @@ public abstract class GHPerson extends GHObject {
|
||||
|
||||
@Override
|
||||
public URL getHtmlUrl() {
|
||||
return GitHub.parseURL(html_url);
|
||||
return GitHubClient.parseURL(html_url);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -346,4 +348,16 @@ public abstract class GHPerson extends GHObject {
|
||||
populate();
|
||||
return site_admin;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets total private repo count.
|
||||
*
|
||||
* @return the total private repo count
|
||||
* @throws IOException
|
||||
* the io exception
|
||||
*/
|
||||
public Optional<Integer> getTotalPrivateRepoCount() throws IOException {
|
||||
populate();
|
||||
return Optional.ofNullable(total_private_repos);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@ import java.util.HashSet;
|
||||
*
|
||||
* @param <T>
|
||||
* the type parameter
|
||||
* @author Kohsuke Kawaguchi
|
||||
*/
|
||||
public class GHPersonSet<T extends GHPerson> extends HashSet<T> {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@@ -33,7 +33,6 @@ import static org.kohsuke.github.Previews.INERTIA;
|
||||
/**
|
||||
* A GitHub project.
|
||||
*
|
||||
* @author Martin van Zijl
|
||||
* @see <a href="https://developer.github.com/v3/projects/">Projects</a>
|
||||
*/
|
||||
public class GHProject extends GHObject {
|
||||
@@ -51,7 +50,7 @@ public class GHProject extends GHObject {
|
||||
|
||||
@Override
|
||||
public URL getHtmlUrl() throws IOException {
|
||||
return GitHub.parseURL(html_url);
|
||||
return GitHubClient.parseURL(html_url);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -99,7 +98,7 @@ public class GHProject extends GHObject {
|
||||
* @return the owner url
|
||||
*/
|
||||
public URL getOwnerUrl() {
|
||||
return GitHub.parseURL(owner_url);
|
||||
return GitHubClient.parseURL(owner_url);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -10,8 +10,6 @@ import static org.kohsuke.github.Previews.INERTIA;
|
||||
|
||||
/**
|
||||
* The type GHProjectCard.
|
||||
*
|
||||
* @author Gunnar Skjold
|
||||
*/
|
||||
public class GHProjectCard extends GHObject {
|
||||
private GitHub root;
|
||||
@@ -149,7 +147,7 @@ public class GHProjectCard extends GHObject {
|
||||
* @return the content url
|
||||
*/
|
||||
public URL getContentUrl() {
|
||||
return GitHub.parseURL(content_url);
|
||||
return GitHubClient.parseURL(content_url);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -158,7 +156,7 @@ public class GHProjectCard extends GHObject {
|
||||
* @return the project url
|
||||
*/
|
||||
public URL getProjectUrl() {
|
||||
return GitHub.parseURL(project_url);
|
||||
return GitHubClient.parseURL(project_url);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -167,7 +165,7 @@ public class GHProjectCard extends GHObject {
|
||||
* @return the column url
|
||||
*/
|
||||
public URL getColumnUrl() {
|
||||
return GitHub.parseURL(column_url);
|
||||
return GitHubClient.parseURL(column_url);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -8,8 +8,6 @@ import static org.kohsuke.github.Previews.INERTIA;
|
||||
|
||||
/**
|
||||
* The type GHProjectColumn.
|
||||
*
|
||||
* @author Gunnar Skjold
|
||||
*/
|
||||
public class GHProjectColumn extends GHObject {
|
||||
protected GitHub root;
|
||||
@@ -90,7 +88,7 @@ public class GHProjectColumn extends GHObject {
|
||||
* @return the project url
|
||||
*/
|
||||
public URL getProjectUrl() {
|
||||
return GitHub.parseURL(project_url);
|
||||
return GitHubClient.parseURL(project_url);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
*/
|
||||
package org.kohsuke.github;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
@@ -39,7 +41,6 @@ import static org.kohsuke.github.Previews.SHADOW_CAT;
|
||||
/**
|
||||
* A pull request.
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
* @see GHRepository#getPullRequest(int) GHRepository#getPullRequest(int)
|
||||
*/
|
||||
@SuppressWarnings({ "UnusedDeclaration" })
|
||||
@@ -99,6 +100,10 @@ public class GHPullRequest extends GHIssue implements Refreshable {
|
||||
|
||||
@Override
|
||||
protected String getApiRoute() {
|
||||
if (owner == null) {
|
||||
// Issues returned from search to do not have an owner. Attempt to use url.
|
||||
return StringUtils.prependIfMissing(getUrl().toString().replace(root.getApiUrl(), ""), "/");
|
||||
}
|
||||
return "/repos/" + owner.getOwnerName() + "/" + owner.getName() + "/pulls/" + number;
|
||||
}
|
||||
|
||||
@@ -108,7 +113,7 @@ public class GHPullRequest extends GHIssue implements Refreshable {
|
||||
* @return the patch url
|
||||
*/
|
||||
public URL getPatchUrl() {
|
||||
return GitHub.parseURL(patch_url);
|
||||
return GitHubClient.parseURL(patch_url);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -117,7 +122,7 @@ public class GHPullRequest extends GHIssue implements Refreshable {
|
||||
* @return the issue url
|
||||
*/
|
||||
public URL getIssueUrl() {
|
||||
return GitHub.parseURL(issue_url);
|
||||
return GitHubClient.parseURL(issue_url);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -156,7 +161,7 @@ public class GHPullRequest extends GHIssue implements Refreshable {
|
||||
* @return the diff url
|
||||
*/
|
||||
public URL getDiffUrl() {
|
||||
return GitHub.parseURL(diff_url);
|
||||
return GitHubClient.parseURL(diff_url);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -165,7 +170,7 @@ public class GHPullRequest extends GHIssue implements Refreshable {
|
||||
* @return the merged at
|
||||
*/
|
||||
public Date getMergedAt() {
|
||||
return GitHub.parseDate(merged_at);
|
||||
return GitHubClient.parseDate(merged_at);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -31,7 +31,6 @@ import java.net.URL;
|
||||
/**
|
||||
* Commit detail inside a {@link GHPullRequest}.
|
||||
*
|
||||
* @author Luca Milanesio
|
||||
* @see GHPullRequest#listCommits() GHPullRequest#listCommits()
|
||||
*/
|
||||
@SuppressFBWarnings(
|
||||
@@ -75,7 +74,7 @@ public class GHPullRequestCommitDetail {
|
||||
* @return the url
|
||||
*/
|
||||
public URL getUrl() {
|
||||
return GitHub.parseURL(url);
|
||||
return GitHubClient.parseURL(url);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -125,7 +124,7 @@ public class GHPullRequestCommitDetail {
|
||||
* @return the url
|
||||
*/
|
||||
public URL getUrl() {
|
||||
return GitHub.parseURL(url);
|
||||
return GitHubClient.parseURL(url);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -161,7 +160,7 @@ public class GHPullRequestCommitDetail {
|
||||
* @return the url
|
||||
*/
|
||||
public URL getUrl() {
|
||||
return GitHub.parseURL(url);
|
||||
return GitHubClient.parseURL(url);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -170,7 +169,7 @@ public class GHPullRequestCommitDetail {
|
||||
* @return the html url
|
||||
*/
|
||||
public URL getHtml_url() {
|
||||
return GitHub.parseURL(html_url);
|
||||
return GitHubClient.parseURL(html_url);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -214,7 +213,7 @@ public class GHPullRequestCommitDetail {
|
||||
* @return the api url
|
||||
*/
|
||||
public URL getApiUrl() {
|
||||
return GitHub.parseURL(url);
|
||||
return GitHubClient.parseURL(url);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -223,7 +222,7 @@ public class GHPullRequestCommitDetail {
|
||||
* @return the url
|
||||
*/
|
||||
public URL getUrl() {
|
||||
return GitHub.parseURL(html_url);
|
||||
return GitHubClient.parseURL(html_url);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -232,7 +231,7 @@ public class GHPullRequestCommitDetail {
|
||||
* @return the comments url
|
||||
*/
|
||||
public URL getCommentsUrl() {
|
||||
return GitHub.parseURL(comments_url);
|
||||
return GitHubClient.parseURL(comments_url);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -28,7 +28,6 @@ import java.net.URL;
|
||||
/**
|
||||
* File detail inside a {@link GHPullRequest}.
|
||||
*
|
||||
* @author Julien Henry
|
||||
* @see GHPullRequest#listFiles() GHPullRequest#listFiles()
|
||||
*/
|
||||
public class GHPullRequestFileDetail {
|
||||
@@ -105,7 +104,7 @@ public class GHPullRequestFileDetail {
|
||||
* @return the blob url
|
||||
*/
|
||||
public URL getBlobUrl() {
|
||||
return GitHub.parseURL(blob_url);
|
||||
return GitHubClient.parseURL(blob_url);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -114,7 +113,7 @@ public class GHPullRequestFileDetail {
|
||||
* @return the raw url
|
||||
*/
|
||||
public URL getRawUrl() {
|
||||
return GitHub.parseURL(raw_url);
|
||||
return GitHubClient.parseURL(raw_url);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -123,7 +122,7 @@ public class GHPullRequestFileDetail {
|
||||
* @return the contents url
|
||||
*/
|
||||
public URL getContentsUrl() {
|
||||
return GitHub.parseURL(contents_url);
|
||||
return GitHubClient.parseURL(contents_url);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,7 +5,6 @@ import static org.kohsuke.github.Previews.SHADOW_CAT;
|
||||
/**
|
||||
* Lists up pull requests with some filtering and sorting.
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
* @see GHRepository#queryPullRequests() GHRepository#queryPullRequests()
|
||||
*/
|
||||
public class GHPullRequestQueryBuilder extends GHQueryBuilder<GHPullRequest> {
|
||||
|
||||
@@ -122,7 +122,7 @@ public class GHPullRequestReview extends GHObject {
|
||||
* the io exception
|
||||
*/
|
||||
public Date getSubmittedAt() throws IOException {
|
||||
return GitHub.parseDate(submitted_at);
|
||||
return GitHubClient.parseDate(submitted_at);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -7,7 +7,6 @@ import java.util.List;
|
||||
/**
|
||||
* Builds up a creation of new {@link GHPullRequestReview}.
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
* @see GHPullRequest#createReview() GHPullRequest#createReview()
|
||||
*/
|
||||
public class GHPullRequestReviewBuilder {
|
||||
|
||||
@@ -33,7 +33,6 @@ import static org.kohsuke.github.Previews.*;
|
||||
/**
|
||||
* Review comment to the pull request
|
||||
*
|
||||
* @author Julien Henry
|
||||
* @see GHPullRequest#listReviewComments() GHPullRequest#listReviewComments()
|
||||
* @see GHPullRequest#createReviewComment(String, String, String, int) GHPullRequest#createReviewComment(String, String,
|
||||
* String, int)
|
||||
|
||||
@@ -5,7 +5,6 @@ package org.kohsuke.github;
|
||||
*
|
||||
* @param <T>
|
||||
* the type parameter
|
||||
* @author Kohsuke Kawaguchi
|
||||
*/
|
||||
public abstract class GHQueryBuilder<T> {
|
||||
protected final GitHub root;
|
||||
|
||||
@@ -19,8 +19,6 @@ import static java.util.logging.Level.FINEST;
|
||||
|
||||
/**
|
||||
* Rate limit.
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
*/
|
||||
@SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD", justification = "JSON API")
|
||||
public class GHRateLimit {
|
||||
@@ -219,6 +217,28 @@ public class GHRateLimit {
|
||||
return Objects.hash(getCore(), getSearch(), getGraphQL(), getIntegrationManifest());
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the appropriate {@link Record} for a particular url path.
|
||||
*
|
||||
* @param urlPath
|
||||
* the url path of the request
|
||||
* @return the {@link Record} for a url path.
|
||||
*/
|
||||
@Nonnull
|
||||
Record getRecordForUrlPath(@Nonnull String urlPath) {
|
||||
if (urlPath.equals("/rate_limit")) {
|
||||
return new UnknownLimitRecord();
|
||||
} else if (urlPath.startsWith("/search")) {
|
||||
return getSearch();
|
||||
} else if (urlPath.startsWith("/graphql")) {
|
||||
return getGraphQL();
|
||||
} else if (urlPath.startsWith("/app-manifests")) {
|
||||
return getIntegrationManifest();
|
||||
} else {
|
||||
return getCore();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* A limit record used as a placeholder when the the actual limit is not known.
|
||||
* <p>
|
||||
@@ -257,6 +277,8 @@ public class GHRateLimit {
|
||||
|
||||
/**
|
||||
* The time at which the current rate limit window resets in UTC epoch seconds.
|
||||
*
|
||||
* This is the raw value returned by the server.
|
||||
*/
|
||||
private final long resetEpochSeconds;
|
||||
|
||||
@@ -266,8 +288,12 @@ public class GHRateLimit {
|
||||
private final long createdAtEpochSeconds = System.currentTimeMillis() / 1000;
|
||||
|
||||
/**
|
||||
* The calculated time at which the rate limit will reset. Recalculated if {@link #recalculateResetDate} is
|
||||
* called.
|
||||
* The time at which the rate limit will reset. This value is calculated based on
|
||||
* {@link #getResetEpochSeconds()} by calling {@link #recalculateResetDate}. If the clock on the local machine
|
||||
* not synchronized with the server clock, this time value will be adjusted to match the local machine's clock.
|
||||
* <p>
|
||||
* Recalculated by calling {@link #recalculateResetDate}.
|
||||
* </p>
|
||||
*/
|
||||
@Nonnull
|
||||
private Date resetDate;
|
||||
@@ -310,8 +336,27 @@ public class GHRateLimit {
|
||||
}
|
||||
|
||||
/**
|
||||
* Recalculates the reset date using the server response date to calculate a time duration and then add that to
|
||||
* the local created time for this record.
|
||||
* Recalculates the {@link #resetDate} relative to the local machine clock.
|
||||
* <p>
|
||||
* {@link RateLimitChecker}s and {@link RateLimitHandler}s use {@link #getResetDate()} to make decisions about
|
||||
* how long to wait for until for the rate limit to reset. That means that {@link #getResetDate()} needs to be
|
||||
* accurate to the local machine.
|
||||
* </p>
|
||||
* <p>
|
||||
* When we say that the clock on two machines is "synchronized", we mean that the UTC time returned from
|
||||
* {@link System#currentTimeMillis()} on each machine is basically the same. For the purposes of rate limits an
|
||||
* differences of up to a second can be ignored.
|
||||
* </p>
|
||||
* <p>
|
||||
* When the clock on the local machine is synchronized to the same time as the clock on the GitHub server (via a
|
||||
* time service for example), the {@link #resetDate} generated directly from {@link #resetEpochSeconds} will be
|
||||
* accurate for the local machine as well.
|
||||
* </p>
|
||||
* <p>
|
||||
* When the clock on the local machine is not synchronized with the server, the {@link #resetDate} must be
|
||||
* recalculated relative to the local machine clock. This is done by taking the number of seconds between the
|
||||
* response "Date" header and {@link #resetEpochSeconds} and then adding that to this record's
|
||||
* {@link #createdAtEpochSeconds}.
|
||||
*
|
||||
* @param updatedAt
|
||||
* a string date in RFC 1123
|
||||
@@ -358,7 +403,12 @@ public class GHRateLimit {
|
||||
/**
|
||||
* Gets the time in epoch seconds when the rate limit will reset.
|
||||
*
|
||||
* @return a long
|
||||
* This is the raw value returned by the server. This value is not adjusted if local machine time is not
|
||||
* synchronized with server time. If attempting to check when the rate limit will reset, use
|
||||
* {@link #getResetDate()} or implement a {@link RateLimitChecker} instead.
|
||||
*
|
||||
* @return a long representing the time in epoch seconds when the rate limit will reset
|
||||
* @see #getResetDate() #getResetDate()
|
||||
*/
|
||||
public long getResetEpochSeconds() {
|
||||
return resetEpochSeconds;
|
||||
@@ -374,7 +424,10 @@ public class GHRateLimit {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the date at which the rate limit will reset.
|
||||
* Returns the date at which the rate limit will reset, adjusted to local machine time if the local machine's
|
||||
* clock not synchronized with to the same clock as the GitHub server.
|
||||
*
|
||||
* If attempting to wait for the rate limit to reset, consider implementing a {@link RateLimitChecker} instead.
|
||||
*
|
||||
* @return the calculated date at which the rate limit has or will reset.
|
||||
*/
|
||||
|
||||
@@ -8,7 +8,6 @@ import static org.kohsuke.github.Previews.*;
|
||||
/**
|
||||
* Reaction to issue, comment, PR, and so on.
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
* @see Reactable
|
||||
*/
|
||||
@Preview
|
||||
|
||||
@@ -7,8 +7,6 @@ import java.net.URL;
|
||||
|
||||
/**
|
||||
* Provides information on a Git ref from GitHub.
|
||||
*
|
||||
* @author Michael Clarke
|
||||
*/
|
||||
public class GHRef {
|
||||
/* package almost final */ GitHub root;
|
||||
@@ -31,7 +29,7 @@ public class GHRef {
|
||||
* @return the url
|
||||
*/
|
||||
public URL getUrl() {
|
||||
return GitHub.parseURL(url);
|
||||
return GitHubClient.parseURL(url);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -131,7 +129,7 @@ public class GHRef {
|
||||
* @return the url
|
||||
*/
|
||||
public URL getUrl() {
|
||||
return GitHub.parseURL(url);
|
||||
return GitHubClient.parseURL(url);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ public class GHRelease extends GHObject {
|
||||
}
|
||||
|
||||
public URL getHtmlUrl() {
|
||||
return GitHub.parseURL(html_url);
|
||||
return GitHubClient.parseURL(html_url);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,7 +5,6 @@ import java.io.IOException;
|
||||
/**
|
||||
* Modifies {@link GHRelease}.
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
* @see GHRelease#update() GHRelease#update()
|
||||
*/
|
||||
public class GHReleaseUpdater {
|
||||
|
||||
@@ -25,6 +25,8 @@ package org.kohsuke.github;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.infradna.tool.bridge_method_injector.WithBridgeMethods;
|
||||
import edu.umd.cs.findbugs.annotations.CheckForNull;
|
||||
import edu.umd.cs.findbugs.annotations.NonNull;
|
||||
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
@@ -55,8 +57,6 @@ import static org.kohsuke.github.Previews.*;
|
||||
|
||||
/**
|
||||
* A repository on GitHub.
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
*/
|
||||
@SuppressWarnings({ "UnusedDeclaration" })
|
||||
@SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD" },
|
||||
@@ -255,7 +255,7 @@ public class GHRepository extends GHObject {
|
||||
}
|
||||
|
||||
public URL getHtmlUrl() {
|
||||
return GitHub.parseURL(html_url);
|
||||
return GitHubClient.parseURL(html_url);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -694,7 +694,7 @@ public class GHRepository extends GHObject {
|
||||
* @return null if the repository was never pushed at.
|
||||
*/
|
||||
public Date getPushedAt() {
|
||||
return GitHub.parseDate(pushed_at);
|
||||
return GitHubClient.parseDate(pushed_at);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -813,7 +813,7 @@ public class GHRepository extends GHObject {
|
||||
* Obtain permission for a given user in this repository.
|
||||
*
|
||||
* @param u
|
||||
* the u
|
||||
* the user
|
||||
* @return the permission
|
||||
* @throws IOException
|
||||
* the io exception
|
||||
@@ -835,6 +835,20 @@ public class GHRepository extends GHObject {
|
||||
root.getOrganization(getOwnerName())))));
|
||||
}
|
||||
|
||||
/**
|
||||
* Add collaborators.
|
||||
*
|
||||
* @param users
|
||||
* the users
|
||||
* @param permission
|
||||
* the permission level
|
||||
* @throws IOException
|
||||
* the io exception
|
||||
*/
|
||||
public void addCollaborators(GHOrganization.Permission permission, GHUser... users) throws IOException {
|
||||
addCollaborators(asList(users), permission);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add collaborators.
|
||||
*
|
||||
@@ -856,7 +870,21 @@ public class GHRepository extends GHObject {
|
||||
* the io exception
|
||||
*/
|
||||
public void addCollaborators(Collection<GHUser> users) throws IOException {
|
||||
modifyCollaborators(users, "PUT");
|
||||
modifyCollaborators(users, "PUT", null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add collaborators.
|
||||
*
|
||||
* @param users
|
||||
* the users
|
||||
* @param permission
|
||||
* the permission level
|
||||
* @throws IOException
|
||||
* the io exception
|
||||
*/
|
||||
public void addCollaborators(Collection<GHUser> users, GHOrganization.Permission permission) throws IOException {
|
||||
modifyCollaborators(users, "PUT", permission);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -880,12 +908,20 @@ public class GHRepository extends GHObject {
|
||||
* the io exception
|
||||
*/
|
||||
public void removeCollaborators(Collection<GHUser> users) throws IOException {
|
||||
modifyCollaborators(users, "DELETE");
|
||||
modifyCollaborators(users, "DELETE", null);
|
||||
}
|
||||
|
||||
private void modifyCollaborators(Collection<GHUser> users, String method) throws IOException {
|
||||
private void modifyCollaborators(@NonNull Collection<GHUser> users,
|
||||
@NonNull String method,
|
||||
@CheckForNull GHOrganization.Permission permission) throws IOException {
|
||||
Requester requester = root.createRequest().method(method);
|
||||
|
||||
if (permission != null) {
|
||||
requester = requester.with("permission", permission).inBody();
|
||||
}
|
||||
|
||||
for (GHUser user : users) {
|
||||
root.createRequest().method(method).withUrlPath(getApiTailUrl("collaborators/" + user.getLogin())).send();
|
||||
requester.withUrlPath(getApiTailUrl("collaborators/" + user.getLogin())).send();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@ package org.kohsuke.github;
|
||||
/**
|
||||
* Search repositories.
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
* @see GitHub#searchRepositories() GitHub#searchRepositories()
|
||||
*/
|
||||
public class GHRepositorySearchBuilder extends GHSearchBuilder<GHRepository> {
|
||||
|
||||
@@ -5,7 +5,6 @@ import java.util.Locale;
|
||||
/**
|
||||
* App installation repository selection.
|
||||
*
|
||||
* @author Paulo Miguel Almeida
|
||||
* @see GHAppInstallation
|
||||
*/
|
||||
public enum GHRepositorySelection {
|
||||
|
||||
@@ -12,8 +12,6 @@ import java.util.NoSuchElementException;
|
||||
|
||||
/**
|
||||
* Statistics for a GitHub repository.
|
||||
*
|
||||
* @author Martin van Zijl
|
||||
*/
|
||||
public class GHRepositoryStatistics {
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ public abstract class GHRepositoryTraffic implements TrafficInfo {
|
||||
* @return the timestamp
|
||||
*/
|
||||
public Date getTimestamp() {
|
||||
return GitHub.parseDate(timestamp);
|
||||
return GitHubClient.parseDate(timestamp);
|
||||
}
|
||||
|
||||
public int getCount() {
|
||||
|
||||
@@ -2,15 +2,17 @@ package org.kohsuke.github;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.net.MalformedURLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
/**
|
||||
* Base class for various search builders.
|
||||
*
|
||||
* @param <T>
|
||||
* the type parameter
|
||||
* @author Kohsuke Kawaguchi
|
||||
*/
|
||||
public abstract class GHSearchBuilder<T> extends GHQueryBuilder<T> {
|
||||
protected final List<String> terms = new ArrayList<String>();
|
||||
@@ -42,16 +44,26 @@ public abstract class GHSearchBuilder<T> extends GHQueryBuilder<T> {
|
||||
*/
|
||||
@Override
|
||||
public PagedSearchIterable<T> list() {
|
||||
return new PagedSearchIterable<T>(root) {
|
||||
public PagedIterator<T> _iterator(int pageSize) {
|
||||
req.set("q", StringUtils.join(terms, " "));
|
||||
return new PagedIterator<T>(adapt(req.withUrlPath(getApiUrl()).asIterator(receiverType, pageSize))) {
|
||||
protected void wrapUp(T[] page) {
|
||||
// SearchResult.getItems() should do it
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
req.set("q", StringUtils.join(terms, " "));
|
||||
try {
|
||||
final GitHubRequest baseRequest = req.build();
|
||||
return new PagedSearchIterable<T>(root) {
|
||||
@Nonnull
|
||||
public PagedIterator<T> _iterator(int pageSize) {
|
||||
return new PagedIterator<T>(adapt(GitHubPageIterator.create(root.getClient(),
|
||||
receiverType,
|
||||
baseRequest.toBuilder().withUrlPath(getApiUrl()).withPageSize(pageSize)))) {
|
||||
protected void wrapUp(T[] page) {
|
||||
// PagedSearchIterable
|
||||
// SearchResult.getItems() should do it
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
} catch (MalformedURLException e) {
|
||||
throw new GHException("", e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -6,8 +6,6 @@ import java.util.Date;
|
||||
|
||||
/**
|
||||
* A stargazer at a repository on GitHub.
|
||||
*
|
||||
* @author noctarius
|
||||
*/
|
||||
@SuppressFBWarnings(value = { "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD" }, justification = "JSON API")
|
||||
public class GHStargazer {
|
||||
@@ -32,7 +30,7 @@ public class GHStargazer {
|
||||
* @return the date the stargazer was added
|
||||
*/
|
||||
public Date getStarredAt() {
|
||||
return GitHub.parseDate(starred_at);
|
||||
return GitHubClient.parseDate(starred_at);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -6,7 +6,6 @@ import java.util.Date;
|
||||
/**
|
||||
* Represents your subscribing to a repository / conversation thread..
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
* @see GHRepository#getSubscription() GHRepository#getSubscription()
|
||||
* @see GHThread#getSubscription() GHThread#getSubscription()
|
||||
*/
|
||||
@@ -23,7 +22,7 @@ public class GHSubscription {
|
||||
* @return the created at
|
||||
*/
|
||||
public Date getCreatedAt() {
|
||||
return GitHub.parseDate(created_at);
|
||||
return GitHubClient.parseDate(created_at);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -7,7 +7,6 @@ import java.util.Locale;
|
||||
/**
|
||||
* App installation target type.
|
||||
*
|
||||
* @author Paulo Miguel Almeida
|
||||
* @see GHAppInstallation
|
||||
*/
|
||||
public enum GHTargetType {
|
||||
|
||||
@@ -8,8 +8,6 @@ import java.util.TreeMap;
|
||||
|
||||
/**
|
||||
* A team in GitHub organization.
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
*/
|
||||
public class GHTeam implements Refreshable {
|
||||
private String name;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user