mirror of
https://github.com/jlengrand/github-api.git
synced 2026-03-12 00:11:22 +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.
|
- [ ] Push your changes to a branch other than `master`. Create your PR from that branch.
|
||||||
- [ ] Add JavaDocs and other comments
|
- [ ] 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.
|
- [ ] 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]
|
on: [push, pull_request]
|
||||||
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
name: build-only (Java ${{ matrix.java }})
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
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:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: Set up JDK
|
- name: Set up JDK
|
||||||
uses: actions/setup-java@v1
|
uses: actions/setup-java@v1
|
||||||
with:
|
with:
|
||||||
java-version: ${{ matrix.java }}
|
java-version: ${{ matrix.java }}
|
||||||
- name: Maven Download all dependencies
|
- uses: actions/cache@v1
|
||||||
run: mvn -B org.apache.maven.plugins:maven-dependency-plugin:3.1.1:go-offline -P ci
|
with:
|
||||||
- name: Maven Build
|
path: ~/.m2/repository
|
||||||
run: mvn -B install site -P ci --file pom.xml
|
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
|
.DS_Store
|
||||||
|
|
||||||
dependency-reduced-pom.xml
|
dependency-reduced-pom.xml
|
||||||
|
.factorypath
|
||||||
|
.vscode/settings.json
|
||||||
|
|||||||
102
pom.xml
102
pom.xml
@@ -2,7 +2,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>org.kohsuke</groupId>
|
<groupId>org.kohsuke</groupId>
|
||||||
<artifactId>github-api</artifactId>
|
<artifactId>github-api</artifactId>
|
||||||
<version>1.106</version>
|
<version>1.107</version>
|
||||||
<name>GitHub API for Java</name>
|
<name>GitHub API for Java</name>
|
||||||
<url>https://github-api.kohsuke.org/</url>
|
<url>https://github-api.kohsuke.org/</url>
|
||||||
<description>GitHub API for Java</description>
|
<description>GitHub API for Java</description>
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
<connection>scm:git:git@github.com/github-api/${project.artifactId}.git</connection>
|
<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>
|
<developerConnection>scm:git:ssh://git@github.com/github-api/${project.artifactId}.git</developerConnection>
|
||||||
<url>https://${project.artifactId}.kohsuke.org/</url>
|
<url>https://${project.artifactId}.kohsuke.org/</url>
|
||||||
<tag>github-api-1.106</tag>
|
<tag>github-api-1.107</tag>
|
||||||
</scm>
|
</scm>
|
||||||
|
|
||||||
<distributionManagement>
|
<distributionManagement>
|
||||||
@@ -34,10 +34,10 @@
|
|||||||
<properties>
|
<properties>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<spotbugs-maven-plugin.version>3.1.12.2</spotbugs-maven-plugin.version>
|
<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>
|
<spotbugs-maven-plugin.failOnError>true</spotbugs-maven-plugin.failOnError>
|
||||||
<hamcrest.version>2.2</hamcrest.version>
|
<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>
|
<okio.version>2.4.3</okio.version>
|
||||||
<formatter-maven-plugin.goal>format</formatter-maven-plugin.goal>
|
<formatter-maven-plugin.goal>format</formatter-maven-plugin.goal>
|
||||||
<impsort-maven-plugin.goal>sort</impsort-maven-plugin.goal>
|
<impsort-maven-plugin.goal>sort</impsort-maven-plugin.goal>
|
||||||
@@ -79,54 +79,6 @@
|
|||||||
</testResources>
|
</testResources>
|
||||||
<pluginManagement>
|
<pluginManagement>
|
||||||
<plugins>
|
<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>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-source-plugin</artifactId>
|
<artifactId>maven-source-plugin</artifactId>
|
||||||
@@ -203,16 +155,18 @@
|
|||||||
<exclude>org.kohsuke.github.GHPerson.1</exclude>
|
<exclude>org.kohsuke.github.GHPerson.1</exclude>
|
||||||
<exclude>org.kohsuke.github.GHPerson.1.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 -->
|
<!-- 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.GHBranchProtection.RequiredSignatures</exclude>
|
||||||
<exclude>org.kohsuke.github.GHBranchProtectionBuilder.Restrictions</exclude>
|
<exclude>org.kohsuke.github.GHBranchProtectionBuilder.Restrictions</exclude>
|
||||||
<exclude>org.kohsuke.github.GHBranchProtection.Restrictions</exclude>
|
<exclude>org.kohsuke.github.GHBranchProtection.Restrictions</exclude>
|
||||||
<exclude>org.kohsuke.github.GHCommentAuthorAssociation</exclude>
|
<exclude>org.kohsuke.github.GHCommentAuthorAssociation</exclude>
|
||||||
<exclude>org.kohsuke.github.GHCommitBuilder.UserInfo</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.GHCommitState</exclude>
|
||||||
<exclude>org.kohsuke.github.GHCompare.Commit</exclude>
|
<exclude>org.kohsuke.github.GHCompare.Commit</exclude>
|
||||||
<exclude>org.kohsuke.github.GHCompare.InnerCommit</exclude>
|
<exclude>org.kohsuke.github.GHCompare.InnerCommit</exclude>
|
||||||
@@ -230,9 +184,6 @@
|
|||||||
<exclude>org.kohsuke.github.GHHook</exclude>
|
<exclude>org.kohsuke.github.GHHook</exclude>
|
||||||
<exclude>org.kohsuke.github.GHHooks.OrgContext</exclude>
|
<exclude>org.kohsuke.github.GHHooks.OrgContext</exclude>
|
||||||
<exclude>org.kohsuke.github.GHInvitation</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.GHMilestoneState</exclude>
|
||||||
<exclude>org.kohsuke.github.GHOrgHook</exclude>
|
<exclude>org.kohsuke.github.GHOrgHook</exclude>
|
||||||
<exclude>org.kohsuke.github.GHProject.ProjectStateFilter</exclude>
|
<exclude>org.kohsuke.github.GHProject.ProjectStateFilter</exclude>
|
||||||
@@ -494,7 +445,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.kohsuke.stapler</groupId>
|
<groupId>org.kohsuke.stapler</groupId>
|
||||||
<artifactId>stapler</artifactId>
|
<artifactId>stapler</artifactId>
|
||||||
<version>1.258</version>
|
<version>1.259</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
@@ -506,7 +457,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.eclipse.jgit</groupId>
|
<groupId>org.eclipse.jgit</groupId>
|
||||||
<artifactId>org.eclipse.jgit</artifactId>
|
<artifactId>org.eclipse.jgit</artifactId>
|
||||||
<version>5.6.0.201912101111-r</version>
|
<version>5.6.1.202002131546-r</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
@@ -556,7 +507,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.github.tomakehurst</groupId>
|
<groupId>com.github.tomakehurst</groupId>
|
||||||
<artifactId>wiremock-jre8-standalone</artifactId>
|
<artifactId>wiremock-jre8-standalone</artifactId>
|
||||||
<version>2.25.1</version>
|
<version>2.26.0</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
@@ -580,23 +531,32 @@
|
|||||||
</pluginRepositories>
|
</pluginRepositories>
|
||||||
<profiles>
|
<profiles>
|
||||||
<profile>
|
<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>
|
<activation>
|
||||||
<property>
|
<property>
|
||||||
<name>enable-ci</name>
|
<name>enable-ci</name>
|
||||||
</property>
|
</property>
|
||||||
</activation>
|
</activation>
|
||||||
<properties>
|
<properties>
|
||||||
<formatter-maven-plugin.goal>validate</formatter-maven-plugin.goal>
|
|
||||||
<impsort-maven-plugin.goal>check</impsort-maven-plugin.goal>
|
|
||||||
<jacoco.haltOnFailure>true</jacoco.haltOnFailure>
|
<jacoco.haltOnFailure>true</jacoco.haltOnFailure>
|
||||||
</properties>
|
</properties>
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-shade-plugin</artifactId>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.jacoco</groupId>
|
<groupId>org.jacoco</groupId>
|
||||||
<artifactId>jacoco-maven-plugin</artifactId>
|
<artifactId>jacoco-maven-plugin</artifactId>
|
||||||
@@ -612,10 +572,6 @@
|
|||||||
</properties>
|
</properties>
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-shade-plugin</artifactId>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-gpg-plugin</artifactId>
|
<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.
|
* 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 GitHubBuilder#withAbuseLimitHandler(AbuseLimitHandler) GitHubBuilder#withAbuseLimitHandler(AbuseLimitHandler)
|
||||||
* @see <a href="https://developer.github.com/v3/#abuse-rate-limits">documentation</a>
|
* @see <a href="https://developer.github.com/v3/#abuse-rate-limits">documentation</a>
|
||||||
* @see RateLimitHandler
|
* @see RateLimitHandler
|
||||||
@@ -29,6 +28,9 @@ public abstract class AbuseLimitHandler {
|
|||||||
* @throws IOException
|
* @throws IOException
|
||||||
* on failure
|
* 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/#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;
|
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;
|
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Kohsuke Kawaguchi
|
*/
|
||||||
*/
|
|
||||||
@SuppressFBWarnings(value = "UUF_UNUSED_PUBLIC_OR_PROTECTED_FIELD",
|
@SuppressFBWarnings(value = "UUF_UNUSED_PUBLIC_OR_PROTECTED_FIELD",
|
||||||
justification = "Being constructed by JSON deserialization")
|
justification = "Being constructed by JSON deserialization")
|
||||||
class DeleteToken {
|
class DeleteToken {
|
||||||
|
|||||||
@@ -4,8 +4,6 @@ import java.util.Locale;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* This was added during preview API period but it has changed since then.
|
* This was added during preview API period but it has changed since then.
|
||||||
*
|
|
||||||
* @author Kohsuke Kawaguchi
|
|
||||||
*/
|
*/
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public enum EnforcementLevel {
|
public enum EnforcementLevel {
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import static org.kohsuke.github.Previews.MACHINE_MAN;
|
|||||||
/**
|
/**
|
||||||
* A Github App.
|
* A Github App.
|
||||||
*
|
*
|
||||||
* @author Paulo Miguel Almeida
|
|
||||||
* @see GitHub#getApp() GitHub#getApp()
|
* @see GitHub#getApp() GitHub#getApp()
|
||||||
*/
|
*/
|
||||||
public class GHApp extends GHObject {
|
public class GHApp extends GHObject {
|
||||||
@@ -140,7 +139,7 @@ public class GHApp extends GHObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public URL getHtmlUrl() {
|
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
|
* Creates a access token for a GitHub App Installation
|
||||||
*
|
*
|
||||||
* @author Paulo Miguel Almeida
|
|
||||||
* @see GHAppInstallation#createToken(Map) GHAppInstallation#createToken(Map)
|
* @see GHAppInstallation#createToken(Map) GHAppInstallation#createToken(Map)
|
||||||
* @see GHAppInstallation#createToken() GHAppInstallation#createToken()
|
* @see GHAppInstallation#createToken() GHAppInstallation#createToken()
|
||||||
*/
|
*/
|
||||||
@@ -63,7 +62,7 @@ public class GHAppCreateTokenBuilder {
|
|||||||
public GHAppCreateTokenBuilder permissions(Map<String, GHPermissionType> permissions) {
|
public GHAppCreateTokenBuilder permissions(Map<String, GHPermissionType> permissions) {
|
||||||
Map<String, String> retMap = new HashMap<>();
|
Map<String, String> retMap = new HashMap<>();
|
||||||
for (Map.Entry<String, GHPermissionType> entry : permissions.entrySet()) {
|
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);
|
builder.with("permissions", retMap);
|
||||||
return this;
|
return this;
|
||||||
|
|||||||
@@ -12,7 +12,6 @@ import static org.kohsuke.github.Previews.GAMBIT;
|
|||||||
/**
|
/**
|
||||||
* A Github App Installation.
|
* A Github App Installation.
|
||||||
*
|
*
|
||||||
* @author Paulo Miguel Almeida
|
|
||||||
* @see GHApp#listInstallations() GHApp#listInstallations()
|
* @see GHApp#listInstallations() GHApp#listInstallations()
|
||||||
* @see GHApp#getInstallationById(long) GHApp#getInstallationById(long)
|
* @see GHApp#getInstallationById(long) GHApp#getInstallationById(long)
|
||||||
* @see GHApp#getInstallationByOrganization(String) GHApp#getInstallationByOrganization(String)
|
* @see GHApp#getInstallationByOrganization(String) GHApp#getInstallationByOrganization(String)
|
||||||
@@ -42,7 +41,7 @@ public class GHAppInstallation extends GHObject {
|
|||||||
private String htmlUrl;
|
private String htmlUrl;
|
||||||
|
|
||||||
public URL getHtmlUrl() {
|
public URL getHtmlUrl() {
|
||||||
return GitHub.parseURL(htmlUrl);
|
return GitHubClient.parseURL(htmlUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ import java.util.Map;
|
|||||||
/**
|
/**
|
||||||
* A Github App Installation Token.
|
* A Github App Installation Token.
|
||||||
*
|
*
|
||||||
* @author Paulo Miguel Almeida
|
|
||||||
* @see GHAppInstallation#createToken(Map) GHAppInstallation#createToken(Map)
|
* @see GHAppInstallation#createToken(Map) GHAppInstallation#createToken(Map)
|
||||||
*/
|
*/
|
||||||
public class GHAppInstallationToken {
|
public class GHAppInstallationToken {
|
||||||
@@ -127,7 +126,7 @@ public class GHAppInstallationToken {
|
|||||||
*/
|
*/
|
||||||
@WithBridgeMethods(value = String.class, adapterMethod = "expiresAtStr")
|
@WithBridgeMethods(value = String.class, adapterMethod = "expiresAtStr")
|
||||||
public Date getExpiresAt() throws IOException {
|
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")
|
@SuppressFBWarnings(value = "UPM_UNCALLED_PRIVATE_METHOD", justification = "Bridge method of getExpiresAt")
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import java.util.List;
|
|||||||
/**
|
/**
|
||||||
* Generated OAuth token
|
* Generated OAuth token
|
||||||
*
|
*
|
||||||
* @author janinko
|
|
||||||
* @see GitHub#createToken(Collection, String, String) GitHub#createToken(Collection, String, String)
|
* @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>
|
* @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
|
* @return the app url
|
||||||
*/
|
*/
|
||||||
public URL getAppUrl() {
|
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")
|
@SuppressFBWarnings(value = "NM_CONFUSING", justification = "It's a part of the library API, cannot be changed")
|
||||||
public URL getApiURL() {
|
public URL getApiURL() {
|
||||||
return GitHub.parseURL(url);
|
return GitHubClient.parseURL(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -141,7 +140,7 @@ public class GHAuthorization extends GHObject {
|
|||||||
* @return the note url
|
* @return the note url
|
||||||
*/
|
*/
|
||||||
public URL getNoteUrl() {
|
public URL getNoteUrl() {
|
||||||
return GitHub.parseURL(note_url);
|
return GitHubClient.parseURL(note_url);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import java.util.Base64;
|
|||||||
/**
|
/**
|
||||||
* The type GHBlob.
|
* The type GHBlob.
|
||||||
*
|
*
|
||||||
* @author Kanstantsin Shautsou
|
|
||||||
* @author Kohsuke Kawaguchi
|
* @author Kohsuke Kawaguchi
|
||||||
* @see GHTreeEntry#asBlob() GHTreeEntry#asBlob()
|
* @see GHTreeEntry#asBlob() GHTreeEntry#asBlob()
|
||||||
* @see GHRepository#getBlob(String) GHRepository#getBlob(String)
|
* @see GHRepository#getBlob(String) GHRepository#getBlob(String)
|
||||||
@@ -24,7 +23,7 @@ public class GHBlob {
|
|||||||
* @return API URL of this blob.
|
* @return API URL of this blob.
|
||||||
*/
|
*/
|
||||||
public URL getUrl() {
|
public URL getUrl() {
|
||||||
return GitHub.parseURL(url);
|
return GitHubClient.parseURL(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -11,8 +11,6 @@ import java.util.Objects;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* A branch in a repository.
|
* A branch in a repository.
|
||||||
*
|
|
||||||
* @author Yusuke Kokubo
|
|
||||||
*/
|
*/
|
||||||
@SuppressFBWarnings(
|
@SuppressFBWarnings(
|
||||||
value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD",
|
value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD",
|
||||||
@@ -90,7 +88,7 @@ public class GHBranch {
|
|||||||
@Preview
|
@Preview
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public URL getProtectionUrl() {
|
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;
|
import java.net.URL;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents a deployment
|
* Represents a check run.
|
||||||
*
|
*
|
||||||
* @see <a href="https://developer.github.com/v3/checks/runs/">documentation</a>
|
* @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 status;
|
||||||
private String conclusion;
|
private String conclusion;
|
||||||
private String name;
|
private String name;
|
||||||
|
private String headSha;
|
||||||
private GHPullRequest[] pullRequests;
|
private GHPullRequest[] pullRequests;
|
||||||
|
|
||||||
GHCheckRun wrap(GHRepository owner) {
|
GHCheckRun wrap(GHRepository owner) {
|
||||||
@@ -52,6 +53,15 @@ public class GHCheckRun extends GHObject {
|
|||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the HEAD SHA.
|
||||||
|
*
|
||||||
|
* @return sha for the HEAD commit
|
||||||
|
*/
|
||||||
|
public String getHeadSha() {
|
||||||
|
return headSha;
|
||||||
|
}
|
||||||
|
|
||||||
GHPullRequest[] getPullRequests() throws IOException {
|
GHPullRequest[] getPullRequests() throws IOException {
|
||||||
if (pullRequests != null && pullRequests.length != 0) {
|
if (pullRequests != null && pullRequests.length != 0) {
|
||||||
for (GHPullRequest singlePull : pullRequests) {
|
for (GHPullRequest singlePull : pullRequests) {
|
||||||
|
|||||||
@@ -2,8 +2,6 @@ package org.kohsuke.github;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* How is an user associated with a repository?
|
* How is an user associated with a repository?
|
||||||
*
|
|
||||||
* @author Kohsuke Kawaguchi
|
|
||||||
*/
|
*/
|
||||||
public enum GHCommentAuthorAssociation {
|
public enum GHCommentAuthorAssociation {
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ import java.util.List;
|
|||||||
/**
|
/**
|
||||||
* A commit in a repository.
|
* A commit in a repository.
|
||||||
*
|
*
|
||||||
* @author Kohsuke Kawaguchi
|
|
||||||
* @see GHRepository#getCommit(String) GHRepository#getCommit(String)
|
* @see GHRepository#getCommit(String) GHRepository#getCommit(String)
|
||||||
* @see GHCommitComment#getCommit() GHCommitComment#getCommit()
|
* @see GHCommitComment#getCommit() GHCommitComment#getCommit()
|
||||||
*/
|
*/
|
||||||
@@ -61,7 +60,7 @@ public class GHCommit {
|
|||||||
* @return the authored date
|
* @return the authored date
|
||||||
*/
|
*/
|
||||||
public Date getAuthoredDate() {
|
public Date getAuthoredDate() {
|
||||||
return GitHub.parseDate(author.date);
|
return GitHubClient.parseDate(author.date);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -80,7 +79,7 @@ public class GHCommit {
|
|||||||
* @return the commit date
|
* @return the commit date
|
||||||
*/
|
*/
|
||||||
public Date getCommitDate() {
|
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.
|
* resolves to the actual content of the file.
|
||||||
*/
|
*/
|
||||||
public URL getRawUrl() {
|
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.
|
* that resolves to the HTML page that describes this file.
|
||||||
*/
|
*/
|
||||||
public URL getBlobUrl() {
|
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"
|
* "https://github.com/kohsuke/sandbox-ant/commit/8ae38db0ea5837313ab5f39d43a6f73de3bd9000"
|
||||||
*/
|
*/
|
||||||
public URL getHtmlUrl() {
|
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.)
|
* 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 GHRepository#listCommitComments() GHRepository#listCommitComments()
|
||||||
* @see GHCommit#listComments() GHCommit#listComments()
|
* @see GHCommit#listComments() GHCommit#listComments()
|
||||||
* @see GHCommit#createComment(String, String, Integer, Integer) GHCommit#createComment(String, String, Integer,
|
* @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.
|
* show this commit comment in a browser.
|
||||||
*/
|
*/
|
||||||
public URL getHtmlUrl() {
|
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}.
|
* Identifies a commit in {@link GHPullRequest}.
|
||||||
*
|
|
||||||
* @author Kohsuke Kawaguchi
|
|
||||||
*/
|
*/
|
||||||
public class GHCommitPointer {
|
public class GHCommitPointer {
|
||||||
private String ref, sha, label;
|
private String ref, sha, label;
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ import java.util.Date;
|
|||||||
* }
|
* }
|
||||||
* </pre>
|
* </pre>
|
||||||
*
|
*
|
||||||
* @author Kohsuke Kawaguchi
|
|
||||||
* @see GHRepository#queryCommits() GHRepository#queryCommits()
|
* @see GHRepository#queryCommits() GHRepository#queryCommits()
|
||||||
*/
|
*/
|
||||||
public class GHCommitQueryBuilder {
|
public class GHCommitQueryBuilder {
|
||||||
@@ -83,7 +82,7 @@ public class GHCommitQueryBuilder {
|
|||||||
* @return the gh commit query builder
|
* @return the gh commit query builder
|
||||||
*/
|
*/
|
||||||
public GHCommitQueryBuilder since(Date dt) {
|
public GHCommitQueryBuilder since(Date dt) {
|
||||||
req.with("since", GitHub.printDate(dt));
|
req.with("since", GitHubClient.printDate(dt));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -106,7 +105,7 @@ public class GHCommitQueryBuilder {
|
|||||||
* @return the gh commit query builder
|
* @return the gh commit query builder
|
||||||
*/
|
*/
|
||||||
public GHCommitQueryBuilder until(Date dt) {
|
public GHCommitQueryBuilder until(Date dt) {
|
||||||
req.with("until", GitHub.printDate(dt));
|
req.with("until", GitHubClient.printDate(dt));
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import java.io.IOException;
|
|||||||
/**
|
/**
|
||||||
* Search commits.
|
* Search commits.
|
||||||
*
|
*
|
||||||
* @author Marc de Verdelhan
|
|
||||||
* @see GitHub#searchCommits() GitHub#searchCommits()
|
* @see GitHub#searchCommits() GitHub#searchCommits()
|
||||||
*/
|
*/
|
||||||
@Preview
|
@Preview
|
||||||
@@ -259,7 +258,7 @@ public class GHCommitSearchBuilder extends GHSearchBuilder<GHCommit> {
|
|||||||
if (StringUtils.isBlank(commitUrl)) {
|
if (StringUtils.isBlank(commitUrl)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
int indexOfUsername = (GitHub.GITHUB_URL + "/repos/").length();
|
int indexOfUsername = (GitHubClient.GITHUB_URL + "/repos/").length();
|
||||||
String[] tokens = commitUrl.substring(indexOfUsername).split("/", 3);
|
String[] tokens = commitUrl.substring(indexOfUsername).split("/", 3);
|
||||||
return tokens[0] + '/' + tokens[1];
|
return tokens[0] + '/' + tokens[1];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package org.kohsuke.github;
|
|||||||
/**
|
/**
|
||||||
* Represents the state of commit
|
* Represents the state of commit
|
||||||
*
|
*
|
||||||
* @author Kohsuke Kawaguchi
|
|
||||||
* @see GHCommitStatus
|
* @see GHCommitStatus
|
||||||
*/
|
*/
|
||||||
public enum GHCommitState {
|
public enum GHCommitState {
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import java.net.URL;
|
|||||||
/**
|
/**
|
||||||
* Represents a status of a commit.
|
* Represents a status of a commit.
|
||||||
*
|
*
|
||||||
* @author Kohsuke Kawaguchi
|
|
||||||
* @see GHRepository#getLastCommitStatus(String) GHRepository#getLastCommitStatus(String)
|
* @see GHRepository#getLastCommitStatus(String) GHRepository#getLastCommitStatus(String)
|
||||||
* @see GHCommit#getLastStatus() GHCommit#getLastStatus()
|
* @see GHCommit#getLastStatus() GHCommit#getLastStatus()
|
||||||
* @see GHRepository#createCommitStatus(String, GHCommitState, String, String) GHRepository#createCommitStatus(String,
|
* @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.
|
* The model user for comparing 2 commits in the GitHub API.
|
||||||
*
|
|
||||||
* @author Michael Clarke
|
|
||||||
*/
|
*/
|
||||||
public class GHCompare {
|
public class GHCompare {
|
||||||
|
|
||||||
@@ -27,7 +25,7 @@ public class GHCompare {
|
|||||||
* @return the url
|
* @return the url
|
||||||
*/
|
*/
|
||||||
public URL getUrl() {
|
public URL getUrl() {
|
||||||
return GitHub.parseURL(url);
|
return GitHubClient.parseURL(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -36,7 +34,7 @@ public class GHCompare {
|
|||||||
* @return the html url
|
* @return the html url
|
||||||
*/
|
*/
|
||||||
public URL getHtmlUrl() {
|
public URL getHtmlUrl() {
|
||||||
return GitHub.parseURL(html_url);
|
return GitHubClient.parseURL(html_url);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -45,7 +43,7 @@ public class GHCompare {
|
|||||||
* @return the permalink url
|
* @return the permalink url
|
||||||
*/
|
*/
|
||||||
public URL getPermalinkUrl() {
|
public URL getPermalinkUrl() {
|
||||||
return GitHub.parseURL(permalink_url);
|
return GitHubClient.parseURL(permalink_url);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -54,7 +52,7 @@ public class GHCompare {
|
|||||||
* @return the diff url
|
* @return the diff url
|
||||||
*/
|
*/
|
||||||
public URL getDiffUrl() {
|
public URL getDiffUrl() {
|
||||||
return GitHub.parseURL(diff_url);
|
return GitHubClient.parseURL(diff_url);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -63,7 +61,7 @@ public class GHCompare {
|
|||||||
* @return the patch url
|
* @return the patch url
|
||||||
*/
|
*/
|
||||||
public URL getPatchUrl() {
|
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.
|
* A Content of a repository.
|
||||||
*
|
*
|
||||||
* @author Alexandre COLLIGNON
|
|
||||||
* @see GHRepository#getFileContent(String) GHRepository#getFileContent(String)
|
* @see GHRepository#getFileContent(String) GHRepository#getFileContent(String)
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "UnusedDeclaration" })
|
@SuppressWarnings({ "UnusedDeclaration" })
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import java.util.Base64;
|
|||||||
* <p>
|
* <p>
|
||||||
* Call various methods to build up parameters, then call {@link #commit()} to make the change effective.
|
* Call various methods to build up parameters, then call {@link #commit()} to make the change effective.
|
||||||
*
|
*
|
||||||
* @author Kohsuke Kawaguchi
|
|
||||||
* @see GHRepository#createContent() GHRepository#createContent()
|
* @see GHRepository#createContent() GHRepository#createContent()
|
||||||
*/
|
*/
|
||||||
public final class GHContentBuilder {
|
public final class GHContentBuilder {
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package org.kohsuke.github;
|
|||||||
/**
|
/**
|
||||||
* Search code for {@link GHContent}.
|
* Search code for {@link GHContent}.
|
||||||
*
|
*
|
||||||
* @author Kohsuke Kawaguchi
|
|
||||||
* @see GitHub#searchContent() GitHub#searchContent()
|
* @see GitHub#searchContent() GitHub#searchContent()
|
||||||
*/
|
*/
|
||||||
public class GHContentSearchBuilder extends GHSearchBuilder<GHContent> {
|
public class GHContentSearchBuilder extends GHSearchBuilder<GHContent> {
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package org.kohsuke.github;
|
|||||||
/**
|
/**
|
||||||
* {@link GHContent} with license information.
|
* {@link GHContent} with license information.
|
||||||
*
|
*
|
||||||
* @author Kohsuke Kawaguchi
|
|
||||||
* @see <a href="https://developer.github.com/v3/licenses/#get-a-repositorys-license">documentation</a>
|
* @see <a href="https://developer.github.com/v3/licenses/#get-a-repositorys-license">documentation</a>
|
||||||
* @see GHRepository#getLicense()
|
* @see GHRepository#getLicense()
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -5,8 +5,6 @@ import java.net.URL;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a repository
|
* Creates a repository
|
||||||
*
|
|
||||||
* @author Kohsuke Kawaguchi
|
|
||||||
*/
|
*/
|
||||||
public class GHCreateRepositoryBuilder {
|
public class GHCreateRepositoryBuilder {
|
||||||
private final GitHub root;
|
private final GitHub root;
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ public class GHDeployment extends GHObject {
|
|||||||
* @return the statuses url
|
* @return the statuses url
|
||||||
*/
|
*/
|
||||||
public URL getStatusesUrl() {
|
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
|
* @return the repository url
|
||||||
*/
|
*/
|
||||||
public URL getRepositoryUrl() {
|
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
|
* @return the target url
|
||||||
*/
|
*/
|
||||||
public URL getTargetUrl() {
|
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
|
* @return the deployment url
|
||||||
*/
|
*/
|
||||||
public URL getDeploymentUrl() {
|
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
|
* @return the repository url
|
||||||
*/
|
*/
|
||||||
public URL getRepositoryUrl() {
|
public URL getRepositoryUrl() {
|
||||||
return GitHub.parseURL(repository_url);
|
return GitHubClient.parseURL(repository_url);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -2,8 +2,6 @@ package org.kohsuke.github;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Sort direction
|
* Sort direction
|
||||||
*
|
|
||||||
* @author Kohsuke Kawaguchi
|
|
||||||
*/
|
*/
|
||||||
public enum GHDirection {
|
public enum GHDirection {
|
||||||
ASC, DESC
|
ASC, DESC
|
||||||
|
|||||||
@@ -27,8 +27,6 @@ import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents an email of GitHub.
|
* Represents an email of GitHub.
|
||||||
*
|
|
||||||
* @author Kelly Campbell
|
|
||||||
*/
|
*/
|
||||||
@SuppressFBWarnings(
|
@SuppressFBWarnings(
|
||||||
value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD",
|
value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD",
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import java.util.Locale;
|
|||||||
/**
|
/**
|
||||||
* Hook event type.
|
* Hook event type.
|
||||||
*
|
*
|
||||||
* @author Kohsuke Kawaguchi
|
|
||||||
* @see GHEventInfo
|
* @see GHEventInfo
|
||||||
* @see <a href="https://developer.github.com/v3/activity/events/types/">Event type reference</a>
|
* @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.
|
* Represents an event.
|
||||||
*
|
|
||||||
* @author Kohsuke Kawaguchi
|
|
||||||
*/
|
*/
|
||||||
@SuppressFBWarnings(value = "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", justification = "JSON API")
|
@SuppressFBWarnings(value = "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", justification = "JSON API")
|
||||||
public class GHEventInfo {
|
public class GHEventInfo {
|
||||||
@@ -78,7 +76,7 @@ public class GHEventInfo {
|
|||||||
* @return the created at
|
* @return the created at
|
||||||
*/
|
*/
|
||||||
public Date getCreatedAt() {
|
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
|
* if payload cannot be parsed
|
||||||
*/
|
*/
|
||||||
public <T extends GHEventPayload> T getPayload(Class<T> type) throws IOException {
|
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);
|
v.wrapUp(root);
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1428,6 +1428,107 @@ public abstract class GHEventPayload {
|
|||||||
organization.wrapUp(root);
|
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.
|
* The type GHException.
|
||||||
*
|
|
||||||
* @author Kohsuke Kawaguchi
|
|
||||||
*/
|
*/
|
||||||
public class GHException extends RuntimeException {
|
public class GHException extends RuntimeException {
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,16 +1,14 @@
|
|||||||
package org.kohsuke.github;
|
package org.kohsuke.github;
|
||||||
|
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.net.HttpURLConnection;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.annotation.CheckForNull;
|
import javax.annotation.CheckForNull;
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Request/responce contains useful metadata. Custom exception allows store info for next diagnostics.
|
* Request/responce contains useful metadata. Custom exception allows store info for next diagnostics.
|
||||||
*
|
|
||||||
* @author Kanstantsin Shautsou
|
|
||||||
*/
|
*/
|
||||||
public class GHFileNotFoundException extends FileNotFoundException {
|
public class GHFileNotFoundException extends FileNotFoundException {
|
||||||
protected Map<String, List<String>> responseHeaderFields;
|
protected Map<String, List<String>> responseHeaderFields;
|
||||||
@@ -24,11 +22,24 @@ public class GHFileNotFoundException extends FileNotFoundException {
|
|||||||
/**
|
/**
|
||||||
* Instantiates a new Gh file not found exception.
|
* Instantiates a new Gh file not found exception.
|
||||||
*
|
*
|
||||||
* @param s
|
* @param message
|
||||||
* the s
|
* the message
|
||||||
*/
|
*/
|
||||||
public GHFileNotFoundException(String s) {
|
public GHFileNotFoundException(String message) {
|
||||||
super(s);
|
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;
|
return responseHeaderFields;
|
||||||
}
|
}
|
||||||
|
|
||||||
GHFileNotFoundException withResponseHeaderFields(HttpURLConnection urlConnection) {
|
GHFileNotFoundException withResponseHeaderFields(@Nonnull Map<String, List<String>> headerFields) {
|
||||||
this.responseHeaderFields = urlConnection.getHeaderFields();
|
this.responseHeaderFields = headerFields;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ import java.util.Map.Entry;
|
|||||||
/**
|
/**
|
||||||
* Gist
|
* Gist
|
||||||
*
|
*
|
||||||
* @author Kohsuke Kawaguchi
|
|
||||||
* @see GHUser#listGists() GHUser#listGists()
|
* @see GHUser#listGists() GHUser#listGists()
|
||||||
* @see GitHub#getGist(String) GitHub#getGist(String)
|
* @see GitHub#getGist(String) GitHub#getGist(String)
|
||||||
* @see GitHub#createGist() GitHub#createGist()
|
* @see GitHub#createGist() GitHub#createGist()
|
||||||
@@ -84,7 +83,7 @@ public class GHGist extends GHObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public URL getHtmlUrl() {
|
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.
|
* Builder pattern for creating a new Gist.
|
||||||
*
|
*
|
||||||
* @author Kohsuke Kawaguchi
|
|
||||||
* @see GitHub#createGist() GitHub#createGist()
|
* @see GitHub#createGist() GitHub#createGist()
|
||||||
*/
|
*/
|
||||||
public class GHGistBuilder {
|
public class GHGistBuilder {
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package org.kohsuke.github;
|
|||||||
/**
|
/**
|
||||||
* A file inside {@link GHGist}
|
* A file inside {@link GHGist}
|
||||||
*
|
*
|
||||||
* @author Kohsuke Kawaguchi
|
|
||||||
* @see GHGist#getFile(String) GHGist#getFile(String)
|
* @see GHGist#getFile(String) GHGist#getFile(String)
|
||||||
* @see GHGist#getFiles() GHGist#getFiles()
|
* @see GHGist#getFiles() GHGist#getFiles()
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -6,8 +6,6 @@ import java.util.LinkedHashMap;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Builder pattern for updating a Gist.
|
* Builder pattern for updating a Gist.
|
||||||
*
|
|
||||||
* @author Martin van Zijl
|
|
||||||
*/
|
*/
|
||||||
public class GHGistUpdater {
|
public class GHGistUpdater {
|
||||||
private final GHGist base;
|
private final GHGist base;
|
||||||
|
|||||||
@@ -12,8 +12,6 @@ import java.util.Map;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The type GHHook.
|
* The type GHHook.
|
||||||
*
|
|
||||||
* @author Kohsuke Kawaguchi
|
|
||||||
*/
|
*/
|
||||||
@SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD" },
|
@SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD" },
|
||||||
justification = "JSON API")
|
justification = "JSON API")
|
||||||
|
|||||||
@@ -1,16 +1,14 @@
|
|||||||
package org.kohsuke.github;
|
package org.kohsuke.github;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.HttpURLConnection;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import javax.annotation.CheckForNull;
|
import javax.annotation.CheckForNull;
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Request/responce contains useful metadata. Custom exception allows store info for next diagnostics.
|
* Request/responce contains useful metadata. Custom exception allows store info for next diagnostics.
|
||||||
*
|
|
||||||
* @author Kanstantsin Shautsou
|
|
||||||
*/
|
*/
|
||||||
public class GHIOException extends IOException {
|
public class GHIOException extends IOException {
|
||||||
protected Map<String, List<String>> responseHeaderFields;
|
protected Map<String, List<String>> responseHeaderFields;
|
||||||
@@ -31,6 +29,20 @@ public class GHIOException extends IOException {
|
|||||||
super(message);
|
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.
|
* Gets response header fields.
|
||||||
*
|
*
|
||||||
@@ -41,8 +53,8 @@ public class GHIOException extends IOException {
|
|||||||
return responseHeaderFields;
|
return responseHeaderFields;
|
||||||
}
|
}
|
||||||
|
|
||||||
GHIOException withResponseHeaderFields(HttpURLConnection urlConnection) {
|
GHIOException withResponseHeaderFields(@Nonnull Map<String, List<String>> headerFields) {
|
||||||
this.responseHeaderFields = urlConnection.getHeaderFields();
|
this.responseHeaderFields = headerFields;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -51,6 +51,6 @@ public class GHInvitation extends GHObject {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public URL getHtmlUrl() {
|
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 com.infradna.tool.bridge_method_injector.WithBridgeMethods;
|
||||||
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
@@ -42,7 +43,6 @@ import static org.kohsuke.github.Previews.SQUIRREL_GIRL;
|
|||||||
/**
|
/**
|
||||||
* Represents an issue on GitHub.
|
* Represents an issue on GitHub.
|
||||||
*
|
*
|
||||||
* @author Eric Maupin
|
|
||||||
* @author Kohsuke Kawaguchi
|
* @author Kohsuke Kawaguchi
|
||||||
* @see GHRepository#getIssue(int) GHRepository#getIssue(int)
|
* @see GHRepository#getIssue(int) GHRepository#getIssue(int)
|
||||||
* @see GitHub#searchIssues() GitHub#searchIssues()
|
* @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
|
* The HTML page of this issue, like https://github.com/jenkinsci/jenkins/issues/100
|
||||||
*/
|
*/
|
||||||
public URL getHtmlUrl() {
|
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
|
* @return the closed at
|
||||||
*/
|
*/
|
||||||
public Date getClosedAt() {
|
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
|
* @return the api url
|
||||||
*/
|
*/
|
||||||
public URL getApiURL() {
|
public URL getApiURL() {
|
||||||
return GitHub.parseURL(url);
|
return GitHubClient.parseURL(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -453,7 +453,7 @@ public class GHIssue extends GHObject implements Reactable {
|
|||||||
@Preview
|
@Preview
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public GHReaction createReaction(ReactionContent content) throws IOException {
|
public GHReaction createReaction(ReactionContent content) throws IOException {
|
||||||
return owner.root.createRequest()
|
return root.createRequest()
|
||||||
.method("POST")
|
.method("POST")
|
||||||
.withPreview(SQUIRREL_GIRL)
|
.withPreview(SQUIRREL_GIRL)
|
||||||
.with("content", content.getContent())
|
.with("content", content.getContent())
|
||||||
@@ -465,10 +465,10 @@ public class GHIssue extends GHObject implements Reactable {
|
|||||||
@Preview
|
@Preview
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public PagedIterable<GHReaction> listReactions() {
|
public PagedIterable<GHReaction> listReactions() {
|
||||||
return owner.root.createRequest()
|
return root.createRequest()
|
||||||
.withPreview(SQUIRREL_GIRL)
|
.withPreview(SQUIRREL_GIRL)
|
||||||
.withUrlPath(getApiRoute() + "/reactions")
|
.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
|
* @return the issues api route
|
||||||
*/
|
*/
|
||||||
protected String getIssuesApiRoute() {
|
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;
|
return "/repos/" + owner.getOwnerName() + "/" + owner.getName() + "/issues/" + number;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -677,7 +681,7 @@ public class GHIssue extends GHObject implements Reactable {
|
|||||||
* @return the diff url
|
* @return the diff url
|
||||||
*/
|
*/
|
||||||
public URL getDiffUrl() {
|
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
|
* @return the patch url
|
||||||
*/
|
*/
|
||||||
public URL getPatchUrl() {
|
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
|
* @return the url
|
||||||
*/
|
*/
|
||||||
public URL getUrl() {
|
public URL getUrl() {
|
||||||
return GitHub.parseURL(html_url);
|
return GitHubClient.parseURL(html_url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,8 +6,6 @@ import java.util.List;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The type GHIssueBuilder.
|
* The type GHIssueBuilder.
|
||||||
*
|
|
||||||
* @author Kohsuke Kawaguchi
|
|
||||||
*/
|
*/
|
||||||
public class GHIssueBuilder {
|
public class GHIssueBuilder {
|
||||||
private final GHRepository repo;
|
private final GHRepository repo;
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ import static org.kohsuke.github.Previews.*;
|
|||||||
/**
|
/**
|
||||||
* Comment to the issue
|
* Comment to the issue
|
||||||
*
|
*
|
||||||
* @author Kohsuke Kawaguchi
|
|
||||||
* @see GHIssue#comment(String) GHIssue#comment(String)
|
* @see GHIssue#comment(String) GHIssue#comment(String)
|
||||||
* @see GHIssue#listComments() GHIssue#listComments()
|
* @see GHIssue#listComments() GHIssue#listComments()
|
||||||
*/
|
*/
|
||||||
@@ -87,7 +86,7 @@ public class GHIssueComment extends GHObject implements Reactable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public URL getHtmlUrl() {
|
public URL getHtmlUrl() {
|
||||||
return GitHub.parseURL(html_url);
|
return GitHubClient.parseURL(html_url);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -4,8 +4,6 @@ import java.util.Date;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The type GHIssueEvent.
|
* The type GHIssueEvent.
|
||||||
*
|
|
||||||
* @author Martin van Zijl
|
|
||||||
*/
|
*/
|
||||||
public class GHIssueEvent {
|
public class GHIssueEvent {
|
||||||
private GitHub root;
|
private GitHub root;
|
||||||
@@ -90,7 +88,7 @@ public class GHIssueEvent {
|
|||||||
* @return the created at
|
* @return the created at
|
||||||
*/
|
*/
|
||||||
public Date getCreatedAt() {
|
public Date getCreatedAt() {
|
||||||
return GitHub.parseDate(created_at);
|
return GitHubClient.parseDate(created_at);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package org.kohsuke.github;
|
|||||||
/**
|
/**
|
||||||
* Search issues.
|
* Search issues.
|
||||||
*
|
*
|
||||||
* @author Kohsuke Kawaguchi
|
|
||||||
* @see GitHub#searchIssues() GitHub#searchIssues()
|
* @see GitHub#searchIssues() GitHub#searchIssues()
|
||||||
*/
|
*/
|
||||||
public class GHIssueSearchBuilder extends GHSearchBuilder<GHIssue> {
|
public class GHIssueSearchBuilder extends GHSearchBuilder<GHIssue> {
|
||||||
|
|||||||
@@ -5,8 +5,6 @@ import org.apache.commons.lang3.builder.ToStringBuilder;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* SSH public key.
|
* SSH public key.
|
||||||
*
|
|
||||||
* @author Kohsuke Kawaguchi
|
|
||||||
*/
|
*/
|
||||||
@SuppressFBWarnings(value = "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", justification = "JSON API")
|
@SuppressFBWarnings(value = "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", justification = "JSON API")
|
||||||
public class GHKey {
|
public class GHKey {
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import java.util.Objects;
|
|||||||
/**
|
/**
|
||||||
* The type GHLabel.
|
* The type GHLabel.
|
||||||
*
|
*
|
||||||
* @author Kohsuke Kawaguchi
|
|
||||||
* @see GHIssue#getLabels() GHIssue#getLabels()
|
* @see GHIssue#getLabels() GHIssue#getLabels()
|
||||||
* @see GHRepository#listLabels() GHRepository#listLabels()
|
* @see GHRepository#listLabels() GHRepository#listLabels()
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -35,7 +35,6 @@ import java.util.List;
|
|||||||
/**
|
/**
|
||||||
* The GitHub Preview API's license information
|
* The GitHub Preview API's license information
|
||||||
*
|
*
|
||||||
* @author Duncan Dickinson
|
|
||||||
* @see GitHub#getLicense(String) GitHub#getLicense(String)
|
* @see GitHub#getLicense(String) GitHub#getLicense(String)
|
||||||
* @see GHRepository#getLicense() GHRepository#getLicense()
|
* @see GHRepository#getLicense() GHRepository#getLicense()
|
||||||
* @see <a href="https://developer.github.com/v3/licenses/">https://developer.github.com/v3/licenses/</a>
|
* @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")
|
@WithBridgeMethods(value = String.class, adapterMethod = "urlToString")
|
||||||
public URL getUrl() {
|
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 {
|
public URL getHtmlUrl() throws IOException {
|
||||||
populate();
|
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.
|
* Base class for Github Marketplace Account.
|
||||||
*
|
*
|
||||||
* @author Paulo Miguel Almeida
|
|
||||||
* @see GitHub#getMyMarketplacePurchases()
|
* @see GitHub#getMyMarketplacePurchases()
|
||||||
* @see GHMarketplaceListAccountBuilder#createRequest()
|
* @see GHMarketplaceListAccountBuilder#createRequest()
|
||||||
*/
|
*/
|
||||||
@@ -37,7 +36,7 @@ public class GHMarketplaceAccount {
|
|||||||
* @return the url
|
* @return the url
|
||||||
*/
|
*/
|
||||||
public URL getUrl() {
|
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.
|
* A Github Marketplace Account Plan.
|
||||||
*
|
*
|
||||||
* @author Paulo Miguel Almeida
|
|
||||||
* @see GHMarketplaceListAccountBuilder#createRequest()
|
* @see GHMarketplaceListAccountBuilder#createRequest()
|
||||||
*/
|
*/
|
||||||
public class GHMarketplaceAccountPlan extends GHMarketplaceAccount {
|
public class GHMarketplaceAccountPlan extends GHMarketplaceAccount {
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import java.util.Locale;
|
|||||||
/**
|
/**
|
||||||
* GitHub Marketplace Account type.
|
* GitHub Marketplace Account type.
|
||||||
*
|
*
|
||||||
* @author Paulo Miguel Almeida
|
|
||||||
* @see GHMarketplaceAccount
|
* @see GHMarketplaceAccount
|
||||||
*/
|
*/
|
||||||
public enum GHMarketplaceAccountType {
|
public enum GHMarketplaceAccountType {
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import java.io.IOException;
|
|||||||
/**
|
/**
|
||||||
* Returns any accounts associated with a plan, including free plans
|
* Returns any accounts associated with a plan, including free plans
|
||||||
*
|
*
|
||||||
* @author Paulo Miguel Almeida
|
|
||||||
* @see GHMarketplacePlan#listAccounts()
|
* @see GHMarketplacePlan#listAccounts()
|
||||||
*/
|
*/
|
||||||
public class GHMarketplaceListAccountBuilder {
|
public class GHMarketplaceListAccountBuilder {
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import java.util.Date;
|
|||||||
/**
|
/**
|
||||||
* A Github Marketplace purchase pending change.
|
* A Github Marketplace purchase pending change.
|
||||||
*
|
*
|
||||||
* @author Paulo Miguel Almeida
|
|
||||||
* @see GHMarketplaceListAccountBuilder#createRequest()
|
* @see GHMarketplaceListAccountBuilder#createRequest()
|
||||||
*/
|
*/
|
||||||
public class GHMarketplacePendingChange {
|
public class GHMarketplacePendingChange {
|
||||||
@@ -68,7 +67,7 @@ public class GHMarketplacePendingChange {
|
|||||||
* @return the effective date
|
* @return the effective date
|
||||||
*/
|
*/
|
||||||
public Date getEffectiveDate() {
|
public Date getEffectiveDate() {
|
||||||
return GitHub.parseDate(effectiveDate);
|
return GitHubClient.parseDate(effectiveDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,6 @@ import java.util.List;
|
|||||||
/**
|
/**
|
||||||
* A Github Marketplace plan.
|
* A Github Marketplace plan.
|
||||||
*
|
*
|
||||||
* @author Paulo Miguel Almeida
|
|
||||||
* @see GitHub#listMarketplacePlans()
|
* @see GitHub#listMarketplacePlans()
|
||||||
*/
|
*/
|
||||||
public class GHMarketplacePlan {
|
public class GHMarketplacePlan {
|
||||||
@@ -47,7 +46,7 @@ public class GHMarketplacePlan {
|
|||||||
* @return the url
|
* @return the url
|
||||||
*/
|
*/
|
||||||
public URL getUrl() {
|
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.
|
* GitHub Marketplace plan pricing model.
|
||||||
*
|
*
|
||||||
* @author Paulo Miguel Almeida
|
|
||||||
* @see GHMarketplacePlan
|
* @see GHMarketplacePlan
|
||||||
*/
|
*/
|
||||||
public enum GHMarketplacePriceModel {
|
public enum GHMarketplacePriceModel {
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import java.util.Date;
|
|||||||
/**
|
/**
|
||||||
* A Github Marketplace purchase.
|
* A Github Marketplace purchase.
|
||||||
*
|
*
|
||||||
* @author Paulo Miguel Almeida
|
|
||||||
* @see GHMarketplaceListAccountBuilder#createRequest() GHMarketplaceListAccountBuilder#createRequest()
|
* @see GHMarketplaceListAccountBuilder#createRequest() GHMarketplaceListAccountBuilder#createRequest()
|
||||||
*/
|
*/
|
||||||
public class GHMarketplacePurchase {
|
public class GHMarketplacePurchase {
|
||||||
@@ -52,7 +51,7 @@ public class GHMarketplacePurchase {
|
|||||||
* @return the next billing date
|
* @return the next billing date
|
||||||
*/
|
*/
|
||||||
public Date getNextBillingDate() {
|
public Date getNextBillingDate() {
|
||||||
return GitHub.parseDate(nextBillingDate);
|
return GitHubClient.parseDate(nextBillingDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -70,7 +69,7 @@ public class GHMarketplacePurchase {
|
|||||||
* @return the free trial ends on
|
* @return the free trial ends on
|
||||||
*/
|
*/
|
||||||
public Date getFreeTrialEndsOn() {
|
public Date getFreeTrialEndsOn() {
|
||||||
return GitHub.parseDate(freeTrialEndsOn);
|
return GitHubClient.parseDate(freeTrialEndsOn);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -88,7 +87,7 @@ public class GHMarketplacePurchase {
|
|||||||
* @return the updated at
|
* @return the updated at
|
||||||
*/
|
*/
|
||||||
public Date getUpdatedAt() {
|
public Date getUpdatedAt() {
|
||||||
return GitHub.parseDate(updatedAt);
|
return GitHubClient.parseDate(updatedAt);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import java.util.Date;
|
|||||||
/**
|
/**
|
||||||
* Github Marketplace User Purchase
|
* Github Marketplace User Purchase
|
||||||
*
|
*
|
||||||
* @author Paulo Miguel Almeida
|
|
||||||
* @see GitHub#getMyMarketplacePurchases()
|
* @see GitHub#getMyMarketplacePurchases()
|
||||||
*/
|
*/
|
||||||
public class GHMarketplaceUserPurchase {
|
public class GHMarketplaceUserPurchase {
|
||||||
@@ -54,7 +53,7 @@ public class GHMarketplaceUserPurchase {
|
|||||||
* @return the next billing date
|
* @return the next billing date
|
||||||
*/
|
*/
|
||||||
public Date getNextBillingDate() {
|
public Date getNextBillingDate() {
|
||||||
return GitHub.parseDate(nextBillingDate);
|
return GitHubClient.parseDate(nextBillingDate);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -72,7 +71,7 @@ public class GHMarketplaceUserPurchase {
|
|||||||
* @return the free trial ends on
|
* @return the free trial ends on
|
||||||
*/
|
*/
|
||||||
public Date getFreeTrialEndsOn() {
|
public Date getFreeTrialEndsOn() {
|
||||||
return GitHub.parseDate(freeTrialEndsOn);
|
return GitHubClient.parseDate(freeTrialEndsOn);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -90,7 +89,7 @@ public class GHMarketplaceUserPurchase {
|
|||||||
* @return the updated at
|
* @return the updated at
|
||||||
*/
|
*/
|
||||||
public Date getUpdatedAt() {
|
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.
|
* Represents a membership of a user in an organization.
|
||||||
*
|
*
|
||||||
* @author Kohsuke Kawaguchi
|
|
||||||
* @see GHMyself#listOrgMemberships() GHMyself#listOrgMemberships()
|
* @see GHMyself#listOrgMemberships() GHMyself#listOrgMemberships()
|
||||||
*/
|
*/
|
||||||
public class GHMembership /* extends GHObject --- but it doesn't have id, created_at, etc. */ {
|
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
|
* @return the url
|
||||||
*/
|
*/
|
||||||
public URL getUrl() {
|
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.
|
* Class that wraps the list of GitHub's IP addresses.
|
||||||
*
|
*
|
||||||
* @author Paulo Miguel Almeida
|
|
||||||
* @see GitHub#getMeta() GitHub#getMeta()
|
* @see GitHub#getMeta() GitHub#getMeta()
|
||||||
* @see <a href="https://developer.github.com/v3/meta/#meta">Get Meta</a>
|
* @see <a href="https://developer.github.com/v3/meta/#meta">Get Meta</a>
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -7,8 +7,6 @@ import java.util.Locale;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The type GHMilestone.
|
* The type GHMilestone.
|
||||||
*
|
|
||||||
* @author Yusuke Kokubo
|
|
||||||
*/
|
*/
|
||||||
public class GHMilestone extends GHObject {
|
public class GHMilestone extends GHObject {
|
||||||
GitHub root;
|
GitHub root;
|
||||||
@@ -56,7 +54,7 @@ public class GHMilestone extends GHObject {
|
|||||||
public Date getDueOn() {
|
public Date getDueOn() {
|
||||||
if (due_on == null)
|
if (due_on == null)
|
||||||
return 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
|
* the io exception
|
||||||
*/
|
*/
|
||||||
public Date getClosedAt() throws IOException {
|
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() {
|
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
|
* the io exception
|
||||||
*/
|
*/
|
||||||
public void setDueOn(Date dueOn) throws IOException {
|
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.
|
* The enum GHMilestoneState.
|
||||||
*
|
|
||||||
* @author Yusuke Kokubo
|
|
||||||
*/
|
*/
|
||||||
public enum GHMilestoneState {
|
public enum GHMilestoneState {
|
||||||
OPEN, CLOSED
|
OPEN, CLOSED
|
||||||
|
|||||||
@@ -12,8 +12,6 @@ import java.util.TreeMap;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents the account that's logging into GitHub.
|
* Represents the account that's logging into GitHub.
|
||||||
*
|
|
||||||
* @author Kohsuke Kawaguchi
|
|
||||||
*/
|
*/
|
||||||
public class GHMyself extends GHUser {
|
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,
|
* 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.
|
* 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 GitHub#listNotifications() GitHub#listNotifications()
|
||||||
* @see GHRepository#listNotifications() GHRepository#listNotifications()
|
* @see GHRepository#listNotifications() GHRepository#listNotifications()
|
||||||
*/
|
*/
|
||||||
@@ -79,7 +78,7 @@ public class GHNotificationStream implements Iterable<GHThread> {
|
|||||||
* @return the gh notification stream
|
* @return the gh notification stream
|
||||||
*/
|
*/
|
||||||
public GHNotificationStream since(Date dt) {
|
public GHNotificationStream since(Date dt) {
|
||||||
since = GitHub.printDate(dt);
|
since = GitHubClient.printDate(dt);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -180,7 +179,11 @@ public class GHNotificationStream implements Iterable<GHThread> {
|
|||||||
|
|
||||||
req.setHeader("If-Modified-Since", lastModified);
|
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) {
|
if (threads == null) {
|
||||||
threads = EMPTY_ARRAY; // if unmodified, we get empty array
|
threads = EMPTY_ARRAY; // if unmodified, we get empty array
|
||||||
} else {
|
} else {
|
||||||
@@ -189,18 +192,16 @@ public class GHNotificationStream implements Iterable<GHThread> {
|
|||||||
}
|
}
|
||||||
idx = threads.length - 1;
|
idx = threads.length - 1;
|
||||||
|
|
||||||
nextCheckTime = calcNextCheckTime();
|
nextCheckTime = calcNextCheckTime(response);
|
||||||
lastModified = req.getResponseHeader("Last-Modified");
|
lastModified = response.headerField("Last-Modified");
|
||||||
}
|
}
|
||||||
} catch (IOException e) {
|
} catch (IOException | InterruptedException e) {
|
||||||
throw new RuntimeException(e);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private long calcNextCheckTime() {
|
private long calcNextCheckTime(GitHubResponse<GHThread[]> response) {
|
||||||
String v = req.getResponseHeader("X-Poll-Interval");
|
String v = response.headerField("X-Poll-Interval");
|
||||||
if (v == null)
|
if (v == null)
|
||||||
v = "60";
|
v = "60";
|
||||||
long seconds = Integer.parseInt(v);
|
long seconds = Integer.parseInt(v);
|
||||||
@@ -234,7 +235,7 @@ public class GHNotificationStream implements Iterable<GHThread> {
|
|||||||
public void markAsRead(long timestamp) throws IOException {
|
public void markAsRead(long timestamp) throws IOException {
|
||||||
final Requester req = root.createRequest();
|
final Requester req = root.createRequest();
|
||||||
if (timestamp >= 0)
|
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();
|
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
|
* 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 {
|
public class GHOTPRequiredException extends GHIOException {
|
||||||
// ...
|
// ...
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ public abstract class GHObject {
|
|||||||
*/
|
*/
|
||||||
@WithBridgeMethods(value = String.class, adapterMethod = "createdAtStr")
|
@WithBridgeMethods(value = String.class, adapterMethod = "createdAtStr")
|
||||||
public Date getCreatedAt() throws IOException {
|
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")
|
@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")
|
@WithBridgeMethods(value = String.class, adapterMethod = "urlToString")
|
||||||
public URL getUrl() {
|
public URL getUrl() {
|
||||||
return GitHub.parseURL(url);
|
return GitHubClient.parseURL(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -96,7 +96,7 @@ public abstract class GHObject {
|
|||||||
* on error
|
* on error
|
||||||
*/
|
*/
|
||||||
public Date getUpdatedAt() throws IOException {
|
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.
|
* The type GHOrganization.
|
||||||
*
|
|
||||||
* @author Kohsuke Kawaguchi
|
|
||||||
*/
|
*/
|
||||||
public class GHOrganization extends GHPerson {
|
public class GHOrganization extends GHPerson {
|
||||||
GHOrganization wrapUp(GitHub root) {
|
GHOrganization wrapUp(GitHub root) {
|
||||||
|
|||||||
@@ -2,8 +2,6 @@ package org.kohsuke.github;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The enum GHPermissionType.
|
* The enum GHPermissionType.
|
||||||
*
|
|
||||||
* @author Kohsuke Kawaguchi
|
|
||||||
*/
|
*/
|
||||||
public enum GHPermissionType {
|
public enum GHPermissionType {
|
||||||
ADMIN, WRITE, READ, NONE
|
ADMIN, WRITE, READ, NONE
|
||||||
|
|||||||
@@ -9,12 +9,11 @@ import java.util.Date;
|
|||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Optional;
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Common part of {@link GHUser} and {@link GHOrganization}.
|
* Common part of {@link GHUser} and {@link GHOrganization}.
|
||||||
*
|
|
||||||
* @author Kohsuke Kawaguchi
|
|
||||||
*/
|
*/
|
||||||
public abstract class GHPerson extends GHObject {
|
public abstract class GHPerson extends GHObject {
|
||||||
/* package almost final */ GitHub root;
|
/* package almost final */ GitHub root;
|
||||||
@@ -28,6 +27,9 @@ public abstract class GHPerson extends GHObject {
|
|||||||
protected int followers, following, public_repos, public_gists;
|
protected int followers, following, public_repos, public_gists;
|
||||||
protected boolean site_admin;
|
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) {
|
GHPerson wrapUp(GitHub root) {
|
||||||
this.root = root;
|
this.root = root;
|
||||||
return this;
|
return this;
|
||||||
@@ -114,9 +116,9 @@ public abstract class GHPerson extends GHObject {
|
|||||||
public synchronized Iterable<List<GHRepository>> iterateRepositories(final int pageSize) {
|
public synchronized Iterable<List<GHRepository>> iterateRepositories(final int pageSize) {
|
||||||
return new Iterable<List<GHRepository>>() {
|
return new Iterable<List<GHRepository>>() {
|
||||||
public Iterator<List<GHRepository>> iterator() {
|
public Iterator<List<GHRepository>> iterator() {
|
||||||
final Iterator<GHRepository[]> pager = root.createRequest()
|
final Iterator<GHRepository[]> pager = GitHubPageIterator.create(root.getClient(),
|
||||||
.withUrlPath("users", login, "repos")
|
GHRepository[].class,
|
||||||
.asIterator(GHRepository[].class, pageSize);
|
root.createRequest().withUrlPath("users", login, "repos").withPageSize(pageSize));
|
||||||
|
|
||||||
return new Iterator<List<GHRepository>>() {
|
return new Iterator<List<GHRepository>>() {
|
||||||
public boolean hasNext() {
|
public boolean hasNext() {
|
||||||
@@ -260,7 +262,7 @@ public abstract class GHPerson extends GHObject {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public URL getHtmlUrl() {
|
public URL getHtmlUrl() {
|
||||||
return GitHub.parseURL(html_url);
|
return GitHubClient.parseURL(html_url);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -346,4 +348,16 @@ public abstract class GHPerson extends GHObject {
|
|||||||
populate();
|
populate();
|
||||||
return site_admin;
|
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>
|
* @param <T>
|
||||||
* the type parameter
|
* the type parameter
|
||||||
* @author Kohsuke Kawaguchi
|
|
||||||
*/
|
*/
|
||||||
public class GHPersonSet<T extends GHPerson> extends HashSet<T> {
|
public class GHPersonSet<T extends GHPerson> extends HashSet<T> {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ import static org.kohsuke.github.Previews.INERTIA;
|
|||||||
/**
|
/**
|
||||||
* A GitHub project.
|
* A GitHub project.
|
||||||
*
|
*
|
||||||
* @author Martin van Zijl
|
|
||||||
* @see <a href="https://developer.github.com/v3/projects/">Projects</a>
|
* @see <a href="https://developer.github.com/v3/projects/">Projects</a>
|
||||||
*/
|
*/
|
||||||
public class GHProject extends GHObject {
|
public class GHProject extends GHObject {
|
||||||
@@ -51,7 +50,7 @@ public class GHProject extends GHObject {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public URL getHtmlUrl() throws IOException {
|
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
|
* @return the owner url
|
||||||
*/
|
*/
|
||||||
public URL getOwnerUrl() {
|
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.
|
* The type GHProjectCard.
|
||||||
*
|
|
||||||
* @author Gunnar Skjold
|
|
||||||
*/
|
*/
|
||||||
public class GHProjectCard extends GHObject {
|
public class GHProjectCard extends GHObject {
|
||||||
private GitHub root;
|
private GitHub root;
|
||||||
@@ -149,7 +147,7 @@ public class GHProjectCard extends GHObject {
|
|||||||
* @return the content url
|
* @return the content url
|
||||||
*/
|
*/
|
||||||
public URL getContentUrl() {
|
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
|
* @return the project url
|
||||||
*/
|
*/
|
||||||
public URL getProjectUrl() {
|
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
|
* @return the column url
|
||||||
*/
|
*/
|
||||||
public URL getColumnUrl() {
|
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.
|
* The type GHProjectColumn.
|
||||||
*
|
|
||||||
* @author Gunnar Skjold
|
|
||||||
*/
|
*/
|
||||||
public class GHProjectColumn extends GHObject {
|
public class GHProjectColumn extends GHObject {
|
||||||
protected GitHub root;
|
protected GitHub root;
|
||||||
@@ -90,7 +88,7 @@ public class GHProjectColumn extends GHObject {
|
|||||||
* @return the project url
|
* @return the project url
|
||||||
*/
|
*/
|
||||||
public URL getProjectUrl() {
|
public URL getProjectUrl() {
|
||||||
return GitHub.parseURL(project_url);
|
return GitHubClient.parseURL(project_url);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -23,6 +23,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.kohsuke.github;
|
package org.kohsuke.github;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -39,7 +41,6 @@ import static org.kohsuke.github.Previews.SHADOW_CAT;
|
|||||||
/**
|
/**
|
||||||
* A pull request.
|
* A pull request.
|
||||||
*
|
*
|
||||||
* @author Kohsuke Kawaguchi
|
|
||||||
* @see GHRepository#getPullRequest(int) GHRepository#getPullRequest(int)
|
* @see GHRepository#getPullRequest(int) GHRepository#getPullRequest(int)
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "UnusedDeclaration" })
|
@SuppressWarnings({ "UnusedDeclaration" })
|
||||||
@@ -99,6 +100,10 @@ public class GHPullRequest extends GHIssue implements Refreshable {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String getApiRoute() {
|
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;
|
return "/repos/" + owner.getOwnerName() + "/" + owner.getName() + "/pulls/" + number;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -108,7 +113,7 @@ public class GHPullRequest extends GHIssue implements Refreshable {
|
|||||||
* @return the patch url
|
* @return the patch url
|
||||||
*/
|
*/
|
||||||
public URL getPatchUrl() {
|
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
|
* @return the issue url
|
||||||
*/
|
*/
|
||||||
public URL getIssueUrl() {
|
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
|
* @return the diff url
|
||||||
*/
|
*/
|
||||||
public URL getDiffUrl() {
|
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
|
* @return the merged at
|
||||||
*/
|
*/
|
||||||
public Date getMergedAt() {
|
public Date getMergedAt() {
|
||||||
return GitHub.parseDate(merged_at);
|
return GitHubClient.parseDate(merged_at);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -31,7 +31,6 @@ import java.net.URL;
|
|||||||
/**
|
/**
|
||||||
* Commit detail inside a {@link GHPullRequest}.
|
* Commit detail inside a {@link GHPullRequest}.
|
||||||
*
|
*
|
||||||
* @author Luca Milanesio
|
|
||||||
* @see GHPullRequest#listCommits() GHPullRequest#listCommits()
|
* @see GHPullRequest#listCommits() GHPullRequest#listCommits()
|
||||||
*/
|
*/
|
||||||
@SuppressFBWarnings(
|
@SuppressFBWarnings(
|
||||||
@@ -75,7 +74,7 @@ public class GHPullRequestCommitDetail {
|
|||||||
* @return the url
|
* @return the url
|
||||||
*/
|
*/
|
||||||
public URL getUrl() {
|
public URL getUrl() {
|
||||||
return GitHub.parseURL(url);
|
return GitHubClient.parseURL(url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -125,7 +124,7 @@ public class GHPullRequestCommitDetail {
|
|||||||
* @return the url
|
* @return the url
|
||||||
*/
|
*/
|
||||||
public URL getUrl() {
|
public URL getUrl() {
|
||||||
return GitHub.parseURL(url);
|
return GitHubClient.parseURL(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -161,7 +160,7 @@ public class GHPullRequestCommitDetail {
|
|||||||
* @return the url
|
* @return the url
|
||||||
*/
|
*/
|
||||||
public URL getUrl() {
|
public URL getUrl() {
|
||||||
return GitHub.parseURL(url);
|
return GitHubClient.parseURL(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -170,7 +169,7 @@ public class GHPullRequestCommitDetail {
|
|||||||
* @return the html url
|
* @return the html url
|
||||||
*/
|
*/
|
||||||
public URL getHtml_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
|
* @return the api url
|
||||||
*/
|
*/
|
||||||
public URL getApiUrl() {
|
public URL getApiUrl() {
|
||||||
return GitHub.parseURL(url);
|
return GitHubClient.parseURL(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -223,7 +222,7 @@ public class GHPullRequestCommitDetail {
|
|||||||
* @return the url
|
* @return the url
|
||||||
*/
|
*/
|
||||||
public URL getUrl() {
|
public URL getUrl() {
|
||||||
return GitHub.parseURL(html_url);
|
return GitHubClient.parseURL(html_url);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -232,7 +231,7 @@ public class GHPullRequestCommitDetail {
|
|||||||
* @return the comments url
|
* @return the comments url
|
||||||
*/
|
*/
|
||||||
public URL getCommentsUrl() {
|
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}.
|
* File detail inside a {@link GHPullRequest}.
|
||||||
*
|
*
|
||||||
* @author Julien Henry
|
|
||||||
* @see GHPullRequest#listFiles() GHPullRequest#listFiles()
|
* @see GHPullRequest#listFiles() GHPullRequest#listFiles()
|
||||||
*/
|
*/
|
||||||
public class GHPullRequestFileDetail {
|
public class GHPullRequestFileDetail {
|
||||||
@@ -105,7 +104,7 @@ public class GHPullRequestFileDetail {
|
|||||||
* @return the blob url
|
* @return the blob url
|
||||||
*/
|
*/
|
||||||
public URL getBlobUrl() {
|
public URL getBlobUrl() {
|
||||||
return GitHub.parseURL(blob_url);
|
return GitHubClient.parseURL(blob_url);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -114,7 +113,7 @@ public class GHPullRequestFileDetail {
|
|||||||
* @return the raw url
|
* @return the raw url
|
||||||
*/
|
*/
|
||||||
public URL getRawUrl() {
|
public URL getRawUrl() {
|
||||||
return GitHub.parseURL(raw_url);
|
return GitHubClient.parseURL(raw_url);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -123,7 +122,7 @@ public class GHPullRequestFileDetail {
|
|||||||
* @return the contents url
|
* @return the contents url
|
||||||
*/
|
*/
|
||||||
public URL getContentsUrl() {
|
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.
|
* Lists up pull requests with some filtering and sorting.
|
||||||
*
|
*
|
||||||
* @author Kohsuke Kawaguchi
|
|
||||||
* @see GHRepository#queryPullRequests() GHRepository#queryPullRequests()
|
* @see GHRepository#queryPullRequests() GHRepository#queryPullRequests()
|
||||||
*/
|
*/
|
||||||
public class GHPullRequestQueryBuilder extends GHQueryBuilder<GHPullRequest> {
|
public class GHPullRequestQueryBuilder extends GHQueryBuilder<GHPullRequest> {
|
||||||
|
|||||||
@@ -122,7 +122,7 @@ public class GHPullRequestReview extends GHObject {
|
|||||||
* the io exception
|
* the io exception
|
||||||
*/
|
*/
|
||||||
public Date getSubmittedAt() throws IOException {
|
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}.
|
* Builds up a creation of new {@link GHPullRequestReview}.
|
||||||
*
|
*
|
||||||
* @author Kohsuke Kawaguchi
|
|
||||||
* @see GHPullRequest#createReview() GHPullRequest#createReview()
|
* @see GHPullRequest#createReview() GHPullRequest#createReview()
|
||||||
*/
|
*/
|
||||||
public class GHPullRequestReviewBuilder {
|
public class GHPullRequestReviewBuilder {
|
||||||
|
|||||||
@@ -33,7 +33,6 @@ import static org.kohsuke.github.Previews.*;
|
|||||||
/**
|
/**
|
||||||
* Review comment to the pull request
|
* Review comment to the pull request
|
||||||
*
|
*
|
||||||
* @author Julien Henry
|
|
||||||
* @see GHPullRequest#listReviewComments() GHPullRequest#listReviewComments()
|
* @see GHPullRequest#listReviewComments() GHPullRequest#listReviewComments()
|
||||||
* @see GHPullRequest#createReviewComment(String, String, String, int) GHPullRequest#createReviewComment(String, String,
|
* @see GHPullRequest#createReviewComment(String, String, String, int) GHPullRequest#createReviewComment(String, String,
|
||||||
* String, int)
|
* String, int)
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ package org.kohsuke.github;
|
|||||||
*
|
*
|
||||||
* @param <T>
|
* @param <T>
|
||||||
* the type parameter
|
* the type parameter
|
||||||
* @author Kohsuke Kawaguchi
|
|
||||||
*/
|
*/
|
||||||
public abstract class GHQueryBuilder<T> {
|
public abstract class GHQueryBuilder<T> {
|
||||||
protected final GitHub root;
|
protected final GitHub root;
|
||||||
|
|||||||
@@ -19,8 +19,6 @@ import static java.util.logging.Level.FINEST;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Rate limit.
|
* Rate limit.
|
||||||
*
|
|
||||||
* @author Kohsuke Kawaguchi
|
|
||||||
*/
|
*/
|
||||||
@SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD", justification = "JSON API")
|
@SuppressFBWarnings(value = "URF_UNREAD_PUBLIC_OR_PROTECTED_FIELD", justification = "JSON API")
|
||||||
public class GHRateLimit {
|
public class GHRateLimit {
|
||||||
@@ -219,6 +217,28 @@ public class GHRateLimit {
|
|||||||
return Objects.hash(getCore(), getSearch(), getGraphQL(), getIntegrationManifest());
|
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.
|
* A limit record used as a placeholder when the the actual limit is not known.
|
||||||
* <p>
|
* <p>
|
||||||
@@ -257,6 +277,8 @@ public class GHRateLimit {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* The time at which the current rate limit window resets in UTC epoch seconds.
|
* 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;
|
private final long resetEpochSeconds;
|
||||||
|
|
||||||
@@ -266,8 +288,12 @@ public class GHRateLimit {
|
|||||||
private final long createdAtEpochSeconds = System.currentTimeMillis() / 1000;
|
private final long createdAtEpochSeconds = System.currentTimeMillis() / 1000;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The calculated time at which the rate limit will reset. Recalculated if {@link #recalculateResetDate} is
|
* The time at which the rate limit will reset. This value is calculated based on
|
||||||
* called.
|
* {@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
|
@Nonnull
|
||||||
private Date resetDate;
|
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
|
* Recalculates the {@link #resetDate} relative to the local machine clock.
|
||||||
* the local created time for this record.
|
* <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
|
* @param updatedAt
|
||||||
* a string date in RFC 1123
|
* 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.
|
* 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() {
|
public long getResetEpochSeconds() {
|
||||||
return resetEpochSeconds;
|
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.
|
* @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.
|
* Reaction to issue, comment, PR, and so on.
|
||||||
*
|
*
|
||||||
* @author Kohsuke Kawaguchi
|
|
||||||
* @see Reactable
|
* @see Reactable
|
||||||
*/
|
*/
|
||||||
@Preview
|
@Preview
|
||||||
|
|||||||
@@ -7,8 +7,6 @@ import java.net.URL;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides information on a Git ref from GitHub.
|
* Provides information on a Git ref from GitHub.
|
||||||
*
|
|
||||||
* @author Michael Clarke
|
|
||||||
*/
|
*/
|
||||||
public class GHRef {
|
public class GHRef {
|
||||||
/* package almost final */ GitHub root;
|
/* package almost final */ GitHub root;
|
||||||
@@ -31,7 +29,7 @@ public class GHRef {
|
|||||||
* @return the url
|
* @return the url
|
||||||
*/
|
*/
|
||||||
public URL getUrl() {
|
public URL getUrl() {
|
||||||
return GitHub.parseURL(url);
|
return GitHubClient.parseURL(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -131,7 +129,7 @@ public class GHRef {
|
|||||||
* @return the url
|
* @return the url
|
||||||
*/
|
*/
|
||||||
public URL getUrl() {
|
public URL getUrl() {
|
||||||
return GitHub.parseURL(url);
|
return GitHubClient.parseURL(url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ public class GHRelease extends GHObject {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public URL getHtmlUrl() {
|
public URL getHtmlUrl() {
|
||||||
return GitHub.parseURL(html_url);
|
return GitHubClient.parseURL(html_url);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import java.io.IOException;
|
|||||||
/**
|
/**
|
||||||
* Modifies {@link GHRelease}.
|
* Modifies {@link GHRelease}.
|
||||||
*
|
*
|
||||||
* @author Kohsuke Kawaguchi
|
|
||||||
* @see GHRelease#update() GHRelease#update()
|
* @see GHRelease#update() GHRelease#update()
|
||||||
*/
|
*/
|
||||||
public class GHReleaseUpdater {
|
public class GHReleaseUpdater {
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ package org.kohsuke.github;
|
|||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import com.infradna.tool.bridge_method_injector.WithBridgeMethods;
|
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 edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
@@ -55,8 +57,6 @@ import static org.kohsuke.github.Previews.*;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* A repository on GitHub.
|
* A repository on GitHub.
|
||||||
*
|
|
||||||
* @author Kohsuke Kawaguchi
|
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "UnusedDeclaration" })
|
@SuppressWarnings({ "UnusedDeclaration" })
|
||||||
@SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD" },
|
@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() {
|
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.
|
* @return null if the repository was never pushed at.
|
||||||
*/
|
*/
|
||||||
public Date getPushedAt() {
|
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.
|
* Obtain permission for a given user in this repository.
|
||||||
*
|
*
|
||||||
* @param u
|
* @param u
|
||||||
* the u
|
* the user
|
||||||
* @return the permission
|
* @return the permission
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* the io exception
|
* the io exception
|
||||||
@@ -835,6 +835,20 @@ public class GHRepository extends GHObject {
|
|||||||
root.getOrganization(getOwnerName())))));
|
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.
|
* Add collaborators.
|
||||||
*
|
*
|
||||||
@@ -856,7 +870,21 @@ public class GHRepository extends GHObject {
|
|||||||
* the io exception
|
* the io exception
|
||||||
*/
|
*/
|
||||||
public void addCollaborators(Collection<GHUser> users) throws IOException {
|
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
|
* the io exception
|
||||||
*/
|
*/
|
||||||
public void removeCollaborators(Collection<GHUser> users) throws IOException {
|
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) {
|
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.
|
* Search repositories.
|
||||||
*
|
*
|
||||||
* @author Kohsuke Kawaguchi
|
|
||||||
* @see GitHub#searchRepositories() GitHub#searchRepositories()
|
* @see GitHub#searchRepositories() GitHub#searchRepositories()
|
||||||
*/
|
*/
|
||||||
public class GHRepositorySearchBuilder extends GHSearchBuilder<GHRepository> {
|
public class GHRepositorySearchBuilder extends GHSearchBuilder<GHRepository> {
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import java.util.Locale;
|
|||||||
/**
|
/**
|
||||||
* App installation repository selection.
|
* App installation repository selection.
|
||||||
*
|
*
|
||||||
* @author Paulo Miguel Almeida
|
|
||||||
* @see GHAppInstallation
|
* @see GHAppInstallation
|
||||||
*/
|
*/
|
||||||
public enum GHRepositorySelection {
|
public enum GHRepositorySelection {
|
||||||
|
|||||||
@@ -12,8 +12,6 @@ import java.util.NoSuchElementException;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Statistics for a GitHub repository.
|
* Statistics for a GitHub repository.
|
||||||
*
|
|
||||||
* @author Martin van Zijl
|
|
||||||
*/
|
*/
|
||||||
public class GHRepositoryStatistics {
|
public class GHRepositoryStatistics {
|
||||||
|
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ public abstract class GHRepositoryTraffic implements TrafficInfo {
|
|||||||
* @return the timestamp
|
* @return the timestamp
|
||||||
*/
|
*/
|
||||||
public Date getTimestamp() {
|
public Date getTimestamp() {
|
||||||
return GitHub.parseDate(timestamp);
|
return GitHubClient.parseDate(timestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getCount() {
|
public int getCount() {
|
||||||
|
|||||||
@@ -2,15 +2,17 @@ package org.kohsuke.github;
|
|||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
|
import java.net.MalformedURLException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import javax.annotation.Nonnull;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base class for various search builders.
|
* Base class for various search builders.
|
||||||
*
|
*
|
||||||
* @param <T>
|
* @param <T>
|
||||||
* the type parameter
|
* the type parameter
|
||||||
* @author Kohsuke Kawaguchi
|
|
||||||
*/
|
*/
|
||||||
public abstract class GHSearchBuilder<T> extends GHQueryBuilder<T> {
|
public abstract class GHSearchBuilder<T> extends GHQueryBuilder<T> {
|
||||||
protected final List<String> terms = new ArrayList<String>();
|
protected final List<String> terms = new ArrayList<String>();
|
||||||
@@ -42,16 +44,26 @@ public abstract class GHSearchBuilder<T> extends GHQueryBuilder<T> {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public PagedSearchIterable<T> list() {
|
public PagedSearchIterable<T> list() {
|
||||||
return new PagedSearchIterable<T>(root) {
|
|
||||||
public PagedIterator<T> _iterator(int pageSize) {
|
req.set("q", StringUtils.join(terms, " "));
|
||||||
req.set("q", StringUtils.join(terms, " "));
|
try {
|
||||||
return new PagedIterator<T>(adapt(req.withUrlPath(getApiUrl()).asIterator(receiverType, pageSize))) {
|
final GitHubRequest baseRequest = req.build();
|
||||||
protected void wrapUp(T[] page) {
|
return new PagedSearchIterable<T>(root) {
|
||||||
// SearchResult.getItems() should do it
|
@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.
|
* A stargazer at a repository on GitHub.
|
||||||
*
|
|
||||||
* @author noctarius
|
|
||||||
*/
|
*/
|
||||||
@SuppressFBWarnings(value = { "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD" }, justification = "JSON API")
|
@SuppressFBWarnings(value = { "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD" }, justification = "JSON API")
|
||||||
public class GHStargazer {
|
public class GHStargazer {
|
||||||
@@ -32,7 +30,7 @@ public class GHStargazer {
|
|||||||
* @return the date the stargazer was added
|
* @return the date the stargazer was added
|
||||||
*/
|
*/
|
||||||
public Date getStarredAt() {
|
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..
|
* Represents your subscribing to a repository / conversation thread..
|
||||||
*
|
*
|
||||||
* @author Kohsuke Kawaguchi
|
|
||||||
* @see GHRepository#getSubscription() GHRepository#getSubscription()
|
* @see GHRepository#getSubscription() GHRepository#getSubscription()
|
||||||
* @see GHThread#getSubscription() GHThread#getSubscription()
|
* @see GHThread#getSubscription() GHThread#getSubscription()
|
||||||
*/
|
*/
|
||||||
@@ -23,7 +22,7 @@ public class GHSubscription {
|
|||||||
* @return the created at
|
* @return the created at
|
||||||
*/
|
*/
|
||||||
public Date getCreatedAt() {
|
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.
|
* App installation target type.
|
||||||
*
|
*
|
||||||
* @author Paulo Miguel Almeida
|
|
||||||
* @see GHAppInstallation
|
* @see GHAppInstallation
|
||||||
*/
|
*/
|
||||||
public enum GHTargetType {
|
public enum GHTargetType {
|
||||||
|
|||||||
@@ -8,8 +8,6 @@ import java.util.TreeMap;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* A team in GitHub organization.
|
* A team in GitHub organization.
|
||||||
*
|
|
||||||
* @author Kohsuke Kawaguchi
|
|
||||||
*/
|
*/
|
||||||
public class GHTeam implements Refreshable {
|
public class GHTeam implements Refreshable {
|
||||||
private String name;
|
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