Compare commits

...

1357 Commits

Author SHA1 Message Date
Liam Newman
dbf6d3bf37 [maven-release-plugin] prepare release github-api-1.129 2021-05-24 05:08:42 -07:00
Liam Newman
081a454ec8 Merge pull request #1141 from hub4j/bitwiseman-patch-1
Only run coverage on code in this library
2021-05-17 14:47:00 -07:00
Liam Newman
543b643fdb Only run coverage on code in this library 2021-05-17 13:55:18 -07:00
Liam Newman
d02f194668 Update release-drafter.yml 2021-05-13 13:03:08 -07:00
Liam Newman
9c8c00b77c Update release-drafter.yml 2021-05-13 12:55:43 -07:00
Liam Newman
a23de4707b Create release-drafter.yml 2021-05-13 12:54:38 -07:00
Liam Newman
301303bd90 Merge pull request #1139 from akashRindhe/feature/1080
(feat) Add method to check if Organization has projects enabled
2021-05-13 11:26:07 -07:00
Akash Rindhe
4689b8f885 (feat) Add method to set projects enabled flag for Organization
[https://github.com/hub4j/github-api/issues/1080]
2021-05-14 00:36:55 +08:00
Akash Rindhe
c4de682493 (feat) Add method to check if Organization has projects enabled
[https://github.com/hub4j/github-api/issues/1080]
2021-05-14 00:35:22 +08:00
Liam Newman
b23934a5a1 Merge pull request #1134 from bitwiseman/task/atomic
Minimize locking for rate limit
2021-05-11 10:26:00 -07:00
Liam Newman
f2eecc3cc5 Update src/main/java/org/kohsuke/github/GHRateLimit.java 2021-05-06 14:37:11 -07:00
dependabot[bot]
f5310965dc Merge pull request #1114 from hub4j/dependabot/github_actions/actions/setup-java-v2 2021-05-04 21:38:47 +00:00
Tim Jacomb
47ffff3407 Update maven-build.yml 2021-05-04 22:33:24 +01:00
Liam Newman
f2a70a46ad Minimize locking for rate limit
Rather than locking to ensure ordered updates to rate limit, use AtomicReference. This reduces
the need for locking to only when rate limit has expired and we have to call getRateLimit().
2021-05-04 12:29:05 -07:00
dependabot[bot]
acd5c6baa6 Chore(deps): Bump actions/setup-java from v1 to v2
Bumps [actions/setup-java](https://github.com/actions/setup-java) from v1 to v2.
- [Release notes](https://github.com/actions/setup-java/releases)
- [Commits](https://github.com/actions/setup-java/compare/v1...8764a52df183aa0ccea74521dfd9d506ffc7a19a)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-04 19:25:01 +00:00
Liam Newman
06d02059cb Merge pull request #1131 from hub4j/dependabot/maven/org.apache.maven.plugins-maven-project-info-reports-plugin-3.1.2
Chore(deps): Bump maven-project-info-reports-plugin from 3.1.1 to 3.1.2
2021-05-04 12:24:38 -07:00
Liam Newman
603288c361 Merge pull request #1132 from hub4j/dependabot/maven/com.diffplug.spotless-spotless-maven-plugin-2.10.3
Chore(deps): Bump spotless-maven-plugin from 2.10.1 to 2.10.3
2021-05-04 12:24:24 -07:00
dependabot[bot]
09ee3168f9 Chore(deps): Bump spotless-maven-plugin from 2.10.1 to 2.10.3
Bumps [spotless-maven-plugin](https://github.com/diffplug/project) from 2.10.1 to 2.10.3.
- [Release notes](https://github.com/diffplug/project/releases)
- [Commits](https://github.com/diffplug/project/commits)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-01 02:01:02 +00:00
dependabot[bot]
1559d063c7 Chore(deps): Bump maven-project-info-reports-plugin from 3.1.1 to 3.1.2
Bumps [maven-project-info-reports-plugin](https://github.com/apache/maven-project-info-reports-plugin) from 3.1.1 to 3.1.2.
- [Release notes](https://github.com/apache/maven-project-info-reports-plugin/releases)
- [Commits](https://github.com/apache/maven-project-info-reports-plugin/compare/maven-project-info-reports-plugin-3.1.1...maven-project-info-reports-plugin-3.1.2)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-01 02:00:57 +00:00
Liam Newman
cfdcb182a4 Merge pull request #1124 from alexanderkjall/upgrade-commons-io
upgrade commons-io due to CVE-2021-29425
2021-04-29 08:41:16 -07:00
Liam Newman
d526b13d7d Apply suggestions from code review
Co-authored-by: Guillaume Smet <guillaume.smet@gmail.com>
2021-04-28 13:33:13 -07:00
Liam Newman
fffe31220e Make apache commons restrictions more accurate and legible 2021-04-27 15:19:46 -07:00
Liam Newman
ce17396ea6 Merge branch 'main' into upgrade-commons-io 2021-04-27 02:33:44 -07:00
Liam Newman
d18e81dc74 More informative message 2021-04-26 21:13:09 -07:00
Liam Newman
6ae5acba5d Fix typo 2021-04-26 21:08:59 -07:00
Liam Newman
0a1c803f69 Test for approved Apache commons methods
This is an inaccurate way of verifying that we are calling only methods that are
compatible with older versions of commons, but it should be sufficient to deter
usage without careful consideration.
2021-04-26 20:39:27 -07:00
Liam Newman
fa0865b208 Fix assertThat arch test 2021-04-26 14:27:28 -07:00
Liam Newman
886887913c Merge pull request #1126 from akashRindhe/refactor/1099
(refactor) Replace complex parsing logic from GHEvent.type to GHEvent with static mapping
2021-04-21 23:53:10 -07:00
Liam Newman
5c64fec032 Streamline with EnumUtils 2021-04-21 16:57:37 -07:00
Liam Newman
892f60ea16 [maven-release-plugin] prepare for next development iteration 2021-04-21 11:05:58 -07:00
Liam Newman
f28f966040 [maven-release-plugin] prepare release github-api-1.128 2021-04-21 11:05:43 -07:00
Liam Newman
0e9cc90d31 Merge pull request #1125 from gsmet/remove-jdk-16-workaround
Remove now unnecessary JDK 16 specific workaround
2021-04-21 08:11:51 -07:00
Akash Rindhe
72dc5c5d18 (refactor) Replace complex parsing logic from GHEvent.type to GHEvent with static mapping
[https://github.com/hub4j/github-api/issues/1099]
2021-04-21 20:07:10 +08:00
Guillaume Smet
02e02d39b0 Remove now unnecessary JDK 16 specific workaround
Now that we are not using reflection anymore to push unsupported HTTP
methods, we can remove this workaround.
2021-04-21 13:29:33 +02:00
Alexander Kjäll
e629a23bd4 upgrade commons-io due to CVE-2021-29425, it's a vulnerability in FileNameUtils.normalize that isn't used in this project 2021-04-21 11:37:38 +02:00
Liam Newman
f6e8a2c7c6 Merge pull request #1123 from bitwiseman/task/assertThat
Move to using assertThat() exclusively
2021-04-20 13:59:24 -07:00
Liam Newman
76bea5174f Merge branch 'main' into task/assertThat 2021-04-20 13:43:04 -07:00
Liam Newman
2be27d1a41 Update maven-build.yml 2021-04-20 13:42:48 -07:00
Liam Newman
cd1454ac03 More assertThat matchers 2021-04-20 12:34:01 -07:00
Liam Newman
b550910f4c Streamline assertThat calls using appropriate matchers 2021-04-20 12:16:55 -07:00
Liam Newman
d13e490be2 Enforce use of assertThat
Assert.assert* methods other than assertThat() produce less clear tests.
This change enforces using assertThat() for all verifications.
While more verbose they are generally more consistent and easier to understand.
2021-04-20 00:46:43 -07:00
Liam Newman
3d451526ef Deprecate all asserts other than assertThat 2021-04-19 19:09:47 -07:00
Liam Newman
bd38897d48 Do not inherit from Assert 2021-04-19 15:58:33 -07:00
Liam Newman
63ccbaf064 Merge pull request #1116 from hub4j/dependabot/maven/spotbugs.version-4.2.3
Chore(deps): Bump spotbugs.version from 4.2.2 to 4.2.3
2021-04-19 13:44:18 -07:00
Liam Newman
2beb806b8a Merge pull request #1120 from hub4j/dependabot/maven/com.fasterxml.jackson.core-jackson-databind-2.12.3
Chore(deps): Bump jackson-databind from 2.12.1 to 2.12.3
2021-04-19 13:44:02 -07:00
dependabot[bot]
552ba6693e Chore(deps): Bump spotbugs.version from 4.2.2 to 4.2.3
Bumps `spotbugs.version` from 4.2.2 to 4.2.3.

Updates `spotbugs` from 4.2.2 to 4.2.3
- [Release notes](https://github.com/spotbugs/spotbugs/releases)
- [Changelog](https://github.com/spotbugs/spotbugs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/spotbugs/spotbugs/compare/4.2.2...4.2.3)

Updates `spotbugs-annotations` from 4.2.2 to 4.2.3
- [Release notes](https://github.com/spotbugs/spotbugs/releases)
- [Changelog](https://github.com/spotbugs/spotbugs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/spotbugs/spotbugs/compare/4.2.2...4.2.3)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-19 20:42:57 +00:00
dependabot[bot]
2452add4d7 Chore(deps): Bump jackson-databind from 2.12.1 to 2.12.3
Bumps [jackson-databind](https://github.com/FasterXML/jackson) from 2.12.1 to 2.12.3.
- [Release notes](https://github.com/FasterXML/jackson/releases)
- [Commits](https://github.com/FasterXML/jackson/commits)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-19 20:42:56 +00:00
Liam Newman
0dc931ceed Merge pull request #1115 from hub4j/dependabot/github_actions/actions/cache-v2.1.5
Chore(deps): Bump actions/cache from v2.1.4 to v2.1.5
2021-04-19 13:42:48 -07:00
Liam Newman
1dfedc6a58 Merge pull request #1117 from hub4j/dependabot/maven/com.diffplug.spotless-spotless-maven-plugin-2.10.1
Chore(deps): Bump spotless-maven-plugin from 2.9.0 to 2.10.1
2021-04-19 13:42:32 -07:00
dependabot[bot]
e33046a624 Chore(deps): Bump actions/cache from v2.1.4 to v2.1.5
Bumps [actions/cache](https://github.com/actions/cache) from v2.1.4 to v2.1.5.
- [Release notes](https://github.com/actions/cache/releases)
- [Commits](https://github.com/actions/cache/compare/v2.1.4...1a9e2138d905efd099035b49d8b7a3888c653ca8)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-19 20:42:30 +00:00
dependabot[bot]
002b3f03da Chore(deps): Bump spotless-maven-plugin from 2.9.0 to 2.10.1
Bumps [spotless-maven-plugin](https://github.com/diffplug/project) from 2.9.0 to 2.10.1.
- [Release notes](https://github.com/diffplug/project/releases)
- [Commits](https://github.com/diffplug/project/commits)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-19 20:42:26 +00:00
Liam Newman
fd1817d111 Merge pull request #1122 from hub4j/dependabot/maven/org.mockito-mockito-core-3.9.0
Chore(deps-dev): Bump mockito-core from 3.8.0 to 3.9.0
2021-04-19 13:42:20 -07:00
Liam Newman
7526b46f9d Merge pull request #1121 from hub4j/dependabot/maven/org.kohsuke.stapler-stapler-1.263
Chore(deps-dev): Bump stapler from 1.262 to 1.263
2021-04-19 13:42:07 -07:00
dependabot[bot]
169fd18a54 Chore(deps-dev): Bump mockito-core from 3.8.0 to 3.9.0
Bumps [mockito-core](https://github.com/mockito/mockito) from 3.8.0 to 3.9.0.
- [Release notes](https://github.com/mockito/mockito/releases)
- [Commits](https://github.com/mockito/mockito/compare/v3.8.0...v3.9.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-19 20:41:49 +00:00
Liam Newman
0708812456 Merge pull request #1113 from hub4j/dependabot/maven/com.github.spotbugs-spotbugs-maven-plugin-4.2.3
Chore(deps): Bump spotbugs-maven-plugin from 4.2.0 to 4.2.3
2021-04-19 13:41:26 -07:00
dependabot[bot]
7d86070ac8 Chore(deps-dev): Bump stapler from 1.262 to 1.263
Bumps [stapler](https://github.com/stapler/stapler) from 1.262 to 1.263.
- [Release notes](https://github.com/stapler/stapler/releases)
- [Changelog](https://github.com/stapler/stapler/blob/master/CHANGELOG.md)
- [Commits](https://github.com/stapler/stapler/compare/stapler-parent-1.262...stapler-parent-1.263)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-19 20:41:24 +00:00
dependabot[bot]
713b85f9de Chore(deps): Bump spotbugs-maven-plugin from 4.2.0 to 4.2.3
Bumps [spotbugs-maven-plugin](https://github.com/spotbugs/spotbugs-maven-plugin) from 4.2.0 to 4.2.3.
- [Release notes](https://github.com/spotbugs/spotbugs-maven-plugin/releases)
- [Commits](https://github.com/spotbugs/spotbugs-maven-plugin/compare/spotbugs-maven-plugin-4.2.0...spotbugs-maven-plugin-4.2.3)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-19 20:41:20 +00:00
Liam Newman
4fef5bb1fc Merge pull request #1112 from hub4j/dependabot/github_actions/codecov/codecov-action-v1.4.0
Chore(deps): Bump codecov/codecov-action from v1.3.2 to v1.4.0
2021-04-19 13:41:14 -07:00
Liam Newman
f3eadcddb6 Merge pull request #1111 from hub4j/dependabot/maven/com.tngtech.archunit-archunit-0.18.0
Chore(deps-dev): Bump archunit from 0.17.0 to 0.18.0
2021-04-19 13:41:02 -07:00
Liam Newman
237171727d Merge pull request #1118 from hub4j/dependabot/maven/org.kohsuke-wordnet-random-name-1.5
Chore(deps-dev): Bump wordnet-random-name from 1.3 to 1.5
2021-04-19 13:40:40 -07:00
Liam Newman
31212d33ae Merge pull request #1119 from bitwiseman/task/main
Switch to 'main' as default branch
2021-04-19 13:40:13 -07:00
Liam Newman
8af66133d2 Switch to 'main' as default branch 2021-04-19 13:27:44 -07:00
dependabot[bot]
9578e027b1 Chore(deps-dev): Bump wordnet-random-name from 1.3 to 1.5
Bumps [wordnet-random-name](https://github.com/kohsuke/wordnet-random-name) from 1.3 to 1.5.
- [Release notes](https://github.com/kohsuke/wordnet-random-name/releases)
- [Commits](https://github.com/kohsuke/wordnet-random-name/compare/wordnet-random-name-1.3...wordnet-random-name-1.5)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-19 20:10:36 +00:00
dependabot[bot]
2c75b42b4e Chore(deps): Bump codecov/codecov-action from v1.3.2 to v1.4.0
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from v1.3.2 to v1.4.0.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/master/CHANGELOG.md)
- [Commits](https://github.com/codecov/codecov-action/compare/v1.3.2...0e28ff86a50029a44d10df6ed4c308711925a6a8)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-19 20:10:13 +00:00
dependabot[bot]
7854b30a76 Chore(deps-dev): Bump archunit from 0.17.0 to 0.18.0
Bumps [archunit](https://github.com/TNG/ArchUnit) from 0.17.0 to 0.18.0.
- [Release notes](https://github.com/TNG/ArchUnit/releases)
- [Commits](https://github.com/TNG/ArchUnit/compare/v0.17.0...v0.18.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-19 20:10:09 +00:00
Liam Newman
cf2571858c Merge pull request #1107 from akashRindhe/feat/1076
(refactor) Rename gitHubBeforeAfter to nonRecordingGitHub #1076
2021-04-19 10:08:35 -07:00
Akash Rindhe
092815747a (refactor) Rename gitHubBeforeAfter to nonRecordingGitHub #1076
[#1076]
2021-04-18 18:41:10 +08:00
Liam Newman
649d7ed87f Merge pull request #1106 from bitwiseman/issue/1103
GHRepository#listLanguages returns correct Map type
2021-04-16 16:04:57 -07:00
Liam Newman
684560ef67 GHRepository#listLanguages returns correct Map type
This is a less than perfect solution, but it is sufficient to solve the current issue
without risking further side-effects.

Fixes #1103
2021-04-16 14:25:28 -07:00
Liam Newman
adf054ba5d Merge pull request #1105 from akashRindhe/feature/1050
GHIssue.addLabels and removeLabels() should return List<GHLabel> not void [#1050]
2021-04-16 13:10:04 -07:00
Liam Newman
dcdfee67cd Cover more code paths using existing test 2021-04-16 13:00:42 -07:00
Akash Rindhe
9d7209ec62 Merge branch 'master' into feature/1050 2021-04-17 00:23:46 +08:00
Akash Rindhe
b97e8a2c38 (feat) Return GHLabel list instead of void on GHIssue#removeLabel(s) #1050
Includes BridgeMethod annotation to keep binary compatibility
(https://github.com/hub4j/github-api/issues/1050)
2021-04-17 00:22:52 +08:00
Akash Rindhe
8bd3f391da (feat) Return GHLabel list instead of void on GHIssue#addLabels #1050
Includes BridgeMethod annotation to keep binary compatibility
(https://github.com/hub4j/github-api/issues/1050)
2021-04-17 00:06:50 +08:00
Liam Newman
5d0dbf6e2f Merge pull request #1101 from breandan/breandan-patch
Add sort and order parameters to GHContentSearchBuilder
2021-04-15 23:26:47 -07:00
Liam Newman
38f3595552 Streamline code paths 2021-04-15 15:29:50 -07:00
Liam Newman
b72e7fa2ee Add BEST_MATCH and expand test 2021-04-15 14:49:23 -07:00
breandan
659b32f5ec update test data 2021-04-15 16:49:24 -04:00
breandan
d0c326bbf5 apply spotless formatting 2021-04-15 16:42:15 -04:00
breandan
4a5aceb1f9 add content and order parameters to GHContentSearchBuilder as per #1088 2021-04-15 16:29:23 -04:00
Liam Newman
884248930e Merge pull request #1096 from gsmet/add-event-schedule
Add SCHEDULE to GHEvent and add UNKNOWN handling to GHEvent
2021-04-14 15:58:52 -07:00
Liam Newman
530d524366 Merge pull request #1095 from gsmet/no-log-on-cancel
Log 202 message at the FINE level
2021-04-14 15:04:38 -07:00
Guillaume Smet
5957da3d6d Log 202 message at the FINE level 2021-04-14 18:43:52 +02:00
Guillaume Smet
6efe428f57 Log a warning when we have an unknown enum value
Can be useful to catch values we should add instead of simply ignoring
them.
2021-04-14 18:36:36 +02:00
Guillaume Smet
25b9a2ce33 Return GHEvent.UNKNOWN in GHEventInfo.getType() if unknown 2021-04-14 18:36:13 +02:00
Guillaume Smet
0ce78016cc Be more permissive about GHEvent parsing 2021-04-14 16:31:57 +02:00
Guillaume Smet
696dd90b23 Add SCHEDULE to GHEvent
This is a valid event for scheduled workflow runs.
2021-04-14 16:26:43 +02:00
Liam Newman
e66a72387e Merge pull request #1093 from bitwiseman/task/codecov
Ignore ObsoleteUrlFactory
2021-04-12 15:52:58 -07:00
Liam Newman
874ce23dd7 Improve coverage of GitHubClient 2021-04-12 15:19:48 -07:00
Liam Newman
7479cac9a7 Ignore more 2021-04-12 14:21:19 -07:00
Liam Newman
064ce1b0bc Test again 2021-04-12 14:12:26 -07:00
Liam Newman
941573af49 One more attempt to ignore obsolete code 2021-04-12 14:00:18 -07:00
Liam Newman
2f9ff32176 Update and rename .github/codecov.yml to codecov.yml 2021-04-12 11:49:38 -07:00
Liam Newman
b84d5a7c39 Ignore ObsoleteUrlFactory 2021-04-12 11:41:09 -07:00
Liam Newman
bd19f23b3f Merge pull request #1087 from gsmet/label-payload
Add label payload
2021-04-12 10:00:18 -07:00
Liam Newman
ee047ea9b5 Merge pull request #1092 from gsmet/attach-check-runs
Properly wrap the check runs with the repository when listing them
2021-04-12 10:00:01 -07:00
Liam Newman
601f18016a Merge branch 'master' into attach-check-runs 2021-04-12 09:42:56 -07:00
Liam Newman
93abb0ed36 Merge branch 'master' into label-payload 2021-04-12 09:42:11 -07:00
Liam Newman
6453e585a9 Merge pull request #1091 from hub4j/bitwiseman-patch-2
Use codecov.io to report coverage
2021-04-12 09:41:14 -07:00
Liam Newman
3a1ed5a5b7 Create codecov.yml 2021-04-12 09:28:21 -07:00
Liam Newman
c5b45523d6 Update pom.xml 2021-04-12 09:28:04 -07:00
Guillaume Smet
bf082f2a46 Properly wrap the check runs with the repository when listing them 2021-04-12 18:15:23 +02:00
Liam Newman
672febd88b Update pom.xml 2021-04-12 09:07:48 -07:00
Liam Newman
927843ea83 Exclude some files from coverage entirely 2021-04-12 08:54:38 -07:00
Liam Newman
8fac7d317e Use codecov.io to report coverage 2021-04-12 08:34:18 -07:00
Guillaume Smet
626574ae36 Add missing javadoc for GHEventPayload.WorkflowRun 2021-04-10 12:55:05 +02:00
Guillaume Smet
8c9eb3393b Add label payload 2021-04-10 12:55:05 +02:00
Liam Newman
0c4728f46a Create codeql-analysis.yml 2021-04-09 09:52:10 -07:00
Liam Newman
837526ce5d Merge pull request #1083 from bitwiseman/issue/754
Replace reflection with X-HTTP-Method-Override
2021-04-09 09:49:10 -07:00
Liam Newman
afcfa906b8 Merge branch 'master' into issue/754 2021-04-09 09:06:07 -07:00
Liam Newman
8b3f50d4d3 [maven-release-plugin] prepare for next development iteration 2021-04-09 01:26:09 -07:00
Liam Newman
9022455d85 [maven-release-plugin] prepare release github-api-1.127 2021-04-09 01:25:56 -07:00
Liam Newman
8e20f4d9f5 Replace reflection with X-HTTP-Method-Override
Fixes #754
2021-04-08 14:36:40 -07:00
Liam Newman
7c8a7ff26e Merge pull request #1079 from gsmet/fix-jacoco-java16
Fix JaCoCo execution when we have additional Surefire options
2021-04-05 14:11:01 -07:00
Liam Newman
064d6944f3 Merge pull request #1081 from gsmet/workflow-jobs
Add support for workflow jobs
2021-04-05 14:10:28 -07:00
Liam Newman
b8b3cf9c80 Merge branch 'master' into fix-jacoco-java16 2021-04-05 13:08:53 -07:00
Liam Newman
18e7138812 Update src/main/java/org/kohsuke/github/GHWorkflowRun.java 2021-04-05 13:07:40 -07:00
Liam Newman
bfb3b94478 Update src/main/java/org/kohsuke/github/GHWorkflowRun.java 2021-04-05 13:07:32 -07:00
Liam Newman
6167d196d9 Remove enable-ci from build-only job
`enable-ci` doesn't make sense with `skipTests`.  
The point of this job is get quick results.
2021-04-05 10:13:14 -07:00
Liam Newman
43ed7c7ac7 Add verification that jacoco.exec exists after run 2021-04-05 09:58:55 -07:00
Guillaume Smet
fc98e72569 Rename GHWorkflowRunJob to GHWorkflowJob 2021-04-05 18:26:16 +02:00
Guillaume Smet
258acf79f6 Small adjustments to the API exposed to get jobs 2021-04-05 17:43:55 +02:00
Guillaume Smet
b509076d6f Add ability to get jobs and download logs from jobs 2021-04-05 15:32:46 +02:00
Guillaume Smet
f57ea4c4e9 Fix some infelicities in GHWorkflowRun javadoc 2021-04-05 15:31:30 +02:00
Liam Newman
578fe085ce Merge pull request #1074 from nvahren/repository-visibility
Add support for repository visibility
2021-04-04 23:31:53 -07:00
Liam Newman
2553a79b02 Update maven-build.yml 2021-04-04 22:53:25 -07:00
Guillaume Smet
4770316898 Fix JaCoCo execution when we have additional Surefire options
Typically on Java 16.
2021-04-04 15:21:53 +02:00
Nathan Vahrenberg
99f192d33c import nebula 2021-04-04 06:15:47 -05:00
Liam Newman
fc3bac0e77 Clean before building 2021-04-04 06:07:25 -05:00
Liam Newman
ad2990b1b6 Remove bridge method 2021-04-04 06:07:25 -05:00
nv035674
fab848a0d3 review comments 2021-04-04 06:07:25 -05:00
nv035674
4a2244e661 self review 2021-04-04 06:07:25 -05:00
nv035674
bab5399327 update existing test data 2021-04-04 06:07:25 -05:00
nv035674
52705ac695 revert testing version 2021-04-04 06:07:25 -05:00
nv035674
73d2e1db5c Add support for repository visibility 2021-04-04 06:07:25 -05:00
Liam Newman
83aa9d04ef Merge pull request #1078 from gsmet/expose-repository-workflows-artifacts
Expose repository for artifacts, workflows and workflow runs
2021-04-03 16:33:08 -07:00
Guillaume Smet
97652c6803 Expose repository for artifacts, workflows and workflow runs 2021-04-03 20:54:31 +02:00
Guillaume Smet
f40daf8488 Add some missing javadoc in the newly added GHArtifact 2021-04-03 20:45:52 +02:00
Liam Newman
3e6a5bc718 Merge pull request #1070 from hub4j/dependabot/maven/spotbugs.version-4.2.2
Chore(deps): Bump spotbugs.version from 4.2.1 to 4.2.2
2021-04-02 14:14:05 -07:00
Liam Newman
78ffe5a759 Merge pull request #1075 from gsmet/more-workflows
Add support for artifacts and logs of workflow runs
2021-04-02 14:13:43 -07:00
Guillaume Smet
9abfdc805b Add support for artifacts and logs of workflow runs 2021-04-02 22:53:08 +02:00
dependabot[bot]
9e47a2b8c6 Chore(deps): Bump spotbugs.version from 4.2.1 to 4.2.2
Bumps `spotbugs.version` from 4.2.1 to 4.2.2.

Updates `spotbugs` from 4.2.1 to 4.2.2
- [Release notes](https://github.com/spotbugs/spotbugs/releases)
- [Changelog](https://github.com/spotbugs/spotbugs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/spotbugs/spotbugs/compare/4.2.1...4.2.2)

Updates `spotbugs-annotations` from 4.2.1 to 4.2.2
- [Release notes](https://github.com/spotbugs/spotbugs/releases)
- [Changelog](https://github.com/spotbugs/spotbugs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/spotbugs/spotbugs/compare/4.2.1...4.2.2)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-01 19:55:54 +00:00
Liam Newman
feba6ed8b6 Merge pull request #1072 from hub4j/dependabot/maven/org.eclipse.jgit-org.eclipse.jgit-5.11.0.202103091610-r
Chore(deps-dev): Bump org.eclipse.jgit from 5.10.0.202012080955-r to 5.11.0.202103091610-r
2021-04-01 12:55:05 -07:00
Liam Newman
acab40b704 Merge pull request #1073 from hub4j/dependabot/maven/org.mockito-mockito-core-3.8.0
Chore(deps-dev): Bump mockito-core from 3.7.7 to 3.8.0
2021-04-01 12:54:51 -07:00
Liam Newman
435272065f Merge pull request #1069 from hub4j/dependabot/maven/com.diffplug.spotless-spotless-maven-plugin-2.9.0
Chore(deps): Bump spotless-maven-plugin from 2.8.1 to 2.9.0
2021-04-01 12:54:37 -07:00
dependabot[bot]
c5c04672fc Chore(deps-dev): Bump mockito-core from 3.7.7 to 3.8.0
Bumps [mockito-core](https://github.com/mockito/mockito) from 3.7.7 to 3.8.0.
- [Release notes](https://github.com/mockito/mockito/releases)
- [Commits](https://github.com/mockito/mockito/compare/v3.7.7...v3.8.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-01 02:00:51 +00:00
dependabot[bot]
5eef764cba Chore(deps-dev): Bump org.eclipse.jgit
Bumps org.eclipse.jgit from 5.10.0.202012080955-r to 5.11.0.202103091610-r.

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-01 02:00:41 +00:00
dependabot[bot]
2682e0a1e2 Chore(deps): Bump spotless-maven-plugin from 2.8.1 to 2.9.0
Bumps [spotless-maven-plugin](https://github.com/diffplug/project) from 2.8.1 to 2.9.0.
- [Release notes](https://github.com/diffplug/project/releases)
- [Commits](https://github.com/diffplug/project/commits)

Signed-off-by: dependabot[bot] <support@github.com>
2021-04-01 02:00:30 +00:00
Liam Newman
a68d16d5de [maven-release-plugin] prepare for next development iteration 2021-03-30 11:52:44 -07:00
Liam Newman
304ab10cf9 [maven-release-plugin] prepare release github-api-1.126 2021-03-30 11:52:06 -07:00
Liam Newman
dc46341432 Revert "[maven-release-plugin] prepare release github-api-1.126"
This reverts commit 99aea9296e.
2021-03-30 11:51:11 -07:00
Liam Newman
99aea9296e [maven-release-plugin] prepare release github-api-1.126 2021-03-30 11:45:11 -07:00
Liam Newman
b0693037f3 Merge pull request #1067 from gsmet/proper-workflow-list-test
Fix GHRepository#listWorkflows() and add a test
2021-03-30 11:42:20 -07:00
Guillaume Smet
c19cfd98d1 Fix GHRepository#listWorkflows() and add a test 2021-03-30 19:56:52 +02:00
Liam Newman
cdc0e2ad6b [maven-release-plugin] prepare for next development iteration 2021-03-25 12:44:21 -07:00
Liam Newman
6606b5c7d1 [maven-release-plugin] prepare release github-api-1.125 2021-03-25 12:44:06 -07:00
Liam Newman
551dbf2a06 Merge pull request #1064 from gsmet/workflow-runs
Implement GHWorkflow, GHWorkflowRun and associated payloads
2021-03-25 12:20:46 -07:00
Guillaume Smet
d734237788 Add some assertions for GHWorkflow dispatch tests 2021-03-25 11:37:13 +01:00
Guillaume Smet
47e2a5aea1 Rearchitecture GHWorkflowRunTest
We don't record the polling requests and we avoid any polling when not
recording.
2021-03-25 11:00:17 +01:00
Guillaume Smet
57cdc308e8 Adjust EnumUtils method name and add javadoc 2021-03-24 21:32:10 +01:00
Guillaume Smet
8919c5f8c7 Implement GHEventPayload.WorkflowRun and GHEventPayload.WorkflowDispatch
Fixes #1037
2021-03-24 10:38:24 +01:00
Guillaume Smet
b8f00bc699 Adjust GHCheckRun so that status and conclusion are returned as enums
Provide bridge methods for compatibility.
2021-03-23 15:35:58 +01:00
Guillaume Smet
042038f480 Implement GHWorkflow and GHWorkflowRun
Most of the actions are implemented but not all.
Looks like a good first step.
2021-03-23 15:35:39 +01:00
Guillaume Smet
fb03e749bd Only execute slow-or-flaky-test if -Dtest= is not defined 2021-03-22 16:10:44 +01:00
Liam Newman
e522239832 [maven-release-plugin] prepare for next development iteration 2021-03-19 13:48:47 -07:00
Liam Newman
ae69324196 [maven-release-plugin] prepare release github-api-1.124 2021-03-19 13:48:39 -07:00
Liam Newman
5194c2d9bc Merge pull request #1061 from gsmet/remove-add-label-payload
Implement getLabel() and getChanges() for GHEventPayload.Issue
2021-03-19 13:45:12 -07:00
Liam Newman
daf5c5eb98 Merge branch 'master' into remove-add-label-payload 2021-03-19 13:23:36 -07:00
Liam Newman
a7b4c97020 Merge pull request #1062 from gsmet/add-missing-label-info
Add the missing fields for GHLabel
2021-03-19 13:17:31 -07:00
Liam Newman
420d5d06f3 Merge branch 'master' into add-missing-label-info 2021-03-19 12:54:22 -07:00
Liam Newman
a7cd052b7c Merge pull request #1063 from gsmet/update-ci-jdks
Fix CI issues
2021-03-19 12:54:05 -07:00
Guillaume Smet
6e1b943823 Disable tests messing with the environment for Java 16+
It might be possible to make them work again but it will require some
more advanced surgery.
2021-03-19 18:22:39 +01:00
Guillaume Smet
8a3559ada5 Open java.net to unnamed modules
This is needed to inject the unsupported HTTP verb. I don't know really
if we will be able to find a better option than that...
2021-03-19 18:22:39 +01:00
Guillaume Smet
ea3cbd4c71 Pass appropriate MAVEN_OPTS for JDK 11+
They are required by spotless starting JDK 16+
2021-03-19 18:22:39 +01:00
Guillaume Smet
34a1f9d6e4 Disable fail-fast for matrix builds 2021-03-19 16:49:35 +01:00
Guillaume Smet
629bd510c1 Update JDKs used by CI to the latest versions 2021-03-19 16:49:33 +01:00
Guillaume Smet
40937a5cc6 Add the missing fields for GHLabel
Fixes #1059
2021-03-19 14:56:05 +01:00
Guillaume Smet
8509957102 Implement getChanges() for GHEventPayload.Issue 2021-03-19 13:39:26 +01:00
Guillaume Smet
b0aea0c575 Expose getLabel() for GHEventPayload.Issue
It was exposed on pull requests but not issues.
2021-03-19 13:11:38 +01:00
Liam Newman
1f7f646bec Merge pull request #1054 from gsmet/fix-add-remove-labels-concurrency
Fix concurrency issues with GHIssue addLabels and removeLabels
2021-03-15 10:56:45 -07:00
Liam Newman
a59ee6a82d Add removeLabel() that throws when label missing 2021-03-12 17:56:34 -08:00
Guillaume Smet
1fefc77582 Fix concurrency issues with GHIssue addLabels and removeLabels
Fixes #1049
2021-03-10 14:03:20 +01:00
Liam Newman
199eee4e25 Merge pull request #1055 from gsmet/update-contributing
Adjust wording used to create the token and give a bit more guidance
2021-03-09 18:45:38 -08:00
Guillaume Smet
854df5321b Adjust wording used to create the token and give a bit more guidance 2021-03-09 16:20:55 +01:00
Liam Newman
bd509070ac Merge pull request #1052 from bitwiseman/task/test-void-bridge
Test that void bridge methods are created
2021-03-05 11:34:10 -08:00
Liam Newman
a8c7c97d06 Test that void bridge methods are created 2021-03-05 11:16:06 -08:00
Liam Newman
6d86cfb4f6 Merge pull request #1047 from hub4j/dependabot/maven/junit-junit-4.13.2
Chore(deps-dev): Bump junit from 4.13.1 to 4.13.2
2021-03-01 09:20:28 -08:00
dependabot[bot]
fb3e956502 Chore(deps-dev): Bump junit from 4.13.1 to 4.13.2
Bumps [junit](https://github.com/junit-team/junit4) from 4.13.1 to 4.13.2.
- [Release notes](https://github.com/junit-team/junit4/releases)
- [Changelog](https://github.com/junit-team/junit4/blob/main/doc/ReleaseNotes4.13.1.md)
- [Commits](https://github.com/junit-team/junit4/compare/r4.13.1...r4.13.2)

Signed-off-by: dependabot[bot] <support@github.com>
2021-03-01 17:19:55 +00:00
Liam Newman
9b0dbe6f34 Merge pull request #1044 from hub4j/dependabot/maven/org.codehaus.mojo-animal-sniffer-maven-plugin-1.20
Chore(deps): Bump animal-sniffer-maven-plugin from 1.19 to 1.20
2021-03-01 09:19:28 -08:00
dependabot[bot]
c10c7237a7 Chore(deps): Bump animal-sniffer-maven-plugin from 1.19 to 1.20
Bumps [animal-sniffer-maven-plugin](https://github.com/mojohaus/animal-sniffer) from 1.19 to 1.20.
- [Release notes](https://github.com/mojohaus/animal-sniffer/releases)
- [Commits](https://github.com/mojohaus/animal-sniffer/compare/animal-sniffer-parent-1.19...animal-sniffer-parent-1.20)

Signed-off-by: dependabot[bot] <support@github.com>
2021-03-01 17:19:16 +00:00
Liam Newman
36612fe97f Merge pull request #1045 from hub4j/dependabot/maven/spotbugs.version-4.2.1
Chore(deps): Bump spotbugs.version from 4.1.3 to 4.2.1
2021-03-01 09:18:58 -08:00
Liam Newman
18e2056a10 Merge pull request #1042 from hub4j/dependabot/maven/com.tngtech.archunit-archunit-0.17.0
Chore(deps-dev): Bump archunit from 0.16.0 to 0.17.0
2021-03-01 09:18:32 -08:00
Liam Newman
8c8f1451d4 Merge pull request #1043 from hub4j/dependabot/github_actions/actions/cache-v2.1.4
Chore(deps): Bump actions/cache from v2 to v2.1.4
2021-03-01 09:18:14 -08:00
dependabot[bot]
be67f1d9e2 Chore(deps): Bump spotbugs.version from 4.1.3 to 4.2.1
Bumps `spotbugs.version` from 4.1.3 to 4.2.1.

Updates `spotbugs` from 4.1.3 to 4.2.1
- [Release notes](https://github.com/spotbugs/spotbugs/releases)
- [Changelog](https://github.com/spotbugs/spotbugs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/spotbugs/spotbugs/compare/4.1.3...4.2.1)

Updates `spotbugs-annotations` from 4.1.3 to 4.2.1
- [Release notes](https://github.com/spotbugs/spotbugs/releases)
- [Changelog](https://github.com/spotbugs/spotbugs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/spotbugs/spotbugs/compare/4.1.3...4.2.1)

Signed-off-by: dependabot[bot] <support@github.com>
2021-03-01 02:00:31 +00:00
dependabot[bot]
90bc250269 Chore(deps): Bump actions/cache from v2 to v2.1.4
Bumps [actions/cache](https://github.com/actions/cache) from v2 to v2.1.4.
- [Release notes](https://github.com/actions/cache/releases)
- [Commits](https://github.com/actions/cache/compare/v2...26968a09c0ea4f3e233fdddbafd1166051a095f6)

Signed-off-by: dependabot[bot] <support@github.com>
2021-03-01 02:00:20 +00:00
dependabot[bot]
1bd178654f Chore(deps-dev): Bump archunit from 0.16.0 to 0.17.0
Bumps [archunit](https://github.com/TNG/ArchUnit) from 0.16.0 to 0.17.0.
- [Release notes](https://github.com/TNG/ArchUnit/releases)
- [Commits](https://github.com/TNG/ArchUnit/compare/v0.16.0...v0.17.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-03-01 02:00:18 +00:00
Liam Newman
f22bf160f9 [maven-release-plugin] prepare for next development iteration 2021-02-26 15:20:10 -08:00
Liam Newman
4261c42949 [maven-release-plugin] prepare release github-api-1.123 2021-02-26 15:20:00 -08:00
Liam Newman
40cfb85a8e Merge pull request #1041 from bitwiseman/task/eol
Only run spotless:check as part of the lifecyle
2021-02-26 15:18:19 -08:00
Liam Newman
f08299b134 Only run spotless:check as part of the lifecyle
Users can run spotless:apply as they see fit.
2021-02-26 14:51:53 -08:00
Liam Newman
a04ab45abc Merge pull request #1040 from bitwiseman/bugfix/reposity-id-type
Fix the type of the id parameter of Github#getRepositoryById
2021-02-26 14:27:41 -08:00
Liam Newman
0647df2d2b Add tests for getRepositoryById 2021-02-26 13:02:12 -08:00
Liam Newman
d4cc3af1e9 Merge pull request #967 from chids/download-repository-archives
Add support for downloading zip and tar archives of repositories.
2021-02-26 12:48:42 -08:00
Liam Newman
936ab499ce Formatting 2021-02-26 12:08:14 -08:00
Liam Newman
453f475b4e Merge pull request #1029 from hub4j/dependabot/maven/com.fasterxml.jackson.core-jackson-databind-2.12.1
Chore(deps): Bump jackson-databind from 2.10.2 to 2.12.1
2021-02-26 11:59:24 -08:00
Liam Newman
bda3855b86 Merge pull request #1039 from bitwiseman/task/jwt
Allow for time skew in JWT authentication
2021-02-26 11:52:22 -08:00
Liam Newman
772a6c112b Remove consumers, use FunctionThrows 2021-02-26 11:12:51 -08:00
Liam Newman
9b4134cada Allow for time skew in JWT authentication 2021-02-26 10:51:07 -08:00
Liam Newman
ed9f54006d Merge branch 'master' into dependabot/maven/com.fasterxml.jackson.core-jackson-databind-2.12.1 2021-02-25 02:04:36 -08:00
Liam Newman
3b1f176544 Merge remote-tracking branch 'upstream/master' into download-repository-archives 2021-02-11 17:12:11 -08:00
Liam Newman
d2732bcf54 Merge pull request #1033 from uhafner/missing-text-in-extra-annotations
Make sure that `output.text` is set in each checks call
2021-02-08 03:16:24 -08:00
M. Abdullah Onus
a1461f401a Update src/main/java/org/kohsuke/github/GitHub.java
Co-authored-by: Liam Newman <bitwiseman@gmail.com>
2021-02-06 20:13:33 +03:00
Ulli Hafner
f9fd30275c Make sure that output.text is set in each checks call.
If a GitHub checks contains more than 50 annotations, then the
check is split into several calls. This fix makes sure that all
additional calls will not only copy the properties `title` and
`summary` but also the previously missing property `text`.
2021-02-04 19:47:49 +01:00
Liam Newman
eeea14dab4 Merge pull request #1028 from hub4j/dependabot/maven/com.tngtech.archunit-archunit-0.16.0
Chore(deps-dev): Bump archunit from 0.15.0 to 0.16.0
2021-02-01 14:26:20 -08:00
dependabot[bot]
1df807a198 Chore(deps-dev): Bump archunit from 0.15.0 to 0.16.0
Bumps [archunit](https://github.com/TNG/ArchUnit) from 0.15.0 to 0.16.0.
- [Release notes](https://github.com/TNG/ArchUnit/releases)
- [Commits](https://github.com/TNG/ArchUnit/compare/v0.15.0...v0.16.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-02-01 21:27:56 +00:00
Liam Newman
0848287069 Merge pull request #1027 from hub4j/dependabot/maven/org.mockito-mockito-core-3.7.7
Chore(deps-dev): Bump mockito-core from 3.6.28 to 3.7.7
2021-02-01 13:27:25 -08:00
dependabot[bot]
334b37a256 Chore(deps-dev): Bump mockito-core from 3.6.28 to 3.7.7
Bumps [mockito-core](https://github.com/mockito/mockito) from 3.6.28 to 3.7.7.
- [Release notes](https://github.com/mockito/mockito/releases)
- [Commits](https://github.com/mockito/mockito/compare/v3.6.28...v3.7.7)

Signed-off-by: dependabot[bot] <support@github.com>
2021-02-01 21:27:13 +00:00
Liam Newman
8776a3b672 Merge pull request #1031 from hub4j/dependabot/maven/com.diffplug.spotless-spotless-maven-plugin-2.7.0
Chore(deps): Bump spotless-maven-plugin from 2.6.1 to 2.7.0
2021-02-01 13:26:34 -08:00
Liam Newman
657550f767 Merge pull request #1030 from hub4j/dependabot/maven/com.github.spotbugs-spotbugs-maven-plugin-4.2.0
Chore(deps): Bump spotbugs-maven-plugin from 4.1.4 to 4.2.0
2021-02-01 13:26:16 -08:00
dependabot[bot]
45a0114f75 Chore(deps): Bump spotless-maven-plugin from 2.6.1 to 2.7.0
Bumps [spotless-maven-plugin](https://github.com/diffplug/project) from 2.6.1 to 2.7.0.
- [Release notes](https://github.com/diffplug/project/releases)
- [Commits](https://github.com/diffplug/project/commits)

Signed-off-by: dependabot[bot] <support@github.com>
2021-02-01 02:01:26 +00:00
dependabot[bot]
a8ddd3e12a Chore(deps): Bump spotbugs-maven-plugin from 4.1.4 to 4.2.0
Bumps [spotbugs-maven-plugin](https://github.com/spotbugs/spotbugs-maven-plugin) from 4.1.4 to 4.2.0.
- [Release notes](https://github.com/spotbugs/spotbugs-maven-plugin/releases)
- [Commits](https://github.com/spotbugs/spotbugs-maven-plugin/compare/spotbugs-maven-plugin-4.1.4...spotbugs-maven-plugin-4.2.0)

Signed-off-by: dependabot[bot] <support@github.com>
2021-02-01 02:00:31 +00:00
dependabot[bot]
b668396151 Chore(deps): Bump jackson-databind from 2.10.2 to 2.12.1
Bumps [jackson-databind](https://github.com/FasterXML/jackson) from 2.10.2 to 2.12.1.
- [Release notes](https://github.com/FasterXML/jackson/releases)
- [Commits](https://github.com/FasterXML/jackson/commits)

Signed-off-by: dependabot[bot] <support@github.com>
2021-02-01 02:00:29 +00:00
Liam Newman
9e7c33369c Merge pull request #1026 from jordiolivares/feature/timestamp-support
Add timestamp field support for the commits sent by GHEventPayload.Push
2021-01-28 18:00:48 -08:00
Jordi Olivares Provencio
8943ca6d1a Reformat the JavaDoc 2021-01-28 22:36:24 +01:00
Jordi Olivares Provencio
b3460c1f9d Add timestamp field support for the commits sent by GHEventPayload.Push 2021-01-28 22:34:09 +01:00
Liam Newman
5166c9265f Merge pull request #1022 from bitwiseman/task/enum-coverage
Code Coverage update
2021-01-25 12:24:24 -08:00
Liam Newman
35c8cfa01d Push method code coverage bar to 50 percent
This change adds or update a swath of tests to push method code coverage numbers up.
Yes, method coverage is not super meaningful, but it is one metric that we can use to
ensure at least minimal coverage of this library.

Almost no product changes in here.
2021-01-25 12:08:57 -08:00
Liam Newman
8e6dbf3772 [maven-release-plugin] prepare for next development iteration 2021-01-14 20:14:08 -08:00
Liam Newman
cb381dfa06 [maven-release-plugin] prepare release github-api-1.122 2021-01-14 20:13:57 -08:00
Liam Newman
80124e3b85 Merge pull request #1021 from bitwiseman/jwt-string
Allow JWT from string
2021-01-14 20:09:21 -08:00
Liam Newman
7aae27e36f Allow JWT from string 2021-01-14 14:25:51 -08:00
Liam Newman
b212956fbb [maven-release-plugin] prepare for next development iteration 2021-01-14 13:19:41 -08:00
Liam Newman
d033355e84 [maven-release-plugin] prepare release github-api-1.121 2021-01-14 13:19:31 -08:00
Liam Newman
59d7a117d0 [maven-release-plugin] prepare for next development iteration 2021-01-14 10:51:52 -08:00
Liam Newman
dfbb38c5f1 [maven-release-plugin] prepare release github-api-1.120 2021-01-14 10:51:41 -08:00
Liam Newman
3f9954144a Merge pull request #945 from MarcosCela/feat/credential-provider-refresh
Feat/credential provider refresh
2021-01-14 10:37:30 -08:00
Liam Newman
1b84efdbfa Add GitHub.DependentAuthorizationProvider
Rather than exposing an unsafe wrapper for GitHub instances, I added a base class
that can be extended by anyone wanting to implement an authorization provider
that needs a GitHub instance to generate it's authorization string.
2021-01-14 10:32:25 -08:00
Liam Newman
c33e78a7dc Create authorization package 2021-01-14 09:23:17 -08:00
Marcos.Cela
747c759bbb fix code violations again 2021-01-08 10:10:44 +01:00
Marcos.Cela
e0a709676e fix format violations 2021-01-08 09:56:05 +01:00
Marcos.Cela
a96275c286 tests for JWTTokenProvider, verifying the "Authentication" header
This test basically ensures that the requests made with a
JWTTokenProvider follow a valid Authentication pattern,
verifying that the header "conforms" to a valid JWT token
More information on JWT tokens can be found at:

- https://jwt.io/introduction/
2021-01-08 09:52:50 +01:00
Marcos.Cela
ca7c809feb remove unused field MINUTES_10 from JWTTokenProvider 2021-01-08 08:21:35 +01:00
Marcos Cela López
a8a0bcb7db Merge branch 'master' into feat/credential-provider-refresh 2021-01-07 12:03:27 +01:00
Marcos.Cela
0e2bf23830 add CODE_SCANNING_ALERT to GHEvent enum 2021-01-07 11:32:33 +01:00
Marcos.Cela
44a8b797fb fix: JWTTokenProvider has an incorrect value for the returned authorization header
more info:
https://docs.github.com/en/free-pro-team@latest/developers/apps/authenticating-with-github-apps#authenticating-as-a-github-app
2021-01-07 11:23:22 +01:00
Marcos.Cela
cdede298a9 rename OrgInstallationAuthorizationProvider to OrgAppInstallationAuthorizationProvider 2021-01-07 09:53:19 +01:00
Marcos.Cela
f6ac4d3559 rename: credential provider -> authorization provider
This includes renames in comments, related methods,
javadocs and fields/variables.
2021-01-07 09:46:30 +01:00
Liam Newman
7e1531dbca [maven-release-plugin] prepare for next development iteration 2021-01-05 17:27:23 -08:00
Liam Newman
9aeb422157 [maven-release-plugin] prepare release github-api-1.119 2021-01-05 17:27:08 -08:00
Liam Newman
fba0f8cf8e Merge pull request #1015 from seregamorph/feature/mock-previews
Fix mocking Previews
2021-01-05 17:23:55 -08:00
seregamorph
0f4a5227e1 internal package 2021-01-05 23:03:49 +03:00
seregamorph
d16a752b43 Fix mocking Previews 2021-01-05 18:50:24 +03:00
Liam Newman
4d9aed90d6 Merge branch 'master' into download-repository-archives 2021-01-04 09:24:25 -08:00
Liam Newman
4bec27fd49 [maven-release-plugin] prepare for next development iteration 2021-01-04 01:48:27 -08:00
Liam Newman
be3bd74bb7 [maven-release-plugin] prepare release github-api-1.118 2021-01-04 01:48:16 -08:00
Liam Newman
f1720b7bbc Move archive readers to use new functional interfaces 2021-01-04 01:32:36 -08:00
Liam Newman
7a79a18d8f Add functional interfaces 2021-01-04 01:30:59 -08:00
Liam Newman
472034c950 Add codeload and fix redirects 2021-01-04 01:27:47 -08:00
Liam Newman
0b14cee817 Merge pull request #1011 from hub4j/dependabot/maven/org.kohsuke.stapler-stapler-1.262
Chore(deps-dev): Bump stapler from 1.260 to 1.262
2021-01-03 23:43:02 -08:00
M. Abdullah Onus
b50ab56f9e Fix linting 2021-01-03 15:52:06 +03:00
M. Abdullah Onus
26d30663c4 Add deprecated not to Github#getRepositoryById 2021-01-03 15:44:28 +03:00
M. Abdullah Onus
ffecc390eb Fix the type of the id parameter of Github#getRepositoryById 2021-01-03 15:35:00 +03:00
dependabot[bot]
252ca04084 Chore(deps-dev): Bump stapler from 1.260 to 1.262
Bumps [stapler](https://github.com/stapler/stapler) from 1.260 to 1.262.
- [Release notes](https://github.com/stapler/stapler/releases)
- [Changelog](https://github.com/stapler/stapler/blob/master/CHANGELOG.md)
- [Commits](https://github.com/stapler/stapler/compare/stapler-parent-1.260...stapler-parent-1.262)

Signed-off-by: dependabot[bot] <support@github.com>
2021-01-01 02:00:35 +00:00
Liam Newman
aae5c56a31 Merge remote-tracking branch 'upstream/master' into download-repository-archives 2020-12-31 09:55:28 -08:00
Liam Newman
6670446037 Reenable GitHubBuilder tests 2020-12-31 09:49:51 -08:00
Liam Newman
bd39b07bb5 Fix javadoc issues 2020-12-30 14:07:37 -08:00
Liam Newman
a9438b6121 Move tests to use JWTTokenProvider 2020-12-30 10:46:45 -08:00
Liam Newman
f546cf4521 Use only credential providers internally to track credentials
Removes extra fields from GitHubClient.
2020-12-30 09:52:30 -08:00
Liam Newman
43efa78750 Post-merge fixes 2020-12-29 09:29:30 -08:00
Liam Newman
9e3de43802 Merge remote-tracking branch 'upstream/master' into feat/credential-provider-refresh 2020-12-29 09:19:09 -08:00
Liam Newman
dc615e432e Merge pull request #985 from lower-case/bugfix-883
Fixes null commit date
2020-12-28 22:06:47 -08:00
Liam Newman
cf9caa6af5 Update test to check values 2020-12-28 22:00:44 -08:00
Liam Newman
15f748358d Merge remote-tracking branch 'upstream/master' into bugfix-883 2020-12-28 20:02:24 -08:00
Liam Newman
b30d648623 Merge pull request #939 from jgangemi/jae/bulk-update
- bulk update of repository options
2020-12-28 19:54:44 -08:00
Liam Newman
33d70560b8 Deprecate templateRepository() for isTemplate() 2020-12-28 18:44:30 -08:00
Liam Newman
865a49d2e8 Update GHRepository method to use Setter
It appears that the correct way to pass these booleans is as booleans not as strings.

Fixes #765
2020-12-28 18:07:32 -08:00
Liam Newman
4fca68c25c Add GHRepository.Setter 2020-12-28 17:03:36 -08:00
Liam Newman
f131a0c1c2 Formatting fixes 2020-12-28 16:26:23 -08:00
Liam Newman
cd4368fa79 Merge remote-tracking branch 'upstream/master' into jae/bulk-update 2020-12-28 16:25:31 -08:00
Liam Newman
4ec4b160b0 Update contributing.md for more clarity 2020-12-28 16:18:04 -08:00
Liam Newman
a585b4957f Merge pull request #1004 from bitwiseman/object-base
Make root field transient in all classes
2020-12-28 16:05:48 -08:00
Liam Newman
e6b02b3bed Merge branch 'master' into object-base 2020-12-28 15:48:41 -08:00
Liam Newman
1ef0ec0432 Update src/main/java/org/kohsuke/github/GitHub.java
Co-authored-by: Tim Jacomb <21194782+timja@users.noreply.github.com>
2020-12-28 15:47:28 -08:00
Liam Newman
2e87bd86a1 Merge pull request #1006 from hub4j/dependabot/maven/org.eclipse.jgit-org.eclipse.jgit-5.10.0.202012080955-r
Chore(deps-dev): Bump org.eclipse.jgit from 5.9.0.202009080501-r to 5.10.0.202012080955-r
2020-12-28 15:46:53 -08:00
Liam Newman
0228a0d023 Merge pull request #1010 from hub4j/dependabot/maven/org.slf4j-slf4j-simple-1.7.30
Chore(deps-dev): Bump slf4j-simple from 1.7.2 to 1.7.30
2020-12-28 15:46:33 -08:00
dependabot[bot]
6365f3749d Chore(deps-dev): Bump slf4j-simple from 1.7.2 to 1.7.30
Bumps [slf4j-simple](https://github.com/qos-ch/slf4j) from 1.7.2 to 1.7.30.
- [Release notes](https://github.com/qos-ch/slf4j/releases)
- [Commits](https://github.com/qos-ch/slf4j/compare/v_1.7.2...v_1.7.30)

Signed-off-by: dependabot[bot] <support@github.com>
2020-12-28 23:45:31 +00:00
dependabot[bot]
25c18130f9 Chore(deps-dev): Bump org.eclipse.jgit
Bumps org.eclipse.jgit from 5.9.0.202009080501-r to 5.10.0.202012080955-r.

Signed-off-by: dependabot[bot] <support@github.com>
2020-12-28 23:45:30 +00:00
Liam Newman
436c19634d Merge pull request #1009 from hub4j/dependabot/maven/com.github.spotbugs-spotbugs-maven-plugin-4.1.4
Chore(deps): Bump spotbugs-maven-plugin from 4.0.4 to 4.1.4
2020-12-28 15:45:13 -08:00
Liam Newman
1a6facc685 Merge pull request #1008 from hub4j/dependabot/maven/com.tngtech.archunit-archunit-0.15.0
Chore(deps-dev): Bump archunit from 0.14.1 to 0.15.0
2020-12-28 15:44:45 -08:00
Liam Newman
bd0093c8ea Change reader and writer to no longer deprecated
While still no recommended, these methods are more recommended than
users creating their own.  These will continue to work even when
internals change, whereas user configured readers or writers may not.
2020-12-28 12:39:21 -08:00
Liam Newman
e150280010 Merge remote-tracking branch 'upstream/master' into object-base 2020-12-28 10:52:16 -08:00
dependabot[bot]
827fd5e472 Chore(deps): Bump spotbugs-maven-plugin from 4.0.4 to 4.1.4
Bumps [spotbugs-maven-plugin](https://github.com/spotbugs/spotbugs-maven-plugin) from 4.0.4 to 4.1.4.
- [Release notes](https://github.com/spotbugs/spotbugs-maven-plugin/releases)
- [Commits](https://github.com/spotbugs/spotbugs-maven-plugin/compare/spotbugs-maven-plugin-4.0.4...spotbugs-maven-plugin-4.1.4)

Signed-off-by: dependabot[bot] <support@github.com>
2020-12-28 18:51:35 +00:00
dependabot[bot]
f89fbc67b9 Chore(deps-dev): Bump archunit from 0.14.1 to 0.15.0
Bumps [archunit](https://github.com/TNG/ArchUnit) from 0.14.1 to 0.15.0.
- [Release notes](https://github.com/TNG/ArchUnit/releases)
- [Commits](https://github.com/TNG/ArchUnit/compare/v0.14.1...v0.15.0)

Signed-off-by: dependabot[bot] <support@github.com>
2020-12-28 18:51:35 +00:00
Liam Newman
c567a88892 Merge pull request #1005 from bitwiseman/task/spotless
Switch to using spotless plugin for formatting
2020-12-28 10:51:06 -08:00
Liam Newman
6a39d7fca5 Trim whitespace and end with newline 2020-12-23 17:13:27 -08:00
Liam Newman
a15e67f065 Switch formatting to spotless
This is change includes minimal changes required to make the switch
2020-12-23 17:13:27 -08:00
Liam Newman
7a1bce9578 Merge branch 'master' into object-base 2020-12-22 09:17:52 -08:00
Liam Newman
f2b4de7943 Merge branch 'master' into jae/bulk-update 2020-12-22 08:32:12 -08:00
Liam Newman
b3ff4ac6d9 Merge pull request #984 from gsmet/okhttp-close-responsebody
Close Okhttp ResponseBody instances when closing the InputStream
2020-12-21 10:20:50 -08:00
Liam Newman
1c56e7fab5 Add missing argument 2020-12-21 09:28:44 -08:00
Liam Newman
70ba4df385 Make root field transient in all classes 2020-12-18 14:58:12 -08:00
Liam Newman
8062c705e8 Merge branch 'master' into jae/bulk-update 2020-12-17 15:12:19 -08:00
Liam Newman
fafb23c1a6 Merge pull request #1002 from marcoferrer/add-sdk-beta-annotation
Implement BetaApi annotation for hub4j sdk
2020-12-17 12:57:01 -08:00
Marco Ferrer
4e7ac7030c Add beta api annotation to project 2020-12-16 16:39:48 -05:00
Liam Newman
4803daca5a Merge branch 'master' into okhttp-close-responsebody 2020-12-15 16:21:08 -08:00
Liam Newman
facfc61316 Merge branch 'master' into jae/bulk-update 2020-12-15 16:08:41 -08:00
Liam Newman
e3e495bfb1 Merge pull request #1001 from marcoferrer/preview-enum-and-cleanup
Implement static typing for previews and clean up usage declarations
2020-12-15 15:39:06 -08:00
Liam Newman
e007284d2f Merge branch 'master' into preview-enum-and-cleanup 2020-12-15 15:20:30 -08:00
Liam Newman
1da8416ebd Merge pull request #983 from marcoferrer/add-preview-arch-rules
Add arch test for preview API usage
2020-12-15 15:20:05 -08:00
Marco Ferrer
79b49a469c Clean up preview declarations 2020-12-15 14:39:00 -05:00
Marco Ferrer
5888efcaef Merge branch 'master' into add-preview-arch-rules 2020-12-15 12:41:51 -05:00
Marco Ferrer
459d1b4f56 update arch tests to add enum checks 2020-12-15 12:41:02 -05:00
Liam Newman
9151102bda Merge pull request #998 from bitwiseman/obsolete-okhttp
Deprecate OkHttp 2.x connector
2020-12-12 16:49:13 -08:00
Liam Newman
3819984add Merge pull request #999 from tginiotis-at-work/targeturl-for-status
"target_url" for the payload of the status event
2020-12-12 16:48:16 -08:00
Tadas Giniotis
3b58fbc186 test "target_url" 2020-12-12 23:53:40 +02:00
Tadas Giniotis
55e589b3d9 add the "target_url" field for "status" events 2020-12-12 23:46:03 +02:00
Liam Newman
e64d64d8d8 Deprecate OkHttp 2.x connector
OkHttp 2.x is unsupported.  OkHttpUrlFactory contains bugs and limiations which will not
be fixed and also cannot be mitigated by this library.  Users should move to OkHttp3.

Closes #997
2020-12-11 17:17:08 -08:00
Jae Gangemi
37c2d9135b - bulk update of repository options 2020-12-11 16:56:26 -07:00
Liam Newman
30c96221bd Make wiremock less noisy with slf4j simple logger during tests 2020-12-11 13:54:47 -08:00
Liam Newman
bf7305e3f8 Merge pull request #990 from hub4j/dependabot/maven/org.apache.maven.plugins-maven-project-info-reports-plugin-3.1.1
Chore(deps): Bump maven-project-info-reports-plugin from 3.1.0 to 3.1.1
2020-12-09 08:54:55 -08:00
Liam Newman
3b12a229c3 Merge branch 'master' into dependabot/maven/org.apache.maven.plugins-maven-project-info-reports-plugin-3.1.1 2020-12-04 14:41:12 -08:00
Liam Newman
5726ceb8dc Merge branch 'master' into okhttp-close-responsebody 2020-12-03 16:55:48 -08:00
Liam Newman
c06c06624d Merge pull request #981 from eSentire/AffiliationFilter
Add affiliation filter for collaborators
2020-12-03 16:54:02 -08:00
Rob Rodrigues
ad40d7071e Streamline per feedback 2020-12-02 11:41:13 -08:00
Rob Rodrigues
f55a39eb90 Merge branch 'master' into AffiliationFilter 2020-12-01 20:08:54 -08:00
Rob Rodrigues
c3869bee31 Reverted changes which added filter unnecessarily, cleanup, add test cache, enable test 2020-12-01 19:50:24 -08:00
dependabot[bot]
6eac15df0f Chore(deps): Bump maven-project-info-reports-plugin from 3.1.0 to 3.1.1
Bumps [maven-project-info-reports-plugin](https://github.com/apache/maven-project-info-reports-plugin) from 3.1.0 to 3.1.1.
- [Release notes](https://github.com/apache/maven-project-info-reports-plugin/releases)
- [Commits](https://github.com/apache/maven-project-info-reports-plugin/compare/maven-project-info-reports-plugin-3.1.0...maven-project-info-reports-plugin-3.1.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-12-01 18:21:10 +00:00
Liam Newman
6f5d3c32c3 Spotbugs 4.1.3 2020-12-01 10:07:46 -08:00
Liam Newman
68ef40e4d0 Merge branch 'master' into bugfix-883 2020-12-01 09:11:23 -08:00
Liam Newman
4046bc4f72 Merge pull request #991 from hub4j/dependabot/maven/org.mockito-mockito-core-3.6.28
Chore(deps-dev): Bump mockito-core from 3.6.0 to 3.6.28
2020-12-01 08:49:54 -08:00
dependabot[bot]
1b8d131915 Chore(deps-dev): Bump mockito-core from 3.6.0 to 3.6.28
Bumps [mockito-core](https://github.com/mockito/mockito) from 3.6.0 to 3.6.28.
- [Release notes](https://github.com/mockito/mockito/releases)
- [Commits](https://github.com/mockito/mockito/compare/v3.6.0...v3.6.28)

Signed-off-by: dependabot[bot] <support@github.com>
2020-12-01 02:00:23 +00:00
Guillaume Smet
f5ad332d28 Properly close ResponseBody when closing the InputStream
ResponseBody objects from Okhttp needs to be closed and, right now, we
just close the InputStream which is not sufficient.

I noticed that because I saw some warnings about leaked ResponseBody
instances in my logs.
2020-11-29 21:56:11 +01:00
Lovekesh Garg
938603ff60 Fixes null commit date 2020-11-28 17:20:28 +05:30
Rob Rodrigues
17af78f2bb Merge branch 'master' into AffiliationFilter 2020-11-25 13:10:09 -08:00
Marco Ferrer
7588267743 Add arch test for preview API usage 2020-11-25 13:16:04 -05:00
Liam Newman
ed4f9c8176 Merge pull request #960 from marcoferrer/update-deployments-api
Implement deployment API support for ant-man and flash previews
2020-11-25 06:37:36 -08:00
Liam Newman
bbb46e88b0 Merge branch 'master' into update-deployments-api 2020-11-25 06:18:07 -08:00
Rob Rodrigues
3db7aac0d8 Merge branch 'master' into AffiliationFilter 2020-11-24 12:52:48 -08:00
Liam Newman
fdbbd2e563 [maven-release-plugin] prepare for next development iteration 2020-11-24 11:13:29 -08:00
Liam Newman
e92f1321d4 [maven-release-plugin] prepare release github-api-1.117 2020-11-24 11:13:17 -08:00
Marco Ferrer
da2aaff9e5 Merge branch 'master' into update-deployments-api 2020-11-24 11:37:36 -05:00
Liam Newman
208904b634 Merge pull request #980 from mrginglymus/check-patcher
Add ability to update a check run
2020-11-23 18:28:48 -08:00
Liam Newman
a433bcda2e Merge pull request #979 from seregamorph/feature/pull_request-edited
pull_request action "edited": changes
2020-11-23 18:26:08 -08:00
Marco Ferrer
4bba692170 Merge branch 'master' into update-deployments-api 2020-11-23 17:20:40 -05:00
Marco Ferrer
59b61cd8be add deprecated to logUrl field 2020-11-23 17:19:57 -05:00
Marco Ferrer
247b013e16 add deprecated annotations to preview usage 2020-11-23 15:51:57 -05:00
Bill Collins
77baafa643 Add method for updating check run by ID 2020-11-20 09:16:34 +00:00
Rob Rodrigues
3c56f1f076 Merge branch 'master' into AffiliationFilter 2020-11-19 15:57:36 -08:00
Bill Collins
224d8c7cb4 Add wiremocks for tests, move existing tests to test org 2020-11-19 15:05:25 +00:00
seregamorph
0feb520549 pull_request action "edited": changes - test 2020-11-19 13:50:33 +03:00
seregamorph
ca365b12f6 Merge remote-tracking branch 'origin/master' into feature/pull_request-edited 2020-11-19 13:44:56 +03:00
Bill Collins
bde6ad9a06 Add a test for check updates 2020-11-19 09:20:58 +00:00
Bill Collins
4953f4500d Create check run updater 2020-11-19 09:20:58 +00:00
Rob Rodrigues
7fee1fcc74 Add affiliation filter for collaborators 2020-11-18 17:58:51 -08:00
Liam Newman
4415ac8fd2 Update src/test/java/org/kohsuke/github/GHEventPayloadTest.java 2020-11-18 12:50:47 -08:00
Liam Newman
8c81e48a31 Update src/test/java/org/kohsuke/github/GHEventPayloadTest.java 2020-11-18 12:48:51 -08:00
Liam Newman
9ad0329c56 Apply suggestions from code review 2020-11-18 12:47:18 -08:00
Liam Newman
78f533bbfc Merge pull request #977 from skaldarnar/feat/528-ghrelease-assets
Include assets directly in GHRelease
2020-11-18 12:46:11 -08:00
Tobias Nett
79c7dd9ecf fix formatting 2020-11-18 21:31:42 +01:00
Tobias Nett
5d796d1f79 revert unwanted assertion change 2020-11-18 21:24:58 +01:00
Tobias Nett
68a82be6c4 rename 'getCachedAssets' to 'assets' (bare property name as getter)) 2020-11-18 19:28:27 +01:00
Tobias Nett
2676ef2b73 rename 'fetchAssets' to 'listAssets' and return PagedIterable 2020-11-18 19:27:31 +01:00
seregamorph
04b283c539 pull_request action "edited": changes 2020-11-18 20:41:58 +03:00
Tobias Nett
98b067937a Make changes backwards compatible
Add '@Deprecation' and '@Preview' annotations to make the changes
backwards compatible and prepare for a transition to the cached behavior
as default.
This explicitly leaves the variant for re-fetching assets under a
different name.
2020-11-17 17:16:44 +01:00
Liam Newman
8ababb60bf Merge pull request #976 from seregamorph/feature/base-event-payload
#947 base event payload
2020-11-16 17:29:38 -08:00
seregamorph
b51d655f77 #947 address review comments 2020-11-13 11:02:54 +03:00
seregamorph
74496d32da Merge remote-tracking branch 'origin/master' into feature/base-event-payload 2020-11-13 10:27:57 +03:00
Liam Newman
316e278be1 Merge pull request #952 from tginiotis-at-work/getRepositories
List repositories for a GHAppInstallation
2020-11-12 10:02:53 -08:00
Tobias Nett
d881bf6504 Bring back previous semantic of getAssets() as fetchAssets()
I don't know a better name for this, and I also don't know whether this
should be an option or not.
The life cycle tests use the feature that retrieving the assets from a
release actually does a roundtrip to Github and sends another request.
This indicates that re-purposing `getAssets()` to be the cached access
might cause problems on consumers that potentially rely on this
assumption, too.
2020-11-11 19:49:58 +01:00
Tobias Nett
c74fbbe1fd Include assets directly in GHRelease
Resolves #528

Instead of doing a separate request to fetch the assets associated with
a release this keeps a local list of the assets that are part of the
list releases endpoint.

See https://docs.github.com/en/free-pro-team@latest/rest/reference/repos#list-releases
2020-11-11 19:16:34 +01:00
seregamorph
929d9fb7bd #947 base event payload 2020-11-09 22:48:04 +03:00
Tadas Giniotis
5d069d0531 add wiremock snapshots 2020-11-05 22:43:49 +02:00
Tadas Giniotis
dd9e6dc5d3 add tests 2020-11-05 22:39:43 +02:00
Tadas Giniotis
d22c77c41d method for listing repositories for a GHAppInstallation 2020-11-05 22:39:15 +02:00
Liam Newman
3a11b7ccbf Merge pull request #950 from tginiotis-at-work/listTeamMembers
List team members by role
2020-11-05 09:12:10 -08:00
Liam Newman
d7931777bc Merge branch 'master' into download-repository-archives 2020-11-05 08:38:31 -08:00
Tadas Giniotis
9d161b28bb add wiremock snapshots 2020-11-04 15:38:00 +02:00
Tadas Giniotis
9b16a1caa0 add tests 2020-11-04 15:37:58 +02:00
Tadas Giniotis
9a918e3bac implement ability to list members on a team by role 2020-11-04 15:35:17 +02:00
Liam Newman
d4c5c6a1e0 Merge pull request #944 from seregamorph/feature/push-pulls-extensions
user, push, pull event extensions
2020-11-03 12:53:07 -08:00
Liam Newman
63fda3555c Merge pull request #953 from tginiotis-at-work/commentsOnCommit
Get comments on a specific commit
2020-11-03 12:33:00 -08:00
Liam Newman
6a2381c06b Merge pull request #951 from tginiotis-at-work/sign_commits
Allow adding signature to commits
2020-11-03 12:30:56 -08:00
Liam Newman
e9c0a16c26 Merge pull request #974 from hub4j/dependabot/maven/org.mockito-mockito-core-3.6.0
Chore(deps-dev): Bump mockito-core from 3.5.7 to 3.6.0
2020-11-03 08:43:55 -08:00
Liam Newman
2101a67ac1 Merge pull request #973 from hub4j/dependabot/maven/org.eclipse.jgit-org.eclipse.jgit-5.9.0.202009080501-r
Chore(deps-dev): Bump org.eclipse.jgit from 5.7.0.202003110725-r to 5.9.0.202009080501-r
2020-11-03 08:43:44 -08:00
dependabot[bot]
ddac568aaa Chore(deps-dev): Bump mockito-core from 3.5.7 to 3.6.0
Bumps [mockito-core](https://github.com/mockito/mockito) from 3.5.7 to 3.6.0.
- [Release notes](https://github.com/mockito/mockito/releases)
- [Commits](https://github.com/mockito/mockito/compare/v3.5.7...v3.6.0)

Signed-off-by: dependabot[bot] <support@github.com>
2020-11-01 02:00:38 +00:00
dependabot[bot]
262ae9f635 Chore(deps-dev): Bump org.eclipse.jgit
Bumps org.eclipse.jgit from 5.7.0.202003110725-r to 5.9.0.202009080501-r.

Signed-off-by: dependabot[bot] <support@github.com>
2020-11-01 02:00:23 +00:00
dependabot[bot]
381502fb80 Merge pull request #963 from hub4j/dependabot/maven/junit-junit-4.13.1 2020-10-22 21:27:26 +00:00
dependabot[bot]
92fb441eb2 Chore(deps-dev): Bump junit from 4.13 to 4.13.1
Bumps [junit](https://github.com/junit-team/junit4) from 4.13 to 4.13.1.
- [Release notes](https://github.com/junit-team/junit4/releases)
- [Changelog](https://github.com/junit-team/junit4/blob/main/doc/ReleaseNotes4.13.1.md)
- [Commits](https://github.com/junit-team/junit4/compare/r4.13...r4.13.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-22 21:21:02 +00:00
dependabot[bot]
29e08037a8 Merge pull request #956 from hub4j/dependabot/maven/com.github.tomakehurst-wiremock-jre8-standalone-2.27.2 2020-10-22 21:20:13 +00:00
dependabot[bot]
84cc6d9315 Chore(deps-dev): Bump wiremock-jre8-standalone from 2.27.1 to 2.27.2
Bumps [wiremock-jre8-standalone](https://github.com/tomakehurst/wiremock) from 2.27.1 to 2.27.2.
- [Release notes](https://github.com/tomakehurst/wiremock/releases)
- [Commits](https://github.com/tomakehurst/wiremock/compare/2.27.1...2.27.2)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-22 21:14:54 +00:00
dependabot[bot]
b8d5a1c732 Merge pull request #958 from hub4j/dependabot/maven/org.jacoco-jacoco-maven-plugin-0.8.6 2020-10-22 21:14:09 +00:00
dependabot[bot]
0197ab9661 Chore(deps): Bump jacoco-maven-plugin from 0.8.5 to 0.8.6
Bumps [jacoco-maven-plugin](https://github.com/jacoco/jacoco) from 0.8.5 to 0.8.6.
- [Release notes](https://github.com/jacoco/jacoco/releases)
- [Commits](https://github.com/jacoco/jacoco/compare/v0.8.5...v0.8.6)

Signed-off-by: dependabot[bot] <support@github.com>
2020-10-22 21:08:37 +00:00
Tim Jacomb
b7915e61a6 Merge pull request #965 from chids/fix-wiremock-status-test
GH docs have moved, adjust assertion accordingly.
2020-10-22 22:03:05 +01:00
Tim Jacomb
586db99450 Merge branch 'master' into fix-wiremock-status-test 2020-10-22 21:57:46 +01:00
Tim Jacomb
5377d0dd18 Merge pull request #964 from jglick/GHPullRequest.getLabels
GHPullRequest.getLabels should not go to the GHIssue API endpoint
2020-10-22 21:35:37 +01:00
Mårten Gustafson
bb48d55bd4 Add support for downloading zip and tar archives of repositories. 2020-10-20 21:45:27 +02:00
Mårten Gustafson
c5d3a7d573 GH docs have moved, adjust assertion accordingly. 2020-10-20 18:41:17 +02:00
Jesse Glick
8267050f06 GHPullRequest.getLabels should not go to the GHIssue API endpoint 2020-10-15 13:25:20 -04:00
Marcos.Cela
610b02968e exlude org.kohsuke.github.extras.auth.* from code coverage
This is a package for examples/extra implementations
2020-10-05 13:57:52 +02:00
Marcos.Cela
a7112c42df linting: JWTTokenProvider.java 2020-10-05 13:48:37 +02:00
Marcos.Cela
8a474a3b00 add: example for Org Installation token on extras package 2020-10-05 13:39:30 +02:00
Marcos.Cela
59e18d155e add dependencies for jwt token generation
These dependencies are marked as "provided" because they are only
used in the extras package
2020-10-05 13:39:01 +02:00
Marco Ferrer
12ca5d8063 update deployment wiremocks 2020-10-02 17:40:47 -04:00
Marco Ferrer
c959e0a928 update accept header in wiremocks 2020-10-02 17:37:21 -04:00
Marco Ferrer
89a08b021d formatting 2020-10-02 17:14:28 -04:00
Marco Ferrer
04b553cdec update deployment status checks 2020-10-02 17:12:10 -04:00
Marco Ferrer
15e9ee30ee formatting 2020-10-02 16:52:23 -04:00
Marco Ferrer
a0d650a86c update deployment tests to read new fields 2020-10-02 16:47:01 -04:00
Marco Ferrer
1a6ad48e08 formatting 2020-10-02 16:35:46 -04:00
Marco Ferrer
7c82eeb018 Support deployment api previews ant-man and flash 2020-10-02 15:57:52 -04:00
Marco Ferrer
b188e74ee0 Add new const for flash preview 2020-10-02 14:16:50 -04:00
Tadas Giniotis
c21bd5765a add wiremock snapshots 2020-10-01 01:25:17 +03:00
Tadas Giniotis
b78c37a695 add tests 2020-10-01 01:23:34 +03:00
Tadas Giniotis
2f151d45c3 add wiremock snapshots 2020-10-01 01:00:20 +03:00
Tadas Giniotis
3ebe3afdbd add tests 2020-10-01 00:58:54 +03:00
Tadas Giniotis
f4845df6c0 implement ability to list comments of a specific commit 2020-10-01 00:58:42 +03:00
Tadas Giniotis
272b87f04d add ability to attach a signature when creating a commit 2020-09-30 23:21:05 +03:00
Marcos.Cela
ff790eeefb formatting of OrgInstallationCredentialProvider.java 2020-09-30 16:48:54 +02:00
Marcos.Cela
97e918da03 remove unused JWTTokenProvider (we are now using a github client) 2020-09-30 16:39:41 +02:00
Marcos.Cela
4f30998873 OrgInstallationCredentialProvider now receives a pre-configured client
This is required to pass integration tests. In terms of functionality,
the user should be able to provide a client with the given token provider.
It additionally increases control (e.g: usage of proxies)

Add tests
2020-09-29 16:13:23 +02:00
Marcos.Cela
a0fc478a28 remove final modifier from credentialProvider (required for tests) 2020-09-29 16:12:06 +02:00
Marcos.Cela
bb03fd1968 use Date#after instead of compareTo 2020-09-28 16:11:16 +02:00
Marcos.Cela
0c65f74662 formatting 2020-09-28 14:45:00 +02:00
Marcos.Cela
29ac2bd4f5 return a correctly formatted token 2020-09-28 14:24:01 +02:00
Marcos.Cela
0d8b4f32e8 document oauthAccessToken 2020-09-28 13:48:56 +02:00
Marcos.Cela
83db7f24eb document CredentialProvider @throws 2020-09-28 13:48:26 +02:00
Marcos.Cela
5f9976a193 formatting for OrgInstallationCredentialProvider 2020-09-28 13:37:59 +02:00
Marcos.Cela
9480ef485b withCredentialProvider is now public 2020-09-28 13:34:14 +02:00
Marcos.Cela
a9b7432584 formatting 2020-09-28 13:28:13 +02:00
Marcos.Cela
6d7081910f add OrgInstallationCredentialProvider and JWTTokenProvider
The JWTTokenProvider implementation is left to the end user,
otherwise we would need to include specific libraries, at least
as far as I am aware.
The OrgInstallationCredentialProvider will give a token,
refreshing when necessary and using the JWTTokenProvider
that the user needs to provide to request new tokens
2020-09-28 13:17:46 +02:00
Marcos.Cela
aa96089ab4 remove @see to external docs 2020-09-28 13:01:55 +02:00
Marcos.Cela
58ae681417 reduce visibilitof GitHubBuilder#withCredentialProvider 2020-09-28 12:59:21 +02:00
Marcos.Cela
c038e0af5e typo it'ts -> it's 2020-09-28 12:51:54 +02:00
Marcos.Cela
4f9976c0cb add GitHubBuilder#withCredentialProvider
With this we also need to check for exceptions when calling
"/user", because now we don't know what kind of credentials
are coming from the provider, and we could be requesting
a "/user" when the type of credentials is not supported
2020-09-28 12:40:44 +02:00
Marcos.Cela
e308e5ed57 use static utility methods instead of building logic in the constructor 2020-09-28 12:26:56 +02:00
Marcos.Cela
7b1b1ca994 ensure that isAnonymous() correctly handles IOException 2020-09-28 12:18:22 +02:00
Marcos.Cela
551be49a1a utility methods on ImmutableCredentialProvider
These methods let us build the most-used cases
for static credentials that will never change:
- JWT credentials
- Token-based credentials
- Basic Auth credentials
2020-09-28 10:43:43 +02:00
Marcos.Cela
a3888e6902 add CredentialProvider#ANONYMOUS class and field
This is basically an implementation of a CredentialProvider
that will always authenticate anonymously
2020-09-28 10:09:54 +02:00
Marcos Cela López
43bb6a0dd8 Merge branch 'master' into feat/credential-provider-refresh 2020-09-28 10:02:16 +02:00
seregamorph
6e3f754366 javadoc 2020-09-26 12:09:15 +03:00
seregamorph
6360112432 Merge remote-tracking branch 'origin/master' into feature/push-pulls-extensions 2020-09-26 12:04:55 +03:00
Liam Newman
f1ca0b5417 Merge pull request #946 from seregamorph/feature/pull-request-review-html-url
pullRequestReview.review.htmlUrl
2020-09-25 12:54:13 -07:00
seregamorph
0894c8007c pullRequestReview.review.htmlUrl 2020-09-25 13:24:35 +03:00
Marcos Cela López
05863acbcd Merge branch 'master' into feat/credential-provider-refresh 2020-09-25 12:05:31 +02:00
Marcos.Cela
0e4cd06137 GitHubClient uses CredentialProvider, instead of encodedAuthorization (string) 2020-09-25 12:02:14 +02:00
Marcos.Cela
85d2d974e7 add ImmutableCredentialProvider
This is basically a class that will hold an authorization
string, returning the same value all the time
2020-09-25 12:01:33 +02:00
Marcos.Cela
3f021f9552 lint CredentialProvider 2020-09-25 10:56:07 +02:00
seregamorph
0456f10709 address objections 2020-09-24 22:55:04 +03:00
seregamorph
b7d03f7463 user, push, pull event extensions 2020-09-24 22:41:56 +03:00
Liam Newman
07a392c2a7 Merge pull request #942 from seregamorph/feature/javadoc-references
Fix events javadoc references
2020-09-24 08:50:53 -07:00
seregamorph
5b69de770f Fix events javadoc references 2020-09-24 14:37:49 +03:00
Marcos.Cela
4688870984 add CredentialProvider interface 2020-09-24 09:01:52 +02:00
Liam Newman
bf67069768 Merge pull request #922 from tginiotis-at-work/commit_updates
methods for listing PRs where the commit is head & listing branches which contain the commit
2020-09-22 15:48:03 -07:00
Liam Newman
91764c1c74 Merge pull request #921 from tginiotis-at-work/pr_updates
update branch & change base on PRs
2020-09-22 15:46:06 -07:00
Tadas Giniotis
8b2a3e1221 add GHCommit tests 2020-09-03 23:17:39 +03:00
Tadas Giniotis
def2f0b37d methods for listing PRs where the commit is head & listing branches which contain the commit 2020-09-03 23:16:31 +03:00
Tadas Giniotis
5d7479a3dd add GHPullRequest tests 2020-09-03 22:13:28 +03:00
Tadas Giniotis
ceb2d35f9f update branch & change base on PRs 2020-09-03 22:10:33 +03:00
Liam Newman
fc38dba59a Update release drafter to $MAJOR.$MINOR
This project uses "x.y" for most releases.  At some point we might change this, but it is convenient for now.
2020-08-27 09:32:19 -07:00
Liam Newman
75b383d398 Update release-drafter.yml 2020-08-27 09:16:33 -07:00
Liam Newman
ee2d9491fb Update CHANGELOG.md 2020-08-27 09:13:03 -07:00
Liam Newman
bf86a7c75a Update dependabot.yml 2020-08-27 09:09:22 -07:00
Liam Newman
70f6d129e2 Merge pull request #936 from hub4j/dependabot/maven/org.mockito-mockito-core-3.5.7
Chore(deps-dev): Bump mockito-core from 3.5.2 to 3.5.7
2020-08-27 09:06:55 -07:00
dependabot[bot]
a4ac2aa99a Chore(deps-dev): Bump mockito-core from 3.5.2 to 3.5.7
Bumps [mockito-core](https://github.com/mockito/mockito) from 3.5.2 to 3.5.7.
- [Release notes](https://github.com/mockito/mockito/releases)
- [Commits](https://github.com/mockito/mockito/compare/v3.5.2...v3.5.7)

Signed-off-by: dependabot[bot] <support@github.com>
2020-08-26 02:00:58 +00:00
Liam Newman
ae3b6fbe6b Merge pull request #931 from hub4j/dependabot/maven/spotbugs.version-4.1.2
Chore(deps): Bump spotbugs.version from 4.1.1 to 4.1.2
2020-08-19 19:52:24 -07:00
Liam Newman
e357fca963 Merge pull request #930 from hub4j/dependabot/maven/org.mockito-mockito-core-3.5.2
Chore(deps-dev): Bump mockito-core from 3.5.0 to 3.5.2
2020-08-19 19:52:08 -07:00
dependabot[bot]
c84cc89805 Chore(deps): Bump spotbugs.version from 4.1.1 to 4.1.2
Bumps `spotbugs.version` from 4.1.1 to 4.1.2.

Updates `spotbugs` from 4.1.1 to 4.1.2
- [Release notes](https://github.com/spotbugs/spotbugs/releases)
- [Changelog](https://github.com/spotbugs/spotbugs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/spotbugs/spotbugs/compare/4.1.1...4.1.2)

Updates `spotbugs-annotations` from 4.1.1 to 4.1.2
- [Release notes](https://github.com/spotbugs/spotbugs/releases)
- [Changelog](https://github.com/spotbugs/spotbugs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/spotbugs/spotbugs/compare/4.1.1...4.1.2)

Signed-off-by: dependabot[bot] <support@github.com>
2020-08-20 02:01:10 +00:00
dependabot[bot]
181238cd50 Chore(deps-dev): Bump mockito-core from 3.5.0 to 3.5.2
Bumps [mockito-core](https://github.com/mockito/mockito) from 3.5.0 to 3.5.2.
- [Release notes](https://github.com/mockito/mockito/releases)
- [Commits](https://github.com/mockito/mockito/compare/v3.5.0...v3.5.2)

Signed-off-by: dependabot[bot] <support@github.com>
2020-08-19 02:00:47 +00:00
Liam Newman
214c24c736 Merge pull request #927 from hub4j/dependabot/maven/org.mockito-mockito-core-3.5.0
Chore(deps-dev): Bump mockito-core from 3.4.6 to 3.5.0
2020-08-17 08:40:40 -07:00
dependabot[bot]
cf51ce8f26 Chore(deps-dev): Bump mockito-core from 3.4.6 to 3.5.0
Bumps [mockito-core](https://github.com/mockito/mockito) from 3.4.6 to 3.5.0.
- [Release notes](https://github.com/mockito/mockito/releases)
- [Commits](https://github.com/mockito/mockito/compare/v3.4.6...v3.5.0)

Signed-off-by: dependabot[bot] <support@github.com>
2020-08-17 02:00:42 +00:00
Liam Newman
2b7ed40d01 [maven-release-plugin] prepare for next development iteration 2020-08-12 18:47:49 -07:00
Liam Newman
349ef7a54c [maven-release-plugin] prepare release github-api-1.116 2020-08-12 18:47:42 -07:00
Liam Newman
94df5fc389 Merge pull request #923 from bitwiseman/feature/is-template
Added GHRepository.isTemplate() method
2020-08-12 18:43:07 -07:00
Liam Newman
906238a297 Add GHRepository.isTemplate() 2020-08-12 18:28:18 -07:00
Liam Newman
7963fa82b5 Ensure withPreview can be called multiple times 2020-08-12 18:27:48 -07:00
Liam Newman
1aba6012fb Centralize GHRepository read 2020-08-12 18:21:44 -07:00
Liam Newman
ff4324ac67 Merge pull request #897 from bonnie-young/add-create-repo-with-template-support
add create repo with template support
2020-08-12 08:43:17 -07:00
Yang Ting
11bc669e1d update code for create repository from template
Signed-off-by: Yang Ting <bonnie.young@maxwit.com>
2020-08-12 22:08:31 +08:00
Liam Newman
dcf26d58e4 Merge pull request #919 from bitwiseman/task/one-more-date
Fixed and streamlined date parsing
2020-08-07 16:42:49 -07:00
Liam Newman
4d46872c35 Fixed and streamlined date parsing
Fixes #917
2020-08-07 16:36:23 -07:00
Liam Newman
4f0d62f421 Merge pull request #920 from ewiegs4/deployment-payload
Support for object deployment payloads
2020-08-07 16:35:54 -07:00
Eddie Wiegers
f7ad1f517b formatting 2020-08-07 17:46:33 -05:00
Eddie Wiegers
345d6197f3 Support for object deployment payloads. 2020-08-07 17:36:28 -05:00
Liam Newman
bb4d44138a Merge branch 'master' into add-create-repo-with-template-support 2020-08-04 16:05:02 -07:00
Liam Newman
a8ef0cde53 Merge pull request #913 from hub4j/dependabot/maven/spotbugs.version-4.1.1
Chore(deps): Bump spotbugs.version from 4.0.6 to 4.1.1
2020-08-03 10:58:51 -07:00
dependabot[bot]
77dc009c95 Chore(deps): Bump spotbugs.version from 4.0.6 to 4.1.1
Bumps `spotbugs.version` from 4.0.6 to 4.1.1.

Updates `spotbugs` from 4.0.6 to 4.1.1
- [Release notes](https://github.com/spotbugs/spotbugs/releases)
- [Changelog](https://github.com/spotbugs/spotbugs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/spotbugs/spotbugs/compare/4.0.6...4.1.1)

Updates `spotbugs-annotations` from 4.0.6 to 4.1.1
- [Release notes](https://github.com/spotbugs/spotbugs/releases)
- [Changelog](https://github.com/spotbugs/spotbugs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/spotbugs/spotbugs/compare/4.0.6...4.1.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-08-03 02:00:46 +00:00
Liam Newman
aa298c93cc Merge pull request #911 from bitwiseman/task/workflow-run
Add GHEvent.WORKFLOW_RUN
2020-08-02 08:27:02 -07:00
Liam Newman
dfb0a5240e Merge pull request #909 from JKalash/jkalash/master
GHCheckRun.getPullRequests public
2020-07-31 16:06:17 -07:00
Liam Newman
9cfc3c22b5 Add GHEvent.WORKFLOW_RUN 2020-07-31 16:03:34 -07:00
Liam Newman
b177d98e29 Populate Check pull requests
Turns out there were quite a few bugs in this area (it was exposed publicly before. Some
tweaking was needed and updates to the tests to show this working as expected.
2020-07-31 15:57:17 -07:00
Joe
5405fb0370 return unmodifiable list 2020-07-30 21:48:42 +01:00
Joe
72a1c24b3b format 2020-07-30 21:43:37 +01:00
Joe
f146ae94ec return iterable 2020-07-30 21:41:16 +01:00
Joe
a0bbba748a check suite exposes pull requests 2020-07-30 20:10:44 +01:00
Joe
81bf818573 pullRequests returns iterable 2020-07-30 20:01:44 +01:00
Joe
d5913dc292 fix array exposure 2020-07-30 15:25:35 +01:00
Joe Kalash
e1e901b794 Merge branch 'master' into jkalash/master 2020-07-30 14:01:01 +01:00
Joe
2f2f26767e make getPullRequests public 2020-07-30 13:59:36 +01:00
Liam Newman
bffa78c1b8 Merge pull request #907 from hub4j/dependabot/maven/org.mockito-mockito-core-3.4.6
Chore(deps-dev): Bump mockito-core from 3.4.4 to 3.4.6
2020-07-29 20:11:55 -07:00
dependabot[bot]
c55719c67a Chore(deps-dev): Bump mockito-core from 3.4.4 to 3.4.6
Bumps [mockito-core](https://github.com/mockito/mockito) from 3.4.4 to 3.4.6.
- [Release notes](https://github.com/mockito/mockito/releases)
- [Commits](https://github.com/mockito/mockito/compare/v3.4.4...v3.4.6)

Signed-off-by: dependabot[bot] <support@github.com>
2020-07-30 02:00:49 +00:00
Liam Newman
cb3b4a6642 Merge pull request #906 from JKalash/jkalash/master
Merge arbitrary branches
2020-07-28 16:37:40 -07:00
Liam Newman
92c141cee6 Add support for string head
Also support all changes already merged.
2020-07-28 12:57:31 -07:00
Liam Newman
fd1a1a1c23 Simplified tests 2020-07-28 11:22:07 -07:00
Joe
b835884b2e fix test 2020-07-28 14:37:50 +01:00
Joe
660763908d test refactor 2020-07-28 14:24:35 +01:00
Joe
fe8bdb755a Merge branches method 2020-07-28 12:41:31 +01:00
Liam Newman
67dc6d2d23 Merge pull request #904 from Javaru/add-missing-org-permissions
Added MAINTAIN and TRIAGE to GHOrganization.Permission enum
2020-07-27 21:27:27 -07:00
Mark Vedder
9c8d73cbe2 Merge branch 'master' into add-missing-org-permissions 2020-07-27 18:54:32 -04:00
Liam Newman
5db97d92dd Merge pull request #899 from gastaldi/set_milestone
PullRequest.setMilestone should use the Issue API
2020-07-27 14:18:05 -07:00
Liam Newman
ac470dddb5 Merge branch 'master' into add-create-repo-with-template-support 2020-07-27 14:14:16 -07:00
Liam Newman
43063fe8ce Minor tweaks 2020-07-27 14:12:15 -07:00
George Gastaldi
59e0046c1e Validate argument in GitHub.getRepository
This avoids the ArrayIndexOutOfBoundsException when the argument format is invalid
2020-07-27 17:47:56 -03:00
George Gastaldi
36ab05c265 PullRequest.setMilestone should use the Issue API 2020-07-27 17:47:56 -03:00
Liam Newman
2b2be05dae Merge pull request #900 from gastaldi/repo_fix
Fixes modifyCollaborators for multiple users
2020-07-27 13:23:06 -07:00
Liam Newman
fb1adbd1ef Make withUrlPath() overwrite instead of append
I had some ideas about having multiple calls to  apend to build up paths,
but it turns out that idea is pretty bad.  `with*()` methods should
overwrite when called for the same field.

If we want to create and , we can do that later.
2020-07-27 13:12:46 -07:00
Javaru
ab68a59b25 Added MAINTAIN and TRIAGE to GHOrganization.Permission enum 2020-07-27 15:50:32 -04:00
George Gastaldi
9c7de767e9 Fixes modifyCollaborators for multiple users
Fixes #868
2020-07-27 12:37:34 -07:00
George Gastaldi
8ba5cf7c2e Formatting tweaks and fixes 2020-07-27 12:31:09 -07:00
Bonnie Young
b194a19b98 Merge branch 'master' into add-create-repo-with-template-support 2020-07-21 00:32:52 +08:00
Liam Newman
1d344b016f Merge pull request #898 from hub4j/dependabot/maven/org.mockito-mockito-core-3.4.4
Chore(deps-dev): Bump mockito-core from 3.4.2 to 3.4.4
2020-07-20 00:35:58 -07:00
dependabot[bot]
474f3ef4ca Chore(deps-dev): Bump mockito-core from 3.4.2 to 3.4.4
Bumps [mockito-core](https://github.com/mockito/mockito) from 3.4.2 to 3.4.4.
- [Release notes](https://github.com/mockito/mockito/releases)
- [Commits](https://github.com/mockito/mockito/compare/v3.4.2...v3.4.4)

Signed-off-by: dependabot[bot] <support@github.com>
2020-07-20 02:00:54 +00:00
Yang Ting
9830927020 add create repo with template support
Signed-off-by: Yang Ting <bonnie.young@maxwit.com>
2020-07-19 23:07:19 +08:00
Liam Newman
727932a442 Merge pull request #895 from jeetchoudhary/protection
GHBranch getProtection method to return correct number of reviewers #890
2020-07-17 12:27:05 -07:00
jeetchoudhary
cd92b51845 Merge branch 'master' into protection 2020-07-17 23:59:51 +05:30
Liam Newman
fe26d16411 Update test and data to verify getProtection() code path
The create and get code paths are different.  Both need testing.
2020-07-17 10:50:54 -07:00
Liam Newman
d68c66ce2b Merge pull request #893 from hub4j/dependabot/maven/org.mockito-mockito-core-3.4.2
Chore(deps-dev): Bump mockito-core from 3.4.0 to 3.4.2
2020-07-17 09:59:31 -07:00
Jitender kumar
e7bfbfb48f reformat class 2020-07-17 17:28:15 +05:30
jeetchoudhary
f2a88ae61c fixing getRequiredReviewers to return count #890 2020-07-17 16:55:51 +05:30
jeetchoudhary
e2113f6ee5 Update rest request for test case 2020-07-17 16:52:17 +05:30
dependabot[bot]
3867224024 Chore(deps-dev): Bump mockito-core from 3.4.0 to 3.4.2
Bumps [mockito-core](https://github.com/mockito/mockito) from 3.4.0 to 3.4.2.
- [Release notes](https://github.com/mockito/mockito/releases)
- [Commits](https://github.com/mockito/mockito/compare/v3.4.0...v3.4.2)

Signed-off-by: dependabot[bot] <support@github.com>
2020-07-17 02:01:30 +00:00
Liam Newman
9ee0bf43bc [maven-release-plugin] prepare for next development iteration 2020-07-16 15:16:56 -07:00
Liam Newman
2844542efa [maven-release-plugin] prepare release github-api-1.115 2020-07-16 15:16:47 -07:00
Liam Newman
e3fcae9392 Revert "Remove Java 15-ea"
This reverts commit c6ccfa91f3.
2020-07-15 15:32:46 -07:00
Liam Newman
c6ccfa91f3 Remove Java 15-ea
It is unclear exactly why this started failing but we're not interested figuring this out.
2020-07-15 15:19:06 -07:00
Liam Newman
b6fcee1cb9 Rollback to surefire 2.22.2 2020-07-15 15:14:16 -07:00
Liam Newman
9071befb04 Run slow or flaky tests in test phase 2020-07-15 15:05:26 -07:00
Liam Newman
bdd5fe98f3 Use file to specify slow-or-flaky-tests list 2020-07-15 15:00:03 -07:00
Liam Newman
a3d3e83a49 Move slow or flaky tests to separate surefire execution
This lets us have most tests run immediately and with no retries and then have slower tests that may be flaky run later with retries.
2020-07-15 14:45:32 -07:00
Liam Newman
08bde72028 Merge pull request #849 from alexanderkjall/add-support-for-child-teams
Added support for fetching what teams are part of this team.
2020-07-15 14:05:47 -07:00
Liam Newman
108a136368 Remove getChildTeams and add test for no children 2020-07-15 13:46:11 -07:00
Liam Newman
57d87ad6b1 Merge branch 'master' into add-support-for-child-teams 2020-07-15 13:28:32 -07:00
Liam Newman
0c22815ff7 Merge pull request #872 from MarcosCela/doc/org-level-resources
Add documentation for organization-level resources
2020-07-15 13:27:05 -07:00
Liam Newman
0ca792ecfd Merge pull request #830 from bitwiseman/task/rate-limit/full
Handle header and endpoint rate limit responses consistently
2020-07-15 12:42:11 -07:00
Liam Newman
987c34c69e Merge branch 'master' into task/rate-limit/full 2020-07-15 12:13:16 -07:00
Liam Newman
c1c02bc8ab Merge pull request #887 from hub4j/dependabot/maven/org.mockito-mockito-core-3.4.0
Chore(deps-dev): Bump mockito-core from 3.3.3 to 3.4.0
2020-07-14 12:02:54 -07:00
dependabot[bot]
4ee369f27c Chore(deps-dev): Bump mockito-core from 3.3.3 to 3.4.0
Bumps [mockito-core](https://github.com/mockito/mockito) from 3.3.3 to 3.4.0.
- [Release notes](https://github.com/mockito/mockito/releases)
- [Commits](https://github.com/mockito/mockito/compare/v3.3.3...v3.4.0)

Signed-off-by: dependabot[bot] <support@github.com>
2020-07-13 15:52:33 +00:00
Liam Newman
c9012efdcb Merge pull request #886 from hub4j/dependabot/maven/net.revelc.code.formatter-formatter-maven-plugin-2.12.1
Chore(deps): Bump formatter-maven-plugin from 2.12.0 to 2.12.1
2020-07-13 08:51:51 -07:00
dependabot[bot]
41524fc67d Chore(deps): Bump formatter-maven-plugin from 2.12.0 to 2.12.1
Bumps [formatter-maven-plugin](https://github.com/revelc/formatter-maven-plugin) from 2.12.0 to 2.12.1.
- [Release notes](https://github.com/revelc/formatter-maven-plugin/releases)
- [Changelog](https://github.com/revelc/formatter-maven-plugin/blob/formatter-maven-plugin-2.12.1/CHANGELOG.md)
- [Commits](https://github.com/revelc/formatter-maven-plugin/compare/formatter-maven-plugin-2.12.0...formatter-maven-plugin-2.12.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-07-13 02:00:47 +00:00
Liam Newman
04ff61e981 Merge pull request #885 from XiongKezhi/add-missing-conclusion
Add the missing SKIPPED check run conclusion
2020-07-12 14:11:56 -07:00
Liam Newman
532468dc67 Update src/main/java/org/kohsuke/github/GHCheckRun.java 2020-07-12 13:41:57 -07:00
Kezhi Xiong
9c9a2dae47 Add JavaDoc for check run conclusion 2020-07-12 15:58:34 +08:00
Kezhi Xiong
c8a868b57f Add the missing SKIPPED check run conclusion 2020-07-12 15:54:09 +08:00
Liam Newman
4b3f81ee34 Clean up comments and javadoc 2020-07-10 10:51:20 -07:00
Liam Newman
afa170ba7c Add more tests for rate limit record selection 2020-07-10 09:01:29 -07:00
Liam Newman
46e3b2272e Clean up and reorganize changes
Changed GitHubRateLimitSpecifier to RateLimitTarget
Made RateLimitTarget public so it can be passed to GitHubBuilder
2020-07-10 09:01:29 -07:00
Liam Newman
52472e90ec Simplified rate limit record selection
Here we have another example of trying to do something clever when simplicity is the better choice.
Rather than trying to guess the rate limit record for a request based on the url path,
I added an enumeration which can be set on the request to say which rate limit record to applies.

This is simpler, safer, and faster than trying to guess the rate limit from the url path.
2020-07-10 09:01:29 -07:00
Liam Newman
4ef0d00846 Integrate full rate limit checking 2020-07-10 09:01:29 -07:00
Liam Newman
580f2537f2 Move GHRef readers to GHRef class 2020-07-09 15:00:40 -07:00
Liam Newman
3d9fd96026 Merge pull request #884 from bitwiseman/task/gitbucket
Workaround for GitBucket refs issue
2020-07-09 13:38:55 -07:00
Liam Newman
f449b92721 Workaround for GitBucket refs issue
The bug that caused this has been fixed by GitBucket but may not be released for some time.
It was a change to this library that broke them, so to be nice we're fully working around it here.

That said, the GET /refs endpoint is deprecated and will be going away at some point.
We will be making a breaking change in this area again in the next few months. We'll need to raise
it to GitBucket to make sure they handle it proproperly.
2020-07-09 09:50:29 -07:00
Liam Newman
3b0216b023 Merge pull request #877 from hub4j/dependabot/maven/com.github.tomakehurst-wiremock-jre8-standalone-2.27.1
Chore(deps-dev): Bump wiremock-jre8-standalone from 2.26.3 to 2.27.1
2020-07-07 12:40:23 -07:00
Liam Newman
98cf839737 Add new methods 2020-07-07 12:29:59 -07:00
dependabot[bot]
0bb0846505 Chore(deps-dev): Bump wiremock-jre8-standalone from 2.26.3 to 2.27.1
Bumps [wiremock-jre8-standalone](https://github.com/tomakehurst/wiremock) from 2.26.3 to 2.27.1.
- [Release notes](https://github.com/tomakehurst/wiremock/releases)
- [Commits](https://github.com/tomakehurst/wiremock/compare/2.26.3...2.27.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-07-07 19:23:07 +00:00
Liam Newman
70969400a3 Merge pull request #876 from jtnord/symlink-support
Add minimal symlink support via GHContent.getTarget()
2020-07-07 12:21:39 -07:00
Liam Newman
147e8d5d12 Merge branch 'master' into symlink-support 2020-07-07 11:38:14 -07:00
Liam Newman
cacc3e6edd Update formatter cache directory 2020-07-07 10:15:00 -07:00
Liam Newman
a284eca147 Shorten file paths for windows 2020-07-07 09:48:31 -07:00
James Nord
0d3ba9d7f0 formatting fixes 2020-07-07 13:29:33 +01:00
Liam Newman
be8064d642 Merge pull request #879 from hub4j/dependabot/maven/org.codehaus.mojo-animal-sniffer-maven-plugin-1.19
Chore(deps): Bump animal-sniffer-maven-plugin from 1.18 to 1.19
2020-07-06 10:15:33 -07:00
dependabot[bot]
e30dba742d Chore(deps): Bump animal-sniffer-maven-plugin from 1.18 to 1.19
Bumps [animal-sniffer-maven-plugin](https://github.com/mojohaus/animal-sniffer) from 1.18 to 1.19.
- [Release notes](https://github.com/mojohaus/animal-sniffer/releases)
- [Commits](https://github.com/mojohaus/animal-sniffer/compare/animal-sniffer-parent-1.18...animal-sniffer-parent-1.19)

Signed-off-by: dependabot[bot] <support@github.com>
2020-07-06 02:01:00 +00:00
James Nord
44b72ed647 Add initial symlink support.
this adds rudimentary symlink support (just enough to get a symlink).

still todo, howto handle GHRepository.getFileContent where the path
contains a symlink within the repository
2020-07-02 17:18:20 +01:00
Liam Newman
666bd77dac Merge pull request #874 from hub4j/bitwiseman-patch-1
Add "workflow_dispatch" to GHEvent
2020-07-02 08:52:31 -07:00
Liam Newman
0a6613e60d Add "workflow_dispatch" to GHEvent
This event is undocumented at this time, but this change will stop the deserialization errors.

Fixes #854
2020-07-01 15:57:33 -07:00
Liam Newman
62e186c123 Merge pull request #871 from hub4j/dependabot/maven/net.revelc.code.formatter-formatter-maven-plugin-2.12.0
Chore(deps): Bump formatter-maven-plugin from 2.11.0 to 2.12.0
2020-06-30 11:02:37 -07:00
Marcos.Cela
50dd8f5bcc add a new doc section "Working with organizations" with a simple example
Closes #812
2020-06-30 09:44:57 +02:00
Marcos Cela
d5fcac9c45 Merge pull request #1 from hub4j/master
Update base
2020-06-30 08:44:42 +02:00
dependabot[bot]
c2bed85190 Chore(deps): Bump formatter-maven-plugin from 2.11.0 to 2.12.0
Bumps [formatter-maven-plugin](https://github.com/revelc/formatter-maven-plugin) from 2.11.0 to 2.12.0.
- [Release notes](https://github.com/revelc/formatter-maven-plugin/releases)
- [Changelog](https://github.com/revelc/formatter-maven-plugin/blob/master/CHANGELOG.md)
- [Commits](https://github.com/revelc/formatter-maven-plugin/compare/formatter-maven-plugin-2.11.0...formatter-maven-plugin-2.12.0)

Signed-off-by: dependabot[bot] <support@github.com>
2020-06-30 02:00:52 +00:00
Liam Newman
183b463ef2 Merge branch 'master' into add-support-for-child-teams 2020-06-29 09:58:14 -07:00
Liam Newman
92fdac44a0 Merge pull request #869 from hub4j/dependabot/maven/org.apache.maven.plugins-maven-site-plugin-3.9.1
Chore(deps): Bump maven-site-plugin from 3.9.0 to 3.9.1
2020-06-29 09:57:00 -07:00
dependabot[bot]
12829ecc73 Chore(deps): Bump maven-site-plugin from 3.9.0 to 3.9.1
Bumps [maven-site-plugin](https://github.com/apache/maven-site-plugin) from 3.9.0 to 3.9.1.
- [Release notes](https://github.com/apache/maven-site-plugin/releases)
- [Commits](https://github.com/apache/maven-site-plugin/compare/maven-site-plugin-3.9.0...maven-site-plugin-3.9.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-06-25 02:00:46 +00:00
Alexander Kjäll
51319c3b26 use this.organization instead of providing the organization as a parameter 2020-06-24 07:30:59 +02:00
Liam Newman
8fd827040b Merge pull request #860 from hub4j/dependabot/github_actions/actions/cache-v2
Chore(deps): Bump actions/cache from v1 to v2
2020-06-23 09:24:06 -07:00
dependabot[bot]
5ec46eae0d Chore(deps): Bump actions/cache from v1 to v2
Bumps [actions/cache](https://github.com/actions/cache) from v1 to v2.
- [Release notes](https://github.com/actions/cache/releases)
- [Commits](https://github.com/actions/cache/compare/v1...b8204782bbb5f872091ecc5eb9cb7d004e35b1fa)

Signed-off-by: dependabot[bot] <support@github.com>
2020-06-23 14:59:54 +00:00
Liam Newman
32c03301be Merge pull request #853 from sullis/add-dependabot
add Dependabot
2020-06-23 07:59:26 -07:00
Liam Newman
df7f29b2ab Merge pull request #858 from hub4j/dependabot/maven/spotbugs.version-4.0.6
Chore(deps): Bump spotbugs.version from 4.0.4 to 4.0.6
2020-06-23 07:55:48 -07:00
dependabot-preview[bot]
e863113c36 Chore(deps): Bump spotbugs.version from 4.0.4 to 4.0.6
Bumps `spotbugs.version` from 4.0.4 to 4.0.6.

Updates `spotbugs` from 4.0.4 to 4.0.6
- [Release notes](https://github.com/spotbugs/spotbugs/releases)
- [Changelog](https://github.com/spotbugs/spotbugs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/spotbugs/spotbugs/compare/4.0.4...4.0.6)

Updates `spotbugs-annotations` from 4.0.4 to 4.0.6
- [Release notes](https://github.com/spotbugs/spotbugs/releases)
- [Changelog](https://github.com/spotbugs/spotbugs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/spotbugs/spotbugs/compare/4.0.4...4.0.6)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-06-23 06:40:11 +00:00
Liam Newman
8e2c1d7382 Merge pull request #851 from MarcosCela/fix/ghteambuilder-accept-long
GHTeamBuilder#parentTeamId now accepts a long instead of an int
2020-06-22 06:28:20 -07:00
Liam Newman
ab7b9cccba Merge branch 'master' into fix/ghteambuilder-accept-long 2020-06-22 06:18:54 -07:00
Liam Newman
81bf61a161 Merge pull request #857 from hub4j/dependabot/maven/com.github.spotbugs-spotbugs-maven-plugin-4.0.4
Chore(deps): Bump spotbugs-maven-plugin from 4.0.0 to 4.0.4
2020-06-22 06:14:39 -07:00
dependabot-preview[bot]
b40f008647 Chore(deps): Bump spotbugs-maven-plugin from 4.0.0 to 4.0.4
Bumps [spotbugs-maven-plugin](https://github.com/spotbugs/spotbugs-maven-plugin) from 4.0.0 to 4.0.4.
- [Release notes](https://github.com/spotbugs/spotbugs-maven-plugin/releases)
- [Commits](https://github.com/spotbugs/spotbugs-maven-plugin/compare/spotbugs-maven-plugin-4.0.0...spotbugs-maven-plugin-4.0.4)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-06-22 06:57:13 +00:00
Sean C. Sullivan
734e41702b add Dependabot
https://github.blog/2020-06-01-keep-all-your-packages-up-to-date-with-dependabot/
2020-06-20 07:10:28 -07:00
Alexander Kjäll
038dd20a91 added a unit test for fetching a child team 2020-06-19 08:27:25 +02:00
Marcos.Cela
1dd62b8550 add a simple test for GHTeamBuilder: create a team with a parent/child relation
Additionally, ensure that when creating the team and setting the parentTeamId
on the GHTeamBuilder, we receive it directly from a previously retrieved
GHTeam. This ensures that the return type of GHTeam#getId() is compatible
with GHTeamBuilder#parentTeamId()
2020-06-18 10:33:04 +02:00
Marcos.Cela
715deebe05 GHTeamBuilder#parentTeamId now accepts a long instead of an int
Closes #850
2020-06-17 12:15:29 +02:00
Alexander Kjäll
b3fe3d8590 Added support for fetching what teams are part of this team.
The call is to this endpoint https://developer.github.com/v3/teams/#list-child-teams-legacy
2020-06-17 09:38:17 +02:00
Liam Newman
f74c3ed3ea Merge pull request #848 from hub4j/dependabot/maven/org.kohsuke.stapler-stapler-1.260
Chore(deps-dev): Bump stapler from 1.259 to 1.260
2020-06-16 08:39:53 -07:00
Liam Newman
2c9aebeeed Merge pull request #847 from hub4j/timja-patch-1
Fix tag template in release drafter
2020-06-16 08:34:54 -07:00
dependabot-preview[bot]
7474f1e11f Chore(deps-dev): Bump stapler from 1.259 to 1.260
Bumps [stapler](https://github.com/stapler/stapler) from 1.259 to 1.260.
- [Release notes](https://github.com/stapler/stapler/releases)
- [Changelog](https://github.com/stapler/stapler/blob/master/CHANGELOG.md)
- [Commits](https://github.com/stapler/stapler/compare/stapler-parent-1.259...stapler-parent-1.260)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-06-16 06:28:21 +00:00
Tim Jacomb
dba9c55b64 Fix tag template in release drafter 2020-06-16 07:16:52 +01:00
Liam Newman
b432364397 [maven-release-plugin] prepare for next development iteration 2020-06-10 20:02:26 -07:00
Liam Newman
696967bdd1 [maven-release-plugin] prepare release github-api-1.114 2020-06-10 20:02:18 -07:00
Liam Newman
b76889efc3 Merge pull request #845 from bitwiseman/task/redo-822
Modify getRef() changes to be compatible with older GHE versions
2020-06-10 20:00:44 -07:00
Liam Newman
e6a7b64ebe Merge branch 'master' into task/redo-822 2020-06-10 19:53:42 -07:00
Liam Newman
9daa0df311 Modify getRef() changes to be compatible with older GHE versions
Fixes #844
    Fixes #794
2020-06-10 19:47:23 -07:00
Liam Newman
612800bda5 Merge pull request #843 from bitwiseman/task/body-close
[JENKINS-62655] Ensure connection response stream is always closed
2020-06-10 17:30:12 -07:00
Liam Newman
a6bbb1dec9 Ensure connection response stream is always closed 2020-06-10 17:22:25 -07:00
Liam Newman
873c93ab64 Merge pull request #841 from hub4j/dependabot/maven/org.apache.bcel-bcel-6.5.0
Chore(deps): Bump bcel from 6.4.1 to 6.5.0
2020-06-10 08:59:00 -07:00
dependabot-preview[bot]
d15242e2d2 Chore(deps): Bump bcel from 6.4.1 to 6.5.0
Bumps bcel from 6.4.1 to 6.5.0.

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-06-10 03:50:37 +00:00
Liam Newman
992d2b937c Merge pull request #840 from hub4j/dependabot/maven/spotbugs.version-4.0.4
Chore(deps): Bump spotbugs.version from 4.0.3 to 4.0.4
2020-06-09 20:49:24 -07:00
dependabot-preview[bot]
1e05ddad4b Chore(deps): Bump spotbugs.version from 4.0.3 to 4.0.4
Bumps `spotbugs.version` from 4.0.3 to 4.0.4.

Updates `spotbugs` from 4.0.3 to 4.0.4
- [Release notes](https://github.com/spotbugs/spotbugs/releases)
- [Changelog](https://github.com/spotbugs/spotbugs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/spotbugs/spotbugs/compare/4.0.3...4.0.4)

Updates `spotbugs-annotations` from 4.0.3 to 4.0.4
- [Release notes](https://github.com/spotbugs/spotbugs/releases)
- [Changelog](https://github.com/spotbugs/spotbugs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/spotbugs/spotbugs/compare/4.0.3...4.0.4)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-06-09 06:33:50 +00:00
Liam Newman
4f8a64610b [maven-release-plugin] prepare for next development iteration 2020-06-08 14:37:20 -07:00
Liam Newman
b82366218c [maven-release-plugin] prepare release github-api-1.113 2020-06-08 14:37:11 -07:00
Liam Newman
acbe1f4cb3 Update PULL_REQUEST_TEMPLATE.md 2020-06-08 13:25:56 -07:00
Liam Newman
4c5e018583 Merge pull request #838 from Chew/feature/new-profile-data
Add bio, hireable, and twitter_username fields to Person
2020-06-08 12:21:16 -07:00
Liam Newman
6c0380e85c Merge pull request #839 from bitwiseman/issue-828
Add GitHub Team Discussions as GHDiscussion
2020-06-08 12:18:46 -07:00
Liam Newman
fde48e604f Test coverage and javadoc fixes 2020-06-08 12:06:39 -07:00
Liam Newman
e83a4de5fb Merge branch 'master' into feature/new-profile-data 2020-06-08 10:33:29 -07:00
Liam Newman
927d2799dc Move url construction to single method 2020-06-08 10:12:15 -07:00
Liam Newman
1ad701fe5d Add convenience override of getId() 2020-06-08 09:59:43 -07:00
Liam Newman
086425d2da Tweaks for batch update 2020-06-08 09:59:43 -07:00
Charles Moulliard
beca54416a Merge branch 'master' into issue-828 2020-06-08 18:43:15 +02:00
Chew
c92f5c5713 Update test value and add new test for Twitter Username 2020-06-07 15:05:02 -05:00
Chew
dee4e6caff Add twitter_username to Person and bio and hireable to User 2020-06-07 00:55:44 -05:00
Liam Newman
dd5a39e72e Improve wiremock stub accuracy 2020-06-06 16:29:26 -07:00
Charles Moulliard
e5ed52165c Fix: Add missing @param for the delete() method 2020-06-04 18:26:14 +02:00
Charles Moulliard
9484f8e0f5 Chore: Add more methods to test CRUD operations on discusions 2020-06-04 18:19:41 +02:00
Charles Moulliard
947caffe0a Chore: Add method to get a discussion using a number/id 2020-06-04 17:27:15 +02:00
Charles Moulliard
870090e8df Chore: Remove javadoc Throwing the exception for the GHDiscussionbuilder - update method 2020-06-04 13:51:04 +02:00
Charles Moulliard
73f07f13c5 Chore: Remove javadoc Throwing the exception 2020-06-04 13:47:41 +02:00
Charles Moulliard
d1952bf591 Chore: Reformat method 2020-06-04 13:37:08 +02:00
Charles Moulliard
5a612e1332 Chore: Add try/catch block if we cannot find the discussion to be updated 2020-06-04 13:25:57 +02:00
Charles Moulliard
b00a9faea6 Fix: Add missing parameter 2020-06-04 12:58:07 +02:00
Charles Moulliard
74db42a703 Chore: Add method to update a discussion 2020-06-04 12:52:58 +02:00
Charles Moulliard
ddf625ca04 Chore: Add method to delete a discussion using its number. Add field number 2020-06-04 12:20:36 +02:00
Charles Moulliard
eca2f017d8 Fix: Add missing import statement for the Jackson Annotation. Use the correct htmlUrl field 2020-06-04 11:32:33 +02:00
Charles Moulliard
3190bde343 Fix: Add mising try/catch block to report the exeption when no discussions are found 2020-06-04 11:31:50 +02:00
Charles Moulliard
c6ebf42a47 Update src/main/java/org/kohsuke/github/GHTeam.java
Dont wrapUp using the team object

Co-authored-by: Liam Newman <bitwiseman@gmail.com>
2020-06-04 11:14:42 +02:00
Charles Moulliard
c116b60d12 Update src/main/java/org/kohsuke/github/GHDiscussion.java
Add doc link to github team discussion API

Co-authored-by: Liam Newman <bitwiseman@gmail.com>
2020-06-04 11:13:19 +02:00
Charles Moulliard
5d09e6d9ab Update src/main/java/org/kohsuke/github/GHDiscussion.java
Remove `this.root` as it is already set with the org

Co-authored-by: Liam Newman <bitwiseman@gmail.com>
2020-06-04 11:12:38 +02:00
Charles Moulliard
2613ce0ac9 Update src/main/java/org/kohsuke/github/GHDiscussion.java
Remove to set the field `root`

Co-authored-by: Liam Newman <bitwiseman@gmail.com>
2020-06-04 11:10:21 +02:00
Charles Moulliard
a88e9b28ea Update src/main/java/org/kohsuke/github/GHDiscussion.java
Change the visibility of the fields from protected to private. Add @JacksonInject annotation. Rename html_url to htmlUrl as needed by Jackson

Co-authored-by: Liam Newman <bitwiseman@gmail.com>
2020-06-04 11:09:24 +02:00
Charles Moulliard
f0a3c26ee6 Fix: Add the missing correct file to check the discussion created using wiremock 2020-06-04 10:44:26 +02:00
Charles Moulliard
84c87ecb32 Chore: Fixed the null org within the generated json file but we still get an error 404 2020-06-04 08:49:16 +02:00
Charles Moulliard
6573f44d41 Fix: As the name of the organization could be empty/null, then use getLogin to get the org name 2020-06-04 07:46:51 +02:00
Charles Moulliard
3cacbc552c Fix: Set the organisation name to avoid to populate a url request having /orgs/null 2020-06-04 07:30:44 +02:00
Charles Moulliard
343d623e02 chore: Push new resource files generated 2020-06-04 07:22:53 +02:00
Charles Moulliard
6b80bb2b11 chore: Remove deleted resources files 2020-06-04 07:00:14 +02:00
Charles Moulliard
56fe7452eb chore. Review test case. Add new wrapUp methods 2020-06-04 06:59:41 +02:00
Charles Moulliard
d3a66f6605 chore: Regenerate new testing files 2020-05-29 17:37:49 +02:00
Charles Moulliard
dd7b4712f1 fix: Add missing @throws IOException 2020-05-29 17:24:49 +02:00
Charles Moulliard
9df5871f6b chore: wrapUp Github instance 2020-05-29 17:20:54 +02:00
Charles Moulliard
29aab9e9f4 chore: Add missing classes and test case 2020-05-29 16:34:07 +02:00
Charles Moulliard
af67eb7f0b feat: add new APi for Discussion 2020-05-29 16:28:47 +02:00
Liam Newman
10482c0141 [maven-release-plugin] prepare for next development iteration 2020-05-28 07:48:53 -07:00
Liam Newman
a7a792251a [maven-release-plugin] prepare release github-api-1.112 2020-05-28 07:48:45 -07:00
Liam Newman
aec2308144 Merge pull request #831 from hub4j/dependabot/maven/org.apache.maven.plugins-maven-project-info-reports-plugin-3.1.0
Bump maven-project-info-reports-plugin from 3.0.0 to 3.1.0
2020-05-28 07:34:56 -07:00
dependabot-preview[bot]
0741b8aa6a Bump maven-project-info-reports-plugin from 3.0.0 to 3.1.0
Bumps [maven-project-info-reports-plugin](https://github.com/apache/maven-project-info-reports-plugin) from 3.0.0 to 3.1.0.
- [Release notes](https://github.com/apache/maven-project-info-reports-plugin/releases)
- [Commits](https://github.com/apache/maven-project-info-reports-plugin/compare/maven-project-info-reports-plugin-3.0.0...maven-project-info-reports-plugin-3.1.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-05-28 06:40:32 +00:00
Liam Newman
3082622394 Merge pull request #822 from bitwiseman/issue/794
Fixed getRef() to use git/ref endpoint instead of git/refs
2020-05-21 11:02:43 -07:00
Liam Newman
965c9cb0af Fixed getRef() to use git/ref endpoint instead of git/refs
Fixes #794
2020-05-21 10:41:36 -07:00
Liam Newman
495a46e2d8 Merge pull request #823 from bitwiseman/task/cleanup-more
Code cleanup for GHObject and GHRepositoryStatistics
2020-05-21 07:51:51 -07:00
Liam Newman
05bda1192e Merge branch 'master' into task/cleanup-more 2020-05-20 21:00:31 -07:00
Liam Newman
6058af0ca1 Merge pull request #821 from bitwiseman/issue/805
Populate Source and Parent if needed
2020-05-20 20:59:21 -07:00
Liam Newman
1eb8bf9719 Reduce round trips and cleanup test data 2020-05-20 19:13:37 -07:00
Liam Newman
afc02faeda Clean up GHObject field access 2020-05-20 19:11:48 -07:00
Liam Newman
66f22de90f Populate Source and Parent if needed
NOTE: this also addresses a bug in push events where the repository url is incorrect
2020-05-20 13:22:09 -07:00
Liam Newman
2949a2e0ff Clean up GHRepositoryStatistics constructors 2020-05-19 17:25:58 -07:00
Liam Newman
ba12efea9d Merge pull request #820 from bitwiseman/issue/800
Prevent NPE when accessing description for GHLicense
2020-05-19 17:25:14 -07:00
Liam Newman
e1180a12fb Merge pull request #817 from bitwiseman/issue/802
Consider header rate limit information for getRateLimit()
2020-05-19 17:08:25 -07:00
Liam Newman
1393706f13 Prevent NPE when accessing description for license
When license can be identified, the description will be null.  So will the url.
Tht means that url cannot be converted to string.

Fixes #800 .
2020-05-19 17:06:59 -07:00
Liam Newman
6f994f31f7 Update src/main/java/org/kohsuke/github/GitHubClient.java 2020-05-19 14:25:16 -07:00
Liam Newman
38aa99a063 Consider header rate limit information for getRateLimit()
Fixes #802
2020-05-18 13:56:10 -07:00
Liam Newman
85c44b3529 Merge pull request #809 from pzygielo/imports
Remove unused imports
2020-05-16 13:50:23 -07:00
Liam Newman
e1a2768de5 Merge pull request #810 from pzygielo/equals
Use .equals to compare Strings
2020-05-16 13:49:54 -07:00
Liam Newman
e1c9b27203 Merge pull request #811 from pzygielo/close
Be nice and close Closeable
2020-05-16 13:49:14 -07:00
Piotrek Żygieło
969f6ef826 Use .equals to compare Strings 2020-05-16 11:55:21 +02:00
Piotrek Żygieło
7abc4d4e76 Be nice and close Closeable 2020-05-16 11:49:02 +02:00
Piotrek Żygieło
ac97147c1f Remove unused imports 2020-05-16 09:58:20 +02:00
Liam Newman
dbd20fe396 Merge pull request #804 from springernature/master
fix to #803
2020-05-13 09:12:20 -07:00
Liam Newman
44e57c9c4b Merge pull request #808 from hub4j/dependabot/maven/spotbugs.version-4.0.3
Bump spotbugs.version from 4.0.2 to 4.0.3
2020-05-13 09:07:37 -07:00
Stefan Reisner
488e5e531f updated GHContentIntegrationTest.java
dummy commit
2020-05-13 12:39:10 +02:00
dependabot-preview[bot]
42a6a8d770 Bump spotbugs.version from 4.0.2 to 4.0.3
Bumps `spotbugs.version` from 4.0.2 to 4.0.3.

Updates `spotbugs` from 4.0.2 to 4.0.3
- [Release notes](https://github.com/spotbugs/spotbugs/releases)
- [Changelog](https://github.com/spotbugs/spotbugs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/spotbugs/spotbugs/compare/4.0.2...4.0.3)

Updates `spotbugs-annotations` from 4.0.2 to 4.0.3
- [Release notes](https://github.com/spotbugs/spotbugs/releases)
- [Changelog](https://github.com/spotbugs/spotbugs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/spotbugs/spotbugs/compare/4.0.2...4.0.3)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-05-13 06:52:27 +00:00
Liam Newman
f8e877ea05 Merge pull request #806 from bitwiseman/task/rename
Rename organization to hub4j
2020-05-12 08:52:06 -07:00
Stefan Reisner
65d6fc7272 updated GHContentIntegrationTest.java
dummy commit
2020-05-12 12:06:44 +02:00
Dr. Stefan Reisner
63ce8e461b Update src/test/java/org/kohsuke/github/GHContentIntegrationTest.java
Co-authored-by: Liam Newman <bitwiseman@gmail.com>
2020-05-12 09:59:53 +02:00
Stefan Reisner
fbf4c48461 updated GHContentIntegrationTest.java, src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/**
adapting to new org hub4-test-org (was github-api-test-org)
2020-05-11 16:33:29 +02:00
Stefan Reisner
81a55db644 updated src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testGetFileWithNoneAsciiPath/** 2020-05-11 15:29:02 +02:00
Stefan Reisner
4d4edfa181 updated GHContentIntegrationTest.java
adapting testGetFileContentWithNonAsciiPath to shortened file path
2020-05-11 08:01:32 +02:00
Liam Newman
6f9182f1f6 Rename organization to hub4j
Fixes #801
2020-05-08 15:17:14 -07:00
Stefan Reisner
fa600c03e2 updated GHContentIntegrationTest.java
sorting imports
2020-05-06 17:33:11 +02:00
Dr. Stefan Reisner
4a53301e9f Merge branch 'master' into master 2020-05-06 17:26:06 +02:00
Stefan Reisner
676984b3d5 added src/test/resources/org/kohsuke/github/GHContentIntegrationTest/wiremock/testGetFileContentWithNonAsciiPath/** 2020-05-06 16:58:42 +02:00
Stefan Reisner
e6d7f7248b updated GitHubRequest.java
using URI.toASCIIString() instead of URI.toString() in urlPathEncode()
2020-05-06 16:54:21 +02:00
Stefan Reisner
50903b5c4a updated GHContentIntegrationTest.java 2020-05-06 16:53:23 +02:00
Liam Newman
01e399fb91 Add Java 15 early access to CI
Switch canary compile to Java 13.
2020-05-01 10:55:42 -07:00
Liam Newman
911aeb7af0 Merge pull request #796 from github-api/dependabot/maven/net.revelc.code-impsort-maven-plugin-1.4.1
Bump impsort-maven-plugin from 1.3.2 to 1.4.1
2020-04-27 14:21:34 -07:00
Liam Newman
7e5cd9abbc Merge branch 'master' into dependabot/maven/net.revelc.code-impsort-maven-plugin-1.4.1 2020-04-27 14:12:08 -07:00
Liam Newman
115527a21a Merge pull request #792 from bitwiseman/issue/682
Fix Gist getId() and deleteFile(), add getGistId()
2020-04-27 13:37:34 -07:00
Liam Newman
eff4f4f601 Merge branch 'master' into issue/682 2020-04-27 13:20:35 -07:00
Liam Newman
16e0099a0d Add deleteFile() to GHGist
Related to #466 and #484
2020-04-27 10:44:25 -07:00
Liam Newman
2c8c678275 Merge pull request #770 from sladyn98/change_url_methods
Change withURLPath to setRawURLPath
2020-04-27 09:54:14 -07:00
Liam Newman
3b51e87fbf Merge branch 'master' into change_url_methods 2020-04-27 09:48:23 -07:00
Liam Newman
6c6eef5e2b Merge pull request #795 from bitwiseman/task/check-raw-url
Check that raw url starts with 'http'
2020-04-27 09:47:24 -07:00
Liam Newman
6e5910f44c Check that raw url starts with 'http' 2020-04-27 09:41:43 -07:00
dependabot-preview[bot]
a967189bc6 Bump impsort-maven-plugin from 1.3.2 to 1.4.1
Bumps [impsort-maven-plugin](https://github.com/revelc/impsort-maven-plugin) from 1.3.2 to 1.4.1.
- [Release notes](https://github.com/revelc/impsort-maven-plugin/releases)
- [Commits](https://github.com/revelc/impsort-maven-plugin/compare/impsort-maven-plugin-1.3.2...impsort-maven-plugin-1.4.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-04-27 06:59:29 +00:00
Sladyn
7069176cf6 Apply suggestions from code review
Co-Authored-By: Liam Newman <bitwiseman@gmail.com>
2020-04-27 10:49:57 +05:30
Liam Newman
44dcbe773d Fix Gist getId() and add getGistId()
Fixes #682
2020-04-25 20:16:58 -07:00
Liam Newman
ca76975461 Record Disable test 2020-04-23 11:13:51 -07:00
Liam Newman
83122ac99e Take new snapshot of testGetProtection() 2020-04-23 11:13:51 -07:00
Sladyn Nunes
c3e9458555 Additional modifications to test 2020-04-23 11:13:51 -07:00
Sladyn Nunes
057ba38873 Added getProtectionTest 2020-04-23 11:13:50 -07:00
Sladyn Nunes
81d7d6236b Add resource files 2020-04-23 11:13:50 -07:00
Sladyn Nunes
191dd49653 added test and modified url 2020-04-23 11:13:50 -07:00
Sladyn Nunes
21e9dd6f51 Change withURLPath to setRawURLPath 2020-04-23 11:13:50 -07:00
Liam Newman
cc2d14acc6 Merge pull request #791 from ingwarsw/global_node_id
Add global node_id to GHObject + GHTeam extends GHObject
2020-04-22 13:15:13 -07:00
Liam Newman
87f37e9f1c Formatting and improved bridge method tests 2020-04-22 09:40:19 -07:00
Karol Lassak
d536a9f874 Merge branch 'master' into global_node_id 2020-04-19 11:41:17 +02:00
Karol Lassak
b45f353fa9 Fix tests + add deprecation to one of methods 2020-04-19 11:38:36 +02:00
Karol Lassak
a3073ec14e Fix formatting 2020-04-19 11:19:48 +02:00
Karol Lassak
f77eb33029 Add deprecated method 2020-04-19 11:18:29 +02:00
Liam Newman
c1c919097a Merge pull request #790 from chids/reintroduce-proxy-test-confirmation
Reintroduce the confirmation message for the Github proxy setup
2020-04-18 15:07:41 -07:00
Karol Lassak
e05348463c Fix javadoc 2020-04-18 14:32:51 +02:00
Karol Lassak
fdcf74eaf2 Add global node_id to GHObject + GHTeam extends GHObject 2020-04-18 14:23:06 +02:00
Mårten Gustafson
6d57a3e3b9 Reintroduce the confirmation message for the Github proxy setup
which is referenced from the contribution guidlines.
2020-04-17 15:17:19 +02:00
Liam Newman
1f449c866e Merge pull request #781 from bitwiseman/task/app-set-dep
Deprecate set methods that should not be public
2020-04-16 11:49:09 -07:00
Liam Newman
e12deccd24 Merge pull request #782 from chids/support-issue-event-attributes
Support issue event attributes
2020-04-16 11:36:42 -07:00
Mårten Gustafson
3184ebb5ee Link to Github docs for issue events. 2020-04-16 09:28:38 +02:00
Liam Newman
4a35ed2b35 Merge branch 'master' into support-issue-event-attributes 2020-04-16 00:02:42 -07:00
Liam Newman
5c9474d1c8 [maven-release-plugin] prepare for next development iteration 2020-04-15 23:48:24 -07:00
Liam Newman
2321dc50c5 [maven-release-plugin] prepare release github-api-1.111 2020-04-15 23:48:15 -07:00
Liam Newman
4efd2e8184 Merge pull request #786 from github-api/dependabot/maven/spotbugs.version-4.0.2
Bump spotbugs.version from 4.0.1 to 4.0.2
2020-04-15 23:43:50 -07:00
dependabot-preview[bot]
e30e153bfa Bump spotbugs.version from 4.0.1 to 4.0.2
Bumps `spotbugs.version` from 4.0.1 to 4.0.2.

Updates `spotbugs` from 4.0.1 to 4.0.2
- [Release notes](https://github.com/spotbugs/spotbugs/releases)
- [Changelog](https://github.com/spotbugs/spotbugs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/spotbugs/spotbugs/compare/4.0.1...4.0.2)

Updates `spotbugs-annotations` from 4.0.1 to 4.0.2
- [Release notes](https://github.com/spotbugs/spotbugs/releases)
- [Changelog](https://github.com/spotbugs/spotbugs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/spotbugs/spotbugs/compare/4.0.1...4.0.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-04-16 06:38:59 +00:00
Mårten Gustafson
2724211535 Merge branch 'master' into support-issue-event-attributes 2020-04-16 08:30:51 +02:00
Mårten Gustafson
81068de0f1 Revert "WireMockStatusReporterTest doesn't print to stdout as of"
This reverts commit d76718e8b2.
2020-04-16 08:26:03 +02:00
Liam Newman
7d842175f7 Merge pull request #783 from bitwiseman/issue/760
Expose MappingReader and MappingWriter
2020-04-15 16:58:01 -07:00
Liam Newman
e0aee9f361 Expose MappingReader and MappingWriter
Jenkins Blue Ocean made interesting design choices relating github-api interactions.

They mostly reused the existing API and OM, but in a few places they chose to
implement their own object mapping independent of this project. This is fine
as long as nothing in this project ever changes, including internals such
as ObjectMapper configuration or behavior.

Recent release have made changes to those internals which break assumptions made
in Blue Ocean.

This change exposes this project's MappingReader and MappingWriter to allow
for a fix to Blue Ocean requiring only minimal changes.

This doesn't prevent future changes from breaking Blue Ocean but at least makes
them much less likely.

Fixes #780
2020-04-15 16:39:59 -07:00
Mårten Gustafson
df576e2738 Expose and test per issue event attributes for milestone, label and
assignment events.
2020-04-14 11:47:44 +02:00
Mårten Gustafson
bb1356b25d Add Wiremock recordings for issue events. 2020-04-14 11:24:44 +02:00
Liam Newman
1b67960da4 Deprecate set methods that should not be public 2020-04-13 13:41:28 -07:00
Mårten Gustafson
d76718e8b2 WireMockStatusReporterTest doesn't print to stdout as of
061e8bb662.
2020-04-13 10:30:08 +02:00
Liam Newman
76c51922f1 [maven-release-plugin] prepare for next development iteration 2020-04-06 09:43:50 -07:00
Liam Newman
f95e89a136 [maven-release-plugin] prepare release github-api-1.110 2020-04-06 09:43:41 -07:00
Liam Newman
2dff60a23c Merge pull request #777 from bitwiseman/issue/775
Reverse removal of misnamed gitHttpTransportUrl
2020-04-06 09:38:47 -07:00
Liam Newman
95f83d1a29 Merge pull request #774 from martinvanzijl/issue_518_allow_getref_with_prefix
Allow "refs/" prefix in parameter to GHRepository.getRef()
2020-04-06 09:33:39 -07:00
Liam Newman
b875ccecc1 Reverse removal of misnamed gitHttpTransportUrl 2020-04-06 09:31:50 -07:00
Martin van Zijl
e4c3802f16 Revert accidental changes to addCollaborators test files. 2020-04-07 04:11:11 +12:00
Liam Newman
081e485f4f Merge pull request #773 from martinvanzijl/issue_444_unset_milestone
Add ability to unset the milestone of an issue
2020-04-05 12:57:10 -07:00
Liam Newman
4adf88da19 Merge pull request #767 from XiongKezhi/installation-repository-event
Installation repository event
2020-04-05 12:45:56 -07:00
Liam Newman
31e2b1b8d3 Merge branch 'master' into issue_444_unset_milestone 2020-04-05 12:41:02 -07:00
Martin van Zijl
bd28abd343 Allow "refs/" prefix in parameter to GHRepository.getRef().
Fixes #518.
2020-04-06 04:43:26 +12:00
August
955690b124 Rename refreash to populate and add node_id for GHRepository 2020-04-05 19:09:02 +08:00
Martin van Zijl
fa6f06ae15 Add ability to unset the milestone of an issue.
Fixes #444.
2020-04-05 16:16:04 +12:00
August
263de140c5 Removed InstallationRepository 2020-04-04 22:49:52 +08:00
Kezhi Xiong
ed85d06d69 Merge branch 'master' into installation-repository-event 2020-04-04 22:33:18 +08:00
August
4ff0870df8 Refresh repositories while warp up installation event 2020-04-04 22:30:05 +08:00
Liam Newman
410bac2040 [maven-release-plugin] prepare for next development iteration 2020-04-01 14:31:22 -07:00
Liam Newman
38b1e367b1 [maven-release-plugin] prepare release github-api-1.109 2020-04-01 14:31:14 -07:00
Liam Newman
3cddffa37f Merge pull request #768 from bitwiseman/task/jacoco-report
Add Jacoco report to site
2020-04-01 14:27:23 -07:00
Liam Newman
ea7a1a7175 More GHRateLimit test stabilization 2020-04-01 14:22:17 -07:00
Liam Newman
36b5601588 Add Jacoco report to site 2020-04-01 14:03:44 -07:00
Liam Newman
7fc68f2969 Merge branch 'master' into installation-repository-event 2020-04-01 12:29:13 -07:00
Liam Newman
c5ee07add4 Merge pull request #741 from sladyn98/add_has_projects
Add has_projects field to github repository
2020-04-01 08:33:59 -07:00
August
32ff315b6b Resolve spotbugs and format code 2020-04-01 16:58:02 +08:00
August
f919346f8f Add installation and installtion repositories event 2020-04-01 16:08:21 +08:00
Liam Newman
279df00404 Add checks for hasProjects() 2020-03-31 14:54:16 -07:00
Liam Newman
bfd4b17fa0 Merge remote-tracking branch 'upstream/master' into add_has_projects 2020-03-31 13:33:36 -07:00
Liam Newman
5fe2817164 Merge pull request #764 from bitwiseman/issue/valid_creds
Change credential check to use rate limit
2020-03-31 12:37:16 -07:00
Liam Newman
b337bb39bc Update PULL_REQUEST_TEMPLATE.md 2020-03-31 10:05:16 -07:00
Liam Newman
65ae41c5f1 Fix tests for isCredentialsValid 2020-03-31 09:36:26 -07:00
Liam Newman
796c644c4a Change credential check to use rate limit
Fixes #582
2020-03-31 08:28:57 -07:00
Liam Newman
bfd9023a27 Merge pull request #762 from bitwiseman/task/insensitive
Http header field names must be case-insensitive
2020-03-31 07:28:44 -07:00
Liam Newman
c9cdf5d03e Make rate limit tests tolerant of one second timing differences
Fixes #760
2020-03-30 19:55:19 -07:00
Liam Newman
f60bb41ad9 Move tests around for clarity 2020-03-30 19:15:00 -07:00
Liam Newman
c333903b4a Http header field names must be case-insensitive
GitHub has started changing their headers from capitalized words to all lowercase.
A recent change made the header fields querying case-senstive which broke gzip content detection.
This was not caught by tests because recorded files remain unchanged.
It is also possible that WireMock is auto-capitalizing.

This fixes the case-sensitivity issue and also extends that funcionality to anyone consuming the
headers generated by ResponseInfo.

Fixes #751
2020-03-30 17:31:42 -07:00
Liam Newman
dd55e8a22c Merge pull request #753 from jglick/createCheckRun
GHRepository.createCheckRun
2020-03-30 13:46:31 -07:00
Jesse Glick
3ab9381d0a createCheckRunErrMissingConclusion 2020-03-30 15:06:01 -04:00
Jesse Glick
58f1fe0671 createPendingCheckRun 2020-03-30 14:58:58 -04:00
Jesse Glick
82b9c05d0f Strengthened test a bit 2020-03-30 14:49:37 -04:00
Jesse Glick
7c9397f7f6 Switched from fluent style with .done() to accessible constructors 2020-03-30 14:46:56 -04:00
Jesse Glick
6214b6a3ff Regenerated WireMock metadata 2020-03-30 14:26:23 -04:00
Jesse Glick
883c8cc4c8 Merge branch 'master' of github.com:github-api/github-api into createCheckRun 2020-03-30 14:20:05 -04:00
Liam Newman
8d47c72913 Merge pull request #758 from XiongKezhi/add-check-suite-warp-up
Add wrapUp() for GHEventPayload.CheckSuite
2020-03-30 09:01:19 -07:00
Jesse Glick
89a6664e45 More links to GH docs from Javadoc 2020-03-27 14:07:40 -04:00
Jesse Glick
30d792d6e1 Remove ‘Draft’ from nested data class names 2020-03-27 14:04:42 -04:00
Liam Newman
3745bf3157 Merge branch 'master' into add_has_projects 2020-03-27 07:53:07 -07:00
Kezhi Xiong
a7fda3e50d Merge branch 'master' into add-check-suite-warp-up 2020-03-27 17:05:14 +08:00
XiongKezhi
7f07204fef Add warpUp() for GHEventPayload.CheckSuite 2020-03-27 16:57:06 +08:00
Jesse Glick
8b51a44b7c Merge branch 'createCheckRun' of github.com:jglick/github-api into createCheckRun 2020-03-26 19:10:29 -04:00
Jesse Glick
c499c73dcc Merge branch 'master' of github.com:github-api/github-api into createCheckRun 2020-03-26 19:09:13 -04:00
Jesse Glick
c01f3f5e8a NPE when there are no annotations 2020-03-26 19:07:35 -04:00
Liam Newman
2aef35655f Merge pull request #756 from bitwiseman/task/shorter
Shorten generated  test resource paths
2020-03-26 15:52:08 -07:00
Liam Newman
7ddf1f5830 Shorten generated test resource paths 2020-03-26 14:58:54 -07:00
Liam Newman
b2c513ea42 Merge branch 'master' into createCheckRun 2020-03-26 14:10:29 -07:00
Liam Newman
4c30f94355 Add Java 8 Site to CI 2020-03-26 14:06:46 -07:00
Liam Newman
e911e86c4c Merge pull request #755 from jglick/javadoc
#724 broke the site goal from .github/PULL_REQUEST_TEMPLATE.md
2020-03-26 13:57:51 -07:00
Liam Newman
ca640b3f64 Merge pull request #738 from sourabhsparkala/sign_verification
Get commit or tag signature verified flag
2020-03-26 13:56:03 -07:00
Jesse Glick
b4c4a05f3b Moving enums inside GHCheckRun 2020-03-26 16:44:01 -04:00
Jesse Glick
fd3c36a259 IMHO treating Javadoc warnings as fatal makes sources less legible and does not improve API comprehension at all 2020-03-26 16:33:57 -04:00
Jesse Glick
d8274ac2d4 Merge branch 'javadoc' into createCheckRun 2020-03-26 16:26:52 -04:00
Jesse Glick
9c7479f953 #724 broke the site goal from .github/PULL_REQUEST_TEMPLATE.md 2020-03-26 16:25:32 -04:00
Jesse Glick
b5dc3c4366 Added some Javadoc. 2020-03-26 16:22:04 -04:00
Jesse Glick
26b8082155 Handle >50 annotations 2020-03-26 16:14:39 -04:00
Liam Newman
418df15f7b Merge branch 'master' into sign_verification 2020-03-26 10:23:16 -07:00
Liam Newman
31ed0125b8 Shorten test paths for windows 2020-03-26 10:09:01 -07:00
Liam Newman
494318b879 Change method name to isVerified 2020-03-26 09:49:03 -07:00
Liam Newman
f554ddc372 Capitalize and Move GHVerification.Reason enum 2020-03-26 09:45:20 -07:00
Jesse Glick
03de12c221 SpotBugs 2020-03-25 20:03:18 -04:00
Jesse Glick
6c41f22b57 Coverage of DraftImage 2020-03-25 19:59:42 -04:00
Jesse Glick
7ae96388e3 Merge branch 'master' of github.com:github-api/github-api into createCheckRun 2020-03-25 19:21:46 -04:00
Jesse Glick
e8b4de00d2 WireMock coverage 2020-03-25 19:18:11 -04:00
Jesse Glick
cd7963b30d Acc to 7a650132c5/src/main/java/org/kohsuke/github/GitHubBuilder.java (L221) it is GITHUB_LOGIN not GITHUB_USER 2020-03-25 17:52:32 -04:00
Liam Newman
0dc44cffcf Merge branch 'master' into add_has_projects 2020-03-25 11:57:44 -07:00
Liam Newman
7a650132c5 Merge pull request #724 from bitwiseman/task/builder-updater
Add Builder/Creator/Updater for GHLabel
2020-03-25 11:56:41 -07:00
Jesse Glick
c7fb390c38 Introduced enums 2020-03-25 13:40:00 -04:00
Jesse Glick
572ff9df19 I guess nullability annotations can be omitted from internal members 2020-03-25 13:20:33 -04:00
Jesse Glick
b715e0cef7 Reformatted 2020-03-25 13:18:11 -04:00
Jesse Glick
36ab2a889f Redesigned using a fluent builder idiom 2020-03-25 13:14:06 -04:00
D067452
a78d2f28d7 Get commit or tag signature verified flag
This fixes #737

- A new entity GHVerification.java has been added which would be reflecting Verification flag
- Updating GHCommit.java and GHTagObject.java with GHVerification
- Altering few test cases AppTest.java and GHTagTest.java to verify if the Verification entity is being picked up
- A separate test class SignatureVerificationTest.java with the associated wiremock test resources
- Adding a new enum GHReason.java
- Updating tests to check the GHReason implementation, GHReasonTest.java with the associated wiremock test resources
2020-03-25 17:19:56 +01:00
Jesse Glick
7d5a39ed89 GHRepository.createCheckRun 2020-03-24 23:51:38 -04:00
Liam Newman
772272ff36 Re-record test for GHLabel 2020-03-24 12:32:13 -07:00
Liam Newman
2ab4eafee9 Tweaks and cleanup 2020-03-23 17:40:01 -07:00
Liam Newman
b15e0d4c45 Cleanup and tweaks 2020-03-23 17:40:01 -07:00
Liam Newman
b8180314d8 Change to Preview for new builder pattern 2020-03-23 17:40:01 -07:00
Liam Newman
fcb8d03a0f Ensure that Description is part of GHLabel comparision 2020-03-23 17:40:01 -07:00
Liam Newman
09ec89bc2e Remove Repository member from GHLabel
It turns out GHLabel instances do not need a reference to their repo, just to root.
2020-03-23 17:40:01 -07:00
Liam Newman
863ad0f486 Clarify behavior 2020-03-23 17:40:01 -07:00
Liam Newman
79a1bb3571 Update src/test/java/org/kohsuke/github/AppTest.java 2020-03-23 17:40:01 -07:00
Liam Newman
9f1d7323c7 Reverted getter changes to highlight the more important set/update changes 2020-03-23 17:40:01 -07:00
Liam Newman
64a82f4785 Clean up proposed API changes 2020-03-23 17:40:01 -07:00
Liam Newman
f37e4bd76e Private fields 2020-03-23 17:40:01 -07:00
Liam Newman
98ef2cc640 Update-in-place and safer single or batch calculation 2020-03-23 17:40:01 -07:00
Liam Newman
134222fd69 Minor cleanups 2020-03-23 17:40:01 -07:00
Liam Newman
0cb2371517 Third alternative proposal
This removes the  from the fields.  Functionally the behavior is unchanged but
it is no longer guaranteed at compile time.  This simplifies streamlines the code slightly,
but at the cost of only being able to assert immutability rather than know it.

However, as we move to using this structure through more of the library, this is may be a better choice.
There are so many places where the GitHub API itself returns partial records or updates them dynamically.
Trying to claim immutability where it doesn't exist is not great either.
2020-03-23 17:40:01 -07:00
Liam Newman
b7de4359fd Alternative proposal
The guts of this version are a bit ugly but they result reasonable API code without a ton of extra
code needed.
2020-03-23 17:40:01 -07:00
Liam Newman
2607d6a107 Make GHLabel example of proposed API design 2020-03-23 17:40:01 -07:00
Liam Newman
db46b1ce13 Merge pull request #752 from github-api/dependabot/maven/com.squareup.okio-okio-2.5.0
Bump okio from 2.4.3 to 2.5.0
2020-03-23 14:44:12 -07:00
dependabot-preview[bot]
d7b08d5207 Bump okio from 2.4.3 to 2.5.0
Bumps [okio](https://github.com/square/okio) from 2.4.3 to 2.5.0.
- [Release notes](https://github.com/square/okio/releases)
- [Changelog](https://github.com/square/okio/blob/master/CHANGELOG.md)
- [Commits](https://github.com/square/okio/compare/parent-2.4.3...parent-2.5.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-03-23 06:54:29 +00:00
Sladyn
29fbba832c Merge branch 'master' into add_has_projects 2020-03-21 23:03:10 +05:30
Liam Newman
fd621a442a Merge pull request #742 from sladyn98/addHtmlURL
Retrieve html_url from Pull Request Review Comment
2020-03-20 12:33:34 -07:00
Liam Newman
a1a73568ae Merge branch 'master' into addHtmlURL 2020-03-20 11:41:23 -07:00
Liam Newman
3daccbd6ec Merge pull request #740 from avano/list-checkruns-for-ref
[CheckRuns] Add method for listing checkruns for given ref
2020-03-20 11:39:40 -07:00
Liam Newman
293deadb48 Merge branch 'master' into addHtmlURL 2020-03-20 08:42:47 -07:00
Andrej Vano
452b56c47b [GHEvent] Add new enum for registry_package event 2020-03-20 11:47:04 +01:00
Andrej Vano
5cb6bfa633 [CheckRuns] Add method for listing checkruns for given ref 2020-03-20 11:47:04 +01:00
Sladyn Nunes
0515cee6f3 Merge branch 'addHtmlURL' of https://github.com/sladyn98/github-api into addHtmlURL 2020-03-20 11:57:58 +05:30
Sladyn Nunes
4247112539 Adjust format 2020-03-20 11:56:22 +05:30
Sladyn Nunes
8d3374f574 Added test 2020-03-20 11:27:29 +05:30
Liam Newman
26833e5f7c Merge branch 'master' into add_has_projects 2020-03-19 12:15:34 -07:00
Liam Newman
6752b46f67 Merge pull request #750 from github-api/dependabot/maven/spotbugs.version-4.0.1
Bump spotbugs.version from 4.0.0 to 4.0.1
2020-03-19 10:30:48 -07:00
dependabot-preview[bot]
b9429ffcaa Bump spotbugs.version from 4.0.0 to 4.0.1
Bumps `spotbugs.version` from 4.0.0 to 4.0.1.

Updates `spotbugs` from 4.0.0 to 4.0.1
- [Release notes](https://github.com/spotbugs/spotbugs/releases)
- [Changelog](https://github.com/spotbugs/spotbugs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/spotbugs/spotbugs/compare/4.0.0...4.0.1)

Updates `spotbugs-annotations` from 4.0.0 to 4.0.1
- [Release notes](https://github.com/spotbugs/spotbugs/releases)
- [Changelog](https://github.com/spotbugs/spotbugs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/spotbugs/spotbugs/compare/4.0.0...4.0.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-03-19 06:35:16 +00:00
Liam Newman
10827c7e21 Merge branch 'master' into addHtmlURL 2020-03-18 08:43:43 -07:00
Liam Newman
23cb4a34a4 Merge branch 'master' into add_has_projects 2020-03-18 08:43:20 -07:00
Liam Newman
adfd09565f Merge pull request #733 from ingwarsw/add_get_team_by_slug
Make getTeambySlug faster
2020-03-17 15:23:14 -07:00
Karol Lassak
78b9ff49d4 Fix tests 2020-03-17 22:36:54 +01:00
Karol Lassak
fca425d25e Add test for old getteam method 2020-03-17 22:34:13 +01:00
Karol Lassak
1a4238156c Fix javadocs 2020-03-17 11:34:31 +01:00
Karol Lassak
f6210cc014 Change variable name to something meningfull 2020-03-17 11:21:58 +01:00
Karol Lassak
6c8b466e59 Add mocks for tests 2020-03-17 11:18:50 +01:00
Karol Lassak
2aebe97f9f Add/restore test for getTeam 2020-03-17 11:18:33 +01:00
Karol Lassak
157724bff8 Fix rest of tests 2020-03-17 10:20:42 +01:00
Karol Lassak
6cbb1a0bee Fix tests partially 2020-03-17 10:13:43 +01:00
Karol Lassak
960a13dd38 Merge branch 'master' into add_get_team_by_slug 2020-03-17 09:08:34 +01:00
Karol Lassak
9213f80435 Add comment to deprecation
Co-Authored-By: Liam Newman <bitwiseman@gmail.com>
2020-03-17 09:07:37 +01:00
Liam Newman
bccae94c7a Merge pull request #734 from github-api/dependabot/maven/org.apache.maven.plugins-maven-site-plugin-3.9.0
Bump maven-site-plugin from 3.8.2 to 3.9.0
2020-03-16 12:57:09 -07:00
Liam Newman
d71f77ce06 Merge pull request #746 from github-api/dependabot/maven/com.github.spotbugs-spotbugs-maven-plugin-4.0.0
Bump spotbugs-maven-plugin from 3.1.12.2 to 4.0.0
2020-03-16 12:56:54 -07:00
Liam Newman
2787f3dc71 Merge pull request #730 from github-api/dependabot/maven/com.squareup.okhttp3-okhttp-4.4.1
Bump okhttp from 4.4.0 to 4.4.1
2020-03-16 12:56:40 -07:00
dependabot-preview[bot]
fb00baab5b Bump maven-site-plugin from 3.8.2 to 3.9.0
Bumps [maven-site-plugin](https://github.com/apache/maven-site-plugin) from 3.8.2 to 3.9.0.
- [Release notes](https://github.com/apache/maven-site-plugin/releases)
- [Commits](https://github.com/apache/maven-site-plugin/compare/maven-site-plugin-3.8.2...maven-site-plugin-3.9.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-03-16 19:29:36 +00:00
dependabot-preview[bot]
9e22155d31 Bump okhttp from 4.4.0 to 4.4.1
Bumps [okhttp](https://github.com/square/okhttp) from 4.4.0 to 4.4.1.
- [Release notes](https://github.com/square/okhttp/releases)
- [Changelog](https://github.com/square/okhttp/blob/master/CHANGELOG.md)
- [Commits](https://github.com/square/okhttp/compare/parent-4.4.0...parent-4.4.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-03-16 19:29:35 +00:00
dependabot-preview[bot]
963373435d Bump spotbugs-maven-plugin from 3.1.12.2 to 4.0.0
Bumps [spotbugs-maven-plugin](https://github.com/spotbugs/spotbugs-maven-plugin) from 3.1.12.2 to 4.0.0.
- [Release notes](https://github.com/spotbugs/spotbugs-maven-plugin/releases)
- [Commits](https://github.com/spotbugs/spotbugs-maven-plugin/compare/spotbugs-maven-plugin-3.1.12.2...spotbugs-maven-plugin-4.0.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-03-16 19:29:30 +00:00
Liam Newman
377987fa92 Merge pull request #747 from sladyn98/add_ci_status_badge
Added github CI status badge
2020-03-16 12:28:18 -07:00
Liam Newman
0b6980639e Merge pull request #745 from github-api/dependabot/maven/org.mockito-mockito-core-3.3.3
Bump mockito-core from 3.3.1 to 3.3.3
2020-03-16 12:26:26 -07:00
Liam Newman
4f1cc9f94f Merge pull request #744 from github-api/dependabot/maven/org.apache.maven.plugins-maven-javadoc-plugin-3.2.0
Bump maven-javadoc-plugin from 3.1.1 to 3.2.0
2020-03-16 12:26:12 -07:00
dependabot-preview[bot]
6e5434a0ec Bump mockito-core from 3.3.1 to 3.3.3
Bumps [mockito-core](https://github.com/mockito/mockito) from 3.3.1 to 3.3.3.
- [Release notes](https://github.com/mockito/mockito/releases)
- [Commits](https://github.com/mockito/mockito/compare/v3.3.1...v3.3.3)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-03-16 19:25:57 +00:00
dependabot-preview[bot]
3244f7c38f Bump maven-javadoc-plugin from 3.1.1 to 3.2.0
Bumps [maven-javadoc-plugin](https://github.com/apache/maven-javadoc-plugin) from 3.1.1 to 3.2.0.
- [Release notes](https://github.com/apache/maven-javadoc-plugin/releases)
- [Commits](https://github.com/apache/maven-javadoc-plugin/compare/maven-javadoc-plugin-3.1.1...maven-javadoc-plugin-3.2.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-03-16 19:25:56 +00:00
Liam Newman
f27b676e89 Merge pull request #743 from github-api/dependabot/maven/org.eclipse.jgit-org.eclipse.jgit-5.7.0.202003110725-r
Bump org.eclipse.jgit from 5.6.1.202002131546-r to 5.7.0.202003110725-r
2020-03-16 12:25:03 -07:00
Liam Newman
4f2a80a4a3 Merge pull request #732 from github-api/dependabot/maven/com.github.tomakehurst-wiremock-jre8-standalone-2.26.3
Bump wiremock-jre8-standalone from 2.26.2 to 2.26.3
2020-03-16 12:24:43 -07:00
Sladyn
a51bc27829 Merge branch 'master' into add_ci_status_badge 2020-03-16 23:35:17 +05:30
Sladyn Nunes
4fd321c93d Added github CI status badge 2020-03-16 23:32:23 +05:30
dependabot-preview[bot]
bbd62bdef5 Bump org.eclipse.jgit from 5.6.1.202002131546-r to 5.7.0.202003110725-r
Bumps org.eclipse.jgit from 5.6.1.202002131546-r to 5.7.0.202003110725-r.

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-03-16 06:40:34 +00:00
Sladyn
4bb1d78939 Merge branch 'master' into addHtmlURL 2020-03-15 18:41:22 +05:30
Sladyn Nunes
53c37ef413 Retrieve html_url from PRReviewComment 2020-03-15 18:30:29 +05:30
Sladyn
a6511b6c5a Merge branch 'master' into add_has_projects 2020-03-15 17:30:45 +05:30
Sladyn Nunes
829e96a2d0 Add has_projects field to github repository 2020-03-15 14:44:52 +05:30
Karol Lassak
2e25f37433 Format code 2020-03-09 16:39:22 +01:00
Karol Lassak
fbf6c73226 Make getTeambySlug fast enought 2020-03-09 16:04:01 +01:00
dependabot-preview[bot]
aab54e3f23 Bump wiremock-jre8-standalone from 2.26.2 to 2.26.3
Bumps [wiremock-jre8-standalone](https://github.com/tomakehurst/wiremock) from 2.26.2 to 2.26.3.
- [Release notes](https://github.com/tomakehurst/wiremock/releases)
- [Commits](https://github.com/tomakehurst/wiremock/compare/2.26.2...2.26.3)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-03-09 06:47:44 +00:00
Liam Newman
a6eff7fbfb [maven-release-plugin] prepare for next development iteration 2020-03-04 16:54:50 -08:00
Liam Newman
d5667d2473 [maven-release-plugin] prepare release github-api-1.108 2020-03-04 16:54:42 -08:00
Liam Newman
a42305dd59 Revert "Removed extraneous author javadocs"
This reverts commit 888abc9e2a.
2020-03-04 11:32:12 -08:00
Liam Newman
c22a718d14 Merge pull request #723 from XiongKezhi/complete-checks-api
Complete checks api
2020-03-03 23:03:10 -08:00
Liam Newman
d0b23c79e2 Merge branch 'master' into complete-checks-api 2020-03-03 19:59:21 -08:00
Liam Newman
76da04afd8 Merge pull request #725 from github-api/dependabot/maven/com.github.tomakehurst-wiremock-jre8-standalone-2.26.2
Bump wiremock-jre8-standalone from 2.26.1 to 2.26.2
2020-03-03 12:55:59 -08:00
XiongKezhi
768f60709f Add Output and more tests 2020-03-03 23:45:01 +08:00
dependabot-preview[bot]
8cd3acd318 Bump wiremock-jre8-standalone from 2.26.1 to 2.26.2
Bumps [wiremock-jre8-standalone](https://github.com/tomakehurst/wiremock) from 2.26.1 to 2.26.2.
- [Release notes](https://github.com/tomakehurst/wiremock/releases)
- [Commits](https://github.com/tomakehurst/wiremock/compare/2.26.1...2.26.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-03-03 06:35:55 +00:00
Kezhi Xiong
ce7cfc0648 Merge branch 'master' into complete-checks-api 2020-03-03 12:57:42 +08:00
Liam Newman
8b6cf55473 Merge pull request #719 from bitwiseman/task/deprecated
Remove a few long deprecated methods and fully annotate others
2020-03-02 14:06:50 -08:00
Liam Newman
75d95d844c Update src/test/java/org/kohsuke/github/AppTest.java
Co-Authored-By: Karl Shultz <kshultz@cloudbees.com>
2020-03-02 08:41:21 -08:00
XiongKezhi
f54bfd3fb5 Fixed JavaDoc warning reported by maven site 2020-03-01 22:18:36 +08:00
XiongKezhi
f8a8ee9b9d Format code 2020-03-01 22:14:53 +08:00
XiongKezhi
16faaae199 Add GHCheckSuite 2020-03-01 21:59:16 +08:00
XiongKezhi
375417527b Change timestamps property back to String 2020-03-01 15:17:24 +08:00
XiongKezhi
10b01ca6b3 using Date for timestamps and add more JavaDoc 2020-03-01 14:01:59 +08:00
Liam Newman
f9006af04c Merge branch 'master' into complete-checks-api 2020-02-29 15:39:38 -08:00
Kezhi Xiong
57f947576e Delete empty line in JavaDoc 2020-02-29 20:15:32 +08:00
XiongKezhi
5a8f8c345b parse completedAt and startedAt into Date in getters 2020-02-29 18:09:25 +08:00
XiongKezhi
e96067e3c8 Merge remote-tracking branch 'origin/complete-checks-api' into complete-checks-api 2020-02-29 13:27:02 +08:00
XiongKezhi
2242174515 add Output in GHCheckRun 2020-02-29 13:26:59 +08:00
Kezhi Xiong
73179c118b Fixed typo in JavaDoc of getApp 2020-02-29 13:19:14 +08:00
Liam Newman
5b575134fc Merge branch 'master' into task/deprecated 2020-02-28 14:38:30 -08:00
Liam Newman
c11c06b896 Merge pull request #720 from bitwiseman/task/inject-root
Enable injection of GitHub and other values into mapping
2020-02-28 14:38:09 -08:00
Liam Newman
ba8d2a251f Merge branch 'master' into task/deprecated 2020-02-28 08:37:51 -08:00
Liam Newman
c9589b73f4 Merge pull request #722 from github-api/dependabot/maven/org.mockito-mockito-core-3.3.1
Bump mockito-core from 3.3.0 to 3.3.1
2020-02-28 08:37:41 -08:00
Liam Newman
32f4425100 Merge pull request #721 from github-api/dependabot/maven/com.github.tomakehurst-wiremock-jre8-standalone-2.26.1
Bump wiremock-jre8-standalone from 2.26.0 to 2.26.1
2020-02-28 08:37:27 -08:00
XiongKezhi
05e81484f1 format code 2020-02-28 16:57:19 +08:00
XiongKezhi
10cc79f737 add more properties to GHCheckRun 2020-02-28 15:40:51 +08:00
dependabot-preview[bot]
957d9b180d Bump mockito-core from 3.3.0 to 3.3.1
Bumps [mockito-core](https://github.com/mockito/mockito) from 3.3.0 to 3.3.1.
- [Release notes](https://github.com/mockito/mockito/releases)
- [Commits](https://github.com/mockito/mockito/compare/v3.3.0...v3.3.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-02-28 06:31:41 +00:00
dependabot-preview[bot]
883204fc43 Bump wiremock-jre8-standalone from 2.26.0 to 2.26.1
Bumps [wiremock-jre8-standalone](https://github.com/tomakehurst/wiremock) from 2.26.0 to 2.26.1.
- [Release notes](https://github.com/tomakehurst/wiremock/releases)
- [Commits](https://github.com/tomakehurst/wiremock/compare/2.26.0...2.26.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-02-28 06:31:11 +00:00
Liam Newman
6d3904fbbd Change name of inject methods 2020-02-27 14:27:57 -08:00
Liam Newman
56a51f18e7 Update src/main/java/org/kohsuke/github/GHIssue.java 2020-02-27 14:20:03 -08:00
Liam Newman
307508b7a0 Move GHGist from late binding to inject bind 2020-02-27 10:23:54 -08:00
Liam Newman
66fce79427 Add ability to inject other local bindings 2020-02-27 10:23:31 -08:00
Liam Newman
5e5708d8d4 Clean up GHPerson deprecated a bit more 2020-02-27 10:16:48 -08:00
Liam Newman
944d92bbb4 Make more methods as deprecated 2020-02-27 09:40:03 -08:00
Liam Newman
0155d5aa39 Make HttpConnector a functional interface 2020-02-27 09:39:03 -08:00
Liam Newman
fe4f45c2b0 Remove DeleteToken class the was never in github v3 api 2020-02-27 09:38:50 -08:00
Liam Newman
1b63a58e63 Increase coverage 2020-02-27 09:38:24 -08:00
Liam Newman
46a141db9c Use consistent templating for all tests 2020-02-25 14:43:37 -08:00
Liam Newman
66de06956c Merge pull request #696 from nobe0716/feature/delete_branch_automatically
Add automatic deletion of branches that merged by PR
2020-02-25 13:44:01 -08:00
Liam Newman
713dd62bd1 Take new snapshot 2020-02-25 12:37:58 -08:00
Liam Newman
5ac65aafad Merge pull request #715 from Sage-Pierce/#714
[#714]Fix query parameter construction of org member filter
2020-02-25 12:17:30 -08:00
Liam Newman
4aef92e6fe Merge pull request #717 from bitwiseman/task/remove-fetch-array
Deprecate PagedIterable.asList() and PagedIterable.asSet()
2020-02-25 12:14:39 -08:00
Sage Pierce
a1b0e771e5 Merge branch 'master' into #714 2020-02-25 08:46:30 -06:00
spierce
5baeac4706 [#714]More specific assertions; Add test for members with filter 2020-02-25 08:42:10 -06:00
Noah J
87aa9bd673 Merge branch 'master' into feature/delete_branch_automatically 2020-02-25 14:22:14 +09:00
Liam Newman
2ec5ca56d5 Merge branch 'master' into task/remove-fetch-array 2020-02-24 20:34:26 -08:00
Liam Newman
b5c7f83ec8 Merge pull request #718 from bitwiseman/task/iterator-remove
Task/iterator remove
2020-02-24 20:30:35 -08:00
Liam Newman
eb3ebdbf52 Merge pull request #716 from bitwiseman/task/inject-response
Use InjectableValue to provide response info
2020-02-24 20:04:40 -08:00
Liam Newman
c60698ff7e Iterator.remove() has a default implementation 2020-02-24 20:03:50 -08:00
Liam Newman
f8c2cda257 Use InjectableValue to provide response info 2020-02-24 19:54:40 -08:00
Liam Newman
48f6c195e0 Remove toIterable from RequestBuilder 2020-02-24 19:31:53 -08:00
Liam Newman
804fa60317 Deprecate asList and asSet 2020-02-24 18:40:23 -08:00
Liam Newman
d77b99d3d4 Remove fetchArray method 2020-02-24 18:28:18 -08:00
spierce
006f1271d6 [#714]Add test for new method 2020-02-24 17:22:03 -06:00
spierce
0d14514712 [#714]Formatting fix 2020-02-24 16:47:35 -06:00
spierce
f25e5f9488 [#714]Fix query parameter construction of org member filter 2020-02-24 15:57:08 -06:00
Liam Newman
9e8bbfd175 Merge pull request #712 from github-api/dependabot/maven/org.mockito-mockito-core-3.3.0
Bump mockito-core from 3.2.4 to 3.3.0
2020-02-24 07:23:34 -08:00
Liam Newman
3d11c96e23 Merge pull request #713 from github-api/oleg-nenashev-patch-1
Fix scm.url in pom.xml so that Dependabot can pick up changelogs
2020-02-24 07:23:10 -08:00
Oleg Nenashev
a670737ca5 Fix scm.url in pom.xml so that Dependabot can pick up changelogs 2020-02-24 10:10:30 +01:00
dependabot-preview[bot]
9fdd982e73 Bump mockito-core from 3.2.4 to 3.3.0
Bumps [mockito-core](https://github.com/mockito/mockito) from 3.2.4 to 3.3.0.
- [Release notes](https://github.com/mockito/mockito/releases)
- [Commits](https://github.com/mockito/mockito/compare/v3.2.4...v3.3.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-02-24 06:44:28 +00:00
Liam Newman
8024918e08 [maven-release-plugin] prepare for next development iteration 2020-02-22 20:19:04 -08:00
Liam Newman
cda7607e1c [maven-release-plugin] prepare release github-api-1.107 2020-02-22 20:18:57 -08:00
Liam Newman
816c83c80a Merge branch 'master' into feature/delete_branch_automatically 2020-02-22 19:33:46 -08:00
Liam Newman
0c3c490d58 Merge pull request #707 from rdvdijk/add-rocket-eyes-reactions
Add support for rocket and eyes reactions.
2020-02-22 19:33:08 -08:00
Liam Newman
99da6fb66f Merge pull request #710 from avano/checks
CheckRun - Add ability to get the head sha + Implement GH Status Event
2020-02-22 19:17:06 -08:00
Liam Newman
fa2601386c Add tests for new reactions 2020-02-22 19:16:33 -08:00
Liam Newman
122833b0e3 Merge branch 'master' into checks 2020-02-22 18:48:50 -08:00
Liam Newman
8618dbf0d5 Merge pull request #709 from bitwiseman/issue/708
Fix for NullPointer in issue search results
2020-02-22 18:42:09 -08:00
Liam Newman
a0baf33459 Fix for NullPointer in issue search results
User reported #708 which made me realize that search tests were basically all disabled.
This terms on two basic search tests and also makes it so GHIssue can continue to work without
a GHRepository set on it.

Fixes #708
2020-02-22 17:01:12 -08:00
Andrej Vano
0ee66ea928 [Status] Add GHEventPayload.Status class 2020-02-22 18:14:03 +01:00
Andrej Vano
f68d4aaf5b [CheckRun] Add ability to access HEAD SHA 2020-02-22 18:10:27 +01:00
Liam Newman
888abc9e2a Removed extraneous author javadocs 2020-02-21 15:58:39 -08:00
Liam Newman
c8115b1c10 Remove shading 2020-02-21 15:58:39 -08:00
Liam Newman
137d4f591f Update maven-build.yml 2020-02-21 15:44:31 -08:00
Liam Newman
337d49770d Update maven-build.yml 2020-02-21 15:42:28 -08:00
Liam Newman
614c5578b0 Fix code coverage and GHRepositoryTraffic test 2020-02-21 15:35:45 -08:00
Liam Newman
d456e60800 Check code coverage on ubuntu 2020-02-21 13:17:31 -08:00
Liam Newman
064206fb9a Merge pull request #706 from bitwiseman/task/guard
Add basic rate limit checker
2020-02-21 13:06:51 -08:00
Liam Newman
a68fe3b39d More javadoc because words are hard 2020-02-21 12:04:25 -08:00
Liam Newman
1904c82941 PR feedback 2020-02-21 10:52:28 -08:00
Roel van Dijk
6fc9dd4b30 Add support for rocket and eyes reactions. 2020-02-21 10:59:17 +01:00
Liam Newman
158a31e924 Added javadocs and other cleanup
Whenever I submit a PR and then start looking at it as a reviewer, I immediately find a bunch of things that need changing.
2020-02-20 18:53:13 -08:00
Liam Newman
b70b924db4 Inital implmentation of RateLimitChecker
This is a stripped down rate limit checking implmentation that handles the infrastructure
of deciding how to get rate limit information and leaves it to other implementers to
decided what kind of checks they want to do and how long they want to wait.

The implmentation supports checkers that sleep less than the full time until the
rate limit is expected to reset, allowing for polling and notifying clients of why their query
is not returning.

A basic checker which sleeps until the rate limit is expected to reset is included as working example..
2020-02-20 16:03:46 -08:00
Liam Newman
9018d72e97 Merge pull request #697 from bitwiseman/tast/response-info
Refactor `Requester` into multiple smaller classes
2020-02-20 15:59:11 -08:00
Liam Newman
5c395138ed Merge pull request #705 from github-api/dependabot/maven/org.eclipse.jgit-org.eclipse.jgit-5.6.1.202002131546-r
Bump org.eclipse.jgit from 5.6.0.201912101111-r to 5.6.1.202002131546-r
2020-02-19 16:01:40 -08:00
Liam Newman
af157adc1b Merge pull request #704 from github-api/dependabot/maven/com.squareup.okhttp3-okhttp-4.4.0
Bump okhttp from 4.3.1 to 4.4.0
2020-02-19 16:01:21 -08:00
Liam Newman
1db4fca9db Comment tweaks 2020-02-18 09:02:52 -08:00
dependabot-preview[bot]
013f475859 Bump org.eclipse.jgit from 5.6.0.201912101111-r to 5.6.1.202002131546-r
Bumps org.eclipse.jgit from 5.6.0.201912101111-r to 5.6.1.202002131546-r.

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-02-18 06:36:30 +00:00
dependabot-preview[bot]
b5bc38fa52 Bump okhttp from 4.3.1 to 4.4.0
Bumps [okhttp](https://github.com/square/okhttp) from 4.3.1 to 4.4.0.
- [Release notes](https://github.com/square/okhttp/releases)
- [Changelog](https://github.com/square/okhttp/blob/master/CHANGELOG.md)
- [Commits](https://github.com/square/okhttp/compare/parent-4.3.1...parent-4.4.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-02-18 06:36:08 +00:00
Liam Newman
bd0e0cdfa4 Revert synchronization in iterators
These were not synchronized before we should leave them fix this in a future change
2020-02-17 20:08:52 -08:00
Liam Newman
dade4c4cc4 Bump spotbugs to 4.0.0 2020-02-17 13:11:00 -08:00
Liam Newman
acc5a89dff Class clean up
We don't need two layers of PageIterator just to get the final response.
Also made iterators thread-safe.
And added more detailed comments.
2020-02-17 12:55:44 -08:00
sunghyo-jung
d34881aa25 Add updated mapping files 2020-02-17 18:43:59 +09:00
sunghyo-jung
b8ad48997b Rollback field name, add mapping files
`delete_branch_on_merge` is field of github repository,
So use it as same literal (ref. https://developer.github.com/v3/repos/)

Use `getRepository` instead of `getTempRepository` at GHRepositoryTest
2020-02-17 18:42:30 +09:00
sunghyo-jung
77754b7246 Merge branch 'feature/delete_branch_automatically' of https://github.com/nobe0716/github-api into feature/delete_branch_automatically 2020-02-17 17:05:19 +09:00
sunghyo-jung
6d5bf49a51 Apply CamelCase on field delete_branch_on_merge 2020-02-17 17:03:43 +09:00
Liam Newman
b7af635a9a Address PR feedback 2020-02-16 21:33:19 -08:00
Noah J
f53b4e959c Merge branch 'master' into feature/delete_branch_automatically 2020-02-14 01:44:39 +09:00
nobe0716
6716d156bb Apply changes 2020-02-14 01:44:04 +09:00
Liam Newman
dc33e28452 Create GitHubHttpUrlConnectionClient to encapsulate interactions with HttpUrlConnection 2020-02-13 08:37:07 -08:00
Liam Newman
9da4781759 Update src/main/java/org/kohsuke/github/GitHub.java 2020-02-12 23:59:15 -08:00
Liam Newman
0c6959cb4a Merge remote-tracking branch 'github-api/master' into tast/response-info 2020-02-12 23:52:45 -08:00
Liam Newman
ff3136df70 Move a few static helpers to GitHubClient 2020-02-12 23:48:33 -08:00
Liam Newman
326c627221 Merge pull request #698 from github-api/dependabot/maven/org.apache.maven.plugins-maven-shade-plugin-3.2.2
Bump maven-shade-plugin from 3.2.1 to 3.2.2
2020-02-12 23:33:14 -08:00
dependabot-preview[bot]
075f382a8f Bump maven-shade-plugin from 3.2.1 to 3.2.2
Bumps [maven-shade-plugin](https://github.com/apache/maven-shade-plugin) from 3.2.1 to 3.2.2.
- [Release notes](https://github.com/apache/maven-shade-plugin/releases)
- [Commits](https://github.com/apache/maven-shade-plugin/compare/maven-shade-plugin-3.2.1...maven-shade-plugin-3.2.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-02-13 07:29:11 +00:00
Liam Newman
dabb8fe49e Merge pull request #675 from jimmysombrero/collaborator-permissions
Added ability to specify permissions for collaborators
2020-02-12 23:28:00 -08:00
Liam Newman
90489e4392 JavaDocs and refactoring 2020-02-12 22:42:12 -08:00
Liam Newman
ad45a74f87 Further clean up of refactored classes 2020-02-12 22:42:12 -08:00
Liam Newman
60c045a713 Delete mocking test that is just too brittle to live 2020-02-12 22:42:12 -08:00
Liam Newman
f6c75e1f99 More refactoring 2020-02-12 22:42:12 -08:00
Liam Newman
dd9245f6f2 Progress commit on moving to Client/Request/Response refactor 2020-02-12 22:42:12 -08:00
Liam Newman
7310a70743 Disable two tests due to spurious mocking failures 2020-02-12 22:42:12 -08:00
Liam Newman
82276837ac Created Client/Request/Response classes 2020-02-12 22:42:12 -08:00
Liam Newman
bd68252b44 Test cleanup 2020-02-12 22:42:12 -08:00
Liam Newman
6b1258e33a Major rewrite of Requester 2020-02-12 22:42:12 -08:00
Liam Newman
0400032923 Merge branch 'master' into collaborator-permissions 2020-02-12 22:32:50 -08:00
Liam Newman
d9563322f1 Merge pull request #695 from github-api/dependabot/maven/org.kohsuke.stapler-stapler-1.259
Bump stapler from 1.258 to 1.259
2020-02-12 22:32:31 -08:00
Liam Newman
ab965969dd Merge branch 'master' into collaborator-permissions 2020-02-12 22:31:03 -08:00
Liam Newman
2f32e034d8 Merge pull request #694 from bitwiseman/task/fetch
Streamline fetch and retry process
2020-02-12 22:29:22 -08:00
sunghyo-jung
d7bb171c1e Add automatic deletion of branches that merged by PR
Add method to Toggle `delete_branch_on_merge`
Locate new fields below to merge options
2020-02-12 19:02:31 +09:00
dependabot-preview[bot]
1cf7931f43 Bump stapler from 1.258 to 1.259
Bumps [stapler](https://github.com/stapler/stapler) from 1.258 to 1.259.
- [Release notes](https://github.com/stapler/stapler/releases)
- [Changelog](https://github.com/stapler/stapler/blob/master/CHANGELOG.md)
- [Commits](https://github.com/stapler/stapler/compare/stapler-parent-1.258...stapler-parent-1.259)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-02-11 06:30:12 +00:00
James Vaughn
edc697dd73 fixed javadoc isues 2020-02-07 21:27:00 -06:00
James Vaughn
54a059ff68 updated signatures for addCollaborators methods
updated javadoc comments for addCollaborators methods
combined both modifyCollaborators methods into one method
updated addColloaborators test to match new method signature
2020-02-07 21:13:23 -06:00
Liam Newman
289282e235 Move OTP detection earlier
Like other errors we've been waiting until later to catch, this one is detectable so
whe should do that before the downstream exception needs to be thrown.
2020-02-06 16:59:49 -08:00
Liam Newman
825c36c15e Tweaks for clarity 2020-02-06 14:11:16 -08:00
Liam Newman
1234c2e99e Add tests for rate limit 2020-02-06 13:33:29 -08:00
Liam Newman
b8fae1308d Streamline fetch and retry process 2020-02-06 08:01:17 -08:00
James Vaughn
dddcf624e6 finished suggested formatting changes 2020-02-05 21:30:52 -06:00
James Vaughn
b33fe9f7fe Merge branch 'collaborator-permissions' of https://github.com/jimmysombrero/github-api into collaborator-permissions 2020-02-04 21:10:39 -06:00
James Vaughn
5a799400a9 fixed minor formatting issues 2020-02-04 21:10:29 -06:00
Liam Newman
76919a819f Merge branch 'master' into collaborator-permissions 2020-02-03 12:46:17 -08:00
Liam Newman
9c30f846b2 Merge pull request #692 from github-api/dependabot/maven/com.github.tomakehurst-wiremock-jre8-standalone-2.26.0
Bump wiremock-jre8-standalone from 2.25.1 to 2.26.0
2020-02-03 12:45:46 -08:00
Liam Newman
9230f51988 Implement new methods on Options 2020-02-03 12:41:33 -08:00
dependabot-preview[bot]
712035dc9a Bump wiremock-jre8-standalone from 2.25.1 to 2.26.0
Bumps [wiremock-jre8-standalone](https://github.com/tomakehurst/wiremock) from 2.25.1 to 2.26.0.
- [Release notes](https://github.com/tomakehurst/wiremock/releases)
- [Commits](https://github.com/tomakehurst/wiremock/compare/2.25.1...2.26.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-02-03 12:34:01 -08:00
Liam Newman
32e5c5b4ad Merge pull request #693 from alexanderrtaylor/replaceAsserts
Replacing asserts with standard
2020-02-03 12:29:59 -08:00
Alex Taylor
134a6fab7e Merge branch 'master' into replaceAsserts 2020-02-03 14:47:11 -05:00
Alex Taylor
82e27cb962 Replacing asserts with standard
Beginning work to replace Asserts with assertThat to keep consistency
2020-02-03 11:43:16 -05:00
James Vaughn
8bcad7b3f9 Merge branch 'collaborator-permissions' of https://github.com/jimmysombrero/github-api into collaborator-permissions 2020-02-02 22:03:08 -06:00
James Vaughn
d767575f76 Added test for addCollaborators
Mark old addCollaborators methods depricated
2020-02-02 22:02:56 -06:00
jimmysombrero
7214c7d393 Merge branch 'master' into collaborator-permissions 2020-02-01 22:40:54 -06:00
James Vaughn
205e5ab03d Merge branch 'collaborator-permissions' of https://github.com/jimmysombrero/github-api into collaborator-permissions 2020-02-01 22:39:28 -06:00
James Vaughn
6576beae76 Added missing methods to keep the API from breaking
added tests for addCollaborators()
2020-02-01 22:39:14 -06:00
Liam Newman
001f8f1f50 Update PULL_REQUEST_TEMPLATE.md 2020-01-31 13:18:17 -08:00
Liam Newman
3b694a87ef Fix formatting 2020-01-31 13:17:16 -08:00
spierce
84dd06d769 [#690]Implement the ability to read total_private_repos for GHPerson 2020-01-31 13:44:43 -06:00
Liam Newman
c5cb16abfb Merge branch 'master' into collaborator-permissions 2020-01-31 08:32:35 -08:00
Liam Newman
79fb34324d Merge pull request #684 from alexanderrtaylor/assertThatIssues
Authentication and assertThat issues
2020-01-30 11:10:38 -08:00
Alex Taylor
303aef3548 Merge branch 'assertThatIssues' of https://github.com/alexanderrtaylor/github-api into assertThatIssues 2020-01-30 11:22:39 -05:00
Alex Taylor
fd278f8c32 Update AbstractGitHubWireMockTest.java
added return for Javadoc
2020-01-30 11:22:37 -05:00
Liam Newman
53041a4117 Merge branch 'master' into assertThatIssues 2020-01-29 18:32:47 -08:00
Liam Newman
9b3fe3b13a Merge pull request #687 from bitwiseman/task/windows-ci
Shorten file names for Windows
2020-01-29 18:06:48 -08:00
Liam Newman
5c6c5081e9 Improve naming of jobs 2020-01-29 18:00:30 -08:00
Liam Newman
e087ea0ac7 Split build jobs for clarity 2020-01-29 17:36:31 -08:00
Liam Newman
71c44dc805 Move CI to cache .m2 directory 2020-01-29 17:18:19 -08:00
Liam Newman
c5c8596664 Reduce output from connection retry 2020-01-29 17:04:24 -08:00
Liam Newman
92a86f4d1c No formatting checks on Windows CI build 2020-01-29 16:01:37 -08:00
Alex Taylor
8098b68b8e formatting changes
sorry forgot to run the formatting automation before committing the last
2020-01-29 16:56:49 -05:00
Alex Taylor
7356001723 Merge remote-tracking branch 'upstream/master' into assertThatIssues 2020-01-29 16:56:15 -05:00
Alex Taylor
aba60587ab Corrected massive change
Added back the extends Assert to the wiremock test base class so that I am not making a massive change and potentially  breaking inflight work people are doing
2020-01-29 16:49:33 -05:00
Liam Newman
936a6a04fb Reduce some code coverage bars on windows 2020-01-29 13:38:08 -08:00
Liam Newman
9675126298 Turn off some tests for windows 2020-01-29 13:30:01 -08:00
Liam Newman
6a5886ea1c Disable import sorting 2020-01-29 11:38:32 -08:00
Liam Newman
648c6a5a8f Shorten file names for Windows 2020-01-29 09:24:50 -08:00
Liam Newman
14b7bf4753 Add windows to CI matrix 2020-01-28 20:52:49 -08:00
jimmysombrero
0e310fa96a Merge branch 'master' into collaborator-permissions 2020-01-28 15:21:25 -06:00
Liam Newman
0f6c282c80 [maven-release-plugin] prepare for next development iteration 2020-01-27 19:07:15 -08:00
Liam Newman
ed3cd0c9c8 [maven-release-plugin] prepare release github-api-1.106 2020-01-27 19:07:07 -08:00
Liam Newman
398f029f6d Merge pull request #685 from bitwiseman/task/commons-io-2.4
Downgrade to commons-io 2.4
2020-01-27 19:04:24 -08:00
Liam Newman
ad9c2b917b Disable rate limit hanging test 2020-01-27 18:56:41 -08:00
Liam Newman
d0d65182c0 Downgrade to commons-io 2.4 for Jenkins compatibility 2020-01-27 18:43:56 -08:00
Alex Taylor
4c3a0d329b added Authentication Check
Added additional authentication checks on gitHubBeforeAfter so that cleanup is done with a user logged in
2020-01-27 15:24:28 -05:00
Alex Taylor
7c495c2177 Fixes after merge
Fixed some failing tests after merge
2020-01-27 14:45:02 -05:00
Alex Taylor
2f86a9e534 Merge remote-tracking branch 'upstream/master' into assertThatIssues 2020-01-27 14:37:46 -05:00
Alex Taylor
12c3a0b1fa Authentication and assertThat issues
Fixed some problems with tests trying to authenticate when you are not actually signed in. This hit rate API limiting which caused tests to hang/fail

Also fixed assertThat getting deprecated from junit
2020-01-27 14:29:46 -05:00
Liam Newman
14f3660f55 [maven-release-plugin] prepare for next development iteration 2020-01-27 00:03:48 -08:00
Liam Newman
5a8b032d74 [maven-release-plugin] prepare release github-api-1.105 2020-01-27 00:03:39 -08:00
Liam Newman
57c4613b1f Merge pull request #683 from timja/add-full-create-team-parameters
Add support for all create team parameters
2020-01-27 00:00:44 -08:00
Tim Jacomb
e008021a42 Merge branch 'add-full-create-team-parameters' of github.com:timja/github-api into add-full-create-team-parameters 2020-01-27 07:52:15 +00:00
Tim Jacomb
7e600c43ed Var-args instead of list 2020-01-27 07:52:08 +00:00
Tim Jacomb
963478e206 Merge branch 'master' into add-full-create-team-parameters 2020-01-27 07:46:14 +00:00
Tim Jacomb
0f32783488 Revert updatePrivacy 2020-01-27 07:40:16 +00:00
Liam Newman
756d470715 [maven-release-plugin] prepare for next development iteration 2020-01-26 23:33:20 -08:00
Liam Newman
2c47b7535b [maven-release-plugin] prepare release github-api-1.104 2020-01-26 23:33:11 -08:00
Tim Jacomb
4cc90b4929 Fix test 2020-01-27 07:31:19 +00:00
Tim Jacomb
32754ffcf5 Cleanup based on review 2020-01-27 07:24:01 +00:00
Tim Jacomb
64aae75680 Allow updating privacy status 2020-01-26 11:02:01 +00:00
Tim Jacomb
69d2160a0d Add support for all create team parameters 2020-01-25 20:07:56 +00:00
Liam Newman
99e326539e Merge pull request #680 from bitwiseman/issue/ssl
Handle SSLHandshakeException with connection retry
2020-01-24 21:47:20 -08:00
Liam Newman
1dde975cfe Handle SSLHandshakeException with connection retry 2020-01-24 21:24:55 -08:00
jimmysombrero
58c069ec5c Merge branch 'master' into collaborator-permissions 2020-01-24 18:26:54 -06:00
James Vaughn
7916600a7b updating local branch 2020-01-24 18:24:53 -06:00
James Vaughn
3e4f160c5d ran mvn clean install then the build commmand and build was successful 2020-01-24 18:23:59 -06:00
Liam Newman
aeb5e5f681 Merge pull request #674 from v1v/master
Retry when SocketException with some sleep
2020-01-24 14:43:29 -08:00
Liam Newman
1c2e491845 Minor improvement to statistics
Reading raw streams just to map them is not needed.
Using arrays instead of lists works fine.
2020-01-24 14:07:19 -08:00
Liam Newman
eb4000f26b Streamline retry code path 2020-01-24 12:32:04 -08:00
Liam Newman
74dd887c79 Merge branch 'master' into master 2020-01-23 22:22:42 -08:00
Liam Newman
764599a7d9 Move socket handling and add test 2020-01-23 20:54:13 -08:00
Liam Newman
ad683fee89 Merge branch 'master' into collaborator-permissions 2020-01-23 17:51:59 -08:00
Liam Newman
85a53fc68f Merge pull request #676 from alexanderrtaylor/issues-349
Issues 349
2020-01-23 17:49:39 -08:00
James Vaughn
3bf8baee85 format fixed and validation passed 2020-01-23 18:32:37 -06:00
Vaughn
8792213594 tried formatting the file once again. 2020-01-23 15:16:36 -06:00
Victor Martinez
d9ebc9455c UTs for the Timeout and Retry 2020-01-23 21:09:14 +00:00
Vaughn
9ab8bdfe4a formatted file 2020-01-23 14:45:24 -06:00
Victor Martinez
418ea9a19e As suggested in the code review, handle exceptions and setup the connection 2020-01-23 20:39:58 +00:00
Victor Martinez
20f04febf2 As suggested in the code review, make a configurable sleep 2020-01-23 20:36:00 +00:00
Alex Taylor
a65783201e updated the test files
Updated the test files and did a temp repo
2020-01-23 15:31:50 -05:00
Victor Martinez
a5f04d44a4 Fix javadoc warning 2020-01-23 20:29:55 +00:00
Victor Martinez
cbe1022f20 Support more generic Socket Exceptions
For instance: connection reset by peer
2020-01-23 20:28:57 +00:00
Vaughn
90301ae9ee Added ability to specify permissions for collaborators 2020-01-23 13:37:35 -06:00
Victor Martinez
4f38ab3640 Cosmetic change 2020-01-23 14:01:29 +00:00
Victor Martinez
fca179abab Retry if SocketException
See https://github.com/github-api/github-api/pull/373
2020-01-23 13:33:12 +00:00
Liam Newman
e426237c35 [maven-release-plugin] prepare for next development iteration 2020-01-22 11:57:10 -08:00
Liam Newman
3dae361d7b [maven-release-plugin] prepare release github-api-1.103 2020-01-22 11:56:59 -08:00
Liam Newman
967831388e Relocate shaded dependecies and generate separate shaded artifact 2020-01-22 09:59:10 -08:00
Liam Newman
f9794f20d4 Use Https 2020-01-21 17:22:58 -08:00
Liam Newman
f98efd6af0 Update site.xml 2020-01-21 16:56:44 -08:00
Liam Newman
69bf0641f8 Update site.xml
Closes #671
2020-01-21 16:55:46 -08:00
Liam Newman
5791843d16 [maven-release-plugin] prepare for next development iteration 2020-01-21 15:40:09 -08:00
Liam Newman
58d0a20074 [maven-release-plugin] prepare release github-api-1.102 2020-01-21 15:40:00 -08:00
Liam Newman
5884c7b3ba Re-enable jacoco during ci 2020-01-21 14:44:47 -08:00
Liam Newman
dd1da268a2 Additional checks and clean up to GHRateLimit and tests 2020-01-21 13:30:08 -08:00
Alex Taylor
473f3954c7 Update GHRepositoryTest.java
Added some parent tests as well
2020-01-21 15:56:07 -05:00
Alex Taylor
5aad5406a2 [WIP]Adding GHRepo tests 2020-01-21 14:35:29 -05:00
Liam Newman
98b606287d Add more validation to rate limit
Downstream tests are doing some strange Json.  Give better output when they do something invalid.
2020-01-18 23:33:44 -08:00
Liam Newman
9792fc0daa Fix missing version 2020-01-18 19:20:21 -08:00
Liam Newman
a9bb9302bc Move cached 404 retry to main code path 2020-01-18 18:53:31 -08:00
Liam Newman
30c70bc8d4 Merge pull request #651 from martinvanzijl/issue_500_create_tag_method
Add createTag() method to GHRepository
2020-01-18 14:02:39 -08:00
Liam Newman
0df48c37ac Merge branch 'master' into issue_500_create_tag_method 2020-01-17 22:43:07 -08:00
Liam Newman
ec31e94e7a Merge pull request #665 from bitwiseman/task/cache-error-test
Workaround for `If-Modified-Since` HTTP request header causing cache corruption
2020-01-17 22:42:09 -08:00
Liam Newman
ea631d0e88 Merge pull request #633 from bitwiseman/task/shade
Add shading of dependencies
2020-01-17 22:41:29 -08:00
Liam Newman
66a180346e Improve commenting of workaround 2020-01-17 17:52:50 -08:00
Liam Newman
63ee878789 Merge remote-tracking branch 'github-api/master' into task/cache-error-test 2020-01-17 17:27:12 -08:00
Liam Newman
3479e4f2fd Clean up and formatting 2020-01-17 17:05:45 -08:00
Liam Newman
54f4152f89 Template data files to make okhttp2 test runnable in CI
OkHttp2 doesn't invalidate caches sometimes when it probably should
2020-01-17 17:00:40 -08:00
Liam Newman
06334bf272 Template data files to make okhttp3 test runnable in CI 2020-01-17 16:58:54 -08:00
Liam Newman
839f096f39 Add caching error test for OkHttp 2020-01-17 15:57:14 -08:00
Liam Newman
f3b2fdc4fc Update test and resources using new workaround 2020-01-17 15:53:55 -08:00
Liam Newman
16d34f3268 Workaround for #669 - retry with cache overridden
This is much more reasonable way to address this issue.
When the Requester detects a 404 response with an ETag (only happpens when the server's 304
is bogus and would cause cache corruption), try the query again with new request header
that forces the server to not return 304 and return new data instead.

Ths solution is transparent to users of this library and autmatically fixes a situation that
was causing cache corruption. If GitHub ever fixes the issue and begins providing accurate
ETags to their 404 responses, this will result in two calls being made for each 404 response.
While that would be unfortunate, it would still be better than the current situation.
2020-01-17 15:53:55 -08:00
Liam Newman
61e8dd09d6 Revert "Workaround for #669 - remove If-Modified-Since header"
This reverts commit 90d7fea7aa.
2020-01-17 14:46:31 -08:00
Liam Newman
90d7fea7aa Workaround for #669 - remove If-Modified-Since header
This is a first cut at working round #669.  It is hacky as hell and I hate it.
2020-01-17 14:46:10 -08:00
Liam Newman
b9c8bf07ea Restore correct exception throwing for getArray 2020-01-15 19:42:42 -08:00
Liam Newman
a3ba07d45f Inline toIterable 2020-01-15 19:33:22 -08:00
Liam Newman
5a6a29cbb5 Add array and iterator tests 2020-01-15 19:31:30 -08:00
Liam Newman
72aedbb76c JENKINS-54126 - Repro of github caching error 2020-01-14 00:29:43 -08:00
Liam Newman
e7e3be6ea7 Merge pull request #662 from sullis/github-actions-checkout-v2
GitHub Actions checkout v2
2020-01-13 11:29:25 -08:00
Liam Newman
62e1b9eb01 Merge pull request #663 from sullis/jackson-2.10.2
jackson 2.10.2
2020-01-13 11:22:29 -08:00
Sean C. Sullivan
3fff92dc35 jackson 2.10.2 2020-01-12 16:09:57 -08:00
Sean C. Sullivan
352d77719e GitHub Actions checkout v2 2020-01-12 15:23:13 -08:00
Martin van Zijl
ff397dfa4d Correction per "mvn install site". 2020-01-11 13:03:41 +13:00
Martin van Zijl
34d64c0dff Added comment to JavaDoc as advised per GitHub Maven test. 2020-01-11 12:53:54 +13:00
Martin van Zijl
b5fdc2f956 Merge branch 'master' of https://github.com/kohsuke/github-api into issue_500_create_tag_method 2020-01-11 12:46:08 +13:00
Martin van Zijl
38602965db Merge branch 'issue_500_create_tag_method' of https://github.com/martinvanzijl/github-api into issue_500_create_tag_method 2020-01-11 12:31:28 +13:00
Martin van Zijl
df1ea62883 Removed wiremock files for old test case. 2020-01-11 12:24:12 +13:00
Martin van Zijl
afaff52888 Removed test from GHRepositoryTest and added to GHTagTest. 2020-01-11 12:23:41 +13:00
Liam Newman
5b7829c288 Merge branch 'master' into task/shade 2020-01-10 11:14:18 -08:00
Liam Newman
2462eb2c79 Merge pull request #652 from github-api/dependabot/maven/com.squareup.okio-okio-2.4.3
Bump okio from 2.4.2 to 2.4.3
2020-01-10 11:13:59 -08:00
Liam Newman
edc26b0a55 Fix site 2020-01-10 10:11:31 -08:00
Liam Newman
cc94e8b0ca Merge branch 'master' into dependabot/maven/com.squareup.okio-okio-2.4.3 2020-01-10 09:24:04 -08:00
Liam Newman
80f3a6e507 Merge pull request #659 from github-api/dependabot/maven/com.squareup.okhttp3-okhttp-4.3.1
Bump okhttp from 4.2.2 to 4.3.1
2020-01-10 09:23:03 -08:00
Liam Newman
5709be7ff7 Merge branch 'master' into issue_500_create_tag_method 2020-01-10 09:19:05 -08:00
Liam Newman
46fce8cf4b Merge branch 'master' into dependabot/maven/com.squareup.okio-okio-2.4.3 2020-01-10 09:18:51 -08:00
Liam Newman
e84049367e Merge branch 'master' into dependabot/maven/com.squareup.okhttp3-okhttp-4.3.1 2020-01-10 09:18:05 -08:00
Liam Newman
f213ead595 Move shade to ci and release profiles 2020-01-09 11:36:24 -08:00
Liam Newman
ba540b0725 Remove parent pom 2020-01-09 08:27:06 -08:00
Liam Newman
eb55691c89 Add shading of dependencies
Fixes #630
2020-01-09 08:26:49 -08:00
Liam Newman
dd508e7dea Rerecord GHTreeBuilder for test org 2020-01-08 19:44:23 -08:00
dependabot-preview[bot]
66357866c5 Bump okio from 2.4.2 to 2.4.3
Bumps [okio](https://github.com/square/okio) from 2.4.2 to 2.4.3.
- [Release notes](https://github.com/square/okio/releases)
- [Changelog](https://github.com/square/okio/blob/master/CHANGELOG.md)
- [Commits](https://github.com/square/okio/compare/parent-2.4.2...parent-2.4.3)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-01-09 03:22:54 +00:00
dependabot-preview[bot]
6e3728b458 Bump okhttp from 4.2.2 to 4.3.1
Bumps [okhttp](https://github.com/square/okhttp) from 4.2.2 to 4.3.1.
- [Release notes](https://github.com/square/okhttp/releases)
- [Changelog](https://github.com/square/okhttp/blob/master/CHANGELOG.md)
- [Commits](https://github.com/square/okhttp/compare/parent-4.2.2...parent-4.3.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-01-09 03:22:54 +00:00
Liam Newman
31d4eef4b1 Merge pull request #642 from asthinasthi/create-tree-null-sha-field
Post only non-null values in request body for createTree
2020-01-08 19:21:43 -08:00
Liam Newman
f58f32a7a8 Merge branch 'master' into create-tree-null-sha-field 2020-01-08 17:36:36 -08:00
Liam Newman
28d8fb686a Merge pull request #653 from github-api/dependabot/maven/org.apache.maven.plugins-maven-source-plugin-3.2.1
Bump maven-source-plugin from 3.2.0 to 3.2.1
2020-01-07 11:26:07 -08:00
dependabot-preview[bot]
4c7fc2ef47 Bump maven-source-plugin from 3.2.0 to 3.2.1
Bumps [maven-source-plugin](https://github.com/apache/maven-source-plugin) from 3.2.0 to 3.2.1.
- [Release notes](https://github.com/apache/maven-source-plugin/releases)
- [Commits](https://github.com/apache/maven-source-plugin/compare/maven-source-plugin-3.2.0...maven-source-plugin-3.2.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-01-07 00:00:39 +00:00
Liam Newman
a3f99978c2 Merge pull request #657 from github-api/dependabot/maven/junit-junit-4.13
Bump junit from 4.12 to 4.13
2020-01-06 15:59:26 -08:00
Liam Newman
136b55d310 Merge pull request #650 from bitwiseman/issue/mime-base64-638
Do not MIME encode Base64 content for sending
2020-01-06 09:23:44 -08:00
dependabot-preview[bot]
617e90259b Bump junit from 4.12 to 4.13
Bumps [junit](https://github.com/junit-team/junit4) from 4.12 to 4.13.
- [Release notes](https://github.com/junit-team/junit4/releases)
- [Changelog](https://github.com/junit-team/junit4/blob/master/doc/ReleaseNotes4.12.md)
- [Commits](https://github.com/junit-team/junit4/compare/r4.12...r4.13)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2020-01-02 06:36:48 +00:00
Martin van Zijl
959eb46162 Deleted unit test cleanup method.
This method failed in the automated GitHub build online with a null
pointer exception.

I tried to make it a @Before/@After method, but that fails on
my local PC.
2020-01-02 13:21:27 +13:00
Martin van Zijl
998bda9de7 Add createTag() method.
Fixes #500.
2019-12-23 05:43:48 +13:00
Liam Newman
37a2018fe3 Do not MIME encode Base64 content for sending
Fixes #638
2019-12-20 19:48:17 -08:00
Liam Newman
2c80e07c9d Merge branch 'master' into create-tree-null-sha-field 2019-12-19 19:11:09 -08:00
Liam Newman
a115f34766 Merge pull request #637 from PauloMigAlmeida/marketplace_endpoints_patch2
[Patch 2/2] :: Add support to Marketplace endpoints
2019-12-19 19:10:00 -08:00
Liam Newman
cd66c1e7c3 Add Accept header 2019-12-19 18:59:50 -08:00
Liam Newman
4f9975dc6d Merge remote-tracking branch 'github-api/master' into marketplace_endpoints_patch2 2019-12-19 18:44:48 -08:00
Liam Newman
9da487d962 Merge pull request #635 from PauloMigAlmeida/marketplace_endpoints
[Patch 1/2] :: Add support to Marketplace endpoints
2019-12-19 18:26:16 -08:00
Liam Newman
c7123b016b Update for Accept header 2019-12-19 18:21:09 -08:00
PauloMigAlmeida
efb13ddaf0 Fix errors caught during the build
Signed-off-by: PauloMigAlmeida <paulo.miguel.almeida.rodenas@gmail.com>
2019-12-19 18:06:14 -08:00
PauloMigAlmeida
3539b73c08 Implement changes requested for patch 1
Signed-off-by: PauloMigAlmeida <paulo.miguel.almeida.rodenas@gmail.com>
2019-12-19 18:06:14 -08:00
PauloMigAlmeida
2c084ef4d5 improve docs related to credentials requirements for some methods
Signed-off-by: PauloMigAlmeida <paulo.miguel.almeida.rodenas@gmail.com>
2019-12-19 18:06:14 -08:00
PauloMigAlmeida
754e66f4dd Additional tests for list accounts with a few parameters combinations
Signed-off-by: PauloMigAlmeida <paulo.miguel.almeida.rodenas@gmail.com>
2019-12-19 18:06:14 -08:00
PauloMigAlmeida
41b698f0a8 Add tests for listing GitHub marketplace accounts
Signed-off-by: PauloMigAlmeida <paulo.miguel.almeida.rodenas@gmail.com>
2019-12-19 18:06:14 -08:00
PauloMigAlmeida
de78da4fa6 Implement listing all GitHub Marketplace accounts given a plan
Signed-off-by: PauloMigAlmeida <paulo.miguel.almeida.rodenas@gmail.com>
2019-12-19 18:06:14 -08:00
PauloMigAlmeida
3d241d6fa1 formatting improvements
Signed-off-by: PauloMigAlmeida <paulo.miguel.almeida.rodenas@gmail.com>
2019-12-19 18:06:14 -08:00
PauloMigAlmeida
1d983a0090 Implement list marketplace plans
Signed-off-by: PauloMigAlmeida <paulo.miguel.almeida.rodenas@gmail.com>
2019-12-19 18:06:13 -08:00
Liam Newman
78fb860305 Merge pull request #648 from bitwiseman/task/accept-header
Enforce 'Accept' request header values
2019-12-19 18:04:55 -08:00
Liam Newman
c699a84f42 Enforce 'Accept' request header values
The 'Accept' header on requests can change what data is returned, so we need to
only match requests with the correct value.
2019-12-19 17:56:32 -08:00
PauloMigAlmeida
d8a178d93d Implement changes requested for patch 2
Signed-off-by: PauloMigAlmeida <paulo.miguel.almeida.rodenas@gmail.com>
2019-12-20 13:27:40 +13:00
PauloMigAlmeida
ada4243548 Merge branch 'marketplace_endpoints' of https://github.com/PauloMigAlmeida/github-api into marketplace_endpoints_patch2
 Conflicts:
	src/main/java/org/kohsuke/github/GHMarketplaceAccount.java
	src/main/java/org/kohsuke/github/GHMarketplaceListAccountBuilder.java
	src/test/java/org/kohsuke/github/GHMarketplacePlanTest.java
2019-12-20 13:14:12 +13:00
PauloMigAlmeida
fa2e3aad6c Fix errors caught during the build
Signed-off-by: PauloMigAlmeida <paulo.miguel.almeida.rodenas@gmail.com>
2019-12-20 12:58:11 +13:00
PauloMigAlmeida
0cf457a46f Merge branch 'master' of https://github.com/kohsuke/github-api into marketplace_endpoints 2019-12-20 12:46:48 +13:00
PauloMigAlmeida
bb7b98d448 Merge remote-tracking branch 'origin/marketplace_endpoints' into marketplace_endpoints 2019-12-20 12:38:16 +13:00
PauloMigAlmeida
e8d90848f2 Implement changes requested for patch 1
Signed-off-by: PauloMigAlmeida <paulo.miguel.almeida.rodenas@gmail.com>
2019-12-20 12:37:59 +13:00
Liam Newman
7c791451ba Merge pull request #647 from halkeye/patch-1
Labels with description are not preview anymore
2019-12-19 13:57:07 -08:00
Liam Newman
16d8c2b221 Remove Symmetra preview 2019-12-19 13:50:18 -08:00
Gavin Mogan
dceecbef0a Labels with description are not preview anymore
https://developer.github.com/v3/issues/labels/#create-a-label
2019-12-19 13:50:07 -08:00
Liam Newman
3cbddf1de9 Merge pull request #646 from PauloMigAlmeida/issue_628
Implement App createToken with empty body
2019-12-19 13:47:22 -08:00
PauloMigAlmeida
650340fcb3 Fix example on the docs
Signed-off-by: PauloMigAlmeida <paulo.miguel.almeida.rodenas@gmail.com>
2019-12-20 01:47:39 +13:00
PauloMigAlmeida
ce5b893224 Add example on the docs
Signed-off-by: PauloMigAlmeida <paulo.miguel.almeida.rodenas@gmail.com>
2019-12-20 01:44:09 +13:00
PauloMigAlmeida
7869afa4ff Implement test for createToken method with no json property
Signed-off-by: PauloMigAlmeida <paulo.miguel.almeida.rodenas@gmail.com>
2019-12-20 01:09:34 +13:00
Paulo Miguel Almeida
9085606082 Fix GHObjectTest test broken on PR #644
Signed-off-by: PauloMigAlmeida <paulo.miguel.almeida.rodenas@gmail.com>
2019-12-20 00:08:23 +13:00
Paulo Miguel Almeida
1e3f646814 Refactor GHAppCreateTokenBuilder;
Add docs;

Signed-off-by: PauloMigAlmeida <paulo.miguel.almeida.rodenas@gmail.com>
2019-12-20 00:05:31 +13:00
PauloMigAlmeida
933f0cb4b8 Merge branch 'master' of https://github.com/github-api/github-api into issue_628
 Conflicts:
	src/main/java/org/kohsuke/github/GHAppCreateTokenBuilder.java
2019-12-19 22:59:44 +13:00
PauloMigAlmeida
7497761fcc Implement create token variation 2019-12-19 19:42:22 +13:00
Liam Newman
12b3d4ec7a Merge branch 'master' into marketplace_endpoints 2019-12-17 17:27:10 -08:00
Liam Newman
8fd5ed57c4 Merge pull request #644 from martinvanzijl/issue_126_add_type_and_site_admin_fields
Add type and site_admin fields to GHPerson
2019-12-17 17:23:54 -08:00
Liam Newman
7bc301bc70 Merge pull request #634 from bitwiseman/task/minimum-coverage
Task/minimum coverage
2019-12-17 17:23:30 -08:00
Liam Newman
30321d3a0e Update coverage excludes and bars 2019-12-17 17:16:23 -08:00
Liam Newman
511a0ae503 Exclude deprecated classes 2019-12-17 17:16:22 -08:00
Liam Newman
1057636666 Add wiremock data 2019-12-17 17:16:22 -08:00
Liam Newman
564b1d2a98 Enable event tests 2019-12-17 17:16:22 -08:00
Liam Newman
20cd0e2de2 Turn Traffic tests back on 2019-12-17 17:16:22 -08:00
Liam Newman
6bc617c488 Merge pull request #623 from bitwiseman/task/iterator
Move array population to single iterator code path
2019-12-17 15:01:12 -08:00
Liam Newman
049db83423 Merge remote-tracking branch 'github-api/master' into task/iterator 2019-12-17 14:35:37 -08:00
Liam Newman
52dd90e85d Additional tweaks to reduce the number of code paths 2019-12-17 14:15:38 -08:00
Liam Newman
305267d07f Rename methods for better clarity 2019-12-17 12:41:23 -08:00
Liam Newman
20369aa1b5 Merge pull request #622 from alexanderrtaylor/GHEventAddition
[JENKINS-57430] Added some new GH Event Types
2019-12-17 11:32:45 -08:00
Liam Newman
40f05e4dbb Clean up request method calls 2019-12-17 10:02:55 -08:00
Liam Newman
a23d19f208 Merge pull request #645 from github-api/dependabot/maven/org.mockito-mockito-core-3.2.4
Bump mockito-core from 3.2.0 to 3.2.4
2019-12-17 09:06:48 -08:00
dependabot-preview[bot]
cb1d1e8ed7 Bump mockito-core from 3.2.0 to 3.2.4
Bumps [mockito-core](https://github.com/mockito/mockito) from 3.2.0 to 3.2.4.
- [Release notes](https://github.com/mockito/mockito/releases)
- [Commits](https://github.com/mockito/mockito/compare/v3.2.0...v3.2.4)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-12-17 06:37:39 +00:00
Alex Taylor
4f67f32719 Update src/main/java/org/kohsuke/github/GHCheckRun.java 2019-12-16 14:53:38 -05:00
Alex Taylor
a80b5b6abc Fixed the findbugs errors 2019-12-14 15:38:34 -05:00
Liam Newman
0be3d88872 Merge pull request #643 from github-api/dependabot/maven/com.squareup.okio-okio-2.4.2
Bump okio from 2.4.1 to 2.4.2
2019-12-13 19:42:09 +00:00
Liam Newman
48bb996350 Merge pull request #640 from github-api/dependabot/maven/org.eclipse.jgit-org.eclipse.jgit-5.6.0.201912101111-r
Bump org.eclipse.jgit from 5.5.1.201910021850-r to 5.6.0.201912101111-r
2019-12-13 19:41:52 +00:00
Martin van Zijl
ee2dde4cd1 Add type and site_admin fields to GHPerson.
Helps with #126.
2019-12-14 07:24:23 +13:00
dependabot-preview[bot]
c10a31c933 Bump okio from 2.4.1 to 2.4.2
Bumps [okio](https://github.com/square/okio) from 2.4.1 to 2.4.2.
- [Release notes](https://github.com/square/okio/releases)
- [Changelog](https://github.com/square/okio/blob/master/CHANGELOG.md)
- [Commits](https://github.com/square/okio/compare/2.4.1...parent-2.4.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-12-12 06:33:01 +00:00
Anirudh Mathad
d6a846f58d Post only non-null values in request body for createTree 2019-12-11 15:25:24 -08:00
dependabot-preview[bot]
945873231d Bump org.eclipse.jgit from 5.5.1.201910021850-r to 5.6.0.201912101111-r
Bumps org.eclipse.jgit from 5.5.1.201910021850-r to 5.6.0.201912101111-r.

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-12-11 06:36:08 +00:00
PauloMigAlmeida
5dc494978e Implement tests
Signed-off-by: PauloMigAlmeida <paulo.miguel.almeida.rodenas@gmail.com>
2019-12-10 13:21:52 +13:00
PauloMigAlmeida
c870ec10c0 Implement /user/marketplace_purchases endpoint
Signed-off-by: PauloMigAlmeida <paulo.miguel.almeida.rodenas@gmail.com>
2019-12-10 13:21:06 +13:00
PauloMigAlmeida
2085b8fd14 Split GHMarketplaceAccount.java into 2 pieces for re-utilisation purposes
Signed-off-by: PauloMigAlmeida <paulo.miguel.almeida.rodenas@gmail.com>
2019-12-10 13:19:19 +13:00
PauloMigAlmeida
e065b6435c improve docs related to credentials requirements for some methods
Signed-off-by: PauloMigAlmeida <paulo.miguel.almeida.rodenas@gmail.com>
2019-12-09 20:59:03 +13:00
PauloMigAlmeida
da5331ceb0 Additional tests for list accounts with a few parameters combinations
Signed-off-by: PauloMigAlmeida <paulo.miguel.almeida.rodenas@gmail.com>
2019-12-09 20:07:32 +13:00
PauloMigAlmeida
8f81982de4 Add tests for listing GitHub marketplace accounts
Signed-off-by: PauloMigAlmeida <paulo.miguel.almeida.rodenas@gmail.com>
2019-12-09 19:36:13 +13:00
PauloMigAlmeida
499b46ecf3 Implement listing all GitHub Marketplace accounts given a plan
Signed-off-by: PauloMigAlmeida <paulo.miguel.almeida.rodenas@gmail.com>
2019-12-09 15:53:46 +13:00
PauloMigAlmeida
a7d232e15f formatting improvements
Signed-off-by: PauloMigAlmeida <paulo.miguel.almeida.rodenas@gmail.com>
2019-12-08 20:26:37 +13:00
PauloMigAlmeida
8fdb394ec5 Implement list marketplace plans
Signed-off-by: PauloMigAlmeida <paulo.miguel.almeida.rodenas@gmail.com>
2019-12-08 20:13:54 +13:00
PauloMigAlmeida
7a1da64bf2 Merge branch 'master' of https://github.com/kohsuke/github-api 2019-12-08 15:42:54 +13:00
PauloMigAlmeida
95ae155fc0 Merge branch 'master' of https://github.com/PauloMigAlmeida/github-api 2019-12-08 15:42:34 +13:00
Liam Newman
d1507f2666 Merge pull request #631 from bitwiseman/task/base64
Remove dependency on apache commons-codec
2019-12-04 10:56:08 +00:00
Liam Newman
7e4f98d328 Remove dependency on apache commons-codec 2019-12-03 11:39:05 +00:00
Liam Newman
f9a956905e Merge pull request #629 from sullis/mockito-3.2.0
mockito 3.2.0
2019-11-30 13:20:54 -08:00
Sean C. Sullivan
e7d95f9da6 mockito 3.2.0 2019-11-29 13:33:54 -05:00
Alex Taylor
bc8f0aa223 Update GHEventPayload.java
updated to meet standards
2019-11-27 15:18:43 -05:00
Liam Newman
6f2ae94e12 Changelog for v1.101 2019-11-27 10:47:25 -08:00
Alex Taylor
8f787e9976 Added the Check Run event
Added the check run event and the objects used there along with a valid test
2019-11-27 13:30:45 -05:00
Liam Newman
321d8240a2 [maven-release-plugin] prepare for next development iteration 2019-11-27 10:27:31 -08:00
Liam Newman
d667b2f822 [maven-release-plugin] prepare release github-api-1.101 2019-11-27 10:27:24 -08:00
Liam Newman
d7f511363d Merge pull request #627 from alecharp/fix-cache-control-packagename
Fixed CacheControl package name
2019-11-27 10:14:12 -08:00
Adrien Lecharpentier
39e7c5c3de Fixed CacheControl package name
With okhttp 3, the package name changed. In the okhttp3.OkHttpConnector,
the incorrect class is loaded, creating a ClassNotFoundException at
runtime when okhttp3 only is loaded.
2019-11-27 18:30:06 +01:00
Liam Newman
60acd5c864 Update CHANGELOG.md 2019-11-26 19:08:00 -08:00
Liam Newman
b92cf6fd35 [maven-release-plugin] prepare for next development iteration 2019-11-26 17:53:42 -08:00
Liam Newman
f7d048e0b9 [maven-release-plugin] prepare release github-api-1.100 2019-11-26 17:53:14 -08:00
Liam Newman
b3d79622e6 Fix lifecycle test to not fail during release 2019-11-26 17:46:49 -08:00
Liam Newman
7e7ae79477 Update change log for 1.100 2019-11-26 17:46:49 -08:00
Liam Newman
0f9482864c Move url to separate method 2019-11-26 15:26:46 -08:00
Liam Newman
60700d59fe Force URI encoding for api paths starting with slash 2019-11-26 15:14:36 -08:00
Liam Newman
3296cef02d Change requester to GET by default 2019-11-25 18:15:21 -08:00
Liam Newman
1b55b5fa3c Move array population to single iterator code path
This remove a second code path throught pagination.
2019-11-25 18:15:21 -08:00
Liam Newman
5910988314 Merge pull request #625 from bitwiseman/bug/content-encode
Fixed GHContent to allow spaces in path
2019-11-25 18:13:38 -08:00
Liam Newman
8c4b1ef74a Fixed GHContent to allow spaces in path
URI path encoding whack-a-mole.  This fix should cover a significant number of cases.

Also, fixed to NOT do URLEncode for URI path.  The encoding is different between path and query.

Fixes #624
2019-11-25 18:06:19 -08:00
Alex Taylor
b2701f5ba4 [JENKINS-57430] Added some new GH Event Types
Added some new GH Event types so that it does not throw errors
2019-11-22 14:26:35 -05:00
Liam Newman
7d4f1941e7 Merge pull request #621 from bitwiseman/lifecycle
Re-enable Lifecycle test
2019-11-21 22:26:48 -08:00
Liam Newman
eedefcdbbb Reformat a few json test files 2019-11-21 22:19:10 -08:00
Liam Newman
bdb5e82abc Make servers only start if the might be needed
If proxying or snapshotting, we start all servers.
Otherwise only start a server if we have mapping files for them.
2019-11-21 22:09:54 -08:00
Liam Newman
ff766a46c8 Enable uploads testing and LifecycleTest
Fixed asset upload url to not hard coded
2019-11-21 17:07:38 -08:00
Liam Newman
0a40dc5939 Merge pull request #620 from siordache-forks/issue#504
fix and unit tests for issue #504
2019-11-20 22:34:02 -08:00
Serban Iordache
71862d76d3 remove '@apiNote' javadoc tag 2019-11-21 00:45:45 +01:00
Serban Iordache
7a35cc3d17 fix and unit tests for issue #504
add new methods for creating tree content
2019-11-21 00:31:36 +01:00
Liam Newman
7a4870c977 Merge pull request #619 from asthinasthi/deprecate-permission
Removed permission field in createTeam. It is deprecated in the API
2019-11-20 09:29:26 -08:00
Matt Farmer
d4d2792498 Deprecated permission field in createTeam & provided alternate method 2019-11-19 17:15:50 -08:00
Liam Newman
a969509283 Merge pull request #616 from bitwiseman/impsort
Cleanup imports
2019-11-18 19:53:07 -08:00
Liam Newman
82fa340c07 Import sorting cleanup 2019-11-18 19:14:24 -08:00
Liam Newman
d44cd4a827 Merge remote-tracking branch 'github-api/master' into impsort 2019-11-18 19:13:27 -08:00
Liam Newman
a8dbe65e30 Move GistTest to GHGistTest 2019-11-18 19:13:10 -08:00
Liam Newman
d2ce7c11ac Merge pull request #615 from alexanderrtaylor/BranchMissing
Branch missing
2019-11-18 19:08:40 -08:00
Liam Newman
d02af5ccb0 Switch property mapper to snake case
Jackson to automatically map property names using known patterns.
GitHub uses snake_case.
2019-11-18 19:05:43 -08:00
Liam Newman
9a5467dcac Re-enable GHBranchProtection test 2019-11-18 19:05:43 -08:00
Liam Newman
2af4f61882 Cleanup imports 2019-11-18 11:35:45 -08:00
Liam Newman
cbd06eef96 Code formatting 2019-11-15 15:51:07 -08:00
Liam Newman
392dc2a040 Merge remote-tracking branch 'github-api/master' into BranchMissing 2019-11-15 15:36:24 -08:00
Liam Newman
da11702f68 Modify formatting to columnize
Turns out I do care about formatting a little.  We have a lot of builders and chained methods.
I think it is easier to follow long chains when lined up veritcally.
2019-11-15 15:18:07 -08:00
Liam Newman
f262bf7cdb Commit default format 2019-11-15 13:49:32 -08:00
Alex Taylor
78ab5ad156 Changed Exception Type
Changed Exception type and added a comment
2019-11-15 14:55:50 -05:00
Alex Taylor
6af796fc3b Adjusted format
Adjusted format according to standard from repo
2019-11-15 14:35:32 -05:00
Liam Newman
c174be37b3 Merge pull request #614 from bitwiseman/task/requester-cleanup
Clean up Requester interface a bit
2019-11-15 08:40:45 -08:00
Alex Taylor
18aa067c44 Merge branch 'master' into BranchMissing 2019-11-15 10:59:15 -05:00
Alex Taylor
8d50b338f4 Added GHBranch creator
Added GHBranch creator and added a test to make sure it works
2019-11-15 10:54:32 -05:00
Liam Newman
37d7cfaaf2 Clean up Requester interface a bit 2019-11-14 18:16:56 -08:00
Liam Newman
d3564a9a4f Merge pull request #613 from bitwiseman/javadoc-warning
Javadoc fail on warning during CI build
2019-11-14 15:53:50 -08:00
Liam Newman
39d6dd9916 Update PULL_REQUEST_TEMPLATE.md 2019-11-14 13:36:33 -08:00
Liam Newman
0152ebf062 Enable failOnWarning for JavaDoc
Continuing to ratchet up some base level code quality
2019-11-14 13:33:33 -08:00
Liam Newman
757b9b2118 Add JavaDocs
Do using IntelliJ JavaDocs plugin. Better to have something than nothing.
2019-11-14 13:24:28 -08:00
Liam Newman
f6a01551fd Make PagedIterableWithConsumer package local for mocking 2019-11-14 13:15:34 -08:00
Liam Newman
1f619f3801 Merge pull request #611 from PauloMigAlmeida/master
Implement Meta endpoint
2019-11-14 13:06:43 -08:00
Liam Newman
fd436cf5b2 Fixes for build failures 2019-11-14 13:01:35 -08:00
Liam Newman
7e05ce38cf Add examples of different ways to create data objects 2019-11-14 12:39:40 -08:00
Liam Newman
7d1e977ffe Make GHMeta fields effectively final 2019-11-14 12:39:04 -08:00
Liam Newman
6c2ce83b45 Make GHMeta fields not externally settable 2019-11-14 10:29:40 -08:00
Liam Newman
d5ba0eebcb Run code formatting 2019-11-14 09:12:28 -08:00
Liam Newman
432585cb75 Merge remote-tracking branch 'github-api/master' into ghmeta 2019-11-14 09:05:20 -08:00
Liam Newman
e41a341ce6 Merge pull request #609 from bitwiseman/task/style
Code style fixes
2019-11-14 08:47:47 -08:00
PauloMigAlmeida
5d9a4b42a6 Merge branch 'master' of https://github.com/kohsuke/github-api 2019-11-14 15:56:42 +13:00
PauloMigAlmeida
6aad80904a Implement Meta endpoint
Signed-off-by: PauloMigAlmeida <paulo.miguel.almeida.rodenas@gmail.com>
2019-11-14 15:52:43 +13:00
Liam Newman
20e796cef4 Create PULL_REQUEST_TEMPLATE.md 2019-11-13 15:47:55 -08:00
Liam Newman
a3b126282d Remove package comments 2019-11-13 15:20:02 -08:00
Liam Newman
5f597379b5 JavaDoc warning fixes 2019-11-13 14:53:42 -08:00
Liam Newman
9d8460bb81 Enable automatic code formatter with CI validation
This may be controversial but it we're doing it. Having code formatting needs to be consistent
and a non-issue during code review. I'm willing modify the configuration if people see a strong
need, but formatting needs to be present and enforced.
2019-11-13 13:28:23 -08:00
Liam Newman
8943af9840 Cleanup tabs and whitespace 2019-11-13 12:47:19 -08:00
Liam Newman
d23c718036 Merge pull request #603 from madhephaestus/master
Add Functionality of OTP to support user 2fa
2019-11-13 12:43:23 -08:00
Alex Taylor
834c84c9ea Added the test for Issue #607
Added a test so that we can prove when this issue is fixed
2019-11-13 15:07:06 -05:00
Liam Newman
adc436a3f5 Update issue templates 2019-11-13 09:48:25 -08:00
Kevin Harrington
e325bf7771 fixed for the sensitive javadoc parser 2019-11-13 00:38:51 -05:00
Kevin Harrington
feabd07a21 adding javadoc 2019-11-13 00:28:18 -05:00
Kevin Harrington
e138c6fd61 Switch interface to existing Supplier class 2019-11-13 00:26:20 -05:00
Kevin Harrington
d32299fde5 add testing of scopes in assigned token 2019-11-13 00:23:38 -05:00
Kevin Harrington
3d7d780e8f only run test with moc date 2019-11-13 00:19:06 -05:00
Kevin Harrington
9f49854033 Comments for the path of OTP exception 2019-11-13 00:17:57 -05:00
Kevin Harrington
1fe820d463 instructions for reproducing the test data 2019-11-12 18:15:08 -05:00
Kevin Harrington
4a78690fde Remove old function prototype and replace it with the lambda model. 2019-11-12 18:10:05 -05:00
Kevin Harrington
3dcaf5a9de Unit test passing with Mock data 2019-11-12 18:05:39 -05:00
Kevin Harrington
ff788852d6 added the filter to the test to only run with mock data 2019-11-12 17:58:21 -05:00
Kevin Harrington
5ae062719e re-run the data capture with the overloaded function 2019-11-12 17:56:25 -05:00
Kevin Harrington
421c0a11fb Implement @PauloMigAlmeida suggested lambda style OTP workflow 2019-11-12 17:32:24 -05:00
Kevin Harrington
6ae586aeb7 Creating a receiver lambda for the PTM functionality 2019-11-12 17:28:23 -05:00
Liam Newman
7036423084 Merge pull request #595 from bitwiseman/issue/rate-limit
Adjust GHRateLimit to system time instead of depending on synchronization
2019-11-12 13:01:58 -08:00
Kevin Harrington
2f118a9cbe Adding suggested exception from @PauloMigAlmeida
When the OTP code is requested, then the special GHOTPRequiredException
is raised instead of the generic IOException. This differentiates
between an OTP request and a failed password.
2019-11-12 15:44:45 -05:00
Kevin Harrington
2c50255b21 renaming 2019-11-12 15:35:55 -05:00
harrington
8cb7210c46 set the timestamp in the token name to match the test data 2019-11-12 15:01:14 -05:00
harrington
ad0a24ad2f Make sure test is only run with stored mock data 2019-11-12 14:54:38 -05:00
harrington
df6c951830 Unit test passing with OTP data 2019-11-12 14:53:14 -05:00
harrington
5da2caa616 Adding the assume only valid when live 2019-11-12 13:00:51 -05:00
harrington
a3fe95d1e4 clear junk data 2019-11-12 12:58:22 -05:00
Liam Newman
38e61c121b Merge pull request #604 from sullis/jackson-2.10.1
jackson 2.10.1
2019-11-11 14:31:21 -08:00
Liam Newman
03e9623073 Updates based on review feedback
Created GHRateLimit.Record
Add the four rate limit records to GHRateLimit
Moved getLimt(), getRemaining(), and so on to point to core record for ease of use.
Fixed update check for header to not replace existing with older when remaining count is lower.

NOTE: Did not expose records other than core and did not resolve header update behavior to respect non-core records.
2019-11-11 14:29:36 -08:00
Sean C. Sullivan
93a1657e1e jackson 2.10.1 2019-11-10 18:31:29 -05:00
Kevin Harrington
91d67fb72f Tuning the test to pass 2019-11-10 12:13:38 -05:00
Kevin Harrington
d8cc1f885c Properly disabling the test 2019-11-10 11:32:59 -05:00
Kevin Harrington
c1f999d896 Disabling test that can't run on CI 2019-11-10 11:27:45 -05:00
Kevin Harrington
efc4d0f59b Merge branch 'master' of git@github.com:madhephaestus/github-api.git 2019-11-10 11:20:50 -05:00
Kevin Harrington
cf55d670b9 Added test to comply with CONTRIBUTING.md
Test extends AbstractGitHubWireMockTest

Test requires 2fa and the user at the command line as the test is run.
2019-11-10 11:20:32 -05:00
Kevin Harrington
8567c5e6a1 Update src/main/java/org/kohsuke/github/GitHub.java
spelling

Co-Authored-By: Liam Newman <bitwiseman@gmail.com>
2019-11-10 10:26:51 -05:00
Kevin Harrington
331084fefd comments 2019-11-09 16:47:26 -05:00
Kevin Harrington
62bf691ac1 Add Functionality of OTP to github
close #602 by adding an API to request a token using an OTP.
2019-11-09 16:43:25 -05:00
Liam Newman
09b41d4665 Merge pull request #593 from github-api/dependabot/maven/com.squareup.okhttp3-okhttp-4.2.2
Bump okhttp from 3.14.2 to 4.2.2
2019-11-07 17:36:00 -08:00
Liam Newman
71645240e9 Address Spotbugs issues in dependency update 2019-11-07 16:40:59 -08:00
dependabot-preview[bot]
603468823d Bump okhttp from 3.14.2 to 4.2.2
Bumps [okhttp](https://github.com/square/okhttp) from 3.14.2 to 4.2.2.
- [Release notes](https://github.com/square/okhttp/releases)
- [Changelog](https://github.com/square/okhttp/blob/master/CHANGELOG.md)
- [Commits](https://github.com/square/okhttp/compare/parent-3.14.2...parent-4.2.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>
2019-11-07 16:18:48 -08:00
Liam Newman
01f464cc69 Add gitter.io chat 2019-11-07 15:47:39 -08:00
Liam Newman
57ac6e982f Updated Last-Modified headers
Introduces #597

This does not appear to be a bug in github-api but in OkHttp 2.7.5
(and/or the Cache implementation in that version).
2019-11-07 14:05:54 -08:00
Liam Newman
319d2d1efe Update cache test Date and Limit values 2019-11-07 13:50:57 -08:00
Liam Newman
37de3a4122 Add tests for server time ahead and behind local time
Sometimes adding tests finds broken product code.  Sometimes it finds broken test environment.
This was the latter.

The wiremock templating returns dates in UTC format not RFC-1123 format.
2019-11-07 13:24:31 -08:00
Liam Newman
bb3a49264d Merge remote-tracking branch 'github-api/master' into issue/rate-limit 2019-11-07 11:38:00 -08:00
Liam Newman
9cecce74fa Merge pull request #594 from martinvanzijl/add-method-to-set-topics
Add method to set repository topics
2019-11-06 21:26:31 -08:00
Liam Newman
f9cf2878ef Tweaks to test 2019-11-06 21:20:55 -08:00
Liam Newman
9c80b7cf54 Various clean up and fixes for GHRateLimit 2019-11-06 20:38:10 -08:00
Liam Newman
1ecad7031f Handle GHRateLimit expiration and server time inconsistency 2019-11-06 17:17:26 -08:00
Martin van Zijl
c85d6107ec Added method to set repository topics. Fixes #546. 2019-11-07 13:41:14 +13:00
Liam Newman
7b7445b601 Clean up GHRateLimit
Improves the way reset date is calculated - uses server date if possible.

Fixes #383
2019-11-06 11:11:53 -08:00
Liam Newman
1ab474673d Lock okhttp3 UrlConnection to working versions, unlock client 2019-11-04 15:15:28 -08:00
Liam Newman
dbf92e7f20 Added changelog 2019-11-04 11:02:11 -08:00
Liam Newman
6c42db2508 Add release version tag 2019-11-04 10:30:08 -08:00
Liam Newman
c9a42178e8 [maven-release-plugin] prepare for next development iteration 2019-11-04 10:09:02 -08:00
5875 changed files with 897675 additions and 602354 deletions

1
.gitattributes vendored Normal file
View File

@@ -0,0 +1 @@
*.java text eol=lf

29
.github/ISSUE_TEMPLATE/bug_report.md vendored Normal file
View File

@@ -0,0 +1,29 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''
---
**Describe the bug**
A clear and concise description of what the bug is.
**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
**Expected behavior**
A clear and concise description of what you expected to happen.
**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]
**Additional context**
Add any other context about the problem here.

16
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View File

@@ -0,0 +1,16 @@
# Description
<!-- Describe your change here -->
# Before submitting a PR:
We love getting PRs, but we hate asking people for the same basic changes every time.
- [ ] Push your changes to a branch other than `main`. Create your PR from that branch.
- [ ] Add JavaDocs and other comments
- [ ] Write tests that run and pass in CI. See [CONTRIBUTING.md](CONTRIBUTING.md) for details on how to capture snapshot data.
- [ ] Run `mvn -D enable-ci clean install site` locally. If this command doesn't succeed, your change will not pass CI.
# When creating a PR:
- [ ] Fill in the "Description" above.
- [ ] Enable "Allow edits from maintainers".

12
.github/dependabot.yml vendored Normal file
View File

@@ -0,0 +1,12 @@
version: 2
updates:
- package-ecosystem: "maven"
directory: "/"
schedule:
interval: "monthly"
time: "02:00"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "monthly"
time: "02:00"

View File

@@ -1,5 +1,6 @@
name-template: 'v$NEXT_PATCH_VERSION 🌈'
tag-template: 'v$NEXT_PATCH_VERSION'
name-template: 'v$NEXT_MINOR_VERSION 🌈'
tag-template: 'github-api-$NEXT_MINOR_VERSION'
version-template: '$MAJOR.$MINOR'
categories:
- title: '🚀 Features'
labels:

67
.github/workflows/codeql-analysis.yml vendored Normal file
View File

@@ -0,0 +1,67 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"
on:
push:
branches: [ main, gh-pages ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ main ]
schedule:
- cron: '20 0 * * 6'
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
language: [ 'java' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
steps:
- name: Checkout repository
uses: actions/checkout@v2
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1
# Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
#- run: |
# make bootstrap
# make release
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1

View File

@@ -1,22 +1,98 @@
name: Java CI Build and Test
name: CI
on: [push, pull_request]
# this is required by spotless for JDK 16+
env:
JAVA_11_PLUS_MAVEN_OPTS: "--add-opens jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-opens jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED"
jobs:
build:
name: build-only (Java ${{ matrix.java }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
java: [ '1.8.0', '11.0.x', '13.0.x' ]
java: [ 16 ]
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v2
- name: Set up JDK
uses: actions/setup-java@v2
with:
java-version: ${{ matrix.java }}
distribution: 'adopt'
- name: Cached .m2
uses: actions/cache@v2.1.5
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Maven Install (skipTests)
env:
MAVEN_OPTS: ${{ env.JAVA_11_PLUS_MAVEN_OPTS }}
run: mvn -B install -DskipTests --file pom.xml
site:
name: site (Java ${{ matrix.java }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
java: [ 8, 11 ]
steps:
- uses: actions/checkout@v2
- name: Set up JDK
uses: actions/setup-java@v2
with:
java-version: ${{ matrix.java }}
distribution: 'adopt'
- uses: actions/cache@v2.1.5
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:
fail-fast: false
matrix:
os: [ ubuntu, windows ]
java: [ 8, 11, 16 ]
steps:
- uses: actions/checkout@v2
- name: Set up JDK
uses: actions/setup-java@v1
uses: actions/setup-java@v2
with:
java-version: ${{ matrix.java }}
- name: Maven Download all dependencies
run: mvn -B org.apache.maven.plugins:maven-dependency-plugin:3.1.1:go-offline
- name: Maven Build
run: mvn -B install site --file pom.xml
distribution: 'adopt'
- uses: actions/cache@v2.1.5
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
# JDK 8
- name: Maven Install without Code Coverage
if: matrix.os == 'windows' && matrix.java == '8'
run: mvn -B install --file pom.xml
- name: Maven Install with Code Coverage
if: matrix.os != 'windows' && matrix.java == '8'
run: mvn -B install -D enable-ci --file pom.xml
- name: Codecov Report
if: matrix.os != 'windows' && matrix.java == '8'
uses: codecov/codecov-action@v1.4.1
# JDK 11+
- name: Maven Install without Code Coverage
if: matrix.os == 'windows' && matrix.java != '8'
env:
MAVEN_OPTS: ${{ env.JAVA_11_PLUS_MAVEN_OPTS }}
run: mvn -B install --file pom.xml
- name: Maven Install with Code Coverage
if: matrix.os != 'windows' && matrix.java != '8'
env:
MAVEN_OPTS: ${{ env.JAVA_11_PLUS_MAVEN_OPTS }}
run: mvn -B install -D enable-ci --file pom.xml

11
.github/workflows/release-drafter.yml vendored Normal file
View File

@@ -0,0 +1,11 @@
name: Release Drafter
on: push
jobs:
update_release_draft:
runs-on: ubuntu-latest
steps:
- name: Release Drafter
uses: release-drafter/release-drafter@v5.15.0

4
.gitignore vendored
View File

@@ -7,3 +7,7 @@ target
.project
.settings/
.DS_Store
dependency-reduced-pom.xml
.factorypath
.vscode/settings.json

1184
CHANGELOG.md Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -14,10 +14,14 @@ Example:
This the default behavior.
Example for a single test case:
`mvn install -Dtest=WireMockStatusReporterTest#user_whenProxying_AuthCorrectlyConfigured`
### Setting up credential
1. Create an OAuth token on github.com
1. Create a "Personal access token" on https://github.com/ (`Settings` > `Developer settings` > `Personal access tokens`)
2. Set the GITHUB_OAUTH environment variable to the value of that token
3. Set the system property `test.github.useProxy` (usually like "-Dtest.github.useProxy" as a Java VM option)
@@ -27,21 +31,37 @@ This the default behavior.
`WireMockStatusReporterTest: GitHub proxying and user auth correctly configured for user login: <your login>`
Whenever you run tests with `-Dtest.github.useProxy`, they will try to get data from local files but will fallback to proxying to github if not found.
Whenever you run tests with `-Dtest.github.useProxy`, they will try to get data from local files but will fallback to proxying to GitHub if not found.
### Writing a new test
Once you have credentials setup, you add new test classes and test methods as you would normally.
Keep `useProxy` enabled and iterate on your tests as needed. Remember, while proxying your tests are interacting with GitHub - you will need to clean up your state between runs.
When you are ready to create a snapshot of your test data,
run your test with `test.github.takeSnapshot` ("-Dtest.github.takeSnapshot" as a Java VM option). For example:
#### Running tests using GitHub test proxy
`mvn install -Dtest.github.takeSnapshot -Dtest=YourTestClassName`
Keep `useProxy` enabled and iterate on your tests as needed. With `useProxy` enabled your tests will interact with
GitHub - you will need to clean up your server-state between runs. This can be done manually to start with.
Once your test code is somewhat stable, use `getNonRecordingGitHub()` to get a `GitHub` instance for test setup and cleanup.
Interactions with that `GitHub` instance will not be recorded as part of the test, keeping the test data files to a minimum.
The above command would create snapshot WireMock data files under the path `src/test/resources/org/kohsuhke/github/YourTestClassName/wiremock`.
Each method would get a separate director that would hold the data files for that test method.
#### Running tests against your personal GitHub user account
By default, test helper methods such as `getTempRepository()` target the `hub4j-test-org` GitHub organization.
Please request access to this org to record your tests before submitting a PR. This helps keep the project stable and nimble.
Until you have access (or if you don't want access), you can set the following additional system property to target
your personal github account.
`mvn install -Dtest.github.org=false -Dtest=YourTestClassName`
#### Taking a snapshot
When you are ready to create a snapshot of your test data, run your test with `test.github.takeSnapshot` ("-Dtest.github.takeSnapshot" as
a Java VM option). For example:
`mvn install -Dtest.github.takeSnapshot -Dtest.github.org=false -Dtest=YourTestClassName`
The above command will create snapshot WireMock data files under the path `src/test/resources/org/kohsuhke/github/YourTestClassName/wiremock`.
Each method will get a separate directory that will hold the data files for that test method.
Add all files including the generated data to your commit and submit a PR.

View File

@@ -1,3 +1,9 @@
Java API for GitHub
# Java API for GitHub
[![Sonatype Nexus (Releases)](https://img.shields.io/nexus/r/org.kohsuke/github-api?server=https%3A%2F%2Foss.sonatype.org)](https://mvnrepository.com/artifact/org.kohsuke/github-api)
[![Join the chat at https://gitter.im/hub4j/github-api](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/hub4j/github-api?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
![CI](https://github.com/hub4j/github-api/workflows/CI/badge.svg?branch=main)
See https://github-api.kohsuke.org/ for more details

7
codecov.yml Normal file
View File

@@ -0,0 +1,7 @@
ignore:
- "**/extras/okhttp3/ObsoleteUrlFactory**"
- "**/extras/OkHttpConnector"
- "**/extras/OkHttp3Connector"
- "**/example/**"
- "**/github/EnforcementLevel"

561
pom.xml
View File

@@ -1,46 +1,53 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.kohsuke</groupId>
<artifactId>pom</artifactId>
<version>21</version>
<relativePath />
</parent>
<groupId>org.kohsuke</groupId>
<artifactId>github-api</artifactId>
<version>1.99</version>
<version>1.129</version>
<name>GitHub API for Java</name>
<url>https://github-api.kohsuke.org/</url>
<description>GitHub API for Java</description>
<scm>
<connection>scm:git:git@github.com/github-api/${project.artifactId}.git</connection>
<developerConnection>scm:git:ssh://git@github.com/github-api/${project.artifactId}.git</developerConnection>
<url>https://${project.artifactId}.kohsuke.org/</url>
<tag>github-api-1.99</tag>
<connection>scm:git:git@github.com/hub4j/${project.artifactId}.git</connection>
<developerConnection>scm:git:ssh://git@github.com/hub4j/${project.artifactId}.git</developerConnection>
<url>https://github.com/hub4j/github-api/</url>
<tag>github-api-1.129</tag>
</scm>
<distributionManagement>
<snapshotRepository>
<id>sonatype-nexus-snapshots</id>
<name>Sonatype Nexus Snapshots</name>
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
</snapshotRepository>
<repository>
<id>sonatype-nexus-staging</id>
<name>Nexus Release Repository</name>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
<site>
<id>github-pages</id>
<url>gitsite:git@github.com/github-api/${project.artifactId}.git</url>
<url>gitsite:git@github.com/hub4j/${project.artifactId}.git</url>
</site>
</distributionManagement>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<spotbugs-maven-plugin.version>3.1.12.2</spotbugs-maven-plugin.version>
<spotbugs.version>3.1.12</spotbugs.version>
<spotbugs-maven-plugin.version>4.2.3</spotbugs-maven-plugin.version>
<spotbugs.version>4.2.3</spotbugs.version>
<spotbugs-maven-plugin.failOnError>true</spotbugs-maven-plugin.failOnError>
<hamcrest.version>2.2</hamcrest.version>
<okhttp3.version>3.12.3</okhttp3.version>
<okio.version>2.4.1</okio.version>
<jacoco.coverage.target.class>.80</jacoco.coverage.target.class>
<jacoco.coverage.target.method>0.20</jacoco.coverage.target.method>
<jacoco.coverage.target.line>0.50</jacoco.coverage.target.line>
<jacoco.coverage.target.other>0.50</jacoco.coverage.target.other>
<okhttp3.version>4.4.1</okhttp3.version>
<okio.version>2.5.0</okio.version>
<!-- Using this as the minimum bar for code coverage. Adding methods without covering them will fail this. -->
<jacoco.coverage.target.bundle.method>0.70</jacoco.coverage.target.bundle.method>
<jacoco.coverage.target.class.method>0.50</jacoco.coverage.target.class.method>
<!-- For non-ci builds we'd like the build to still complete if jacoco metrics aren't met. -->
<jacoco.haltOnFailure>false</jacoco.haltOnFailure>
<jjwt.suite.version>0.11.2</jjwt.suite.version>
<jacoco.surefire.argLine />
<surefire.argLine />
</properties>
<build>
@@ -55,6 +62,14 @@
<artifactId>maven-scm-manager-plexus</artifactId>
<version>1.11.2</version>
</extension>
<!-- Doing site publishing manually for now -->
<!--
<extension>
<groupId>org.kohsuke</groupId>
<artifactId>wagon-gitsite</artifactId>
<version>0.3.5</version>
</extension>
-->
</extensions>
<testResources>
<testResource>
@@ -66,18 +81,147 @@
</testResources>
<pluginManagement>
<plugins>
<!-- adds jacoco coverage -->
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
<configuration>
<!-- SUREFIRE-1226 workaround -->
<trimStackTrace>false</trimStackTrace>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.2.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.6</version>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.5</version>
<version>0.8.6</version>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<propertyName>jacoco.surefire.argLine</propertyName>
<!-- no need to get data about external code. It dramatically reduces performance of JaCoCo for nothing -->
<include>org.kohsuke.*</include>
</configuration>
</execution>
<!-- attached to Maven test phase -->
<execution>
<id>report</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
<execution>
<id>check</id>
<phase>test</phase>
<goals>
<goal>check</goal>
</goals>
<configuration>
<rules>
<rule>
<element>BUNDLE</element>
<limits>
<limit>
<counter>METHOD</counter>
<value>COVEREDRATIO</value>
<minimum>${jacoco.coverage.target.bundle.method}</minimum>
</limit>
</limits>
</rule>
<rule>
<!--We end up with chatty logs, but it shows us which particular classes -->
<!--are lacking in coverage. If this is too much, just remove the -->
<!--<element>CLASS</element> tag below. -->
<element>CLASS</element>
<limits>
<limit>
<counter>METHOD</counter>
<value>COVEREDRATIO</value>
<minimum>${jacoco.coverage.target.class.method}</minimum>
</limit>
</limits>
<excludes>
<!-- Code implemented externally -->
<exclude>org.kohsuke.github.extras.okhttp3.ObsoleteUrlFactory.**</exclude>
<exclude>org.kohsuke.github.extras.okhttp3.ObsoleteUrlFactory</exclude>
<!-- Sample only -->
<exclude>org.kohsuke.github.example.*</exclude>
<!-- Deprecated -->
<exclude>org.kohsuke.github.extras.OkHttpConnector</exclude>
<exclude>org.kohsuke.github.extras.OkHttp3Connector</exclude>
<exclude>org.kohsuke.github.EnforcementLevel</exclude>
<exclude>org.kohsuke.github.GHPerson.1</exclude>
<!-- TODO: Some coverage, but more needed -->
<exclude>org.kohsuke.github.GHPullRequestReviewBuilder.DraftReviewComment</exclude>
<exclude>org.kohsuke.github.GHIssue.PullRequest</exclude>
<exclude>org.kohsuke.github.GHCommitSearchBuilder</exclude>
<exclude>org.kohsuke.github.GHRepositorySearchBuilder</exclude>
<exclude>org.kohsuke.github.GHUserSearchBuilder</exclude>
<!-- TODO: These still need test coverage -->
<exclude>org.kohsuke.github.GHBranchProtection.RequiredSignatures</exclude>
<exclude>org.kohsuke.github.GHBranchProtectionBuilder.Restrictions</exclude>
<exclude>org.kohsuke.github.GHBranchProtection.Restrictions</exclude>
<exclude>org.kohsuke.github.GHCommentAuthorAssociation</exclude>
<exclude>org.kohsuke.github.GHCompare.Commit</exclude>
<exclude>org.kohsuke.github.GHCompare.InnerCommit</exclude>
<exclude>org.kohsuke.github.GHCompare.Tree</exclude>
<exclude>org.kohsuke.github.GHCompare.User</exclude>
<exclude>org.kohsuke.github.GHCompare</exclude>
<exclude>org.kohsuke.github.GHDeployKey</exclude>
<exclude>org.kohsuke.github.GHEmail</exclude>
<exclude>org.kohsuke.github.GHInvitation</exclude>
<exclude>org.kohsuke.github.GHPullRequestCommitDetail.Authorship</exclude>
<exclude>org.kohsuke.github.GHPullRequestCommitDetail.Commit</exclude>
<exclude>org.kohsuke.github.GHPullRequestCommitDetail.CommitPointer</exclude>
<exclude>org.kohsuke.github.GHPullRequestCommitDetail.Tree</exclude>
<exclude>org.kohsuke.github.GHPullRequestCommitDetail</exclude>
<exclude>org.kohsuke.github.GHPullRequestFileDetail</exclude>
<exclude>org.kohsuke.github.GHReleaseUpdater</exclude>
<exclude>org.kohsuke.github.GHRequestedAction</exclude>
<exclude>org.kohsuke.github.GHVerifiedKey</exclude>
</excludes>
</rule>
</rules>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.1.1</version>
<version>3.2.0</version>
<configuration>
<source>8</source>
<failOnWarnings>true</failOnWarnings>
<doclint>all</doclint>
</configuration>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.8</version>
<extensions>true</extensions>
<configuration>
<serverId>sonatype-nexus-staging</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
</plugins>
@@ -86,7 +230,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.8.2</version>
<version>3.9.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@@ -99,15 +243,19 @@
<goals>deploy</goals>
</configuration>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.0.0</version>
<version>3.1.2</version>
<dependencies>
<dependency>
<groupId>org.apache.bcel</groupId>
<artifactId>bcel</artifactId>
<version>6.4.1</version>
<version>6.5.0</version>
</dependency>
</dependencies>
</plugin>
@@ -129,12 +277,20 @@
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
<executions>
<execution>
<id>default-test</id>
<configuration>
<excludesFile>src/test/resources/slow-or-flaky-tests.txt</excludesFile>
<argLine>@{jacoco.surefire.argLine} ${surefire.argLine}</argLine>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>animal-sniffer-maven-plugin</artifactId>
<version>1.18</version>
<version>1.20</version>
<configuration>
<signature>
<groupId>org.codehaus.mojo.signature</groupId>
@@ -152,17 +308,48 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.infradna.tool</groupId>
<artifactId>bridge-method-injector</artifactId>
<version>1.18</version>
<executions>
<execution>
<goals>
<goal>process</goal>
</goals>
</execution>
</executions>
<plugin>
<groupId>com.infradna.tool</groupId>
<artifactId>bridge-method-injector</artifactId>
<version>1.18</version>
<executions>
<execution>
<goals>
<goal>process</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
<version>2.10.3</version>
<executions>
<execution>
<id>spotless-check</id>
<!-- runs in verify phase by default -->
<goals>
<!-- can be disabled using -Dspotless.check.skip=true -->
<goal>check</goal>
</goals>
</execution>
</executions>
<configuration>
<java>
<eclipse>
<file>${basedir}/src/build/eclipse/formatter.xml</file>
</eclipse>
<importOrder>
<file>${basedir}/src/build/eclipse/eclipse.importorder</file>
</importOrder>
<removeUnusedImports />
<trimTrailingWhitespace />
<endWithNewline />
</java>
</configuration>
</plugin>
<plugin>
<groupId>com.github.spotbugs</groupId>
@@ -190,17 +377,6 @@
</dependency>
</dependencies>
</plugin>
<!-- Do not use gmaven plugin -->
<plugin>
<groupId>org.codehaus.gmaven</groupId>
<artifactId>gmaven-plugin</artifactId>
<executions>
<execution>
<goals>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
@@ -211,9 +387,10 @@
<version>3.9</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.13</version>
<groupId>com.tngtech.archunit</groupId>
<artifactId>archunit</artifactId>
<version>0.18.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.hamcrest</groupId>
@@ -237,18 +414,24 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<version>4.13.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.awaitility</groupId>
<artifactId>awaitility</artifactId>
<version>4.0.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.10.0</version>
<version>2.12.3</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.6</version>
<version>2.8.0</version>
</dependency>
<dependency>
<groupId>com.infradna.tool</groupId>
@@ -256,6 +439,27 @@
<version>1.18</version>
<optional>true</optional>
</dependency>
<!-- for stapler-jetty -->
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.4</version>
<scope>test</scope>
</dependency>
<!-- for stapler-jetty -->
<dependency>
<groupId>commons-discovery</groupId>
<artifactId>commons-discovery</artifactId>
<version>0.5</version>
<scope>test</scope>
</dependency>
<!-- for stapler-jetty -->
<dependency>
<groupId>org.kohsuke.stapler</groupId>
<artifactId>stapler</artifactId>
<version>1.263</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.kohsuke.stapler</groupId>
<artifactId>stapler-jetty</artifactId>
@@ -265,9 +469,27 @@
<dependency>
<groupId>org.eclipse.jgit</groupId>
<artifactId>org.eclipse.jgit</artifactId>
<version>5.5.1.201910021850-r</version>
<version>5.11.0.202103091610-r</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-api</artifactId>
<version>${jjwt.suite.version}</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-impl</artifactId>
<version>${jjwt.suite.version}</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-jackson</artifactId>
<version>${jjwt.suite.version}</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>com.squareup.okio</groupId>
<artifactId>okio</artifactId>
@@ -280,10 +502,12 @@
<version>${okhttp3.version}</version>
<optional>true</optional>
</dependency>
<!-- This is the last version of okhttp3 that support UrlConnection -->
<!-- The class using this has been deprecated, this dependency can be remove when that class is. -->
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp-urlconnection</artifactId>
<version>${okhttp3.version}</version>
<version>3.12.3</version>
<optional>true</optional>
</dependency>
<dependency>
@@ -295,25 +519,25 @@
<dependency>
<groupId>org.kohsuke</groupId>
<artifactId>wordnet-random-name</artifactId>
<version>1.3</version>
<version>1.5</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>3.1.0</version>
<version>3.9.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.github.spotbugs</groupId>
<artifactId>spotbugs-annotations</artifactId>
<version>${spotbugs.version}</version>
<optional>true</optional>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.github.tomakehurst</groupId>
<artifactId>wiremock-jre8-standalone</artifactId>
<version>2.25.1</version>
<version>2.27.2</version>
<scope>test</scope>
</dependency>
<dependency>
@@ -322,6 +546,12 @@
<version>2.8.6</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.30</version>
<scope>test</scope>
</dependency>
</dependencies>
<repositories>
<repository>
@@ -336,96 +566,31 @@
</pluginRepository>
</pluginRepositories>
<profiles>
<!-- only enable slow-or-flaky-test if -Dtest= is not present -->
<profile>
<id>jacoco</id>
<id>slow-or-flaky-test</id>
<activation>
<property>
<name>enable-jacoco</name>
<name>!test</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.5</version>
<artifactId>maven-surefire-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<!-- attached to Maven test phase -->
<execution>
<id>report</id>
<id>slow-or-flaky-test</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
<execution>
<id>check</id>
<phase>install</phase>
<goals>
<goal>check</goal>
<goal>test</goal>
</goals>
<configuration>
<rules>
<rule>
<!--We end up with chatty logs, but it shows us which particular classes -->
<!--are lacking in coverage. If this is too much, just remove the -->
<!--<element>CLASS</element> tag below. -->
<element>CLASS</element>
<limits>
<!-- These limits can be overridden, in the form of `0.50` for -->
<!-- 50%, as necessary. Using a property just puts it in one spot. -->
<!--
<limit>
<counter>LINE</counter>
<value>COVEREDRATIO</value>
<minimum>${jacoco.coverage.target.lines}</minimum>
</limit>
-->
<!--
<limit>
<counter>BRANCH</counter>
<value>COVEREDRATIO</value>
<minimum>${jacoco.coverage.target.other}</minimum>
</limit>
-->
<!--
<limit>
<counter>INSTRUCTION</counter>
<value>COVEREDRATIO</value>
<minimum>${jacoco.coverage.target.other}</minimum>
</limit>
-->
<!--
<limit>
<counter>COMPLEXITY</counter>
<value>COVEREDRATIO</value>
<minimum>${jacoco.coverage.target.other}</minimum>
</limit>
-->
<limit>
<counter>METHOD</counter>
<value>COVEREDRATIO</value>
<minimum>${jacoco.coverage.target.method}</minimum>
</limit>
<!-- <limit>-->
<!-- <counter>CLASS</counter>-->
<!-- <value>COVEREDRATIO</value>-->
<!-- <minimum>${jacoco.coverage.target.class}</minimum>-->
<!-- </limit>-->
</limits>
<excludes>
<exclude>org.kohsuke.github.extras.okhttp3.ObsoleteUrlFactory.**</exclude>
<exclude>org.kohsuke.github.extras.okhttp3.ObsoleteUrlFactory</exclude>
<exclude>org.kohsuke.github.extras.OkHttp3Connector</exclude>
<!--<exclude>io.jenkins.plugins.todeclarative.converter.api.*</exclude>-->
</excludes>
</rule>
</rules>
<rerunFailingTestsCount>2</rerunFailingTestsCount>
<!-- There are some tests that take longer or are a little
flaky. Run them here. -->
<includesFile>src/test/resources/slow-or-flaky-tests.txt</includesFile>
<argLine>@{jacoco.surefire.argLine} ${surefire.argLine}</argLine>
</configuration>
</execution>
</executions>
@@ -434,13 +599,85 @@
</build>
</profile>
<profile>
<id>release</id>
<id>ci-non-windows</id>
<activation>
<property>
<name>enable-ci</name>
</property>
<os>
<family>!windows</family>
</os>
</activation>
<properties>
<!-- Only fail code coverage on non-windows machines -->
<jacoco.haltOnFailure>true</jacoco.haltOnFailure>
</properties>
</profile>
<profile>
<id>ci-all</id>
<activation>
<property>
<name>enable-ci</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>com.diffplug.spotless</groupId>
<artifactId>spotless-maven-plugin</artifactId>
<executions>
<execution>
<id>spotless-check</id>
<!-- In CI, run check early in the build -->
<phase>process-sources</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.0.0-M3</version>
<executions>
<execution>
<id>enforce-jacoco-exist</id>
<phase>verify</phase>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireFilesExist>
<files>
<file>${project.build.directory}/jacoco.exec</file>
</files>
</requireFilesExist>
</rules>
<fail>true</fail>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>release</id>
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.6</version>
<executions>
<execution>
<id>sign-artifacts</id>
@@ -460,7 +697,26 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
@@ -468,6 +724,18 @@
</profiles>
<reporting>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<reportSets>
<reportSet>
<reports>
<!-- select non-aggregate reports -->
<report>report</report>
</reports>
</reportSet>
</reportSets>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
@@ -494,4 +762,13 @@
<archive>https://groups.google.com/forum/#!forum/github-api</archive>
</mailingList>
</mailingLists>
<developers>
<developer>
<name>Kohsuke Kawaguchi</name>
<id>kohsuke</id>
<email>kk@kohsuke.org</email>
</developer>
</developers>
</project>

View File

@@ -0,0 +1,6 @@
#Organize Import Order
# Import this file in Window -> Preferences -> Java -> Code Style -> Organize Imports -> Import...
0=
1=java
2=javax
3=\#

View File

@@ -0,0 +1,383 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<profiles version="17">
<profile kind="CodeFormatterProfile" name="Java Conventions - GitHub-api" version="17">
<!-- Make various elements turn to colums when they wrap -->
<!-- Basically the only way to create this is by downloading eclipse and working in their UI -->
<setting id="org.eclipse.jdt.core.formatter.alignment_for_enum_constants" value="80"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call" value="80"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration" value="80"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation" value="80"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression" value="80"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation" value="80"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation" value="80"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression" value="80"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration" value="80"/>
<setting id="org.eclipse.jdt.core.formatter.comment.line_length" value="120"/>
<setting id="org.eclipse.jdt.core.formatter.lineSplit" value="120"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.tabulation.char" value="space"/>
</profile>
<!-- Keeping the "default" exported values for reference -->
<!--
<profile kind="CodeFormatterProfile" name="Eclipse [built-in]-Default" version="17">
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_ellipsis" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_for_statment" value="common_lines"/>
<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_logical_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_package" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_method_invocation" value="common_lines"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_imports" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_switch_statement" value="common_lines"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_javadoc_comments" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.indentation.size" value="4"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_enum_constant_declaration" value="common_lines"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_default" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.align_with_spaces" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.disabling_tag" value="@formatter:off"/>
<setting id="org.eclipse.jdt.core.formatter.continuation_indentation" value="2"/>
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_before_code_block" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_switch_case_expressions" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_enum_constants" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_imports" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_end_of_method_body" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_package" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_if_while_statement" value="common_lines"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.indent_root_tags" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_before_or_operator_multicatch" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.enabling_tag" value="@formatter:on"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.count_line_length_from_starting_position" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_case" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_before_multiplicative_operator" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_field" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_method" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameterized_type_references" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_logical_operator" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.keep_annotation_declaration_on_one_line" value="one_line_never"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_enum_constant" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_multiplicative_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_block" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.align_tags_descriptions_grouped" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.comment.line_length" value="80"/>
<setting id="org.eclipse.jdt.core.formatter.use_on_off_tags" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.keep_method_body_on_one_line" value="one_line_never"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.keep_loop_body_block_on_one_line" value="one_line_never"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_method_declaration" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_abstract_method" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.keep_enum_constant_declaration_on_one_line" value="one_line_never"/>
<setting id="org.eclipse.jdt.core.formatter.align_variable_declarations_on_columns" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_union_type_in_multicatch" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.keep_type_declaration_on_one_line" value="one_line_never"/>
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_catch_clause" value="common_lines"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_additive_operator" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_relational_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_multiplicative_operator" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.keep_anonymous_type_declaration_on_one_line" value="one_line_never"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_switch_case_expressions" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_before_shift_operator" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_lambda_body" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_end_of_code_block" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.compact_else_if" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_bitwise_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_type_parameters" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_loops" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_try" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.keep_simple_for_body_on_same_line" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_relational_operator" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_unary_operator" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_annotation" value="common_lines"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_ellipsis" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_additive_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_try_resources" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_string_concatenation" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_line_comments" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.align_type_members_on_columns" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_assignment" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_module_statements" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_after_code_block" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.comment.align_tags_names_descriptions" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.keep_if_then_body_block_on_one_line" value="one_line_never"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression" value="80"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.align_assignment_statements_on_columns" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_type" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_block_in_case" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_arrow_in_switch_default" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_conditional_expression_chain" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_header" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_additive_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_method_declaration" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.join_wrapped_lines" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_before_conditional_operator" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_shift_operator" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.align_fields_grouping_blank_lines" value="2147483647"/>
<setting id="org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_bitwise_operator" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_resources_in_try" value="80"/>
<setting id="org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_try_clause" value="common_lines"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.keep_code_block_on_one_line" value="one_line_never"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.tabulation.size" value="4"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_bitwise_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_source_code" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_try" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_try_resources" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_field" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer" value="2"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_method" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_before_assignment_operator" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_switch" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_type_annotation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_html" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_method_delcaration" value="common_lines"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_compact_if" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.keep_lambda_body_block_on_one_line" value="one_line_never"/>
<setting id="org.eclipse.jdt.core.formatter.indent_empty_lines" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_type_arguments" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_unary_operator" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_label" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_arrow_in_switch_case" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_member_type" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_logical_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_before_bitwise_operator" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_before_relational_operator" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_try" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.format_block_comments" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_lambda_arrow" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.indent_tag_description" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_string_concatenation" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_after_last_class_body_declaration" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.indent_statements_compare_to_body" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_multiple_fields" value="16"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.keep_simple_while_body_on_same_line" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_array_initializer" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_before_logical_operator" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_shift_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_statement_group_in_switch" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.parentheses_positions_in_lambda_declaration" value="common_lines"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_shift_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.keep_simple_do_while_body_on_same_line" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.keep_enum_declaration_on_one_line" value="one_line_never"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_enum_constant" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.brace_position_for_type_declaration" value="end_of_line"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_multiplicative_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_before_package" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.alignment_for_expressions_in_for_loop_header" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_before_additive_operator" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.keep_simple_getter_setter_on_one_line" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_string_concatenation" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_lambda_arrow" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.join_lines_in_comments" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.comment.indent_parameter_description" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_code_block" value="0"/>
<setting id="org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.tabulation.char" value="tab"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_relational_operator" value="insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.wrap_before_string_concatenation" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.blank_lines_between_import_groups" value="1"/>
<setting id="org.eclipse.jdt.core.formatter.lineSplit" value="120"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation" value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch" value="insert"/>
</profile>
-->
</profiles>

View File

@@ -0,0 +1,166 @@
package org.kohsuke.github;
import java.io.IOException;
import javax.annotation.CheckForNull;
import javax.annotation.Nonnull;
/**
* An abstract data object builder/updater.
*
* This class can be use to make a Builder that supports both batch and single property changes.
* <p>
* Batching looks like this:
* </p>
*
* <pre>
* update().someName(value).otherName(value).done()
* </pre>
* <p>
* Single changes look like this:
* </p>
*
* <pre>
* set().someName(value);
* set().otherName(value);
* </pre>
* <p>
* If {@link S} is the same as {@link R}, {@link #with(String, Object)} will commit changes after the first value change
* and return a {@link R} from {@link #done()}.
* </p>
* <p>
* If {@link S} is not the same as {@link R}, {@link #with(String, Object)} will batch together multiple changes and let
* the user call {@link #done()} when they are ready.
*
* @param <R>
* Final return type built by this builder returned when {@link #done()}} is called.
* @param <S>
* Intermediate return type for this builder returned by calls to {@link #with(String, Object)}. If {@link S}
* the same as {@link R}, this builder will commit changes after each call to {@link #with(String, Object)}.
*/
abstract class AbstractBuilder<R, S> extends GitHubInteractiveObject {
@Nonnull
private final Class<R> returnType;
private final boolean commitChangesImmediately;
@CheckForNull
private final R baseInstance;
@Nonnull
protected final Requester requester;
// TODO: Not sure how update-in-place behavior should be controlled
// However, it certainly can be controlled dynamically down to the instance level or inherited for all children of
// some
// connection.
protected boolean updateInPlace;
/**
* Creates a builder.
*
* @param root
* the GitHub instance to connect to.
* @param intermediateReturnType
* the intermediate return type of type {@link S} returned by calls to {@link #with(String, Object)}.
* Must either be equal to {@code builtReturnType} or this instance must be castable to this class. If
* not, the constructor will throw {@link IllegalArgumentException}.
* @param finalReturnType
* the final return type for built by this builder returned when {@link #done()}} is called.
* @param baseInstance
* optional instance on which to base this builder.
*/
protected AbstractBuilder(@Nonnull Class<R> finalReturnType,
@Nonnull Class<S> intermediateReturnType,
@Nonnull GitHub root,
@CheckForNull R baseInstance) {
super(root);
this.requester = root.createRequest();
this.returnType = finalReturnType;
this.commitChangesImmediately = returnType.equals(intermediateReturnType);
if (!commitChangesImmediately && !intermediateReturnType.isInstance(this)) {
throw new IllegalArgumentException(
"Argument \"intermediateReturnType\": This instance must be castable to intermediateReturnType or finalReturnType must be equal to intermediateReturnType.");
}
this.baseInstance = baseInstance;
this.updateInPlace = false;
}
/**
* Finishes an update, committing changes.
*
* This method may update-in-place or not. Either way it returns the resulting instance.
*
* @return an instance with updated current data
* @throws IOException
* if there is an I/O Exception
*/
@Nonnull
@BetaApi
@Deprecated
public R done() throws IOException {
R result;
if (updateInPlace && baseInstance != null) {
result = requester.fetchInto(baseInstance);
} else {
result = requester.fetch(returnType);
}
return result;
}
/**
* Applies a value to a name for this builder.
*
* If {@link S} is the same as {@link R}, this method will commit changes after the first value change and return a
* {@link R} from {@link #done()}.
*
* If {@link S} is not the same as {@link R}, this method will return an {@link S} and letting the caller batch
* together multiple changes and call {@link #done()} when they are ready.
*
* @param name
* the name of the field
* @param value
* the value of the field
* @return either a continuing builder or an updated data record
* @throws IOException
* if an I/O error occurs
*/
@Nonnull
@BetaApi
@Deprecated
protected S with(@Nonnull String name, Object value) throws IOException {
requester.with(name, value);
return continueOrDone();
}
/**
* Chooses whether to return a continuing builder or an updated data record
*
* If {@link S} is the same as {@link R}, this method will commit changes after the first value change and return a
* {@link R} from {@link #done()}.
*
* If {@link S} is not the same as {@link R}, this method will return an {@link S} and letting the caller batch
* together multiple changes and call {@link #done()} when they are ready.
*
* @return either a continuing builder or an updated data record
* @throws IOException
* if an I/O error occurs
*/
@Nonnull
@BetaApi
@Deprecated
protected S continueOrDone() throws IOException {
// This little bit of roughness in this base class means all inheriting builders get to create Updater and
// Setter classes from almost identical code. Creator can often be implemented with significant code reuse as
// well.
if (commitChangesImmediately) {
// These casts look strange and risky, but they they're actually guaranteed safe due to the return path
// being based on the previous comparison of class instances passed to the constructor.
return (S) done();
} else {
return (S) this;
}
}
}

View File

@@ -8,7 +8,7 @@ import java.net.HttpURLConnection;
* Pluggable strategy to determine what to do when the API abuse limit is hit.
*
* @author Kohsuke Kawaguchi
* @see GitHubBuilder#withAbuseLimitHandler(AbuseLimitHandler)
* @see GitHubBuilder#withAbuseLimitHandler(AbuseLimitHandler) GitHubBuilder#withAbuseLimitHandler(AbuseLimitHandler)
* @see <a href="https://developer.github.com/v3/#abuse-rate-limits">documentation</a>
* @see RateLimitHandler
*/
@@ -17,17 +17,22 @@ public abstract class AbuseLimitHandler {
* Called when the library encounters HTTP error indicating that the API abuse limit is reached.
*
* <p>
* Any exception thrown from this method will cause the request to fail, and the caller of github-api
* will receive an exception. If this method returns normally, another request will be attempted.
* For that to make sense, the implementation needs to wait for some time.
* Any exception thrown from this method will cause the request to fail, and the caller of github-api will receive
* an exception. If this method returns normally, another request will be attempted. For that to make sense, the
* implementation needs to wait for some time.
*
* @see <a href="https://developer.github.com/v3/#abuse-rate-limits">API documentation from GitHub</a>
* @param e
* Exception from Java I/O layer. If you decide to fail the processing, you can throw
* this exception (or wrap this exception into another exception and throw it).
* Exception from Java I/O layer. If you decide to fail the processing, you can throw this exception (or
* wrap this exception into another exception and throw it).
* @param uc
* Connection that resulted in an error. Useful for accessing other response headers.
* Connection that resulted in an error. Useful for accessing other response headers.
* @throws IOException
* on failure
* @see <a href="https://developer.github.com/v3/#abuse-rate-limits">API documentation from GitHub</a>
* @see <a href=
* "https://developer.github.com/v3/guides/best-practices-for-integrators/#dealing-with-abuse-rate-limits">Dealing
* with abuse rate limits</a>
*
*/
public abstract void onError(IOException e, HttpURLConnection uc) throws IOException;
@@ -40,15 +45,16 @@ public abstract class AbuseLimitHandler {
try {
Thread.sleep(parseWaitTime(uc));
} catch (InterruptedException ex) {
throw (InterruptedIOException)new InterruptedIOException().initCause(e);
throw (InterruptedIOException) new InterruptedIOException().initCause(e);
}
}
private long parseWaitTime(HttpURLConnection uc) {
String v = uc.getHeaderField("Retry-After");
if (v==null) return 60 * 1000; // can't tell, return 1 min
if (v == null)
return 60 * 1000; // can't tell, return 1 min
return Math.max(1000, Long.parseLong(v)*1000);
return Math.max(1000, Long.parseLong(v) * 1000);
}
};
@@ -58,7 +64,7 @@ public abstract class AbuseLimitHandler {
public static final AbuseLimitHandler FAIL = new AbuseLimitHandler() {
@Override
public void onError(IOException e, HttpURLConnection uc) throws IOException {
throw (IOException)new IOException("Abuse limit reached").initCause(e);
throw (IOException) new IOException("Abuse limit reached").initCause(e);
}
};
}

View File

@@ -0,0 +1,18 @@
package org.kohsuke.github;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
/**
* Indicates that the method/class/etc marked is a beta implementation of an sdk feature.
* <p>
* These APIs are subject to change and not a part of the backward compatibility commitment. Always used in conjunction
* with 'deprecated' to raise awareness to clients.
* </p>
*
*/
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface BetaApi {
}

View File

@@ -1,35 +0,0 @@
/*
* The MIT License
*
* Copyright (c) 2010, Kohsuke Kawaguchi
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.kohsuke.github;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
/**
* @author Kohsuke Kawaguchi
*/
@SuppressFBWarnings(value = "UUF_UNUSED_PUBLIC_OR_PROTECTED_FIELD",
justification = "Being constructed by JSON deserialization")
class DeleteToken {
public String delete_token;
}

View File

@@ -1,172 +1,292 @@
package org.kohsuke.github;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.IOException;
import java.net.URL;
import java.util.List;
import java.util.Map;
import static org.kohsuke.github.Previews.MACHINE_MAN;
import static org.kohsuke.github.internal.Previews.MACHINE_MAN;
/**
* A Github App.
*
* @author Paulo Miguel Almeida
*
* @see GitHub#getApp()
* @see GitHub#getApp() GitHub#getApp()
*/
public class GHApp extends GHObject {
private GitHub root;
private GHUser owner;
private String name;
private String description;
@JsonProperty("external_url")
private String externalUrl;
private Map<String,String> permissions;
private Map<String, String> permissions;
private List<GHEvent> events;
@JsonProperty("installations_count")
private long installationsCount;
@JsonProperty("html_url")
private String htmlUrl;
/**
* Gets owner.
*
* @return the owner
*/
public GHUser getOwner() {
return owner;
}
/**
* Sets owner.
*
* @param owner
* the owner
* @deprecated Do not use this method. It was added due to incomplete understanding of Jackson binding.
*/
@Deprecated
public void setOwner(GHUser owner) {
this.owner = owner;
}
/**
* Gets name.
*
* @return the name
*/
public String getName() {
return name;
}
/**
* Sets name.
*
* @param name
* the name
* @deprecated Do not use this method. It was added due to incomplete understanding of Jackson binding.
*/
@Deprecated
public void setName(String name) {
this.name = name;
}
/**
* Gets description.
*
* @return the description
*/
public String getDescription() {
return description;
}
/**
* Sets description.
*
* @param description
* the description
* @deprecated Do not use this method. It was added due to incomplete understanding of Jackson binding.
*/
@Deprecated
public void setDescription(String description) {
this.description = description;
}
/**
* Gets external url.
*
* @return the external url
*/
public String getExternalUrl() {
return externalUrl;
}
/**
* Sets external url.
*
* @param externalUrl
* the external url
* @deprecated Do not use this method. It was added due to incomplete understanding of Jackson binding.
*/
@Deprecated
public void setExternalUrl(String externalUrl) {
this.externalUrl = externalUrl;
}
/**
* Gets events.
*
* @return the events
*/
public List<GHEvent> getEvents() {
return events;
}
/**
* Sets events.
*
* @param events
* the events
* @deprecated Do not use this method. It was added due to incomplete understanding of Jackson binding.
*/
@Deprecated
public void setEvents(List<GHEvent> events) {
this.events = events;
}
/**
* Gets installations count.
*
* @return the installations count
*/
public long getInstallationsCount() {
return installationsCount;
}
/**
* Sets installations count.
*
* @param installationsCount
* the installations count
* @deprecated Do not use this method. It was added due to incomplete understanding of Jackson binding.
*/
@Deprecated
public void setInstallationsCount(long installationsCount) {
this.installationsCount = installationsCount;
}
public URL getHtmlUrl() {
return GitHub.parseURL(htmlUrl);
return GitHubClient.parseURL(htmlUrl);
}
/**
* Gets permissions.
*
* @return the permissions
*/
public Map<String, String> getPermissions() {
return permissions;
}
/**
* Sets permissions.
*
* @param permissions
* the permissions
* @deprecated Do not use this method. It was added due to incomplete understanding of Jackson binding.
*/
@Deprecated
public void setPermissions(Map<String, String> permissions) {
this.permissions = permissions;
}
/*package*/ GHApp wrapUp(GitHub root) {
GHApp wrapUp(GitHub root) {
this.root = root;
return this;
}
/**
* Obtains all the installations associated with this app.
*
* <p>
* You must use a JWT to access this endpoint.
*
* @see <a href="https://developer.github.com/v3/apps/#list-installations">List installations</a>
* @return a list of App installations
* @see <a href="https://developer.github.com/v3/apps/#list-installations">List installations</a>
*/
@Preview @Deprecated
@Preview(MACHINE_MAN)
@Deprecated
public PagedIterable<GHAppInstallation> listInstallations() {
return root.retrieve().withPreview(MACHINE_MAN)
.asPagedIterable(
"/app/installations",
GHAppInstallation[].class,
item -> item.wrapUp(root) );
return root.createRequest()
.withPreview(MACHINE_MAN)
.withUrlPath("/app/installations")
.toIterable(GHAppInstallation[].class, item -> item.wrapUp(root));
}
/**
* Obtain an installation associated with this app
* @param id - Installation Id
*
* Obtain an installation associated with this app.
* <p>
* You must use a JWT to access this endpoint.
*
* @param id
* Installation Id
* @return a GHAppInstallation
* @throws IOException
* on error
* @see <a href="https://developer.github.com/v3/apps/#get-an-installation">Get an installation</a>
*/
@Preview @Deprecated
@Preview(MACHINE_MAN)
@Deprecated
public GHAppInstallation getInstallationById(long id) throws IOException {
return root.retrieve().withPreview(MACHINE_MAN).to(String.format("/app/installations/%d", id), GHAppInstallation.class).wrapUp(root);
return root.createRequest()
.withPreview(MACHINE_MAN)
.withUrlPath(String.format("/app/installations/%d", id))
.fetch(GHAppInstallation.class)
.wrapUp(root);
}
/**
* Obtain an organization installation associated with this app
* @param name - Organization name
*
* Obtain an organization installation associated with this app.
* <p>
* You must use a JWT to access this endpoint.
*
* @see <a href="https://developer.github.com/v3/apps/#get-an-organization-installation">Get an organization installation</a>
* @param name
* Organization name
* @return a GHAppInstallation
* @throws IOException
* on error
* @see <a href="https://developer.github.com/v3/apps/#get-an-organization-installation">Get an organization
* installation</a>
*/
@Preview @Deprecated
@Preview(MACHINE_MAN)
@Deprecated
public GHAppInstallation getInstallationByOrganization(String name) throws IOException {
return root.retrieve().withPreview(MACHINE_MAN).to(String.format("/orgs/%s/installation", name), GHAppInstallation.class).wrapUp(root);
return root.createRequest()
.withPreview(MACHINE_MAN)
.withUrlPath(String.format("/orgs/%s/installation", name))
.fetch(GHAppInstallation.class)
.wrapUp(root);
}
/**
* Obtain an repository installation associated with this app
* @param ownerName - Organization or user name
* @param repositoryName - Repository name
*
* Obtain an repository installation associated with this app.
* <p>
* You must use a JWT to access this endpoint.
*
* @see <a href="https://developer.github.com/v3/apps/#get-a-repository-installation">Get a repository installation</a>
* @param ownerName
* Organization or user name
* @param repositoryName
* Repository name
* @return a GHAppInstallation
* @throws IOException
* on error
* @see <a href="https://developer.github.com/v3/apps/#get-a-repository-installation">Get a repository
* installation</a>
*/
@Preview @Deprecated
@Preview(MACHINE_MAN)
@Deprecated
public GHAppInstallation getInstallationByRepository(String ownerName, String repositoryName) throws IOException {
return root.retrieve().withPreview(MACHINE_MAN).to(String.format("/repos/%s/%s/installation", ownerName, repositoryName), GHAppInstallation.class).wrapUp(root);
return root.createRequest()
.withPreview(MACHINE_MAN)
.withUrlPath(String.format("/repos/%s/%s/installation", ownerName, repositoryName))
.fetch(GHAppInstallation.class)
.wrapUp(root);
}
/**
* Obtain a user installation associated with this app
* @param name - user name
*
* Obtain a user installation associated with this app.
* <p>
* You must use a JWT to access this endpoint.
*
* @param name
* user name
* @return a GHAppInstallation
* @throws IOException
* on error
* @see <a href="https://developer.github.com/v3/apps/#get-a-user-installation">Get a user installation</a>
*/
@Preview @Deprecated
@Preview(MACHINE_MAN)
@Deprecated
public GHAppInstallation getInstallationByUser(String name) throws IOException {
return root.retrieve().withPreview(MACHINE_MAN).to(String.format("/users/%s/installation", name), GHAppInstallation.class).wrapUp(root);
return root.createRequest()
.withPreview(MACHINE_MAN)
.withUrlPath(String.format("/users/%s/installation", name))
.fetch(GHAppInstallation.class)
.wrapUp(root);
}
}

View File

@@ -1,29 +1,36 @@
package org.kohsuke.github;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static org.kohsuke.github.Previews.MACHINE_MAN;
import static org.kohsuke.github.internal.Previews.MACHINE_MAN;
/**
* Creates a access token for a GitHub App Installation
*
* @author Paulo Miguel Almeida
*
* @see GHAppInstallation#createToken(Map)
* @see GHAppInstallation#createToken(Map) GHAppInstallation#createToken(Map)
* @see GHAppInstallation#createToken() GHAppInstallation#createToken()
*/
public class GHAppCreateTokenBuilder {
private final GitHub root;
public class GHAppCreateTokenBuilder extends GitHubInteractiveObject {
protected final Requester builder;
private final String apiUrlTail;
@Preview @Deprecated
/*package*/ GHAppCreateTokenBuilder(GitHub root, String apiUrlTail, Map<String, GHPermissionType> permissions) {
@BetaApi
@Deprecated
GHAppCreateTokenBuilder(GitHub root, String apiUrlTail) {
this.root = root;
this.apiUrlTail = apiUrlTail;
this.builder = new Requester(root);
this.builder.withPermissions("permissions",permissions);
this.builder = root.createRequest();
}
@BetaApi
@Deprecated
GHAppCreateTokenBuilder(GitHub root, String apiUrlTail, Map<String, GHPermissionType> permissions) {
this(root, apiUrlTail);
permissions(permissions);
}
/**
@@ -31,23 +38,53 @@ public class GHAppCreateTokenBuilder {
* the access to specific repositories, you can provide the repository_ids when creating the token. When you omit
* repository_ids, the response does not contain neither the repositories nor the permissions key.
*
* @param repositoryIds - Array containing the repositories Ids
*
* @param repositoryIds
* Array containing the repositories Ids
* @return a GHAppCreateTokenBuilder
*/
@Preview @Deprecated
@BetaApi
@Deprecated
public GHAppCreateTokenBuilder repositoryIds(List<Long> repositoryIds) {
this.builder.with("repository_ids",repositoryIds);
this.builder.with("repository_ids", repositoryIds);
return this;
}
/**
* Set the permissions granted to the access token. The permissions object includes the permission names and their
* access type.
*
* @param permissions
* Map containing the permission names and types.
* @return a GHAppCreateTokenBuilder
*/
@BetaApi
@Deprecated
public GHAppCreateTokenBuilder permissions(Map<String, GHPermissionType> permissions) {
Map<String, String> retMap = new HashMap<>();
for (Map.Entry<String, GHPermissionType> entry : permissions.entrySet()) {
retMap.put(entry.getKey(), GitHubRequest.transformEnum(entry.getValue()));
}
builder.with("permissions", retMap);
return this;
}
/**
* Creates an app token with all the parameters.
*
* <p>
* You must use a JWT to access this endpoint.
*
* @return a GHAppInstallationToken
* @throws IOException
* on error
*/
@Preview @Deprecated
@Preview(MACHINE_MAN)
@Deprecated
public GHAppInstallationToken create() throws IOException {
return builder.method("POST").withPreview(MACHINE_MAN).to(apiUrlTail, GHAppInstallationToken.class).wrapUp(root);
return builder.method("POST")
.withPreview(MACHINE_MAN)
.withUrlPath(apiUrlTail)
.fetch(GHAppInstallationToken.class)
.wrapUp(root);
}
}

View File

@@ -3,26 +3,25 @@ package org.kohsuke.github;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.List;
import java.util.Map;
import static org.kohsuke.github.Previews.GAMBIT;
import static org.kohsuke.github.internal.Previews.GAMBIT;
import static org.kohsuke.github.internal.Previews.MACHINE_MAN;
/**
* A Github App Installation.
*
* @author Paulo Miguel Almeida
*
* @see GHApp#listInstallations()
* @see GHApp#getInstallationById(long)
* @see GHApp#getInstallationByOrganization(String)
* @see GHApp#getInstallationByRepository(String, String)
* @see GHApp#getInstallationByUser(String)
* @see GHApp#listInstallations() GHApp#listInstallations()
* @see GHApp#getInstallationById(long) GHApp#getInstallationById(long)
* @see GHApp#getInstallationByOrganization(String) GHApp#getInstallationByOrganization(String)
* @see GHApp#getInstallationByRepository(String, String) GHApp#getInstallationByRepository(String, String)
* @see GHApp#getInstallationByUser(String) GHApp#getInstallationByUser(String)
*/
public class GHAppInstallation extends GHObject {
private GitHub root;
private GHUser account;
@JsonProperty("access_tokens_url")
@@ -44,124 +43,326 @@ public class GHAppInstallation extends GHObject {
private String htmlUrl;
public URL getHtmlUrl() {
return GitHub.parseURL(htmlUrl);
return GitHubClient.parseURL(htmlUrl);
}
/**
* Gets root.
*
* @return the root
*/
public GitHub getRoot() {
return root;
}
/**
* Sets root.
*
* @param root
* the root
* @deprecated Do not use this method. It was added due to incomplete understanding of Jackson binding.
*/
@Deprecated
public void setRoot(GitHub root) {
this.root = root;
}
/**
* Gets account.
*
* @return the account
*/
public GHUser getAccount() {
return account;
}
/**
* Sets account.
*
* @param account
* the account
* @deprecated Do not use this method. It was added due to incomplete understanding of Jackson binding.
*/
@Deprecated
public void setAccount(GHUser account) {
this.account = account;
}
/**
* Gets access token url.
*
* @return the access token url
*/
public String getAccessTokenUrl() {
return accessTokenUrl;
}
/**
* Sets access token url.
*
* @param accessTokenUrl
* the access token url
* @deprecated Do not use this method. It was added due to incomplete understanding of Jackson binding.
*/
@Deprecated
public void setAccessTokenUrl(String accessTokenUrl) {
this.accessTokenUrl = accessTokenUrl;
}
/**
* Gets repositories url.
*
* @return the repositories url
*/
public String getRepositoriesUrl() {
return repositoriesUrl;
}
/**
* List repositories that this app installation can access.
*
* @return the paged iterable
*/
@Preview(MACHINE_MAN)
@Deprecated
public PagedSearchIterable<GHRepository> listRepositories() {
GitHubRequest request;
try {
request = root.createRequest().withPreview(MACHINE_MAN).withUrlPath("/installation/repositories").build();
} catch (MalformedURLException e) {
throw new GHException("", e);
}
return new PagedSearchIterable<>(root, request, GHAppInstallationRepositoryResult.class);
}
private static class GHAppInstallationRepositoryResult extends SearchResult<GHRepository> {
private GHRepository[] repositories;
@Override
GHRepository[] getItems(GitHub root) {
for (GHRepository item : repositories)
item.wrap(root);
return repositories;
}
}
/**
* Sets repositories url.
*
* @param repositoriesUrl
* the repositories url
* @deprecated Do not use this method. It was added due to incomplete understanding of Jackson binding.
*/
@Deprecated
public void setRepositoriesUrl(String repositoriesUrl) {
this.repositoriesUrl = repositoriesUrl;
}
/**
* Gets app id.
*
* @return the app id
*/
public long getAppId() {
return appId;
}
/**
* Sets app id.
*
* @param appId
* the app id
* @deprecated Do not use this method. It was added due to incomplete understanding of Jackson binding.
*/
@Deprecated
public void setAppId(long appId) {
this.appId = appId;
}
/**
* Gets target id.
*
* @return the target id
*/
public long getTargetId() {
return targetId;
}
/**
* Sets target id.
*
* @param targetId
* the target id
* @deprecated Do not use this method. It was added due to incomplete understanding of Jackson binding.
*/
@Deprecated
public void setTargetId(long targetId) {
this.targetId = targetId;
}
/**
* Gets target type.
*
* @return the target type
*/
public GHTargetType getTargetType() {
return targetType;
}
/**
* Sets target type.
*
* @param targetType
* the target type
* @deprecated Do not use this method. It was added due to incomplete understanding of Jackson binding.
*/
@Deprecated
public void setTargetType(GHTargetType targetType) {
this.targetType = targetType;
}
/**
* Gets permissions.
*
* @return the permissions
*/
public Map<String, GHPermissionType> getPermissions() {
return permissions;
}
/**
* Sets permissions.
*
* @param permissions
* the permissions
* @deprecated Do not use this method. It was added due to incomplete understanding of Jackson binding.
*/
@Deprecated
public void setPermissions(Map<String, GHPermissionType> permissions) {
this.permissions = permissions;
}
/**
* Gets events.
*
* @return the events
*/
public List<GHEvent> getEvents() {
return events;
}
/**
* Sets events.
*
* @param events
* the events
* @deprecated Do not use this method. It was added due to incomplete understanding of Jackson binding.
*/
@Deprecated
public void setEvents(List<GHEvent> events) {
this.events = events;
}
/**
* Gets single file name.
*
* @return the single file name
*/
public String getSingleFileName() {
return singleFileName;
}
/**
* Sets single file name.
*
* @param singleFileName
* the single file name
* @deprecated Do not use this method. It was added due to incomplete understanding of Jackson binding.
*/
@Deprecated
public void setSingleFileName(String singleFileName) {
this.singleFileName = singleFileName;
}
/**
* Gets repository selection.
*
* @return the repository selection
*/
public GHRepositorySelection getRepositorySelection() {
return repositorySelection;
}
/**
* Sets repository selection.
*
* @param repositorySelection
* the repository selection
* @deprecated Do not use this method. It was added due to incomplete understanding of Jackson binding.
*/
@Deprecated
public void setRepositorySelection(GHRepositorySelection repositorySelection) {
this.repositorySelection = repositorySelection;
}
/*package*/ GHAppInstallation wrapUp(GitHub root) {
GHAppInstallation wrapUp(GitHub root) {
this.root = root;
return this;
}
/**
* Delete a Github App installation
*
* <p>
* You must use a JWT to access this endpoint.
*
* @throws IOException
* on error
* @see <a href="https://developer.github.com/v3/apps/#delete-an-installation">Delete an installation</a>
*/
@Preview @Deprecated
@Preview(GAMBIT)
@Deprecated
public void deleteInstallation() throws IOException {
root.retrieve().method("DELETE").withPreview(GAMBIT).to(String.format("/app/installations/%d", id));
root.createRequest()
.method("DELETE")
.withPreview(GAMBIT)
.withUrlPath(String.format("/app/installations/%d", getId()))
.send();
}
/**
* Starts a builder that creates a new App Installation Token.
*
* <p>
* You use the returned builder to set various properties, then call {@link GHAppCreateTokenBuilder#create()}
* to finally create an access token.
* You use the returned builder to set various properties, then call {@link GHAppCreateTokenBuilder#create()} to
* finally create an access token.
*
* @param permissions
* map of permissions for the created token
* @return a GHAppCreateTokenBuilder instance
* @deprecated Use {@link GHAppInstallation#createToken()} instead.
*/
@Preview @Deprecated
public GHAppCreateTokenBuilder createToken(Map<String,GHPermissionType> permissions){
return new GHAppCreateTokenBuilder(root,String.format("/app/installations/%d/access_tokens", id), permissions);
@BetaApi
@Deprecated
public GHAppCreateTokenBuilder createToken(Map<String, GHPermissionType> permissions) {
return new GHAppCreateTokenBuilder(root,
String.format("/app/installations/%d/access_tokens", getId()),
permissions);
}
/**
* Starts a builder that creates a new App Installation Token.
*
* <p>
* You use the returned builder to set various properties, then call {@link GHAppCreateTokenBuilder#create()} to
* finally create an access token.
*
* @return a GHAppCreateTokenBuilder instance
*/
@BetaApi
@Deprecated
public GHAppCreateTokenBuilder createToken() {
return new GHAppCreateTokenBuilder(root, String.format("/app/installations/%d/access_tokens", getId()));
}
}

View File

@@ -1,6 +1,5 @@
package org.kohsuke.github;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.infradna.tool.bridge_method_injector.WithBridgeMethods;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
@@ -13,66 +12,130 @@ import java.util.Map;
* A Github App Installation Token.
*
* @author Paulo Miguel Almeida
*
* @see GHAppInstallation#createToken(Map)
* @see GHAppInstallation#createToken(Map) GHAppInstallation#createToken(Map)
*/
public class GHAppInstallationToken {
private GitHub root;
public class GHAppInstallationToken extends GitHubInteractiveObject {
private String token;
protected String expires_at;
private Map<String, String> permissions;
private List<GHRepository> repositories;
@JsonProperty("repository_selection")
private GHRepositorySelection repositorySelection;
/**
* Gets root.
*
* @return the root
*/
public GitHub getRoot() {
return root;
}
/**
* Sets root.
*
* @param root
* the root
* @deprecated Do not use this method. It was added due to incomplete understanding of Jackson binding.
*/
@Deprecated
public void setRoot(GitHub root) {
this.root = root;
}
/**
* Gets permissions.
*
* @return the permissions
*/
public Map<String, String> getPermissions() {
return permissions;
}
/**
* Sets permissions.
*
* @param permissions
* the permissions
* @deprecated Do not use this method. It was added due to incomplete understanding of Jackson binding.
*/
@Deprecated
public void setPermissions(Map<String, String> permissions) {
this.permissions = permissions;
}
/**
* Gets token.
*
* @return the token
*/
public String getToken() {
return token;
}
/**
* Sets token.
*
* @param token
* the token
* @deprecated Do not use this method. It was added due to incomplete understanding of Jackson binding.
*/
@Deprecated
public void setToken(String token) {
this.token = token;
}
/**
* Gets repositories.
*
* @return the repositories
*/
public List<GHRepository> getRepositories() {
return repositories;
}
/**
* Sets repositories.
*
* @param repositories
* the repositories
* @deprecated Do not use this method. It was added due to incomplete understanding of Jackson binding.
*/
@Deprecated
public void setRepositories(List<GHRepository> repositories) {
this.repositories = repositories;
}
/**
* Gets repository selection.
*
* @return the repository selection
*/
public GHRepositorySelection getRepositorySelection() {
return repositorySelection;
}
/**
* Sets repository selection.
*
* @param repositorySelection
* the repository selection
* @deprecated Do not use this method. It was added due to incomplete understanding of Jackson binding.
*/
@Deprecated
public void setRepositorySelection(GHRepositorySelection repositorySelection) {
this.repositorySelection = repositorySelection;
}
/**
* When was this tokens expires?
* Gets expires at.
*
* @return date when this token expires
* @throws IOException
* on error
*/
@WithBridgeMethods(value=String.class, adapterMethod="expiresAtStr")
@WithBridgeMethods(value = String.class, adapterMethod = "expiresAtStr")
public Date getExpiresAt() throws IOException {
return GitHub.parseDate(expires_at);
return GitHubClient.parseDate(expires_at);
}
@SuppressFBWarnings(value = "UPM_UNCALLED_PRIVATE_METHOD", justification = "Bridge method of getExpiresAt")
@@ -80,7 +143,7 @@ public class GHAppInstallationToken {
return expires_at;
}
/*package*/ GHAppInstallationToken wrapUp(GitHub root) {
GHAppInstallationToken wrapUp(GitHub root) {
this.root = root;
return this;
}

View File

@@ -0,0 +1,140 @@
package org.kohsuke.github;
import com.fasterxml.jackson.annotation.JsonIgnore;
import org.apache.commons.lang3.StringUtils;
import org.kohsuke.github.function.InputStreamFunction;
import java.io.IOException;
import java.net.URL;
import java.util.Date;
import java.util.Objects;
import static java.util.Objects.requireNonNull;
/**
* An artifact from a workflow run.
*
* @author Guillaume Smet
*/
public class GHArtifact extends GHObject {
// Not provided by the API.
@JsonIgnore
private GHRepository owner;
private String name;
private long sizeInBytes;
private String archiveDownloadUrl;
private boolean expired;
private String expiresAt;
/**
* Gets the name.
*
* @return the name
*/
public String getName() {
return name;
}
/**
* Gets the size of the artifact in bytes.
*
* @return the size
*/
public long getSizeInBytes() {
return sizeInBytes;
}
/**
* Gets the archive download URL.
*
* @return the archive download URL
*/
public URL getArchiveDownloadUrl() {
return GitHubClient.parseURL(archiveDownloadUrl);
}
/**
* If this artifact has expired.
*
* @return if the artifact has expired
*/
public boolean isExpired() {
return expired;
}
/**
* Gets the date at which this artifact will expire.
*
* @return the date of expiration
*/
public Date getExpiresAt() {
return GitHubClient.parseDate(expiresAt);
}
/**
* Repository to which the artifact belongs.
*
* @return the repository
*/
public GHRepository getRepository() {
return owner;
}
/**
* @deprecated This object has no HTML URL.
*/
@Override
public URL getHtmlUrl() throws IOException {
return null;
}
/**
* Deletes the artifact.
*
* @throws IOException
* the io exception
*/
public void delete() throws IOException {
root.createRequest().method("DELETE").withUrlPath(getApiRoute()).fetchHttpStatusCode();
}
/**
* Downloads the artifact.
*
* @param <T>
* the type of result
* @param streamFunction
* The {@link InputStreamFunction} that will process the stream
* @throws IOException
* The IO exception.
* @return the result of reading the stream.
*/
public <T> T download(InputStreamFunction<T> streamFunction) throws IOException {
requireNonNull(streamFunction, "Stream function must not be null");
return root.createRequest().method("GET").withUrlPath(getApiRoute(), "zip").fetchStream(streamFunction);
}
private String getApiRoute() {
if (owner == null) {
// Workflow runs returned from search to do not have an owner. Attempt to use url.
final URL url = Objects.requireNonNull(getUrl(), "Missing instance URL!");
return StringUtils.prependIfMissing(url.toString().replace(root.getApiUrl(), ""), "/");
}
return "/repos/" + owner.getOwnerName() + "/" + owner.getName() + "/actions/artifacts/" + getId();
}
GHArtifact wrapUp(GHRepository owner) {
this.owner = owner;
return wrapUp(owner.root);
}
GHArtifact wrapUp(GitHub root) {
this.root = root;
if (owner != null)
owner.wrap(root);
return this;
}
}

View File

@@ -0,0 +1,49 @@
package org.kohsuke.github;
import java.net.MalformedURLException;
import java.util.Iterator;
import javax.annotation.Nonnull;
/**
* Iterable for artifacts listing.
*/
class GHArtifactsIterable extends PagedIterable<GHArtifact> {
private final transient GHRepository owner;
private final GitHubRequest request;
private GHArtifactsPage result;
public GHArtifactsIterable(GHRepository owner, GitHubRequest.Builder<?> requestBuilder) {
this.owner = owner;
try {
this.request = requestBuilder.build();
} catch (MalformedURLException e) {
throw new GHException("Malformed URL", e);
}
}
@Nonnull
@Override
public PagedIterator<GHArtifact> _iterator(int pageSize) {
return new PagedIterator<>(
adapt(GitHubPageIterator.create(owner.getRoot().getClient(), GHArtifactsPage.class, request, pageSize)),
null);
}
protected Iterator<GHArtifact[]> adapt(final Iterator<GHArtifactsPage> base) {
return new Iterator<GHArtifact[]>() {
public boolean hasNext() {
return base.hasNext();
}
public GHArtifact[] next() {
GHArtifactsPage v = base.next();
if (result == null) {
result = v;
}
return v.getArtifacts(owner);
}
};
}
}

View File

@@ -0,0 +1,20 @@
package org.kohsuke.github;
/**
* Represents the one page of artifacts result when listing artifacts.
*/
class GHArtifactsPage {
private int total_count;
private GHArtifact[] artifacts;
public int getTotalCount() {
return total_count;
}
GHArtifact[] getArtifacts(GHRepository owner) {
for (GHArtifact artifact : artifacts) {
artifact.wrapUp(owner);
}
return artifacts;
}
}

View File

@@ -6,10 +6,9 @@ import java.net.URL;
/**
* Asset in a release.
*
* @see GHRelease#getAssets()
* @see GHRelease#getAssets() GHRelease#getAssets()
*/
public class GHAsset extends GHObject {
GitHub root;
GHRepository owner;
private String name;
private String label;
@@ -19,44 +18,100 @@ public class GHAsset extends GHObject {
private long download_count;
private String browser_download_url;
/**
* Gets content type.
*
* @return the content type
*/
public String getContentType() {
return content_type;
}
/**
* Sets content type.
*
* @param contentType
* the content type
* @throws IOException
* the io exception
*/
public void setContentType(String contentType) throws IOException {
edit("content_type", contentType);
this.content_type = contentType;
}
/**
* Gets download count.
*
* @return the download count
*/
public long getDownloadCount() {
return download_count;
}
/**
* Gets label.
*
* @return the label
*/
public String getLabel() {
return label;
}
/**
* Sets label.
*
* @param label
* the label
* @throws IOException
* the io exception
*/
public void setLabel(String label) throws IOException {
edit("label", label);
this.label = label;
}
/**
* Gets name.
*
* @return the name
*/
public String getName() {
return name;
}
/**
* Gets owner.
*
* @return the owner
*/
public GHRepository getOwner() {
return owner;
}
/**
* Gets root.
*
* @return the root
*/
public GitHub getRoot() {
return root;
}
/**
* Gets size.
*
* @return the size
*/
public long getSize() {
return size;
}
/**
* Gets state.
*
* @return the state
*/
public String getState() {
return state;
}
@@ -69,21 +124,31 @@ public class GHAsset extends GHObject {
return null;
}
/**
* Gets browser download url.
*
* @return the browser download url
*/
public String getBrowserDownloadUrl() {
return browser_download_url;
}
private void edit(String key, Object value) throws IOException {
new Requester(root)._with(key, value).method("PATCH").to(getApiRoute());
root.createRequest().with(key, value).method("PATCH").withUrlPath(getApiRoute()).send();
}
/**
* Delete.
*
* @throws IOException
* the io exception
*/
public void delete() throws IOException {
new Requester(root).method("DELETE").to(getApiRoute());
root.createRequest().method("DELETE").withUrlPath(getApiRoute()).send();
}
private String getApiRoute() {
return "/repos/" + owner.getOwnerName() + "/" + owner.getName() + "/releases/assets/" + id;
return "/repos/" + owner.getOwnerName() + "/" + owner.getName() + "/releases/assets/" + getId();
}
GHAsset wrap(GHRelease release) {
@@ -92,6 +157,15 @@ public class GHAsset extends GHObject {
return this;
}
/**
* Wrap gh asset [ ].
*
* @param assets
* the assets
* @param release
* the release
* @return the gh asset [ ]
*/
public static GHAsset[] wrap(GHAsset[] assets, GHRelease release) {
for (GHAsset aTo : assets) {
aTo.wrap(release);

View File

@@ -10,7 +10,7 @@ import java.util.List;
* Generated OAuth token
*
* @author janinko
* @see 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>
*/
public class GHAuthorization extends GHObject {
@@ -33,7 +33,6 @@ public class GHAuthorization extends GHObject {
public static final String WRITE_KEY = "write:public_key";
public static final String ADMIN_KEY = "admin:public_key";
private GitHub root;
private List<String> scopes;
private String token;
private String token_last_eight;
@@ -42,41 +41,82 @@ public class GHAuthorization extends GHObject {
private String note;
private String note_url;
private String fingerprint;
//TODO add some user class for https://developer.github.com/v3/oauth_authorizations/#check-an-authorization ?
//private GHUser user;
// TODO add some user class for https://developer.github.com/v3/oauth_authorizations/#check-an-authorization ?
// private GHUser user;
/**
* Gets root.
*
* @return the root
*/
public GitHub getRoot() {
return root;
}
/**
* Gets scopes.
*
* @return the scopes
*/
public List<String> getScopes() {
return scopes;
}
/**
* Gets token.
*
* @return the token
*/
public String getToken() {
return token;
}
/**
* Gets token last eight.
*
* @return the token last eight
*/
public String getTokenLastEight() {
return token_last_eight;
}
/**
* Gets hashed token.
*
* @return the hashed token
*/
public String getHashedToken() {
return hashed_token;
}
/**
* Gets app url.
*
* @return the app url
*/
public URL getAppUrl() {
return GitHub.parseURL(app.url);
return GitHubClient.parseURL(app.url);
}
/**
* Gets app name.
*
* @return the app name
*/
public String getAppName() {
return app.name;
}
@SuppressFBWarnings(value = "NM_CONFUSING",
justification = "It's a part of the library API, cannot be changed")
/**
* Gets api url.
*
* @return the api url
* @deprecated use {@link #getUrl()}
*/
@Deprecated
@SuppressFBWarnings(value = "NM_CONFUSING", justification = "It's a part of the library API, cannot be changed")
public URL getApiURL() {
return GitHub.parseURL(url);
return getUrl();
}
/**
@@ -87,25 +127,40 @@ public class GHAuthorization extends GHObject {
return null;
}
/**
* Gets note.
*
* @return the note
*/
public String getNote() {
return note;
}
/**
* Gets note url.
*
* @return the note url
*/
public URL getNoteUrl() {
return GitHub.parseURL(note_url);
return GitHubClient.parseURL(note_url);
}
/**
* Gets fingerprint.
*
* @return the fingerprint
*/
public String getFingerprint() {
return fingerprint;
}
/*package*/ GHAuthorization wrap(GitHub root) {
GHAuthorization wrap(GitHub root) {
this.root = root;
return this;
}
@SuppressFBWarnings(value = {"UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD"},
justification = "JSON API")
@SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD" },
justification = "JSON API")
private static class App {
private String url;
private String name;

View File

@@ -1,17 +1,17 @@
package org.kohsuke.github;
import org.apache.commons.codec.binary.Base64InputStream;
import java.io.ByteArrayInputStream;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.net.URL;
import java.util.Base64;
/**
* The type GHBlob.
*
* @author Kanstantsin Shautsou
* @author Kohsuke Kawaguchi
* @see GHTreeEntry#asBlob()
* @see GHRepository#getBlob(String)
* @see GHTreeEntry#asBlob() GHTreeEntry#asBlob()
* @see GHRepository#getBlob(String) GHRepository#getBlob(String)
* @see <a href="https://developer.github.com/v3/git/blobs/#get-a-blob">Get a blob</a>
*/
public class GHBlob {
@@ -19,46 +19,65 @@ public class GHBlob {
private long size;
/**
* API URL of this blob.
* Gets url.
*
* @return API URL of this blob.
*/
public URL getUrl() {
return GitHub.parseURL(url);
return GitHubClient.parseURL(url);
}
/**
* Gets sha.
*
* @return the sha
*/
public String getSha() {
return sha;
}
/**
* Number of bytes in this blob.
* Gets size.
*
* @return Number of bytes in this blob.
*/
public long getSize() {
return size;
}
/**
* Gets encoding.
*
* @return the encoding
*/
public String getEncoding() {
return encoding;
}
/**
* Encoded content. You probably want {@link #read()}
* Gets content.
*
* @return Encoded content. You probably want {@link #read()}
*/
public String getContent() {
return content;
}
/**
* Retrieves the actual bytes of the blob.
* Read input stream.
*
* @return the actual bytes of the blob.
*/
public InputStream read() {
if (encoding.equals("base64")) {
try {
return new Base64InputStream(new ByteArrayInputStream(content.getBytes("US-ASCII")), false);
} catch (UnsupportedEncodingException e) {
throw new AssertionError(e); // US-ASCII is mandatory
Base64.Decoder decoder = Base64.getMimeDecoder();
return new ByteArrayInputStream(decoder.decode(content));
} catch (IllegalArgumentException e) {
throw new AssertionError(e); // US-ASCII is mandatory
}
}
throw new UnsupportedOperationException("Unrecognized encoding: "+encoding);
throw new UnsupportedOperationException("Unrecognized encoding: " + encoding);
}
}

View File

@@ -1,12 +1,10 @@
package org.kohsuke.github;
import org.apache.commons.codec.binary.Base64;
import java.io.IOException;
import java.util.Base64;
/**
* Builder pattern for creating a new blob.
* Based on https://developer.github.com/v3/git/blobs/#create-a-blob
* Builder pattern for creating a new blob. Based on https://developer.github.com/v3/git/blobs/#create-a-blob
*/
public class GHBlobBuilder {
private final GHRepository repo;
@@ -14,11 +12,15 @@ public class GHBlobBuilder {
GHBlobBuilder(GHRepository repo) {
this.repo = repo;
req = new Requester(repo.root);
req = repo.root.createRequest();
}
/**
* Configures a blob with the specified text {@code content}.
*
* @param content
* string text of the blob
* @return a GHBlobBuilder
*/
public GHBlobBuilder textContent(String content) {
req.with("content", content);
@@ -28,9 +30,13 @@ public class GHBlobBuilder {
/**
* Configures a blob with the specified binary {@code content}.
*
* @param content
* byte array of the blob
* @return a GHBlobBuilder
*/
public GHBlobBuilder binaryContent(byte[] content) {
String base64Content = Base64.encodeBase64String(content);
String base64Content = Base64.getEncoder().encodeToString(content);
req.with("content", base64Content);
req.with("encoding", "base64");
return this;
@@ -42,8 +48,12 @@ public class GHBlobBuilder {
/**
* Creates a blob based on the parameters specified thus far.
*
* @return a GHBlob
* @throws IOException
* if the blob cannot be created.
*/
public GHBlob create() throws IOException {
return req.method("POST").to(getApiTail(), GHBlob.class);
return req.method("POST").withUrlPath(getApiTail()).fetch(GHBlob.class);
}
}

View File

@@ -1,23 +1,27 @@
package org.kohsuke.github;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.kohsuke.github.internal.Previews;
import java.io.IOException;
import java.net.URL;
import java.util.Collection;
import java.util.Objects;
import static org.kohsuke.github.Previews.*;
import javax.annotation.CheckForNull;
/**
* A branch in a repository.
*
* @author Yusuke Kokubo
*/
@SuppressFBWarnings(value = {"UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD",
"NP_UNWRITTEN_FIELD", "URF_UNREAD_FIELD"}, justification = "JSON API")
public class GHBranch {
private GitHub root;
@SuppressFBWarnings(
value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD",
"URF_UNREAD_FIELD" },
justification = "JSON API")
public class GHBranch extends GitHubInteractiveObject {
private GHRepository owner;
private String name;
@@ -26,7 +30,15 @@ public class GHBranch {
private boolean protection;
private String protection_url;
@JsonCreator
GHBranch(@JsonProperty(value = "name", required = true) String name) throws Exception {
Objects.requireNonNull(name);
this.name = name;
}
/**
* The type Commit.
*/
public static class Commit {
String sha;
@@ -34,43 +46,76 @@ public class GHBranch {
String url;
}
/**
* Gets root.
*
* @return the root
*/
public GitHub getRoot() {
return root;
}
/**
* Repository that this branch is in.
* Gets owner.
*
* @return the repository that this branch is in.
*/
public GHRepository getOwner() {
return owner;
}
/**
* Gets name.
*
* @return the name
*/
public String getName() {
return name;
}
/**
* Returns true if the push to this branch is restricted via branch protection.
* Is protected boolean.
*
* @return true if the push to this branch is restricted via branch protection.
*/
@Preview @Deprecated
@Preview(Previews.LUKE_CAGE)
@Deprecated
public boolean isProtected() {
return protection;
}
/**
* Returns API URL that deals with the protection of this branch.
* Gets protection url.
*
* @return API URL that deals with the protection of this branch.
*/
@Preview @Deprecated
@Preview(Previews.LUKE_CAGE)
@Deprecated
public URL getProtectionUrl() {
return GitHub.parseURL(protection_url);
}
public GHBranchProtection getProtection() throws IOException {
return root.retrieve().to(protection_url, GHBranchProtection.class).wrap(this);
return GitHubClient.parseURL(protection_url);
}
/**
* The commit that this branch currently points to.
* Gets protection.
*
* @return the protection
* @throws IOException
* the io exception
*/
@Preview(Previews.LUKE_CAGE)
@Deprecated
public GHBranchProtection getProtection() throws IOException {
return root.createRequest()
.withPreview(Previews.LUKE_CAGE)
.setRawUrlPath(protection_url)
.fetch(GHBranchProtection.class)
.wrap(this);
}
/**
* Gets sha 1.
*
* @return The SHA1 of the commit that this branch currently points to.
*/
public String getSHA1() {
return commit.sha;
@@ -78,40 +123,107 @@ public class GHBranch {
/**
* Disables branch protection and allows anyone with push access to push changes.
*
* @throws IOException
* if disabling protection fails
*/
public void disableProtection() throws IOException {
new Requester(root).method("DELETE").to(protection_url);
root.createRequest().method("DELETE").setRawUrlPath(protection_url).send();
}
/**
* Enables branch protection to control what commit statuses are required to push.
*
* @see GHCommitStatus#getContext()
* @return GHBranchProtectionBuilder for enabling protection
* @see GHCommitStatus#getContext() GHCommitStatus#getContext()
*/
@Preview @Deprecated
@Preview(Previews.LUKE_CAGE)
@Deprecated
public GHBranchProtectionBuilder enableProtection() {
return new GHBranchProtectionBuilder(this);
}
/**
* Enable protection.
*
* @param level
* the level
* @param contexts
* the contexts
* @throws IOException
* the io exception
*/
// backward compatibility with previous signature
@Deprecated
public void enableProtection(EnforcementLevel level, Collection<String> contexts) throws IOException {
switch (level) {
case OFF:
disableProtection();
break;
case NON_ADMINS:
case EVERYONE:
enableProtection()
.addRequiredChecks(contexts)
.includeAdmins(level==EnforcementLevel.EVERYONE)
.enable();
break;
case OFF :
disableProtection();
break;
case NON_ADMINS :
case EVERYONE :
enableProtection().addRequiredChecks(contexts)
.includeAdmins(level == EnforcementLevel.EVERYONE)
.enable();
break;
}
}
/**
* Merge a branch into this branch.
*
* @param headBranch
* the branch whose head will be merged
*
* @param commitMessage
* the commit message
*
* @return the merge {@link GHCommit} created, or {@code null} if the base already contains the head (nothing to
* merge).
*
* @throws IOException
* if merging fails
*/
@CheckForNull
public GHCommit merge(GHBranch headBranch, String commitMessage) throws IOException {
return merge(headBranch.getName(), commitMessage);
}
/**
* Merge a ref into this branch.
*
* @param head
* the ref name that will be merged into this branch. Follows the usual ref naming rules, could be a
* branch name, tag, or commit sha.
*
* @param commitMessage
* the commit message
*
* @return the merge {@link GHCommit} created, or {@code null} if the base already contains the head (nothing to
* merge).
*
* @throws IOException
* if merging fails
*/
@CheckForNull
public GHCommit merge(String head, String commitMessage) throws IOException {
GHCommit result = root.createRequest()
.withUrlPath(owner.getApiTailUrl("merges"))
.method("POST")
.with("commit_message", commitMessage)
.with("base", this.name)
.with("head", head)
.fetch(GHCommit.class);
if (result != null) {
result.wrapUp(owner);
}
return result;
}
String getApiRoute() {
return owner.getApiTailUrl("/branches/"+name);
return owner.getApiTailUrl("/branches/" + name);
}
@Override
@@ -120,7 +232,7 @@ public class GHBranch {
return "Branch:" + name + " in " + url;
}
/*package*/ GHBranch wrap(GHRepository repo) {
GHBranch wrap(GHRepository repo) {
this.owner = repo;
this.root = repo.root;
return this;

View File

@@ -3,25 +3,30 @@ package org.kohsuke.github;
import com.fasterxml.jackson.annotation.JsonProperty;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import static org.kohsuke.github.Previews.ZZZAX;
import java.io.IOException;
import java.util.Collection;
@SuppressFBWarnings(value = {"UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD",
"URF_UNREAD_FIELD"}, justification = "JSON API")
public class GHBranchProtection {
import static org.kohsuke.github.internal.Previews.ZZZAX;
/**
* The type GHBranchProtection.
*
* @see <a href="https://docs.github.com/en/rest/reference/repos#get-branch-protection">GitHub Branch Protection</a>
*/
@SuppressFBWarnings(
value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD",
"URF_UNREAD_FIELD" },
justification = "JSON API")
public class GHBranchProtection extends GitHubInteractiveObject {
private static final String REQUIRE_SIGNATURES_URI = "/required_signatures";
@JsonProperty("enforce_admins")
@JsonProperty
private EnforceAdmins enforceAdmins;
private GitHub root;
@JsonProperty("required_pull_request_reviews")
private RequiredReviews requiredReviews;
@JsonProperty("required_status_checks")
@JsonProperty
private RequiredStatusChecks requiredStatusChecks;
@JsonProperty
@@ -30,40 +35,84 @@ public class GHBranchProtection {
@JsonProperty
private String url;
@Preview @Deprecated
/**
* Enabled signed commits.
*
* @throws IOException
* the io exception
*/
@Preview(ZZZAX)
@Deprecated
public void enabledSignedCommits() throws IOException {
requester().method("POST")
.to(url + REQUIRE_SIGNATURES_URI, RequiredSignatures.class);
requester().method("POST").withUrlPath(url + REQUIRE_SIGNATURES_URI).fetch(RequiredSignatures.class);
}
@Preview @Deprecated
/**
* Disable signed commits.
*
* @throws IOException
* the io exception
*/
@Preview(ZZZAX)
@Deprecated
public void disableSignedCommits() throws IOException {
requester().method("DELETE")
.to(url + REQUIRE_SIGNATURES_URI);
requester().method("DELETE").withUrlPath(url + REQUIRE_SIGNATURES_URI).send();
}
/**
* Gets enforce admins.
*
* @return the enforce admins
*/
public EnforceAdmins getEnforceAdmins() {
return enforceAdmins;
}
/**
* Gets required reviews.
*
* @return the required reviews
*/
public RequiredReviews getRequiredReviews() {
return requiredReviews;
}
@Preview @Deprecated
/**
* Gets required signatures.
*
* @return the required signatures
* @throws IOException
* the io exception
*/
@Preview(ZZZAX)
@Deprecated
public boolean getRequiredSignatures() throws IOException {
return requester().method("GET")
.to(url + REQUIRE_SIGNATURES_URI, RequiredSignatures.class).enabled;
return requester().withUrlPath(url + REQUIRE_SIGNATURES_URI).fetch(RequiredSignatures.class).enabled;
}
/**
* Gets required status checks.
*
* @return the required status checks
*/
public RequiredStatusChecks getRequiredStatusChecks() {
return requiredStatusChecks;
}
/**
* Gets restrictions.
*
* @return the restrictions
*/
public Restrictions getRestrictions() {
return restrictions;
}
/**
* Gets url.
*
* @return the url
*/
public String getUrl() {
return url;
}
@@ -74,9 +123,12 @@ public class GHBranchProtection {
}
private Requester requester() {
return new Requester(root).withPreview(ZZZAX);
return root.createRequest().withPreview(ZZZAX);
}
/**
* The type EnforceAdmins.
*/
public static class EnforceAdmins {
@JsonProperty
private boolean enabled;
@@ -84,23 +136,34 @@ public class GHBranchProtection {
@JsonProperty
private String url;
/**
* Gets url.
*
* @return the url
*/
public String getUrl() {
return url;
}
/**
* Is enabled boolean.
*
* @return the boolean
*/
public boolean isEnabled() {
return enabled;
}
}
/**
* The type RequiredReviews.
*/
public static class RequiredReviews {
@JsonProperty("dismissal_restrictions")
private Restrictions dismissalRestriction;
@JsonProperty("dismiss_stale_reviews")
private boolean dismissStaleReviews;
@JsonProperty("require_code_owner_reviews")
private boolean requireCodeOwnerReviews;
@JsonProperty("required_approving_review_count")
@@ -109,22 +172,47 @@ public class GHBranchProtection {
@JsonProperty
private String url;
/**
* Gets dismissal restrictions.
*
* @return the dismissal restrictions
*/
public Restrictions getDismissalRestrictions() {
return dismissalRestriction;
}
/**
* Gets url.
*
* @return the url
*/
public String getUrl() {
return url;
}
/**
* Is dismiss stale reviews boolean.
*
* @return the boolean
*/
public boolean isDismissStaleReviews() {
return dismissStaleReviews;
}
/**
* Is require code owner reviews boolean.
*
* @return the boolean
*/
public boolean isRequireCodeOwnerReviews() {
return requireCodeOwnerReviews;
}
/**
* Gets required reviewers.
*
* @return the required reviewers
*/
public int getRequiredReviewers() {
return requiredReviewers;
}
@@ -137,15 +225,28 @@ public class GHBranchProtection {
@JsonProperty
private String url;
/**
* Gets url.
*
* @return the url
*/
public String getUrl() {
return url;
}
/**
* Is enabled boolean.
*
* @return the boolean
*/
public boolean isEnabled() {
return enabled;
}
}
/**
* The type RequiredStatusChecks.
*/
public static class RequiredStatusChecks {
@JsonProperty
private Collection<String> contexts;
@@ -156,24 +257,41 @@ public class GHBranchProtection {
@JsonProperty
private String url;
/**
* Gets contexts.
*
* @return the contexts
*/
public Collection<String> getContexts() {
return contexts;
}
/**
* Gets url.
*
* @return the url
*/
public String getUrl() {
return url;
}
/**
* Is requires branch up to date boolean.
*
* @return the boolean
*/
public boolean isRequiresBranchUpToDate() {
return strict;
}
}
/**
* The type Restrictions.
*/
public static class Restrictions {
@JsonProperty
private Collection<GHTeam> teams;
@JsonProperty("teams_url")
private String teamsUrl;
@JsonProperty
@@ -182,25 +300,49 @@ public class GHBranchProtection {
@JsonProperty
private Collection<GHUser> users;
@JsonProperty("users_url")
private String usersUrl;
/**
* Gets teams.
*
* @return the teams
*/
public Collection<GHTeam> getTeams() {
return teams;
}
/**
* Gets teams url.
*
* @return the teams url
*/
public String getTeamsUrl() {
return teamsUrl;
}
/**
* Gets url.
*
* @return the url
*/
public String getUrl() {
return url;
}
/**
* Gets users.
*
* @return the users
*/
public Collection<GHUser> getUsers() {
return users;
}
/**
* Gets users url.
*
* @return the users url
*/
public String getUsersUrl() {
return usersUrl;
}

View File

@@ -12,15 +12,17 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import static org.kohsuke.github.Previews.*;
import static org.kohsuke.github.internal.Previews.LUKE_CAGE;
/**
* Builder to configure the branch protection settings.
*
* @see GHBranch#enableProtection()
* @see GHBranch#enableProtection() GHBranch#enableProtection()
*/
@SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD",
"URF_UNREAD_FIELD" }, justification = "JSON API")
@SuppressFBWarnings(
value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD",
"URF_UNREAD_FIELD" },
justification = "JSON API")
public class GHBranchProtectionBuilder {
private final GHBranch branch;
@@ -33,72 +35,159 @@ public class GHBranchProtectionBuilder {
this.branch = branch;
}
/**
* Add required checks gh branch protection builder.
*
* @param checks
* the checks
* @return the gh branch protection builder
*/
public GHBranchProtectionBuilder addRequiredChecks(Collection<String> checks) {
getStatusChecks().contexts.addAll(checks);
return this;
}
/**
* Add required checks gh branch protection builder.
*
* @param checks
* the checks
* @return the gh branch protection builder
*/
public GHBranchProtectionBuilder addRequiredChecks(String... checks) {
addRequiredChecks(Arrays.asList(checks));
return this;
}
/**
* Dismiss stale reviews gh branch protection builder.
*
* @return the gh branch protection builder
*/
public GHBranchProtectionBuilder dismissStaleReviews() {
return dismissStaleReviews(true);
}
/**
* Dismiss stale reviews gh branch protection builder.
*
* @param v
* the v
* @return the gh branch protection builder
*/
public GHBranchProtectionBuilder dismissStaleReviews(boolean v) {
getPrReviews().put("dismiss_stale_reviews", v);
return this;
}
/**
* Enable gh branch protection.
*
* @return the gh branch protection
* @throws IOException
* the io exception
*/
public GHBranchProtection enable() throws IOException {
return requester().method("PUT")
.withNullable("required_status_checks", statusChecks)
.withNullable("required_pull_request_reviews", prReviews)
.withNullable("restrictions", restrictions)
.withNullable("enforce_admins", enforceAdmins)
.to(branch.getProtectionUrl().toString(), GHBranchProtection.class)
.withUrlPath(branch.getProtectionUrl().toString())
.fetch(GHBranchProtection.class)
.wrap(branch);
}
/**
* Include admins gh branch protection builder.
*
* @return the gh branch protection builder
*/
public GHBranchProtectionBuilder includeAdmins() {
return includeAdmins(true);
}
/**
* Include admins gh branch protection builder.
*
* @param v
* the v
* @return the gh branch protection builder
*/
public GHBranchProtectionBuilder includeAdmins(boolean v) {
enforceAdmins = v;
return this;
}
/**
* Required reviewers gh branch protection builder.
*
* @param v
* the v
* @return the gh branch protection builder
*/
public GHBranchProtectionBuilder requiredReviewers(int v) {
getPrReviews().put("required_approving_review_count", v);
return this;
}
/**
* Require branch is up to date gh branch protection builder.
*
* @return the gh branch protection builder
*/
public GHBranchProtectionBuilder requireBranchIsUpToDate() {
return requireBranchIsUpToDate(true);
}
/**
* Require branch is up to date gh branch protection builder.
*
* @param v
* the v
* @return the gh branch protection builder
*/
public GHBranchProtectionBuilder requireBranchIsUpToDate(boolean v) {
getStatusChecks().strict = v;
return this;
}
/**
* Require code own reviews gh branch protection builder.
*
* @return the gh branch protection builder
*/
public GHBranchProtectionBuilder requireCodeOwnReviews() {
return requireCodeOwnReviews(true);
}
/**
* Require code own reviews gh branch protection builder.
*
* @param v
* the v
* @return the gh branch protection builder
*/
public GHBranchProtectionBuilder requireCodeOwnReviews(boolean v) {
getPrReviews().put("require_code_owner_reviews", v);
return this;
}
/**
* Require reviews gh branch protection builder.
*
* @return the gh branch protection builder
*/
public GHBranchProtectionBuilder requireReviews() {
getPrReviews();
return this;
}
/**
* Restrict review dismissals gh branch protection builder.
*
* @return the gh branch protection builder
*/
public GHBranchProtectionBuilder restrictReviewDismissals() {
getPrReviews();
@@ -109,11 +198,23 @@ public class GHBranchProtectionBuilder {
return this;
}
/**
* Restrict push access gh branch protection builder.
*
* @return the gh branch protection builder
*/
public GHBranchProtectionBuilder restrictPushAccess() {
getRestrictions();
return this;
}
/**
* Team push access gh branch protection builder.
*
* @param teams
* the teams
* @return the gh branch protection builder
*/
public GHBranchProtectionBuilder teamPushAccess(Collection<GHTeam> teams) {
for (GHTeam team : teams) {
teamPushAccess(team);
@@ -121,6 +222,13 @@ public class GHBranchProtectionBuilder {
return this;
}
/**
* Team push access gh branch protection builder.
*
* @param teams
* the teams
* @return the gh branch protection builder
*/
public GHBranchProtectionBuilder teamPushAccess(GHTeam... teams) {
for (GHTeam team : teams) {
getRestrictions().teams.add(team.getSlug());
@@ -128,6 +236,13 @@ public class GHBranchProtectionBuilder {
return this;
}
/**
* Team review dismissals gh branch protection builder.
*
* @param teams
* the teams
* @return the gh branch protection builder
*/
public GHBranchProtectionBuilder teamReviewDismissals(Collection<GHTeam> teams) {
for (GHTeam team : teams) {
teamReviewDismissals(team);
@@ -135,6 +250,13 @@ public class GHBranchProtectionBuilder {
return this;
}
/**
* Team review dismissals gh branch protection builder.
*
* @param teams
* the teams
* @return the gh branch protection builder
*/
public GHBranchProtectionBuilder teamReviewDismissals(GHTeam... teams) {
for (GHTeam team : teams) {
addReviewRestriction(team.getSlug(), true);
@@ -142,13 +264,27 @@ public class GHBranchProtectionBuilder {
return this;
}
/**
* User push access gh branch protection builder.
*
* @param users
* the users
* @return the gh branch protection builder
*/
public GHBranchProtectionBuilder userPushAccess(Collection<GHUser> users) {
for (GHUser user : users) {
userPushAccess(user);
}
return this;
}
/**
* User push access gh branch protection builder.
*
* @param users
* the users
* @return the gh branch protection builder
*/
public GHBranchProtectionBuilder userPushAccess(GHUser... users) {
for (GHUser user : users) {
getRestrictions().users.add(user.getLogin());
@@ -156,6 +292,13 @@ public class GHBranchProtectionBuilder {
return this;
}
/**
* User review dismissals gh branch protection builder.
*
* @param users
* the users
* @return the gh branch protection builder
*/
public GHBranchProtectionBuilder userReviewDismissals(Collection<GHUser> users) {
for (GHUser team : users) {
userReviewDismissals(team);
@@ -163,6 +306,13 @@ public class GHBranchProtectionBuilder {
return this;
}
/**
* User review dismissals gh branch protection builder.
*
* @param users
* the users
* @return the gh branch protection builder
*/
public GHBranchProtectionBuilder userReviewDismissals(GHUser... users) {
for (GHUser user : users) {
addReviewRestriction(user.getLogin(), false);
@@ -173,7 +323,7 @@ public class GHBranchProtectionBuilder {
private void addReviewRestriction(String restriction, boolean isTeam) {
restrictReviewDismissals();
Restrictions restrictions = (Restrictions) prReviews.get("dismissal_restrictions");
if (isTeam) {
restrictions.teams.add(restriction);
} else {
@@ -203,7 +353,7 @@ public class GHBranchProtectionBuilder {
}
private Requester requester() {
return new Requester(branch.getRoot()).withPreview(LUKE_CAGE);
return branch.getRoot().createRequest().withPreview(LUKE_CAGE);
}
private static class Restrictions {

View File

@@ -0,0 +1,342 @@
package org.kohsuke.github;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.infradna.tool.bridge_method_injector.WithBridgeMethods;
import edu.umd.cs.findbugs.annotations.NonNull;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.kohsuke.github.GHWorkflowRun.Conclusion;
import org.kohsuke.github.GHWorkflowRun.Status;
import org.kohsuke.github.internal.EnumUtils;
import org.kohsuke.github.internal.Previews;
import java.io.IOException;
import java.net.URL;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Locale;
/**
* Represents a check run.
*
* @see <a href="https://developer.github.com/v3/checks/runs/">documentation</a>
*/
@SuppressFBWarnings(value = { "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD", "URF_UNREAD_FIELD" },
justification = "JSON API")
public class GHCheckRun extends GHObject {
@JsonProperty("repository")
GHRepository owner;
private String status;
private String conclusion;
private String name;
private String headSha;
private String nodeId;
private String externalId;
private String startedAt;
private String completedAt;
private URL htmlUrl;
private URL detailsUrl;
private Output output;
private GHApp app;
private GHPullRequest[] pullRequests;
private GHCheckSuite checkSuite;
GHCheckRun wrap(GHRepository owner) {
this.owner = owner;
wrap(owner.root);
return this;
}
GHCheckRun wrap(GitHub root) {
this.root = root;
if (owner != null) {
owner.wrap(root);
if (pullRequests != null && pullRequests.length != 0) {
for (GHPullRequest singlePull : pullRequests) {
singlePull.wrap(owner);
}
}
}
if (checkSuite != null) {
if (owner != null) {
checkSuite.wrap(owner);
} else {
checkSuite.wrap(root);
}
}
if (app != null) {
app.wrapUp(root);
}
return this;
}
GHPullRequest[] wrap() {
return pullRequests;
}
/**
* Gets status of the check run.
*
* @return Status of the check run
* @see Status
*/
@WithBridgeMethods(value = String.class, adapterMethod = "statusAsStr")
public Status getStatus() {
return Status.from(status);
}
@SuppressFBWarnings(value = "UPM_UNCALLED_PRIVATE_METHOD", justification = "Bridge method of getStatus")
private Object statusAsStr(Status status, Class type) {
return status;
}
public static enum Status {
QUEUED, IN_PROGRESS, COMPLETED, UNKNOWN;
public static Status from(String value) {
return EnumUtils.getNullableEnumOrDefault(Status.class, value, Status.UNKNOWN);
}
@Override
public String toString() {
return name().toLowerCase(Locale.ROOT);
}
}
/**
* Gets conclusion of a completed check run.
*
* @return Status of the check run
* @see Conclusion
*/
@WithBridgeMethods(value = String.class, adapterMethod = "conclusionAsStr")
public Conclusion getConclusion() {
return Conclusion.from(conclusion);
}
@SuppressFBWarnings(value = "UPM_UNCALLED_PRIVATE_METHOD", justification = "Bridge method of getConclusion")
private Object conclusionAsStr(Conclusion conclusion, Class type) {
return conclusion;
}
/**
* Final conclusion of the check.
*
* From <a href="https://docs.github.com/en/rest/reference/checks#create-a-check-run--parameters">Check Run
* Parameters - <code>conclusion</code></a>.
*/
public static enum Conclusion {
ACTION_REQUIRED, CANCELLED, FAILURE, NEUTRAL, SUCCESS, SKIPPED, STALE, TIMED_OUT, UNKNOWN;
public static Conclusion from(String value) {
return EnumUtils.getNullableEnumOrDefault(Conclusion.class, value, Conclusion.UNKNOWN);
}
@Override
public String toString() {
return name().toLowerCase(Locale.ROOT);
}
}
/**
* Gets the custom name of this check run.
*
* @return Name of the check run
*/
public String getName() {
return name;
}
/**
* Gets the HEAD SHA.
*
* @return sha for the HEAD commit
*/
public String getHeadSha() {
return headSha;
}
/**
* Gets the pull requests participated in this check run.
*
* Note this field is only populated for events. When getting a {@link GHCheckRun} outside of an event, this is
* always empty.
*
* @return the list of {@link GHPullRequest}s for this check run. Only populated for events.
* @throws IOException
* the io exception
*/
public List<GHPullRequest> getPullRequests() throws IOException {
if (pullRequests != null && pullRequests.length != 0) {
for (GHPullRequest singlePull : pullRequests) {
// Only refresh if we haven't do so before
singlePull.refresh(singlePull.getTitle());
}
return Collections.unmodifiableList(Arrays.asList(pullRequests));
}
return Collections.emptyList();
}
/**
* Gets the HTML URL: https://github.com/[owner]/[repo-name]/runs/[check-run-id], usually an GitHub Action page of
* the check run.
*
* @return HTML URL
*/
@Override
public URL getHtmlUrl() {
return htmlUrl;
}
/**
* Gets the global node id to access most objects in GitHub.
*
* @see <a href="https://developer.github.com/v4/guides/using-global-node-ids/">documentation</a>
* @return Global node id
*/
public String getNodeId() {
return nodeId;
}
/**
* Gets a reference for the check run on the integrator's system.
*
* @return Reference id
*/
public String getExternalId() {
return externalId;
}
/**
* Gets the details URL from which to find full details of the check run on the integrator's site.
*
* @return Details URL
*/
public URL getDetailsUrl() {
return detailsUrl;
}
/**
* Gets the start time of the check run in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.
*
* @return Timestamp of the start time
*/
public Date getStartedAt() {
return GitHubClient.parseDate(startedAt);
}
/**
* Gets the completed time of the check run in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ.
*
* @return Timestamp of the completed time
*/
public Date getCompletedAt() {
return GitHubClient.parseDate(completedAt);
}
/**
* Gets the GitHub app this check run belongs to, included in response.
*
* @return GitHub App
*/
public GHApp getApp() {
return app;
}
/**
* Gets the check suite this check run belongs to
*
* @return Check suite
*/
public GHCheckSuite getCheckSuite() {
return checkSuite;
}
/**
* Gets an output for a check run.
*
* @return Output of a check run
*/
public Output getOutput() {
return output;
}
/**
* Represents an output in a check run to include summary and other results.
*
* @see <a href="https://developer.github.com/v3/checks/runs/#output-object">documentation</a>
*/
public static class Output {
private String title;
private String summary;
private String text;
private int annotationsCount;
private URL annotationsUrl;
/**
* Gets the title of check run.
*
* @return title of check run
*/
public String getTitle() {
return title;
}
/**
* Gets the summary of the check run, note that it supports Markdown.
*
* @return summary of check run
*/
public String getSummary() {
return summary;
}
/**
* Gets the details of the check run, note that it supports Markdown.
*
* @return Details of the check run
*/
public String getText() {
return text;
}
/**
* Gets the annotation count of a check run.
*
* @return annotation count of a check run
*/
public int getAnnotationsCount() {
return annotationsCount;
}
/**
* Gets the URL of annotations.
*
* @return URL of annotations
*/
public URL getAnnotationsUrl() {
return annotationsUrl;
}
}
public static enum AnnotationLevel {
NOTICE, WARNING, FAILURE
}
/**
* Updates this check run.
*
* @return a builder which you should customize, then call {@link GHCheckRunBuilder#create}
*/
@Preview(Previews.ANTIOPE)
@Deprecated
public @NonNull GHCheckRunBuilder update() {
return new GHCheckRunBuilder(owner, getId());
}
}

View File

@@ -0,0 +1,307 @@
/*
* The MIT License
*
* Copyright 2020 CloudBees, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
package org.kohsuke.github;
import com.fasterxml.jackson.annotation.JsonInclude;
import edu.umd.cs.findbugs.annotations.CheckForNull;
import edu.umd.cs.findbugs.annotations.NonNull;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.kohsuke.github.internal.Previews;
import java.io.IOException;
import java.util.Collections;
import java.util.Date;
import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
/**
* Drafts or updates a check run.
*
* @see GHCheckRun
* @see GHRepository#createCheckRun
* @see <a href="https://developer.github.com/v3/checks/runs/#create-a-check-run">documentation</a>
* @see GHCheckRun#update()
* @see <a href="https://developer.github.com/v3/checks/runs/#update-a-check-run">documentation</a>
*/
@SuppressFBWarnings(value = "URF_UNREAD_FIELD", justification = "Jackson serializes these even without a getter")
@Preview(Previews.ANTIOPE)
@Deprecated
public final class GHCheckRunBuilder {
protected final GHRepository repo;
protected final Requester requester;
private Output output;
private List<Action> actions;
private GHCheckRunBuilder(GHRepository repo, Requester requester) {
this.repo = repo;
this.requester = requester;
}
GHCheckRunBuilder(GHRepository repo, String name, String headSHA) {
this(repo,
repo.root.createRequest()
.withPreview(Previews.ANTIOPE)
.method("POST")
.with("name", name)
.with("head_sha", headSHA)
.withUrlPath(repo.getApiTailUrl("check-runs")));
}
GHCheckRunBuilder(GHRepository repo, long checkId) {
this(repo,
repo.root.createRequest()
.withPreview(Previews.ANTIOPE)
.method("PATCH")
.withUrlPath(repo.getApiTailUrl("check-runs/" + checkId)));
}
public @NonNull GHCheckRunBuilder withDetailsURL(@CheckForNull String detailsURL) {
requester.with("details_url", detailsURL);
return this;
}
public @NonNull GHCheckRunBuilder withExternalID(@CheckForNull String externalID) {
requester.with("external_id", externalID);
return this;
}
public @NonNull GHCheckRunBuilder withStatus(@CheckForNull GHCheckRun.Status status) {
if (status != null) {
// Do *not* use the overload taking Enum, as that s/_/-/g which would be wrong here.
requester.with("status", status.toString().toLowerCase(Locale.ROOT));
}
return this;
}
public @NonNull GHCheckRunBuilder withConclusion(@CheckForNull GHCheckRun.Conclusion conclusion) {
if (conclusion != null) {
requester.with("conclusion", conclusion.toString().toLowerCase(Locale.ROOT));
}
return this;
}
public @NonNull GHCheckRunBuilder withStartedAt(@CheckForNull Date startedAt) {
if (startedAt != null) {
requester.with("started_at", GitHubClient.printDate(startedAt));
}
return this;
}
public @NonNull GHCheckRunBuilder withCompletedAt(@CheckForNull Date completedAt) {
if (completedAt != null) {
requester.with("completed_at", GitHubClient.printDate(completedAt));
}
return this;
}
public @NonNull GHCheckRunBuilder add(@NonNull Output output) {
if (this.output != null) {
throw new IllegalStateException("cannot add Output twice");
}
this.output = output;
return this;
}
public @NonNull GHCheckRunBuilder add(@NonNull Action action) {
if (actions == null) {
actions = new LinkedList<>();
}
actions.add(action);
return this;
}
private static final int MAX_ANNOTATIONS = 50;
/**
* Actually creates the check run. (If more than fifty annotations were requested, this is done in batches.)
*
* @return the resulting run
* @throws IOException
* for the usual reasons
*/
public @NonNull GHCheckRun create() throws IOException {
List<Annotation> extraAnnotations;
if (output != null && output.annotations != null && output.annotations.size() > MAX_ANNOTATIONS) {
extraAnnotations = output.annotations.subList(MAX_ANNOTATIONS, output.annotations.size());
output.annotations = output.annotations.subList(0, MAX_ANNOTATIONS);
} else {
extraAnnotations = Collections.emptyList();
}
GHCheckRun run = requester.with("output", output).with("actions", actions).fetch(GHCheckRun.class).wrap(repo);
while (!extraAnnotations.isEmpty()) {
Output output2 = new Output(output.title, output.summary).withText(output.text);
int i = Math.min(extraAnnotations.size(), MAX_ANNOTATIONS);
output2.annotations = extraAnnotations.subList(0, i);
extraAnnotations = extraAnnotations.subList(i, extraAnnotations.size());
run = repo.root.createRequest()
.withPreview(Previews.ANTIOPE)
.method("PATCH")
.with("output", output2)
.withUrlPath(repo.getApiTailUrl("check-runs/" + run.getId()))
.fetch(GHCheckRun.class)
.wrap(repo);
}
return run;
}
/**
* @see <a href="https://developer.github.com/v3/checks/runs/#output-object">documentation</a>
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
public static final class Output {
private final String title;
private final String summary;
private String text;
private List<Annotation> annotations;
private List<Image> images;
public Output(@NonNull String title, @NonNull String summary) {
this.title = title;
this.summary = summary;
}
public @NonNull Output withText(@CheckForNull String text) {
this.text = text;
return this;
}
public @NonNull Output add(@NonNull Annotation annotation) {
if (annotations == null) {
annotations = new LinkedList<>();
}
annotations.add(annotation);
return this;
}
public @NonNull Output add(@NonNull Image image) {
if (images == null) {
images = new LinkedList<>();
}
images.add(image);
return this;
}
}
/**
* @see <a href="https://developer.github.com/v3/checks/runs/#annotations-object">documentation</a>
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
public static final class Annotation {
private final String path;
private final int start_line;
private final int end_line;
private final String annotation_level;
private final String message;
private Integer start_column;
private Integer end_column;
private String title;
private String raw_details;
public Annotation(@NonNull String path,
int line,
@NonNull GHCheckRun.AnnotationLevel annotationLevel,
@NonNull String message) {
this(path, line, line, annotationLevel, message);
}
public Annotation(@NonNull String path,
int startLine,
int endLine,
@NonNull GHCheckRun.AnnotationLevel annotationLevel,
@NonNull String message) {
this.path = path;
start_line = startLine;
end_line = endLine;
annotation_level = annotationLevel.toString().toLowerCase(Locale.ROOT);
this.message = message;
}
public @NonNull Annotation withStartColumn(@CheckForNull Integer startColumn) {
start_column = startColumn;
return this;
}
public @NonNull Annotation withEndColumn(@CheckForNull Integer endColumn) {
end_column = endColumn;
return this;
}
public @NonNull Annotation withTitle(@CheckForNull String title) {
this.title = title;
return this;
}
public @NonNull Annotation withRawDetails(@CheckForNull String rawDetails) {
raw_details = rawDetails;
return this;
}
}
/**
* @see <a href="https://developer.github.com/v3/checks/runs/#images-object">documentation</a>
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
public static final class Image {
private final String alt;
private final String image_url;
private String caption;
public Image(@NonNull String alt, @NonNull String imageURL) {
this.alt = alt;
image_url = imageURL;
}
public @NonNull Image withCaption(@CheckForNull String caption) {
this.caption = caption;
return this;
}
}
/**
* @see <a href="https://developer.github.com/v3/checks/runs/#actions-object">documentation</a>
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
public static final class Action {
private final String label;
private final String description;
private final String identifier;
public Action(@NonNull String label, @NonNull String description, @NonNull String identifier) {
this.label = label;
this.description = description;
this.identifier = identifier;
}
}
}

View File

@@ -0,0 +1,44 @@
package org.kohsuke.github;
import java.util.Iterator;
import javax.annotation.Nonnull;
/**
* Iterable for check-runs listing.
*/
class GHCheckRunsIterable extends PagedIterable<GHCheckRun> {
private final GHRepository owner;
private final GitHubRequest request;
private GHCheckRunsPage result;
public GHCheckRunsIterable(GHRepository owner, GitHubRequest request) {
this.owner = owner;
this.request = request;
}
@Nonnull
@Override
public PagedIterator<GHCheckRun> _iterator(int pageSize) {
return new PagedIterator<>(
adapt(GitHubPageIterator.create(owner.getRoot().getClient(), GHCheckRunsPage.class, request, pageSize)),
null);
}
protected Iterator<GHCheckRun[]> adapt(final Iterator<GHCheckRunsPage> base) {
return new Iterator<GHCheckRun[]>() {
public boolean hasNext() {
return base.hasNext();
}
public GHCheckRun[] next() {
GHCheckRunsPage v = base.next();
if (result == null) {
result = v;
}
return v.getCheckRuns(owner);
}
};
}
}

View File

@@ -0,0 +1,20 @@
package org.kohsuke.github;
/**
* Represents the one page of check-runs result when listing check-runs.
*/
class GHCheckRunsPage {
private int total_count;
private GHCheckRun[] check_runs;
public int getTotalCount() {
return total_count;
}
GHCheckRun[] getCheckRuns(GHRepository owner) {
for (GHCheckRun check_run : check_runs) {
check_run.wrap(owner);
}
return check_runs;
}
}

View File

@@ -0,0 +1,259 @@
package org.kohsuke.github;
import com.fasterxml.jackson.annotation.JsonProperty;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.io.IOException;
import java.net.URL;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.List;
/**
* Represents a check suite.
*
* @see <a href="https://developer.github.com/v3/checks/suites/">documentation</a>
*/
@SuppressFBWarnings(value = { "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD", "URF_UNREAD_FIELD" },
justification = "JSON API")
public class GHCheckSuite extends GHObject {
@JsonProperty("repository")
GHRepository owner;
private String nodeId;
private String headBranch;
private String headSha;
private String status;
private String conclusion;
private String before;
private String after;
private int latestCheckRunsCount;
private URL checkRunsUrl;
private HeadCommit headCommit;
private GHApp app;
private GHPullRequest[] pullRequests;
GHCheckSuite wrap(GHRepository owner) {
this.owner = owner;
this.wrap(owner.root);
return this;
}
GHCheckSuite wrap(GitHub root) {
this.root = root;
if (owner != null) {
owner.wrap(root);
if (pullRequests != null && pullRequests.length != 0) {
for (GHPullRequest singlePull : pullRequests) {
singlePull.wrap(owner);
}
}
}
if (app != null) {
app.wrapUp(root);
}
return this;
}
GHPullRequest[] wrap() {
return pullRequests;
}
/**
* Gets the global node id to access most objects in GitHub.
*
* @see <a href="https://developer.github.com/v4/guides/using-global-node-ids/">documentation</a>
* @return global node id
*/
public String getNodeId() {
return nodeId;
}
/**
* The head branch name the changes are on.
*
* @return head branch name
*/
public String getHeadBranch() {
return headBranch;
}
/**
* Gets the HEAD SHA.
*
* @return sha for the HEAD commit
*/
public String getHeadSha() {
return headSha;
}
/**
* Gets status of the check suite. It can be one of request, in_progress, or completed.
*
* @return status of the check suite
*/
public String getStatus() {
return status;
}
/**
* Gets conclusion of a completed check suite. It can be one of success, failure, neutral, cancelled, time_out,
* action_required, or stale. The check suite will report the highest priority check run conclusion in the check
* suite's conclusion.
*
* @return conclusion of the check suite
*/
public String getConclusion() {
return conclusion;
}
/**
* The SHA of the most recent commit on ref before the push.
*
* @return sha of a commit
*/
public String getBefore() {
return before;
}
/**
* The SHA of the most recent commit on ref after the push.
*
* @return sha of a commit
*/
public String getAfter() {
return after;
}
/**
* The quantity of check runs that had run as part of the latest push.
*
* @return sha of the most recent commit
*/
public int getLatestCheckRunsCount() {
return latestCheckRunsCount;
}
/**
* The url used to list all the check runs belonged to this suite.
*
* @return url containing all check runs
*/
public URL getCheckRunsUrl() {
return checkRunsUrl;
}
/**
* The commit of current head.
*
* @return head commit
*/
public HeadCommit getHeadCommit() {
return headCommit;
}
/**
* Gets the GitHub app this check suite belongs to, included in response.
*
* @return GitHub App
*/
public GHApp getApp() {
return app;
}
/**
* Gets the pull requests participated in this check suite.
*
* Note this field is only populated for events. When getting a {@link GHCheckSuite} outside of an event, this is
* always empty.
*
* @return the list of {@link GHPullRequest}s for this check suite. Only populated for events.
* @throws IOException
* the io exception
*/
public List<GHPullRequest> getPullRequests() throws IOException {
if (pullRequests != null && pullRequests.length != 0) {
for (GHPullRequest singlePull : pullRequests) {
// Only refresh if we haven't do so before
singlePull.refresh(singlePull.getTitle());
}
return Collections.unmodifiableList(Arrays.asList(pullRequests));
}
return Collections.emptyList();
}
/**
* Check suite doesn't have a HTML URL.
*
* @return null
*/
@Override
public URL getHtmlUrl() {
return null;
}
public static class HeadCommit {
private String id;
private String treeId;
private String message;
private String timestamp;
private GitUser author;
private GitUser committer;
/**
* Gets id of the commit, used by {@link GHCheckSuite} when a {@link GHEvent#CHECK_SUITE} comes
*
* @return id of the commit
*/
public String getId() {
return id;
}
/**
* Gets id of the tree.
*
* @return id of the tree
*/
public String getTreeId() {
return treeId;
}
/**
* Gets message.
*
* @return commit message.
*/
public String getMessage() {
return message;
}
/**
* Gets timestamp of the commit.
*
* @return timestamp of the commit
*/
public Date getTimestamp() {
return GitHubClient.parseDate(timestamp);
}
/**
* Gets author.
*
* @return the author
*/
public GitUser getAuthor() {
return author;
}
/**
* Gets committer.
*
* @return the committer
*/
public GitUser getCommitter() {
return committer;
}
}
}

View File

@@ -11,121 +11,176 @@ import java.util.Collections;
import java.util.Date;
import java.util.List;
import static org.kohsuke.github.internal.Previews.ANTIOPE;
import static org.kohsuke.github.internal.Previews.GROOT;
/**
* A commit in a repository.
*
* @author Kohsuke Kawaguchi
* @see GHRepository#getCommit(String)
* @see GHCommitComment#getCommit()
* @see GHRepository#getCommit(String) GHRepository#getCommit(String)
* @see GHCommitComment#getCommit() GHCommitComment#getCommit()
*/
@SuppressFBWarnings(value = {"NP_UNWRITTEN_FIELD", "UWF_UNWRITTEN_FIELD"},
justification = "JSON API")
@SuppressFBWarnings(value = { "NP_UNWRITTEN_FIELD", "UWF_UNWRITTEN_FIELD" }, justification = "JSON API")
public class GHCommit {
private GHRepository owner;
private ShortInfo commit;
/**
* Short summary of this commit.
*/
@SuppressFBWarnings(value = {"UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD",
"NP_UNWRITTEN_FIELD", "UWF_UNWRITTEN_FIELD"}, justification = "JSON API")
@SuppressFBWarnings(
value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD",
"UWF_UNWRITTEN_FIELD" },
justification = "JSON API")
public static class ShortInfo {
private GHAuthor author;
private GHAuthor committer;
private String message;
private int comment_count;
private GHVerification verification;
static class Tree {
String sha;
}
private Tree tree;
/**
* Gets author.
*
* @return the author
*/
@WithBridgeMethods(value = GHAuthor.class, castRequired = true)
public GitUser getAuthor() {
return author;
}
/**
* Gets authored date.
*
* @return the authored date
*/
public Date getAuthoredDate() {
return GitHub.parseDate(author.date);
return author.getDate();
}
/**
* Gets committer.
*
* @return the committer
*/
@WithBridgeMethods(value = GHAuthor.class, castRequired = true)
public GitUser getCommitter() {
return committer;
}
/**
* Gets commit date.
*
* @return the commit date
*/
public Date getCommitDate() {
return GitHub.parseDate(committer.date);
return committer.getDate();
}
/**
* Commit message.
* Gets message.
*
* @return Commit message.
*/
public String getMessage() {
return message;
}
/**
* Gets comment count.
*
* @return the comment count
*/
public int getCommentCount() {
return comment_count;
}
/**
* Gets Verification Status.
*
* @return the Verification status
*/
public GHVerification getVerification() {
return verification;
}
}
/**
* The type GHAuthor.
*
* @deprecated Use {@link GitUser} instead.
*/
public static class GHAuthor extends GitUser {
private String date;
}
/**
* The type Stats.
*/
public static class Stats {
int total,additions,deletions;
int total, additions, deletions;
}
/**
* A file that was modified.
*/
@SuppressFBWarnings(value = "UWF_UNWRITTEN_FIELD",
justification = "It's being initilized by JSON deserialization")
@SuppressFBWarnings(value = "UWF_UNWRITTEN_FIELD", justification = "It's being initilized by JSON deserialization")
public static class File {
String status;
int changes,additions,deletions;
int changes, additions, deletions;
String raw_url, blob_url, sha, patch;
String filename, previous_filename;
/**
* Number of lines added + removed.
* Gets lines changed.
*
* @return Number of lines added + removed.
*/
public int getLinesChanged() {
return changes;
}
/**
* Number of lines added.
* Gets lines added.
*
* @return Number of lines added.
*/
public int getLinesAdded() {
return additions;
}
/**
* Number of lines removed.
* Gets lines deleted.
*
* @return Number of lines removed.
*/
public int getLinesDeleted() {
return deletions;
}
/**
* "modified", "added", or "removed"
* Gets status.
*
* @return "modified", "added", or "removed"
*/
public String getStatus() {
return status;
}
/**
* Full path in the repository.
* Gets file name.
*
* @return Full path in the repository.
*/
@SuppressFBWarnings(value = "NM_CONFUSING",
justification = "It's a part of the library's API and cannot be renamed")
@@ -134,81 +189,108 @@ public class GHCommit {
}
/**
* Previous path, in case file has moved.
* Gets previous filename.
*
* @return Previous path, in case file has moved.
*/
public String getPreviousFilename() {
return previous_filename;
}
/**
* The actual change.
* Gets patch.
*
* @return The actual change.
*/
public String getPatch() {
return patch;
}
/**
* URL like 'https://raw.github.com/jenkinsci/jenkins/4eb17c197dfdcf8ef7ff87eb160f24f6a20b7f0e/core/pom.xml'
* that resolves to the actual content of the file.
* Gets raw url.
*
* @return URL like
* 'https://raw.github.com/jenkinsci/jenkins/4eb17c197dfdcf8ef7ff87eb160f24f6a20b7f0e/core/pom.xml' that
* resolves to the actual content of the file.
*/
public URL getRawUrl() {
return GitHub.parseURL(raw_url);
return GitHubClient.parseURL(raw_url);
}
/**
* URL like 'https://github.com/jenkinsci/jenkins/blob/1182e2ebb1734d0653142bd422ad33c21437f7cf/core/pom.xml'
* that resolves to the HTML page that describes this file.
* Gets blob url.
*
* @return URL like
* 'https://github.com/jenkinsci/jenkins/blob/1182e2ebb1734d0653142bd422ad33c21437f7cf/core/pom.xml'
* that resolves to the HTML page that describes this file.
*/
public URL getBlobUrl() {
return GitHub.parseURL(blob_url);
return GitHubClient.parseURL(blob_url);
}
/**
* [0-9a-f]{40} SHA1 checksum.
* Gets sha.
*
* @return [0 -9a-f]{40} SHA1 checksum.
*/
public String getSha() {
return sha;
}
}
/**
* The type Parent.
*/
public static class Parent {
@SuppressFBWarnings(value = "UUF_UNUSED_FIELD", justification = "We don't provide it in API now")
String url;
String url;
String sha;
}
static class User {
// TODO: what if someone who doesn't have an account on GitHub makes a commit?
@SuppressFBWarnings(value = "UUF_UNUSED_FIELD", justification = "We don't provide it in API now")
String url,avatar_url,gravatar_id;
String url, avatar_url, gravatar_id;
@SuppressFBWarnings(value = "UUF_UNUSED_FIELD", justification = "We don't provide it in API now")
int id;
String login;
}
String url,html_url,sha;
String url, html_url, sha;
List<File> files;
Stats stats;
List<Parent> parents;
User author,committer;
User author, committer;
/**
* Gets commit short info.
*
* @return the commit short info
* @throws IOException
* the io exception
*/
public ShortInfo getCommitShortInfo() throws IOException {
if (commit==null)
if (commit == null)
populate();
return commit;
}
/**
* The repository that contains the commit.
* Gets owner.
*
* @return the repository that contains the commit.
*/
public GHRepository getOwner() {
return owner;
}
/**
* Number of lines added + removed.
* Gets lines changed.
*
* @return the number of lines added + removed.
* @throws IOException
* if the field was not populated and refresh fails
*/
public int getLinesChanged() throws IOException {
populate();
@@ -216,7 +298,11 @@ public class GHCommit {
}
/**
* Number of lines added.
* Gets lines added.
*
* @return Number of lines added.
* @throws IOException
* if the field was not populated and refresh fails
*/
public int getLinesAdded() throws IOException {
populate();
@@ -224,7 +310,11 @@ public class GHCommit {
}
/**
* Number of lines removed.
* Gets lines deleted.
*
* @return Number of lines removed.
* @throws IOException
* if the field was not populated and refresh fails
*/
public int getLinesDeleted() throws IOException {
populate();
@@ -232,21 +322,30 @@ public class GHCommit {
}
/**
* Use this method to walk the tree
* Use this method to walk the tree.
*
* @return a GHTree to walk
* @throws IOException
* on error
*/
public GHTree getTree() throws IOException {
return owner.getTree(getCommitShortInfo().tree.sha);
}
/**
* URL of this commit like "https://github.com/kohsuke/sandbox-ant/commit/8ae38db0ea5837313ab5f39d43a6f73de3bd9000"
* Gets html url.
*
* @return URL of this commit like
* "https://github.com/kohsuke/sandbox-ant/commit/8ae38db0ea5837313ab5f39d43a6f73de3bd9000"
*/
public URL getHtmlUrl() {
return GitHub.parseURL(html_url);
return GitHubClient.parseURL(html_url);
}
/**
* [0-9a-f]{40} SHA1 checksum.
* Gets sha 1.
*
* @return [0 -9a-f]{40} SHA1 checksum.
*/
public String getSHA1() {
return sha;
@@ -255,19 +354,23 @@ public class GHCommit {
/**
* List of files changed/added/removed in this commit.
*
* @return
* Can be empty but never null.
* @return Can be empty but never null.
* @throws IOException
* on error
*/
public List<File> getFiles() throws IOException {
populate();
return files!=null ? Collections.unmodifiableList(files) : Collections.<File>emptyList();
return files != null ? Collections.unmodifiableList(files) : Collections.<File>emptyList();
}
/**
* Returns the SHA1 of parent commit objects.
* Gets parent sha 1 s.
*
* @return SHA1 of parent commit objects.
*/
public List<String> getParentSHA1s() {
if (parents==null) return Collections.emptyList();
if (parents == null)
return Collections.emptyList();
return new AbstractList<String>() {
@Override
public String get(int index) {
@@ -283,6 +386,10 @@ public class GHCommit {
/**
* Resolves the parent commit objects and return them.
*
* @return parent commit objects
* @throws IOException
* on error
*/
public List<GHCommit> getParents() throws IOException {
List<GHCommit> r = new ArrayList<GHCommit>();
@@ -291,19 +398,35 @@ public class GHCommit {
return r;
}
/**
* Gets author.
*
* @return the author
* @throws IOException
* the io exception
*/
public GHUser getAuthor() throws IOException {
return resolveUser(author);
}
/**
* Gets the date the change was authored on.
*
* @return the date the change was authored on.
* @throws IOException if the information was not already fetched and an attempt at fetching the information failed.
* @throws IOException
* if the information was not already fetched and an attempt at fetching the information failed.
*/
public Date getAuthoredDate() throws IOException {
return getCommitShortInfo().getAuthoredDate();
}
/**
* Gets committer.
*
* @return the committer
* @throws IOException
* the io exception
*/
public GHUser getCommitter() throws IOException {
return resolveUser(committer);
}
@@ -312,67 +435,151 @@ public class GHCommit {
* Gets the date the change was committed on.
*
* @return the date the change was committed on.
* @throws IOException if the information was not already fetched and an attempt at fetching the information failed.
* @throws IOException
* if the information was not already fetched and an attempt at fetching the information failed.
*/
public Date getCommitDate() throws IOException {
return getCommitShortInfo().getCommitDate();
}
private GHUser resolveUser(User author) throws IOException {
if (author==null || author.login==null) return null;
if (author == null || author.login == null)
return null;
return owner.root.getUser(author.login);
}
/**
* Lists up all the commit comments in this repository.
* Retrieves a list of pull requests which contain this commit.
*
* @return {@link PagedIterable} with the pull requests which contain this commit
*/
@Preview(GROOT)
@Deprecated
public PagedIterable<GHPullRequest> listPullRequests() {
return owner.root.createRequest()
.withPreview(GROOT)
.withUrlPath(String.format("/repos/%s/%s/commits/%s/pulls", owner.getOwnerName(), owner.getName(), sha))
.toIterable(GHPullRequest[].class, item -> item.wrapUp(owner));
}
/**
* Retrieves a list of branches where this commit is the head commit.
*
* @return {@link PagedIterable} with the branches where the commit is the head commit
* @throws IOException
* the io exception
*/
@Preview(GROOT)
@Deprecated
public PagedIterable<GHBranch> listBranchesWhereHead() throws IOException {
return owner.root.createRequest()
.withPreview(GROOT)
.withUrlPath(String.format("/repos/%s/%s/commits/%s/branches-where-head",
owner.getOwnerName(),
owner.getName(),
sha))
.toIterable(GHBranch[].class, item -> item.wrap(owner));
}
/**
* List comments paged iterable.
*
* @return {@link PagedIterable} with all the commit comments in this repository.
*/
public PagedIterable<GHCommitComment> listComments() {
return owner.root.retrieve()
.asPagedIterable(
String.format("/repos/%s/%s/commits/%s/comments", owner.getOwnerName(), owner.getName(), sha),
GHCommitComment[].class,
item -> item.wrap(owner) );
return owner.root.createRequest()
.withUrlPath(
String.format("/repos/%s/%s/commits/%s/comments", owner.getOwnerName(), owner.getName(), sha))
.toIterable(GHCommitComment[].class, item -> item.wrap(owner));
}
/**
* Creates a commit comment.
*
* <p>
* I'm not sure how path/line/position parameters interact with each other.
*
* @param body
* body of the comment
* @param path
* path of file being commented on
* @param line
* target line for comment
* @param position
* position on line
* @return created GHCommitComment
* @throws IOException
* if comment is not created
*/
public GHCommitComment createComment(String body, String path, Integer line, Integer position) throws IOException {
GHCommitComment r = new Requester(owner.root)
.with("body",body)
.with("path",path)
.with("line",line)
.with("position",position)
.to(String.format("/repos/%s/%s/commits/%s/comments",owner.getOwnerName(),owner.getName(),sha),GHCommitComment.class);
GHCommitComment r = owner.root.createRequest()
.method("POST")
.with("body", body)
.with("path", path)
.with("line", line)
.with("position", position)
.withUrlPath(
String.format("/repos/%s/%s/commits/%s/comments", owner.getOwnerName(), owner.getName(), sha))
.fetch(GHCommitComment.class);
return r.wrap(owner);
}
/**
* Create comment gh commit comment.
*
* @param body
* the body
* @return the gh commit comment
* @throws IOException
* the io exception
*/
public GHCommitComment createComment(String body) throws IOException {
return createComment(body, null, null, null);
}
/**
* Gets the status of this commit, newer ones first.
* List statuses paged iterable.
*
* @return status of this commit, newer ones first.
* @throws IOException
* if statuses cannot be read
*/
public PagedIterable<GHCommitStatus> listStatuses() throws IOException {
return owner.listCommitStatuses(sha);
}
/**
* Gets the last status of this commit, which is what gets shown in the UI.
* Gets last status.
*
* @return the last status of this commit, which is what gets shown in the UI.
* @throws IOException
* on error
*/
public GHCommitStatus getLastStatus() throws IOException {
return owner.getLastCommitStatus(sha);
}
/**
* Gets check-runs for given sha.
*
* @return check runs for given sha.
* @throws IOException
* on error
*/
@Preview(ANTIOPE)
@Deprecated
public PagedIterable<GHCheckRun> getCheckRuns() throws IOException {
return owner.getCheckRuns(sha);
}
/**
* Some of the fields are not always filled in when this object is retrieved as a part of another API call.
*
* @throws IOException
* on error
*/
void populate() throws IOException {
if (files==null && stats==null)
owner.root.retrieve().to(owner.getApiTailUrl("commits/" + sha), this);
if (files == null && stats == null)
owner.root.createRequest().withUrlPath(owner.getApiTailUrl("commits/" + sha)).fetchInto(this);
}
GHCommit wrapUp(GHRepository owner) {

View File

@@ -9,8 +9,7 @@ import java.util.List;
import java.util.TimeZone;
/**
* Builder pattern for creating a new commit.
* Based on https://developer.github.com/v3/git/commits/#create-a-commit
* Builder pattern for creating a new commit. Based on https://developer.github.com/v3/git/commits/#create-a-commit
*/
public class GHCommitBuilder {
private final GHRepository repo;
@@ -35,11 +34,15 @@ public class GHCommitBuilder {
GHCommitBuilder(GHRepository repo) {
this.repo = repo;
req = new Requester(repo.root);
req = repo.root.createRequest().method("POST");
}
/**
* @param message the commit message
* Message gh commit builder.
*
* @param message
* the commit message
* @return the gh commit builder
*/
public GHCommitBuilder message(String message) {
req.with("message", message);
@@ -47,7 +50,11 @@ public class GHCommitBuilder {
}
/**
* @param tree the SHA of the tree object this commit points to
* Tree gh commit builder.
*
* @param tree
* the SHA of the tree object this commit points to
* @return the gh commit builder
*/
public GHCommitBuilder tree(String tree) {
req.with("tree", tree);
@@ -55,7 +62,11 @@ public class GHCommitBuilder {
}
/**
* @param parent the SHA of a parent commit.
* Parent gh commit builder.
*
* @param parent
* the SHA of a parent commit.
* @return the gh commit builder
*/
public GHCommitBuilder parent(String parent) {
parents.add(parent);
@@ -64,17 +75,46 @@ public class GHCommitBuilder {
/**
* Configures the author of this commit.
*
* @param name
* the name
* @param email
* the email
* @param date
* the date
* @return the gh commit builder
*/
public GHCommitBuilder author(String name, String email, Date date) {
req._with("author", new UserInfo(name, email, date));
req.with("author", new UserInfo(name, email, date));
return this;
}
/**
* Configures the PGP signature of this commit.
*
* @param signature
* the signature calculated from the commit
*
* @return the gh commit builder
*/
public GHCommitBuilder withSignature(String signature) {
req.with("signature", signature);
return this;
}
/**
* Configures the committer of this commit.
*
* @param name
* the name
* @param email
* the email
* @param date
* the date
* @return the gh commit builder
*/
public GHCommitBuilder committer(String name, String email, Date date) {
req._with("committer", new UserInfo(name, email, date));
req.with("committer", new UserInfo(name, email, date));
return this;
}
@@ -84,9 +124,13 @@ public class GHCommitBuilder {
/**
* Creates a blob based on the parameters specified thus far.
*
* @return the gh commit
* @throws IOException
* the io exception
*/
public GHCommit create() throws IOException {
req._with("parents", parents);
return req.method("POST").to(getApiTail(), GHCommit.class).wrapUp(repo);
req.with("parents", parents);
return req.method("POST").withUrlPath(getApiTail()).fetch(GHCommit.class).wrapUp(repo);
}
}

View File

@@ -5,67 +5,89 @@ import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.io.IOException;
import java.net.URL;
import static org.kohsuke.github.Previews.*;
import static org.kohsuke.github.internal.Previews.SQUIRREL_GIRL;
/**
* A comment attached to a commit (or a specific line in a specific file of a commit.)
*
* @author Kohsuke Kawaguchi
* @see GHRepository#listCommitComments()
* @see GHCommit#listComments()
* @see GHCommit#createComment(String, String, Integer, Integer)
* @see GHRepository#listCommitComments() GHRepository#listCommitComments()
* @see GHCommit#listComments() GHCommit#listComments()
* @see GHCommit#createComment(String, String, Integer, Integer) GHCommit#createComment(String, String, Integer,
* Integer)
*/
@SuppressFBWarnings(value = {"UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD",
"NP_UNWRITTEN_FIELD"}, justification = "JSON API")
@SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD" },
justification = "JSON API")
public class GHCommitComment extends GHObject implements Reactable {
private GHRepository owner;
String body, html_url, commit_id;
Integer line;
String path;
GHUser user; // not fully populated. beware.
GHUser user; // not fully populated. beware.
/**
* Gets owner.
*
* @return the owner
*/
public GHRepository getOwner() {
return owner;
}
/**
* URL like 'https://github.com/kohsuke/sandbox-ant/commit/8ae38db0ea5837313ab5f39d43a6f73de3bd9000#commitcomment-1252827' to
* URL like
* 'https://github.com/kohsuke/sandbox-ant/commit/8ae38db0ea5837313ab5f39d43a6f73de3bd9000#commitcomment-1252827' to
* show this commit comment in a browser.
*/
public URL getHtmlUrl() {
return GitHub.parseURL(html_url);
return GitHubClient.parseURL(html_url);
}
/**
* Gets sha 1.
*
* @return the sha 1
*/
public String getSHA1() {
return commit_id;
}
/**
* Commit comment in the GitHub flavored markdown format.
*
* @return the body
*/
public String getBody() {
return body;
}
/**
* A commit comment can be on a specific line of a specific file, if so, this field points to a file.
* Otherwise null.
* A commit comment can be on a specific line of a specific file, if so, this field points to a file. Otherwise
* null.
*
* @return the path
*/
public String getPath() {
return path;
}
/**
* A commit comment can be on a specific line of a specific file, if so, this field points to the line number in the file.
* Otherwise -1.
* A commit comment can be on a specific line of a specific file, if so, this field points to the line number in the
* file. Otherwise -1.
*
* @return the line
*/
public int getLine() {
return line!=null ? line : -1;
return line != null ? line : -1;
}
/**
* Gets the user who put this comment.
*
* @return the user
* @throws IOException
* the io exception
*/
public GHUser getUser() throws IOException {
return owner == null || owner.root.isOffline() ? user : owner.root.getUser(user.login);
@@ -73,6 +95,10 @@ public class GHCommitComment extends GHObject implements Reactable {
/**
* Gets the commit to which this comment is associated with.
*
* @return the commit
* @throws IOException
* the io exception
*/
public GHCommit getCommit() throws IOException {
return getOwner().getCommit(getSHA1());
@@ -80,43 +106,56 @@ public class GHCommitComment extends GHObject implements Reactable {
/**
* Updates the body of the commit message.
*
* @param body
* the body
* @throws IOException
* the io exception
*/
public void update(String body) throws IOException {
new Requester(owner.root)
owner.root.createRequest()
.method("PATCH")
.with("body", body)
.method("PATCH").to(getApiTail(), GHCommitComment.class);
.withUrlPath(getApiTail())
.fetch(GHCommitComment.class);
this.body = body;
}
@Preview @Deprecated
@Preview(SQUIRREL_GIRL)
@Deprecated
public GHReaction createReaction(ReactionContent content) throws IOException {
return new Requester(owner.root)
return owner.root.createRequest()
.method("POST")
.withPreview(SQUIRREL_GIRL)
.with("content", content.getContent())
.to(getApiTail()+"/reactions", GHReaction.class).wrap(owner.root);
.withUrlPath(getApiTail() + "/reactions")
.fetch(GHReaction.class)
.wrap(owner.root);
}
@Preview @Deprecated
@Preview(SQUIRREL_GIRL)
@Deprecated
public PagedIterable<GHReaction> listReactions() {
return owner.root.retrieve().withPreview(SQUIRREL_GIRL)
.asPagedIterable(
getApiTail()+"/reactions",
GHReaction[].class,
item -> item.wrap(owner.root) );
return owner.root.createRequest()
.withPreview(SQUIRREL_GIRL)
.withUrlPath(getApiTail() + "/reactions")
.toIterable(GHReaction[].class, item -> item.wrap(owner.root));
}
/**
* Deletes this comment.
*
* @throws IOException
* the io exception
*/
public void delete() throws IOException {
new Requester(owner.root).method("DELETE").to(getApiTail());
owner.root.createRequest().method("DELETE").withUrlPath(getApiTail()).send();
}
private String getApiTail() {
return String.format("/repos/%s/%s/comments/%s",owner.getOwnerName(),owner.getName(),id);
return String.format("/repos/%s/%s/comments/%s", owner.getOwnerName(), owner.getName(), getId());
}
GHCommitComment wrap(GHRepository owner) {
this.owner = owner;
if (owner.root.isOffline()) {

View File

@@ -36,16 +36,22 @@ public class GHCommitPointer {
private GHRepository repo;
/**
* This points to the user who owns
* the {@link #getRepository()}.
* This points to the user who owns the {@link #getRepository()}.
*
* @return the user
* @throws IOException
* the io exception
*/
public GHUser getUser() throws IOException {
if (user != null) return user.root.intern(user);
if (user != null)
return user.root.intern(user);
return user;
}
/**
* The repository that contains the commit.
*
* @return the repository
*/
public GHRepository getRepository() {
return repo;
@@ -53,6 +59,8 @@ public class GHCommitPointer {
/**
* Named ref to the commit. This appears to be a "short ref" that doesn't include "refs/heads/" portion.
*
* @return the ref
*/
public String getRef() {
return ref;
@@ -60,6 +68,8 @@ public class GHCommitPointer {
/**
* SHA1 of the commit.
*
* @return the sha
*/
public String getSha() {
return sha;
@@ -67,6 +77,8 @@ public class GHCommitPointer {
/**
* String that looks like "USERNAME:REF".
*
* @return the label
*/
public String getLabel() {
return label;
@@ -74,13 +86,19 @@ public class GHCommitPointer {
/**
* Obtains the commit that this pointer is referring to.
*
* @return the commit
* @throws IOException
* the io exception
*/
public GHCommit getCommit() throws IOException {
return getRepository().getCommit(getSha());
}
void wrapUp(GitHub root) {
if (user!=null) user.root = root;
if (repo!=null) repo.wrap(root);
if (user != null)
user.root = root;
if (repo != null)
repo.wrap(root);
}
}

View File

@@ -16,57 +16,83 @@ import java.util.Date;
* </pre>
*
* @author Kohsuke Kawaguchi
* @see GHRepository#queryCommits()
*/
* @see GHRepository#queryCommits() GHRepository#queryCommits()
*/
public class GHCommitQueryBuilder {
private final Requester req;
private final GHRepository repo;
/*package*/ GHCommitQueryBuilder(GHRepository repo) {
GHCommitQueryBuilder(GHRepository repo) {
this.repo = repo;
this.req = repo.root.retrieve(); // requester to build up
this.req = repo.root.createRequest(); // requester to build up
}
/**
* GItHub login or email address by which to filter by commit author.
*
* @param author
* the author
* @return the gh commit query builder
*/
public GHCommitQueryBuilder author(String author) {
req.with("author",author);
req.with("author", author);
return this;
}
/**
* Only commits containing this file path will be returned.
*
* @param path
* the path
* @return the gh commit query builder
*/
public GHCommitQueryBuilder path(String path) {
req.with("path",path);
req.with("path", path);
return this;
}
/**
* Specifies the SHA1 commit / tag / branch / etc to start listing commits from.
*
* @param ref
* the ref
* @return the gh commit query builder
*/
public GHCommitQueryBuilder from(String ref) {
req.with("sha",ref);
req.with("sha", ref);
return this;
}
/**
* Page size gh commit query builder.
*
* @param pageSize
* the page size
* @return the gh commit query builder
*/
public GHCommitQueryBuilder pageSize(int pageSize) {
req.with("per_page",pageSize);
req.with("per_page", pageSize);
return this;
}
/**
* Only commits after this date will be returned
*
* @param dt
* the dt
* @return the gh commit query builder
*/
public GHCommitQueryBuilder since(Date dt) {
req.with("since",GitHub.printDate(dt));
req.with("since", GitHubClient.printDate(dt));
return this;
}
/**
* Only commits after this date will be returned
*
* @param timestamp
* the timestamp
* @return the gh commit query builder
*/
public GHCommitQueryBuilder since(long timestamp) {
return since(new Date(timestamp));
@@ -74,14 +100,22 @@ public class GHCommitQueryBuilder {
/**
* Only commits before this date will be returned
*
* @param dt
* the dt
* @return the gh commit query builder
*/
public GHCommitQueryBuilder until(Date dt) {
req.with("until",GitHub.printDate(dt));
req.with("until", GitHubClient.printDate(dt));
return this;
}
/**
* Only commits before this date will be returned
*
* @param timestamp
* the timestamp
* @return the gh commit query builder
*/
public GHCommitQueryBuilder until(long timestamp) {
return until(new Date(timestamp));
@@ -89,12 +123,10 @@ public class GHCommitQueryBuilder {
/**
* Lists up the commits with the criteria built so far.
*
* @return the paged iterable
*/
public PagedIterable<GHCommit> list() {
return req
.asPagedIterable(
repo.getApiTailUrl("commits"),
GHCommit[].class,
item -> item.wrapUp(repo) );
return req.withUrlPath(repo.getApiTailUrl("commits")).toIterable(GHCommit[].class, item -> item.wrapUp(repo));
}
}

View File

@@ -1,6 +1,7 @@
package org.kohsuke.github;
import org.apache.commons.lang3.StringUtils;
import org.kohsuke.github.internal.Previews;
import java.io.IOException;
@@ -8,12 +9,13 @@ import java.io.IOException;
* Search commits.
*
* @author Marc de Verdelhan
* @see GitHub#searchCommits()
* @see GitHub#searchCommits() GitHub#searchCommits()
*/
@Preview @Deprecated
@Preview(Previews.CLOAK)
@Deprecated
public class GHCommitSearchBuilder extends GHSearchBuilder<GHCommit> {
/*package*/ GHCommitSearchBuilder(GitHub root) {
super(root,CommitSearchResult.class);
GHCommitSearchBuilder(GitHub root) {
super(root, CommitSearchResult.class);
req.withPreview(Previews.CLOAK);
}
@@ -25,107 +27,240 @@ public class GHCommitSearchBuilder extends GHSearchBuilder<GHCommit> {
return this;
}
/**
* Author gh commit search builder.
*
* @param v
* the v
* @return the gh commit search builder
*/
public GHCommitSearchBuilder author(String v) {
return q("author:"+v);
return q("author:" + v);
}
/**
* Committer gh commit search builder.
*
* @param v
* the v
* @return the gh commit search builder
*/
public GHCommitSearchBuilder committer(String v) {
return q("committer:"+v);
return q("committer:" + v);
}
/**
* Author name gh commit search builder.
*
* @param v
* the v
* @return the gh commit search builder
*/
public GHCommitSearchBuilder authorName(String v) {
return q("author-name:"+v);
return q("author-name:" + v);
}
/**
* Committer name gh commit search builder.
*
* @param v
* the v
* @return the gh commit search builder
*/
public GHCommitSearchBuilder committerName(String v) {
return q("committer-name:"+v);
return q("committer-name:" + v);
}
/**
* Author email gh commit search builder.
*
* @param v
* the v
* @return the gh commit search builder
*/
public GHCommitSearchBuilder authorEmail(String v) {
return q("author-email:"+v);
return q("author-email:" + v);
}
/**
* Committer email gh commit search builder.
*
* @param v
* the v
* @return the gh commit search builder
*/
public GHCommitSearchBuilder committerEmail(String v) {
return q("committer-email:"+v);
return q("committer-email:" + v);
}
/**
* Author date gh commit search builder.
*
* @param v
* the v
* @return the gh commit search builder
*/
public GHCommitSearchBuilder authorDate(String v) {
return q("author-date:"+v);
return q("author-date:" + v);
}
/**
* Committer date gh commit search builder.
*
* @param v
* the v
* @return the gh commit search builder
*/
public GHCommitSearchBuilder committerDate(String v) {
return q("committer-date:"+v);
return q("committer-date:" + v);
}
/**
* Merge gh commit search builder.
*
* @param merge
* the merge
* @return the gh commit search builder
*/
public GHCommitSearchBuilder merge(boolean merge) {
return q("merge:"+Boolean.valueOf(merge).toString().toLowerCase());
return q("merge:" + Boolean.valueOf(merge).toString().toLowerCase());
}
/**
* Hash gh commit search builder.
*
* @param v
* the v
* @return the gh commit search builder
*/
public GHCommitSearchBuilder hash(String v) {
return q("hash:"+v);
return q("hash:" + v);
}
/**
* Parent gh commit search builder.
*
* @param v
* the v
* @return the gh commit search builder
*/
public GHCommitSearchBuilder parent(String v) {
return q("parent:"+v);
return q("parent:" + v);
}
/**
* Tree gh commit search builder.
*
* @param v
* the v
* @return the gh commit search builder
*/
public GHCommitSearchBuilder tree(String v) {
return q("tree:"+v);
return q("tree:" + v);
}
/**
* Is gh commit search builder.
*
* @param v
* the v
* @return the gh commit search builder
*/
public GHCommitSearchBuilder is(String v) {
return q("is:"+v);
return q("is:" + v);
}
/**
* User gh commit search builder.
*
* @param v
* the v
* @return the gh commit search builder
*/
public GHCommitSearchBuilder user(String v) {
return q("user:"+v);
return q("user:" + v);
}
/**
* Org gh commit search builder.
*
* @param v
* the v
* @return the gh commit search builder
*/
public GHCommitSearchBuilder org(String v) {
return q("org:"+v);
return q("org:" + v);
}
/**
* Repo gh commit search builder.
*
* @param v
* the v
* @return the gh commit search builder
*/
public GHCommitSearchBuilder repo(String v) {
return q("repo:"+v);
return q("repo:" + v);
}
/**
* Order gh commit search builder.
*
* @param v
* the v
* @return the gh commit search builder
*/
public GHCommitSearchBuilder order(GHDirection v) {
req.with("order",v);
req.with("order", v);
return this;
}
/**
* Sort gh commit search builder.
*
* @param sort
* the sort
* @return the gh commit search builder
*/
public GHCommitSearchBuilder sort(Sort sort) {
req.with("sort",sort);
req.with("sort", sort);
return this;
}
public enum Sort { AUTHOR_DATE, COMMITTER_DATE }
/**
* The enum Sort.
*/
public enum Sort {
AUTHOR_DATE, COMMITTER_DATE
}
private static class CommitSearchResult extends SearchResult<GHCommit> {
private GHCommit[] items;
@Override
/*package*/ GHCommit[] getItems(GitHub root) {
GHCommit[] getItems(GitHub root) {
for (GHCommit commit : items) {
String repoName = getRepoName(commit.url);
try {
GHRepository repo = root.getRepository(repoName);
commit.wrapUp(repo);
} catch (IOException ioe) {}
} catch (IOException ioe) {
}
}
return items;
}
}
/**
* @param commitUrl a commit URL
* @param commitUrl
* a commit URL
* @return the repo name ("username/reponame")
*/
private static String getRepoName(String commitUrl) {
if (StringUtils.isBlank(commitUrl)) {
return null;
}
int indexOfUsername = (GitHub.GITHUB_URL + "/repos/").length();
int indexOfUsername = (GitHubClient.GITHUB_URL + "/repos/").length();
String[] tokens = commitUrl.substring(indexOfUsername).split("/", 3);
return tokens[0] + '/' + tokens[1];
}

View File

@@ -7,49 +7,73 @@ import java.net.URL;
* Represents a status of a commit.
*
* @author Kohsuke Kawaguchi
* @see GHRepository#getLastCommitStatus(String)
* @see GHCommit#getLastStatus()
* @see GHRepository#createCommitStatus(String, GHCommitState, String, String)
* @see GHRepository#getLastCommitStatus(String) GHRepository#getLastCommitStatus(String)
* @see GHCommit#getLastStatus() GHCommit#getLastStatus()
* @see GHRepository#createCommitStatus(String, GHCommitState, String, String) GHRepository#createCommitStatus(String,
* GHCommitState, String, String)
*/
public class GHCommitStatus extends GHObject {
String state;
String target_url,description;
String target_url, description;
String context;
GHUser creator;
private GitHub root;
/*package*/ GHCommitStatus wrapUp(GitHub root) {
if (creator!=null) creator.wrapUp(root);
GHCommitStatus wrapUp(GitHub root) {
if (creator != null)
creator.wrapUp(root);
this.root = root;
return this;
}
/**
* Gets state.
*
* @return the state
*/
public GHCommitState getState() {
for (GHCommitState s : GHCommitState.values()) {
if (s.name().equalsIgnoreCase(state))
return s;
}
throw new IllegalStateException("Unexpected state: "+state);
throw new IllegalStateException("Unexpected state: " + state);
}
/**
* The URL that this status is linked to.
*
* <p>
* This is the URL specified when creating a commit status.
*
* @return the target url
*/
public String getTargetUrl() {
return target_url;
}
/**
* Gets description.
*
* @return the description
*/
public String getDescription() {
return description;
}
/**
* Gets creator.
*
* @return the creator
* @throws IOException
* the io exception
*/
public GHUser getCreator() throws IOException {
return root.intern(creator);
}
/**
* Gets context.
*
* @return the context
*/
public String getContext() {
return context;
}

View File

@@ -21,52 +21,108 @@ public class GHCompare {
private GHRepository owner;
/**
* Gets url.
*
* @return the url
*/
public URL getUrl() {
return GitHub.parseURL(url);
return GitHubClient.parseURL(url);
}
/**
* Gets html url.
*
* @return the html url
*/
public URL getHtmlUrl() {
return GitHub.parseURL(html_url);
return GitHubClient.parseURL(html_url);
}
/**
* Gets permalink url.
*
* @return the permalink url
*/
public URL getPermalinkUrl() {
return GitHub.parseURL(permalink_url);
return GitHubClient.parseURL(permalink_url);
}
/**
* Gets diff url.
*
* @return the diff url
*/
public URL getDiffUrl() {
return GitHub.parseURL(diff_url);
return GitHubClient.parseURL(diff_url);
}
/**
* Gets patch url.
*
* @return the patch url
*/
public URL getPatchUrl() {
return GitHub.parseURL(patch_url);
return GitHubClient.parseURL(patch_url);
}
/**
* Gets status.
*
* @return the status
*/
public Status getStatus() {
return status;
}
/**
* Gets ahead by.
*
* @return the ahead by
*/
public int getAheadBy() {
return ahead_by;
}
/**
* Gets behind by.
*
* @return the behind by
*/
public int getBehindBy() {
return behind_by;
}
/**
* Gets total commits.
*
* @return the total commits
*/
public int getTotalCommits() {
return total_commits;
}
/**
* Gets base commit.
*
* @return the base commit
*/
public Commit getBaseCommit() {
return base_commit;
}
/**
* Gets merge base commit.
*
* @return the merge base commit
*/
public Commit getMergeBaseCommit() {
return merge_base_commit;
}
/**
* Gets an array of commits.
*
* @return A copy of the array being stored in the class.
*/
public Commit[] getCommits() {
@@ -74,9 +130,10 @@ public class GHCompare {
System.arraycopy(commits, 0, newValue, 0, commits.length);
return newValue;
}
/**
* Gets an array of commits.
*
* @return A copy of the array being stored in the class.
*/
public GHCommit.File[] getFiles() {
@@ -85,6 +142,13 @@ public class GHCompare {
return newValue;
}
/**
* Wrap gh compare.
*
* @param owner
* the owner
* @return the gh compare
*/
public GHCompare wrap(GHRepository owner) {
this.owner = owner;
for (Commit commit : commits) {
@@ -96,71 +160,126 @@ public class GHCompare {
}
/**
* Compare commits had a child commit element with additional details we want to capture.
* This extenstion of GHCommit provides that.
* Compare commits had a child commit element with additional details we want to capture. This extenstion of
* GHCommit provides that.
*/
@SuppressFBWarnings(value = {"UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD"},
@SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD" },
justification = "JSON API")
public static class Commit extends GHCommit {
private InnerCommit commit;
/**
* Gets commit.
*
* @return the commit
*/
public InnerCommit getCommit() {
return commit;
}
}
/**
* The type InnerCommit.
*/
public static class InnerCommit {
private String url, sha, message;
private User author, committer;
private Tree tree;
/**
* Gets url.
*
* @return the url
*/
public String getUrl() {
return url;
}
/**
* Gets sha.
*
* @return the sha
*/
public String getSha() {
return sha;
}
/**
* Gets message.
*
* @return the message
*/
public String getMessage() {
return message;
}
@WithBridgeMethods(value=User.class,castRequired=true)
/**
* Gets author.
*
* @return the author
*/
@WithBridgeMethods(value = User.class, castRequired = true)
public GitUser getAuthor() {
return author;
}
@WithBridgeMethods(value=User.class,castRequired=true)
/**
* Gets committer.
*
* @return the committer
*/
@WithBridgeMethods(value = User.class, castRequired = true)
public GitUser getCommitter() {
return committer;
}
/**
* Gets tree.
*
* @return the tree
*/
public Tree getTree() {
return tree;
}
}
/**
* The type Tree.
*/
public static class Tree {
private String url, sha;
/**
* Gets url.
*
* @return the url
*/
public String getUrl() {
return url;
}
/**
* Gets sha.
*
* @return the sha
*/
public String getSha() {
return sha;
}
}
/**
* The type User.
*
* @deprecated use {@link GitUser} instead.
*/
public static class User extends GitUser {
}
/**
* The enum Status.
*/
public static enum Status {
behind, ahead, identical, diverged
}

View File

@@ -1,110 +1,169 @@
package org.kohsuke.github;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.codec.binary.Base64InputStream;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets;
import java.util.Base64;
/**
* A Content of a repository.
*
* @author Alexandre COLLIGNON
* @see GHRepository#getFileContent(String)
* @see GHRepository#getFileContent(String) GHRepository#getFileContent(String)
*/
@SuppressWarnings({"UnusedDeclaration"})
public class GHContent implements Refreshable {
@SuppressWarnings({ "UnusedDeclaration" })
public class GHContent extends GitHubInteractiveObject implements Refreshable {
/*
In normal use of this class, repository field is set via wrap(),
but in the code search API, there's a nested 'repository' field that gets populated from JSON.
* In normal use of this class, repository field is set via wrap(), but in the code search API, there's a nested
* 'repository' field that gets populated from JSON.
*/
private GHRepository repository;
private GitHub root;
private String type;
private String encoding;
private long size;
private String sha;
private String name;
private String path;
private String target;
private String content;
private String url; // this is the API url
private String git_url; // this is the Blob url
private String html_url; // this is the UI
private String git_url; // this is the Blob url
private String html_url; // this is the UI
private String download_url;
/**
* Gets owner.
*
* @return the owner
*/
public GHRepository getOwner() {
return repository;
}
/**
* Gets type.
*
* @return the type
*/
public String getType() {
return type;
}
/**
* Gets encoding.
*
* @return the encoding
*/
public String getEncoding() {
return encoding;
}
/**
* Gets size.
*
* @return the size
*/
public long getSize() {
return size;
}
/**
* Gets sha.
*
* @return the sha
*/
public String getSha() {
return sha;
}
/**
* Gets name.
*
* @return the name
*/
public String getName() {
return name;
}
/**
* Gets path.
*
* @return the path
*/
public String getPath() {
return path;
}
/**
* Gets target of a symlink. This will only be set if {@code "symlink".equals(getType())}
*
* @return the target
*/
public String getTarget() {
return target;
}
/**
* Retrieve the decoded content that is stored at this location.
*
* <p>
* Due to the nature of GitHub's API, you're not guaranteed that
* the content will already be populated, so this may trigger
* network activity, and can throw an IOException.
* Due to the nature of GitHub's API, you're not guaranteed that the content will already be populated, so this may
* trigger network activity, and can throw an IOException.
*
* @deprecated
* Use {@link #read()}
* @return the content
* @throws IOException
* the io exception
* @deprecated Use {@link #read()}
*/
@SuppressFBWarnings("DM_DEFAULT_ENCODING")
public String getContent() throws IOException {
return new String(Base64.decodeBase64(getEncodedContent()));
return new String(Base64.getMimeDecoder().decode(getEncodedContent()));
}
/**
* Retrieve the base64-encoded content that is stored at this location.
*
* <p>
* Due to the nature of GitHub's API, you're not guaranteed that
* the content will already be populated, so this may trigger
* network activity, and can throw an IOException.
* Due to the nature of GitHub's API, you're not guaranteed that the content will already be populated, so this may
* trigger network activity, and can throw an IOException.
*
* @deprecated
* Use {@link #read()}
* @return the encoded content
* @throws IOException
* the io exception
* @deprecated Use {@link #read()}
*/
public String getEncodedContent() throws IOException {
refresh(content);
return content;
}
/**
* Gets url.
*
* @return the url
*/
public String getUrl() {
return url;
}
/**
* Gets git url.
*
* @return the git url
*/
public String getGitUrl() {
return git_url;
}
/**
* Gets html url.
*
* @return the html url
*/
public String getHtmlUrl() {
return html_url;
}
@@ -114,88 +173,161 @@ public class GHContent implements Refreshable {
*/
/**
* Retrieves the actual bytes of the blob.
*
* @return the input stream
* @throws IOException
* the io exception
*/
public InputStream read() throws IOException {
refresh(content);
if (encoding.equals("base64")) {
try {
return new Base64InputStream(new ByteArrayInputStream(content.getBytes("US-ASCII")), false);
} catch (UnsupportedEncodingException e) {
throw new AssertionError(e); // US-ASCII is mandatory
Base64.Decoder decoder = Base64.getMimeDecoder();
return new ByteArrayInputStream(decoder.decode(content.getBytes(StandardCharsets.US_ASCII)));
} catch (IllegalArgumentException e) {
throw new AssertionError(e); // US-ASCII is mandatory
}
}
throw new UnsupportedOperationException("Unrecognized encoding: "+encoding);
throw new UnsupportedOperationException("Unrecognized encoding: " + encoding);
}
/**
* URL to retrieve the raw content of the file. Null if this is a directory.
*
* @return the download url
* @throws IOException
* the io exception
*/
public String getDownloadUrl() throws IOException {
refresh(download_url);
return download_url;
}
/**
* Is file boolean.
*
* @return the boolean
*/
public boolean isFile() {
return "file".equals(type);
}
/**
* Is directory boolean.
*
* @return the boolean
*/
public boolean isDirectory() {
return "dir".equals(type);
}
/**
* Fully populate the data by retrieving missing data.
*
* <p>
* Depending on the original API call where this object is created, it may not contain everything.
*
* @throws IOException
* the io exception
*/
protected synchronized void populate() throws IOException {
root.retrieve().to(url, this);
root.createRequest().withUrlPath(url).fetchInto(this);
}
/**
* List immediate children of this directory.
*
* @return the paged iterable
* @throws IOException
* the io exception
*/
public PagedIterable<GHContent> listDirectoryContent() throws IOException {
if (!isDirectory())
throw new IllegalStateException(path+" is not a directory");
throw new IllegalStateException(path + " is not a directory");
return root.retrieve()
.asPagedIterable(
url,
GHContent[].class,
item -> item.wrap(repository) );
return root.createRequest().setRawUrlPath(url).toIterable(GHContent[].class, item -> item.wrap(repository));
}
/**
* Update gh content update response.
*
* @param newContent
* the new content
* @param commitMessage
* the commit message
* @return the gh content update response
* @throws IOException
* the io exception
*/
@SuppressFBWarnings("DM_DEFAULT_ENCODING")
public GHContentUpdateResponse update(String newContent, String commitMessage) throws IOException {
return update(newContent.getBytes(), commitMessage, null);
}
/**
* Update gh content update response.
*
* @param newContent
* the new content
* @param commitMessage
* the commit message
* @param branch
* the branch
* @return the gh content update response
* @throws IOException
* the io exception
*/
@SuppressFBWarnings("DM_DEFAULT_ENCODING")
public GHContentUpdateResponse update(String newContent, String commitMessage, String branch) throws IOException {
return update(newContent.getBytes(), commitMessage, branch);
}
/**
* Update gh content update response.
*
* @param newContentBytes
* the new content bytes
* @param commitMessage
* the commit message
* @return the gh content update response
* @throws IOException
* the io exception
*/
public GHContentUpdateResponse update(byte[] newContentBytes, String commitMessage) throws IOException {
return update(newContentBytes, commitMessage, null);
}
public GHContentUpdateResponse update(byte[] newContentBytes, String commitMessage, String branch) throws IOException {
String encodedContent = Base64.encodeBase64String(newContentBytes);
/**
* Update gh content update response.
*
* @param newContentBytes
* the new content bytes
* @param commitMessage
* the commit message
* @param branch
* the branch
* @return the gh content update response
* @throws IOException
* the io exception
*/
public GHContentUpdateResponse update(byte[] newContentBytes, String commitMessage, String branch)
throws IOException {
String encodedContent = Base64.getEncoder().encodeToString(newContentBytes);
Requester requester = new Requester(root)
.with("path", path)
.with("message", commitMessage)
.with("sha", sha)
.with("content", encodedContent)
.method("PUT");
Requester requester = root.createRequest()
.method("POST")
.with("path", path)
.with("message", commitMessage)
.with("sha", sha)
.with("content", encodedContent)
.method("PUT");
if (branch != null) {
requester.with("branch", branch);
}
GHContentUpdateResponse response = requester.to(getApiRoute(), GHContentUpdateResponse.class);
GHContentUpdateResponse response = requester.withUrlPath(getApiRoute(repository, path))
.fetch(GHContentUpdateResponse.class);
response.getContent().wrap(repository);
response.getCommit().wrapUp(repository);
@@ -204,29 +336,51 @@ public class GHContent implements Refreshable {
return response;
}
/**
* Delete gh content update response.
*
* @param message
* the message
* @return the gh content update response
* @throws IOException
* the io exception
*/
public GHContentUpdateResponse delete(String message) throws IOException {
return delete(message, null);
}
/**
* Delete gh content update response.
*
* @param commitMessage
* the commit message
* @param branch
* the branch
* @return the gh content update response
* @throws IOException
* the io exception
*/
public GHContentUpdateResponse delete(String commitMessage, String branch) throws IOException {
Requester requester = new Requester(root)
.with("path", path)
.with("message", commitMessage)
.with("sha", sha)
.method("DELETE");
Requester requester = root.createRequest()
.method("POST")
.with("path", path)
.with("message", commitMessage)
.with("sha", sha)
.method("DELETE");
if (branch != null) {
requester.with("branch", branch);
}
GHContentUpdateResponse response = requester.to(getApiRoute(), GHContentUpdateResponse.class);
GHContentUpdateResponse response = requester.withUrlPath(getApiRoute(repository, path))
.fetch(GHContentUpdateResponse.class);
response.getCommit().wrapUp(repository);
return response;
}
private String getApiRoute() {
return "/repos/" + repository.getOwnerName() + "/" + repository.getName() + "/contents/" + path;
static String getApiRoute(GHRepository repository, String path) {
return repository.getApiTailUrl("contents/" + path);
}
GHContent wrap(GHRepository owner) {
@@ -234,21 +388,14 @@ public class GHContent implements Refreshable {
this.root = owner.root;
return this;
}
GHContent wrap(GitHub root) {
this.root = root;
if (repository!=null)
if (repository != null)
repository.wrap(root);
return this;
}
public static GHContent[] wrap(GHContent[] contents, GHRepository repository) {
for (GHContent unwrappedContent : contents) {
unwrappedContent.wrap(repository);
}
return contents;
}
/**
* Fully populate the data by retrieving missing data.
*
@@ -256,6 +403,6 @@ public class GHContent implements Refreshable {
*/
@Override
public synchronized void refresh() throws IOException {
root.retrieve().to(url, this);
root.createRequest().setRawUrlPath(url).fetchInto(this);
}
}

View File

@@ -1,9 +1,8 @@
package org.kohsuke.github;
import org.apache.commons.codec.binary.Base64;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.nio.charset.StandardCharsets;
import java.util.Base64;
/**
* Used to create/update content.
@@ -12,7 +11,7 @@ import java.io.UnsupportedEncodingException;
* Call various methods to build up parameters, then call {@link #commit()} to make the change effective.
*
* @author Kohsuke Kawaguchi
* @see GHRepository#createContent()
* @see GHRepository#createContent() GHRepository#createContent()
*/
public final class GHContentBuilder {
private final GHRepository repo;
@@ -21,42 +20,76 @@ public final class GHContentBuilder {
GHContentBuilder(GHRepository repo) {
this.repo = repo;
this.req = new Requester(repo.root).method("PUT");
this.req = repo.root.createRequest().method("PUT");
}
/**
* Path gh content builder.
*
* @param path
* the path
* @return the gh content builder
*/
public GHContentBuilder path(String path) {
this.path = path;
req.with("path",path);
req.with("path", path);
return this;
}
/**
* Branch gh content builder.
*
* @param branch
* the branch
* @return the gh content builder
*/
public GHContentBuilder branch(String branch) {
req.with("branch", branch);
return this;
}
/**
* Used when updating (but not creating a new content) to specify
* Thetblob SHA of the file being replaced.
* Used when updating (but not creating a new content) to specify the blob SHA of the file being replaced.
*
* @param sha
* the sha
* @return the gh content builder
*/
public GHContentBuilder sha(String sha) {
req.with("sha", sha);
return this;
}
/**
* Content gh content builder.
*
* @param content
* the content
* @return the gh content builder
*/
public GHContentBuilder content(byte[] content) {
req.with("content", Base64.encodeBase64String(content));
req.with("content", Base64.getEncoder().encodeToString(content));
return this;
}
/**
* Content gh content builder.
*
* @param content
* the content
* @return the gh content builder
*/
public GHContentBuilder content(String content) {
try {
return content(content.getBytes("UTF-8"));
} catch (UnsupportedEncodingException x) {
throw new AssertionError();
}
return content(content.getBytes(StandardCharsets.UTF_8));
}
/**
* Message gh content builder.
*
* @param commitMessage
* the commit message
* @return the gh content builder
*/
public GHContentBuilder message(String commitMessage) {
req.with("message", commitMessage);
return this;
@@ -64,9 +97,14 @@ public final class GHContentBuilder {
/**
* Commits a new content.
*
* @return the gh content update response
* @throws IOException
* the io exception
*/
public GHContentUpdateResponse commit() throws IOException {
GHContentUpdateResponse response = req.to(repo.getApiTailUrl("contents/" + path), GHContentUpdateResponse.class);
GHContentUpdateResponse response = req.withUrlPath(GHContent.getApiRoute(repo, path))
.fetch(GHContentUpdateResponse.class);
response.getContent().wrap(repo);
response.getCommit().wrapUp(repo);

View File

@@ -4,11 +4,11 @@ package org.kohsuke.github;
* Search code for {@link GHContent}.
*
* @author Kohsuke Kawaguchi
* @see GitHub#searchContent()
* @see GitHub#searchContent() GitHub#searchContent()
*/
public class GHContentSearchBuilder extends GHSearchBuilder<GHContent> {
/*package*/ GHContentSearchBuilder(GitHub root) {
super(root,ContentSearchResult.class);
GHContentSearchBuilder(GitHub root) {
super(root, ContentSearchResult.class);
}
/**
@@ -19,48 +19,145 @@ public class GHContentSearchBuilder extends GHSearchBuilder<GHContent> {
return this;
}
/**
* In gh content search builder.
*
* @param v
* the v
* @return the gh content search builder
*/
public GHContentSearchBuilder in(String v) {
return q("in:"+v);
return q("in:" + v);
}
/**
* Language gh content search builder.
*
* @param v
* the v
* @return the gh content search builder
*/
public GHContentSearchBuilder language(String v) {
return q("language:"+v);
return q("language:" + v);
}
/**
* Fork gh content search builder.
*
* @param v
* the v
* @return the gh content search builder
*/
public GHContentSearchBuilder fork(String v) {
return q("fork:"+v);
return q("fork:" + v);
}
/**
* Size gh content search builder.
*
* @param v
* the v
* @return the gh content search builder
*/
public GHContentSearchBuilder size(String v) {
return q("size:"+v);
return q("size:" + v);
}
/**
* Path gh content search builder.
*
* @param v
* the v
* @return the gh content search builder
*/
public GHContentSearchBuilder path(String v) {
return q("path:"+v);
return q("path:" + v);
}
/**
* Filename gh content search builder.
*
* @param v
* the v
* @return the gh content search builder
*/
public GHContentSearchBuilder filename(String v) {
return q("filename:"+v);
return q("filename:" + v);
}
/**
* Extension gh content search builder.
*
* @param v
* the v
* @return the gh content search builder
*/
public GHContentSearchBuilder extension(String v) {
return q("extension:"+v);
return q("extension:" + v);
}
/**
* User gh content search builder.
*
* @param v
* the v
* @return the gh content search builder
*/
public GHContentSearchBuilder user(String v) {
return q("user:"+v);
return q("user:" + v);
}
/**
* Repo gh content search builder.
*
* @param v
* the v
* @return the gh content search builder
*/
public GHContentSearchBuilder repo(String v) {
return q("repo:"+v);
return q("repo:" + v);
}
/**
* Order gh content search builder.
*
* @param v
* the v
* @return the gh content search builder
*/
public GHContentSearchBuilder order(GHDirection v) {
req.with("order", v);
return this;
}
/**
* Sort gh content search builder.
*
* @param sort
* the sort
* @return the gh content search builder
*/
public GHContentSearchBuilder sort(GHContentSearchBuilder.Sort sort) {
if (Sort.BEST_MATCH.equals(sort)) {
req.remove("sort");
} else {
req.with("sort", sort);
}
return this;
}
/**
* The enum Sort.
*/
public enum Sort {
BEST_MATCH, INDEXED
}
private static class ContentSearchResult extends SearchResult<GHContent> {
private GHContent[] items;
@Override
/*package*/ GHContent[] getItems(GitHub root) {
GHContent[] getItems(GitHub root) {
for (GHContent item : items)
item.wrap(root);
return items;

View File

@@ -1,17 +1,26 @@
package org.kohsuke.github;
/**
* The response that is returned when updating
* repository content.
**/
* The response that is returned when updating repository content.
*/
public class GHContentUpdateResponse {
private GHContent content;
private GHCommit commit;
/**
* Gets content.
*
* @return the content
*/
public GHContent getContent() {
return content;
}
/**
* Gets commit.
*
* @return the commit
*/
public GHCommit getCommit() {
return commit;
}

View File

@@ -13,7 +13,7 @@ class GHContentWithLicense extends GHContent {
@Override
GHContentWithLicense wrap(GHRepository owner) {
super.wrap(owner);
if (license!=null)
if (license != null)
license.wrap(owner.root);
return this;
}

View File

@@ -1,138 +1,134 @@
package org.kohsuke.github;
import java.io.IOException;
import java.net.URL;
import static org.kohsuke.github.internal.Previews.BAPTISTE;
/**
* Creates a repository
*
* @author Kohsuke Kawaguchi
*/
public class GHCreateRepositoryBuilder {
private final GitHub root;
protected final Requester builder;
private final String apiUrlTail;
public class GHCreateRepositoryBuilder extends GHRepositoryBuilder<GHCreateRepositoryBuilder> {
/*package*/ GHCreateRepositoryBuilder(GitHub root, String apiUrlTail, String name) {
this.root = root;
this.apiUrlTail = apiUrlTail;
this.builder = new Requester(root);
this.builder.with("name",name);
}
public GHCreateRepositoryBuilder(String name, GitHub root, String apiTail) {
super(GHCreateRepositoryBuilder.class, root, null);
requester.method("POST").withUrlPath(apiTail);
public GHCreateRepositoryBuilder description(String description) {
this.builder.with("description",description);
return this;
}
public GHCreateRepositoryBuilder homepage(URL homepage) {
return homepage(homepage.toExternalForm());
}
public GHCreateRepositoryBuilder homepage(String homepage) {
this.builder.with("homepage",homepage);
return this;
}
/**
* Creates a private repository
*/
public GHCreateRepositoryBuilder private_(boolean b) {
this.builder.with("private",b);
return this;
}
/**
* Enables issue tracker
*/
public GHCreateRepositoryBuilder issues(boolean b) {
this.builder.with("has_issues",b);
return this;
}
/**
* Enables wiki
*/
public GHCreateRepositoryBuilder wiki(boolean b) {
this.builder.with("has_wiki",b);
return this;
}
/**
* Enables downloads
*/
public GHCreateRepositoryBuilder downloads(boolean b) {
this.builder.with("has_downloads",b);
return this;
}
/**
* If true, create an initial commit with empty README.
*/
public GHCreateRepositoryBuilder autoInit(boolean b) {
this.builder.with("auto_init",b);
return this;
}
/**
* Allow or disallow squash-merging pull requests.
*/
public GHCreateRepositoryBuilder allowSquashMerge(boolean b) {
this.builder.with("allow_squash_merge",b);
return this;
}
/**
* Allow or disallow merging pull requests with a merge commit.
*/
public GHCreateRepositoryBuilder allowMergeCommit(boolean b) {
this.builder.with("allow_merge_commit",b);
return this;
}
/**
* Allow or disallow rebase-merging pull requests.
*/
public GHCreateRepositoryBuilder allowRebaseMerge(boolean b) {
this.builder.with("allow_rebase_merge",b);
return this;
try {
name(name);
} catch (IOException e) {
// not going to happen here
}
}
/**
* Creates a default .gitignore
*
* See https://developer.github.com/v3/repos/#create
* @param language
* template to base the ignore file on
* @return a builder to continue with building See https://developer.github.com/v3/repos/#create
* @throws IOException
* In case of any networking error or error from the server.
*/
public GHCreateRepositoryBuilder gitignoreTemplate(String language) {
this.builder.with("gitignore_template",language);
return this;
public GHCreateRepositoryBuilder gitignoreTemplate(String language) throws IOException {
return with("gitignore_template", language);
}
/**
* Desired license template to apply
*
* See https://developer.github.com/v3/repos/#create
* @param license
* template to base the license file on
* @return a builder to continue with building See https://developer.github.com/v3/repos/#create
* @throws IOException
* In case of any networking error or error from the server.
*/
public GHCreateRepositoryBuilder licenseTemplate(String license) {
this.builder.with("license_template",license);
public GHCreateRepositoryBuilder licenseTemplate(String license) throws IOException {
return with("license_template", license);
}
/**
* If true, create an initial commit with empty README.
*
* @param enabled
* true if enabled
* @return a builder to continue with building
* @throws IOException
* In case of any networking error or error from the server.
*/
public GHCreateRepositoryBuilder autoInit(boolean enabled) throws IOException {
return with("auto_init", enabled);
}
/**
* The team that gets granted access to this repository. Only valid for creating a repository in an organization.
*
* @param team
* team to grant access to
* @return a builder to continue with building
* @throws IOException
* In case of any networking error or error from the server.
*/
public GHCreateRepositoryBuilder team(GHTeam team) throws IOException {
if (team != null)
return with("team_id", team.getId());
return this;
}
/**
* The team that gets granted access to this repository. Only valid for creating a repository in
* an organization.
* Specifies whether the repository is a template.
*
* @param enabled
* true if enabled
* @return a builder to continue with building
* @throws IOException
* In case of any networking error or error from the server.
* @deprecated Use {@link #isTemplate(boolean)} method instead
*/
public GHCreateRepositoryBuilder team(GHTeam team) {
if (team!=null)
this.builder.with("team_id",team.getId());
@Deprecated
public GHCreateRepositoryBuilder templateRepository(boolean enabled) throws IOException {
return isTemplate(enabled);
}
/**
* Specifies the ownership of the repository.
*
* @param owner
* organization or personage
* @return a builder to continue with building
* @throws IOException
* In case of any networking error or error from the server.
*/
public GHCreateRepositoryBuilder owner(String owner) throws IOException {
return with("owner", owner);
}
/**
* Create repository from template repository
*
* @param templateOwner
* template repository owner
* @param templateRepo
* template repository
* @return a builder to continue with building
* @see <a href="https://developer.github.com/v3/previews/">GitHub API Previews</a>
*/
@Preview(BAPTISTE)
@Deprecated
public GHCreateRepositoryBuilder fromTemplateRepository(String templateOwner, String templateRepo) {
requester.withPreview(BAPTISTE).withUrlPath("/repos/" + templateOwner + "/" + templateRepo + "/generate");
return this;
}
/**
* Creates a repository with all the parameters.
*
* @return the gh repository
* @throws IOException
* if repository cannot be created
*/
public GHRepository create() throws IOException {
return builder.method("POST").to(apiUrlTail, GHRepository.class).wrap(root);
return done();
}
}

View File

@@ -4,6 +4,9 @@ import org.apache.commons.lang3.builder.ToStringBuilder;
import java.io.IOException;
/**
* The type GHDeployKey.
*/
public class GHDeployKey {
protected String url, key, title;
@@ -11,36 +14,77 @@ public class GHDeployKey {
protected long id;
private GHRepository owner;
/**
* Gets id.
*
* @return the id
*/
public long getId() {
return id;
}
/**
* Gets key.
*
* @return the key
*/
public String getKey() {
return key;
}
/**
* Gets title.
*
* @return the title
*/
public String getTitle() {
return title;
}
/**
* Gets url.
*
* @return the url
*/
public String getUrl() {
return url;
}
/**
* Is verified boolean.
*
* @return the boolean
*/
public boolean isVerified() {
return verified;
}
/**
* Wrap gh deploy key.
*
* @param repo
* the repo
* @return the gh deploy key
*/
public GHDeployKey wrap(GHRepository repo) {
this.owner = repo;
return this;
}
public String toString() {
return new ToStringBuilder(this).append("title",title).append("id",id).append("key",key).toString();
return new ToStringBuilder(this).append("title", title).append("id", id).append("key", key).toString();
}
/**
* Delete.
*
* @throws IOException
* the io exception
*/
public void delete() throws IOException {
new Requester(owner.root).method("DELETE").to(String.format("/repos/%s/%s/keys/%d", owner.getOwnerName(), owner.getName(), id));
owner.root.createRequest()
.method("DELETE")
.withUrlPath(String.format("/repos/%s/%s/keys/%d", owner.getOwnerName(), owner.getName(), id))
.send();
}
}

View File

@@ -1,18 +1,21 @@
package org.kohsuke.github;
import org.kohsuke.github.internal.Previews;
import java.io.IOException;
import java.net.URL;
import java.util.Map;
/**
* Represents a deployment
*
* @see <a href="https://developer.github.com/v3/repos/deployments/">documentation</a>
* @see GHRepository#listDeployments(String, String, String, String)
* @see GHRepository#getDeployment(long)
* @see GHRepository#listDeployments(String, String, String, String) GHRepository#listDeployments(String, String,
* String, String)
* @see GHRepository#getDeployment(long) GHRepository#getDeployment(long)
*/
public class GHDeployment extends GHObject {
private GHRepository owner;
private GitHub root;
protected String sha;
protected String ref;
protected String task;
@@ -22,39 +25,149 @@ public class GHDeployment extends GHObject {
protected String statuses_url;
protected String repository_url;
protected GHUser creator;
protected String original_environment;
protected boolean transient_environment;
protected boolean production_environment;
GHDeployment wrap(GHRepository owner) {
this.owner = owner;
this.root = owner.root;
if(creator != null) creator.wrapUp(root);
if (creator != null)
creator.wrapUp(root);
return this;
}
/**
* Gets statuses url.
*
* @return the statuses url
*/
public URL getStatusesUrl() {
return GitHub.parseURL(statuses_url);
return GitHubClient.parseURL(statuses_url);
}
/**
* Gets repository url.
*
* @return the repository url
*/
public URL getRepositoryUrl() {
return GitHub.parseURL(repository_url);
return GitHubClient.parseURL(repository_url);
}
/**
* Gets task.
*
* @return the task
*/
public String getTask() {
return task;
}
/**
* Gets payload. <b>NOTE:</b> only use this method if you can guarantee the payload will be a simple string,
* otherwise use {@link #getPayloadObject()}.
*
* @return the payload
*/
public String getPayload() {
return (String) payload;
}
/**
* Gets payload. <b>NOTE:</b> only use this method if you can guarantee the payload will be a JSON object (Map),
* otherwise use {@link #getPayloadObject()}.
*
* @return the payload
*/
public Map<String, Object> getPayloadMap() {
return (Map<String, Object>) payload;
}
/**
* Gets payload without assuming its type. It could be a String or a Map.
*
* @return the payload
*/
public Object getPayloadObject() {
return payload;
}
/**
* The environment defined when the deployment was first created.
*
* @deprecated until preview feature has graduated to stable
*
* @return the original deployment environment
*/
@Deprecated
@Preview(Previews.FLASH)
public String getOriginalEnvironment() {
return original_environment;
}
/**
* Gets environment.
*
* @return the environment
*/
public String getEnvironment() {
return environment;
}
/**
* Specifies if the given environment is specific to the deployment and will no longer exist at some point in the
* future.
*
* @deprecated until preview feature has graduated to stable
*
* @return the environment is transient
*/
@Deprecated
@Preview(Previews.ANT_MAN)
public boolean isTransientEnvironment() {
return transient_environment;
}
/**
* Specifies if the given environment is one that end-users directly interact with.
*
* @deprecated until preview feature has graduated to stable
*
* @return the environment is used by end-users directly
*/
@Deprecated
@Preview(Previews.ANT_MAN)
public boolean isProductionEnvironment() {
return production_environment;
}
/**
* Gets creator.
*
* @return the creator
* @throws IOException
* the io exception
*/
public GHUser getCreator() throws IOException {
return root.intern(creator);
}
/**
* Gets ref.
*
* @return the ref
*/
public String getRef() {
return ref;
}
public String getSha(){
/**
* Gets sha.
*
* @return the sha
*/
public String getSha() {
return sha;
}
@@ -66,16 +179,28 @@ public class GHDeployment extends GHObject {
return null;
}
/**
* Create status gh deployment status builder.
*
* @param state
* the state
* @return the gh deployment status builder
*/
public GHDeploymentStatusBuilder createStatus(GHDeploymentState state) {
return new GHDeploymentStatusBuilder(owner,id,state);
return new GHDeploymentStatusBuilder(owner, getId(), state);
}
/**
* List statuses paged iterable.
*
* @return the paged iterable
*/
public PagedIterable<GHDeploymentStatus> listStatuses() {
return root.retrieve()
.asPagedIterable(
statuses_url,
GHDeploymentStatus[].class,
item -> item.wrap(owner) );
return root.createRequest()
.withUrlPath(statuses_url)
.withPreview(Previews.ANT_MAN)
.withPreview(Previews.FLASH)
.toIterable(GHDeploymentStatus[].class, item -> item.wrap(owner));
}
}

View File

@@ -1,55 +1,180 @@
package org.kohsuke.github;
import org.kohsuke.github.internal.Previews;
import java.io.IOException;
import java.util.List;
//Based on https://developer.github.com/v3/repos/deployments/#create-a-deployment
/**
* The type GHDeploymentBuilder.
*/
// Based on https://developer.github.com/v3/repos/deployments/#create-a-deployment
public class GHDeploymentBuilder {
private final GHRepository repo;
private final Requester builder;
/**
* Instantiates a new Gh deployment builder.
*
* @param repo
* the repo
*/
public GHDeploymentBuilder(GHRepository repo) {
this.repo = repo;
this.builder = new Requester(repo.root);
this.builder = repo.root.createRequest()
.withPreview(Previews.ANT_MAN)
.withPreview(Previews.FLASH)
.method("POST");
}
/**
* Instantiates a new Gh deployment builder.
*
* @param repo
* the repo
* @param ref
* the ref
*/
public GHDeploymentBuilder(GHRepository repo, String ref) {
this(repo);
ref(ref);
}
/**
* Ref gh deployment builder.
*
* @param branch
* the branch
*
* @return the gh deployment builder
*/
public GHDeploymentBuilder ref(String branch) {
builder.with("ref",branch);
builder.with("ref", branch);
return this;
}
/**
* Task gh deployment builder.
*
* @param task
* the task
*
* @return the gh deployment builder
*/
public GHDeploymentBuilder task(String task) {
builder.with("task",task);
builder.with("task", task);
return this;
}
/**
* Auto merge gh deployment builder.
*
* @param autoMerge
* the auto merge
*
* @return the gh deployment builder
*/
public GHDeploymentBuilder autoMerge(boolean autoMerge) {
builder.with("auto_merge",autoMerge);
builder.with("auto_merge", autoMerge);
return this;
}
/**
* Required contexts gh deployment builder.
*
* @param requiredContexts
* the required contexts
*
* @return the gh deployment builder
*/
public GHDeploymentBuilder requiredContexts(List<String> requiredContexts) {
builder.with("required_contexts",requiredContexts);
builder.with("required_contexts", requiredContexts);
return this;
}
/**
* Payload gh deployment builder.
*
* @param payload
* the payload
*
* @return the gh deployment builder
*/
public GHDeploymentBuilder payload(String payload) {
builder.with("payload",payload);
builder.with("payload", payload);
return this;
}
/**
* Environment gh deployment builder.
*
* @param environment
* the environment
*
* @return the gh deployment builder
*/
public GHDeploymentBuilder environment(String environment) {
builder.with("environment",environment);
return this;
}
public GHDeploymentBuilder description(String description) {
builder.with("description",description);
builder.with("environment", environment);
return this;
}
/**
* Specifies if the given environment is specific to the deployment and will no longer exist at some point in the
* future.
*
* @deprecated until preview feature has graduated to stable
*
* @param transientEnvironment
* the environment is transient
*
* @return the gh deployment builder
*/
@Deprecated
@Preview(Previews.ANT_MAN)
public GHDeploymentBuilder transientEnvironment(boolean transientEnvironment) {
builder.with("transient_environment", transientEnvironment);
return this;
}
/**
* Specifies if the given environment is one that end-users directly interact with.
*
* @deprecated until preview feature has graduated to stable
*
* @param productionEnvironment
* the environment is used by end-users directly
*
* @return the gh deployment builder
*/
@Deprecated
@Preview(Previews.ANT_MAN)
public GHDeploymentBuilder productionEnvironment(boolean productionEnvironment) {
builder.with("production_environment", productionEnvironment);
return this;
}
/**
* Description gh deployment builder.
*
* @param description
* the description
*
* @return the gh deployment builder
*/
public GHDeploymentBuilder description(String description) {
builder.with("description", description);
return this;
}
/**
* Create gh deployment.
*
* @return the gh deployment
*
* @throws IOException
* the io exception
*/
public GHDeployment create() throws IOException {
return builder.to(repo.getApiTailUrl("deployments"),GHDeployment.class).wrap(repo);
return builder.withUrlPath(repo.getApiTailUrl("deployments")).fetch(GHDeployment.class).wrap(repo);
}
}

View File

@@ -1,8 +1,40 @@
package org.kohsuke.github;
import org.kohsuke.github.internal.Previews;
/**
* Represents the state of deployment
*/
public enum GHDeploymentState {
PENDING, SUCCESS, ERROR, FAILURE
PENDING,
SUCCESS,
ERROR,
FAILURE,
/**
* The state of the deployment currently reflects it's in progress.
*
* @deprecated until preview feature has graduated to stable
*/
@Deprecated
@Preview(Previews.FLASH)
IN_PROGRESS,
/**
* The state of the deployment currently reflects it's queued up for processing.
*
* @deprecated until preview feature has graduated to stable
*/
@Deprecated
@Preview(Previews.FLASH)
QUEUED,
/**
* The state of the deployment currently reflects it's no longer active.
*
* @deprecated until preview feature has graduated to stable
*/
@Deprecated
@Preview(Previews.ANT_MAN)
INACTIVE
}

View File

@@ -1,35 +1,103 @@
package org.kohsuke.github;
import org.kohsuke.github.internal.Previews;
import java.net.URL;
import java.util.Locale;
/**
* The type GHDeploymentStatus.
*/
public class GHDeploymentStatus extends GHObject {
private GHRepository owner;
private GitHub root;
protected GHUser creator;
protected String state;
protected String description;
protected String target_url;
protected String log_url;
protected String deployment_url;
protected String repository_url;
protected String environment_url;
/**
* Wrap gh deployment status.
*
* @param owner
* the owner
*
* @return the gh deployment status
*/
public GHDeploymentStatus wrap(GHRepository owner) {
this.owner = owner;
this.root = owner.root;
if(creator != null) creator.wrapUp(root);
if (creator != null)
creator.wrapUp(root);
return this;
}
/**
* Gets target url.
*
* @deprecated Target url is deprecated in favor of {@link #getLogUrl() getLogUrl}
*
* @return the target url
*/
@Deprecated
public URL getTargetUrl() {
return GitHub.parseURL(target_url);
return GitHubClient.parseURL(target_url);
}
/**
* Gets target url.
* <p>
* This method replaces {@link #getTargetUrl() getTargetUrl}}.
*
* @deprecated until preview feature has graduated to stable
*
* @return the target url
*/
@Deprecated
@Preview(Previews.ANT_MAN)
public URL getLogUrl() {
return GitHubClient.parseURL(log_url);
}
/**
* Gets deployment url.
*
* @return the deployment url
*/
public URL getDeploymentUrl() {
return GitHub.parseURL(deployment_url);
return GitHubClient.parseURL(deployment_url);
}
public URL getRepositoryUrl() {
return GitHub.parseURL(repository_url);
/**
* Gets deployment environment url.
*
* @deprecated until preview feature has graduated to stable
*
* @return the deployment environment url
*/
@Deprecated
@Preview(Previews.ANT_MAN)
public URL getEnvironmentUrl() {
return GitHubClient.parseURL(environment_url);
}
/**
* Gets repository url.
*
* @return the repository url
*/
public URL getRepositoryUrl() {
return GitHubClient.parseURL(repository_url);
}
/**
* Gets state.
*
* @return the state
*/
public GHDeploymentState getState() {
return GHDeploymentState.valueOf(state.toUpperCase(Locale.ENGLISH));
}

View File

@@ -1,12 +1,13 @@
package org.kohsuke.github;
import org.kohsuke.github.internal.Previews;
import java.io.IOException;
/**
* Creates a new deployment status.
*
* @see
* GHDeployment#createStatus(GHDeploymentState)
* @see GHDeployment#createStatus(GHDeploymentState) GHDeployment#createStatus(GHDeploymentState)
*/
public class GHDeploymentStatusBuilder {
private final Requester builder;
@@ -14,31 +15,144 @@ public class GHDeploymentStatusBuilder {
private long deploymentId;
/**
* @deprecated
* Use {@link GHDeployment#createStatus(GHDeploymentState)}
* Instantiates a new Gh deployment status builder.
*
* @param repo
* the repo
* @param deploymentId
* the deployment id
* @param state
* the state
*
* @deprecated Use {@link GHDeployment#createStatus(GHDeploymentState)}
*/
@Deprecated
public GHDeploymentStatusBuilder(GHRepository repo, int deploymentId, GHDeploymentState state) {
this(repo,(long)deploymentId,state);
this(repo, (long) deploymentId, state);
}
/*package*/ GHDeploymentStatusBuilder(GHRepository repo, long deploymentId, GHDeploymentState state) {
GHDeploymentStatusBuilder(GHRepository repo, long deploymentId, GHDeploymentState state) {
this.repo = repo;
this.deploymentId = deploymentId;
this.builder = new Requester(repo.root);
this.builder.with("state",state);
this.builder = repo.root.createRequest()
.withPreview(Previews.ANT_MAN)
.withPreview(Previews.FLASH)
.method("POST");
this.builder.with("state", state);
}
public GHDeploymentStatusBuilder description(String description) {
this.builder.with("description",description);
return this;
}
public GHDeploymentStatusBuilder targetUrl(String targetUrl) {
this.builder.with("target_url",targetUrl);
/**
* Add an inactive status to all prior non-transient, non-production environment deployments with the same
* repository and environment name as the created status's deployment.
*
* @deprecated until preview feature has graduated to stable
*
* @param autoInactive
* Add inactive status flag
*
* @return the gh deployment status builder
*/
@Deprecated
@Preview({ Previews.ANT_MAN, Previews.FLASH })
public GHDeploymentStatusBuilder autoInactive(boolean autoInactive) {
this.builder.with("auto_inactive", autoInactive);
return this;
}
/**
* Description gh deployment status builder.
*
* @param description
* the description
*
* @return the gh deployment status builder
*/
public GHDeploymentStatusBuilder description(String description) {
this.builder.with("description", description);
return this;
}
/**
* Name for the target deployment environment, which can be changed when setting a deploy status.
*
* @deprecated until preview feature has graduated to stable
*
* @param environment
* the environment name
*
* @return the gh deployment status builder
*/
@Deprecated
@Preview(Previews.FLASH)
public GHDeploymentStatusBuilder environment(String environment) {
this.builder.with("environment", environment);
return this;
}
/**
* The URL for accessing the environment
*
* @deprecated until preview feature has graduated to stable
*
* @param environmentUrl
* the environment url
*
* @return the gh deployment status builder
*/
@Deprecated
@Preview(Previews.ANT_MAN)
public GHDeploymentStatusBuilder environmentUrl(String environmentUrl) {
this.builder.with("environment_url", environmentUrl);
return this;
}
/**
* The full URL of the deployment's output.
* <p>
* This method replaces {@link #targetUrl(String) targetUrl}.
*
* @deprecated until preview feature has graduated to stable
*
* @param logUrl
* the deployment output url
*
* @return the gh deployment status builder
*/
@Deprecated
@Preview(Previews.ANT_MAN)
public GHDeploymentStatusBuilder logUrl(String logUrl) {
this.builder.with("log_url", logUrl);
return this;
}
/**
* Target url gh deployment status builder.
*
* @deprecated Target url is deprecated in favor of {@link #logUrl(String) logUrl}
*
* @param targetUrl
* the target url
*
* @return the gh deployment status builder
*/
@Deprecated
public GHDeploymentStatusBuilder targetUrl(String targetUrl) {
this.builder.with("target_url", targetUrl);
return this;
}
/**
* Create gh deployment status.
*
* @return the gh deployment status
*
* @throws IOException
* the io exception
*/
public GHDeploymentStatus create() throws IOException {
return builder.to(repo.getApiTailUrl("deployments/"+deploymentId+"/statuses"),GHDeploymentStatus.class).wrap(repo);
return builder.withUrlPath(repo.getApiTailUrl("deployments/" + deploymentId + "/statuses"))
.fetch(GHDeploymentStatus.class)
.wrap(repo);
}
}

View File

@@ -0,0 +1,230 @@
package org.kohsuke.github;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.kohsuke.github.internal.Previews;
import java.io.IOException;
import java.net.URL;
import java.util.Objects;
import javax.annotation.CheckForNull;
import javax.annotation.Nonnull;
/**
* A discussion in GitHub Team.
*
* @author Charles Moulliard
* @see <a href="https://developer.github.com/v3/teams/discussions">GitHub Team Discussions</a>
*/
public class GHDiscussion extends GHObject {
private GHTeam team;
private long number;
private String body, title, htmlUrl;
@JsonProperty(value = "private")
private boolean isPrivate;
@Override
public URL getHtmlUrl() throws IOException {
return GitHubClient.parseURL(htmlUrl);
}
GHDiscussion wrapUp(GHTeam team) {
this.team = team;
return this;
}
/**
* Get the team to which this discussion belongs.
*
* @return the team for this discussion
*/
@Nonnull
public GHTeam getTeam() {
return team;
}
/**
* Get the title of the discussion.
*
* @return the title
*/
public String getTitle() {
return title;
}
/**
* The description of this discussion.
*
* @return the body
*/
public String getBody() {
return body;
}
/**
* The number of this discussion.
*
* @return the number
*/
public long getNumber() {
return number;
}
/**
* The id number of this discussion. GitHub discussions have "number" instead of "id". This is provided for
* convenience.
*
* @return the id number for this discussion
* @see #getNumber()
*/
@Override
public long getId() {
return getNumber();
}
/**
* Whether the discussion is private to the team.
*
* @return {@code true} if discussion is private.
*/
public boolean isPrivate() {
return isPrivate;
}
/**
* Begins the creation of a new instance.
*
* Consumer must call {@link GHDiscussion.Creator#done()} to commit changes.
*
* @param team
* the team in which the discussion will be created.
* @return a {@link GHLabel.Creator}
* @throws IOException
* the io exception
*/
static GHDiscussion.Creator create(GHTeam team) throws IOException {
return new GHDiscussion.Creator(team);
}
static GHDiscussion read(GHTeam team, long discussionNumber) throws IOException {
return team.root.createRequest()
.setRawUrlPath(getRawUrlPath(team, discussionNumber))
.fetch(GHDiscussion.class)
.wrapUp(team);
}
static PagedIterable<GHDiscussion> readAll(GHTeam team) throws IOException {
return team.root.createRequest()
.setRawUrlPath(getRawUrlPath(team, null))
.toIterable(GHDiscussion[].class, item -> item.wrapUp(team));
}
/**
* Begins a batch update
*
* Consumer must call {@link GHDiscussion.Updater#done()} to commit changes.
*
* @return a {@link GHDiscussion.Updater}
*/
@Preview(Previews.SQUIRREL_GIRL)
@Deprecated
public GHDiscussion.Updater update() {
return new GHDiscussion.Updater(this);
}
/**
* Begins a single property update.
*
* @return a {@link GHDiscussion.Setter}
*/
@Preview(Previews.SQUIRREL_GIRL)
@Deprecated
public GHDiscussion.Setter set() {
return new GHDiscussion.Setter(this);
}
/**
* Delete the discussion
*
* @throws IOException
* the io exception
*/
public void delete() throws IOException {
team.root.createRequest().method("DELETE").setRawUrlPath(getRawUrlPath(team, number)).send();
}
private static String getRawUrlPath(@Nonnull GHTeam team, @CheckForNull Long discussionNumber) {
return team.getUrl().toString() + "/discussions" + (discussionNumber == null ? "" : "/" + discussionNumber);
}
/**
* A {@link GHLabelBuilder} that updates a single property per request
*
* {@link #done()} is called automatically after the property is set.
*/
public static class Setter extends GHDiscussionBuilder<GHDiscussion> {
private Setter(@Nonnull GHDiscussion base) {
super(GHDiscussion.class, base.team, base);
requester.method("PATCH").setRawUrlPath(base.getUrl().toString());
}
}
/**
* A {@link GHLabelBuilder} that allows multiple properties to be updated per request.
*
* Consumer must call {@link #done()} to commit changes.
*/
public static class Updater extends GHDiscussionBuilder<Updater> {
private Updater(@Nonnull GHDiscussion base) {
super(GHDiscussion.Updater.class, base.team, base);
requester.method("PATCH").setRawUrlPath(base.getUrl().toString());
}
}
/**
* A {@link GHLabelBuilder} that creates a new {@link GHLabel}
*
* Consumer must call {@link #done()} to create the new instance.
*/
public static class Creator extends GHDiscussionBuilder<Creator> {
private Creator(@Nonnull GHTeam team) {
super(GHDiscussion.Creator.class, team, null);
requester.method("POST").setRawUrlPath(getRawUrlPath(team, null));
}
/**
* Sets whether this discussion is private to this team.
*
* @param value
* privacy of this discussion
* @return either a continuing builder or an updated {@link GHDiscussion}
* @throws IOException
* if there is an I/O Exception
*/
@Nonnull
public Creator private_(boolean value) throws IOException {
return with("private", value);
}
}
@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
GHDiscussion that = (GHDiscussion) o;
return number == that.number && Objects.equals(getUrl(), that.getUrl()) && Objects.equals(team, that.team)
&& Objects.equals(body, that.body) && Objects.equals(title, that.title);
}
@Override
public int hashCode() {
return Objects.hash(team, number, body, title);
}
}

View File

@@ -0,0 +1,80 @@
package org.kohsuke.github;
import java.io.IOException;
import javax.annotation.CheckForNull;
import javax.annotation.Nonnull;
/**
* Base class for creating or updating a discussion.
*
* @param <S>
* Intermediate return type for this builder returned by calls to {@link #with(String, Object)}. If {@link S}
* the same as {@link GHLabel}, this builder will commit changes after each call to
* {@link #with(String, Object)}.
*/
class GHDiscussionBuilder<S> extends AbstractBuilder<GHDiscussion, S> {
private final GHTeam team;
/**
*
* @param intermediateReturnType
* Intermediate return type for this builder returned by calls to {@link #with(String, Object)}. If
* {@link S} the same as {@link GHDiscussion}, this builder will commit changes after each call to
* {@link #with(String, Object)}.
* @param team
* the GitHub team. Updates will be sent to the root of this team.
* @param baseInstance
* instance on which to base this builder. If {@code null} a new instance will be created.
*/
protected GHDiscussionBuilder(@Nonnull Class<S> intermediateReturnType,
@Nonnull GHTeam team,
@CheckForNull GHDiscussion baseInstance) {
super(GHDiscussion.class, intermediateReturnType, team.root, baseInstance);
this.team = team;
if (baseInstance != null) {
requester.with("title", baseInstance.getTitle());
requester.with("body", baseInstance.getBody());
}
}
/**
* Title for this discussion.
*
* @param value
* title of discussion
* @return either a continuing builder or an updated {@link GHDiscussion}
* @throws IOException
* if there is an I/O Exception
*/
@Nonnull
public S title(String value) throws IOException {
return with("title", value);
}
/**
* Body content for this discussion.
*
* @param value
* body of discussion*
* @return either a continuing builder or an updated {@link GHDiscussion}
* @throws IOException
* if there is an I/O Exception
*/
@Nonnull
public S body(String value) throws IOException {
return with("body", value);
}
/**
* {@inheritDoc}
*/
@Nonnull
@Override
public GHDiscussion done() throws IOException {
return super.done().wrapUp(team);
}
}

View File

@@ -25,36 +25,51 @@ package org.kohsuke.github;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
/**
* Represents an email of GitHub.
*
* @author Kelly Campbell
*/
@SuppressFBWarnings(value = {"UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD",
"NP_UNWRITTEN_FIELD", "NP_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD"}, justification = "JSON API")
@SuppressFBWarnings(
value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD",
"NP_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD" },
justification = "JSON API")
public class GHEmail {
protected String email;
protected boolean primary;
protected boolean verified;
/**
* Gets email.
*
* @return the email
*/
public String getEmail() {
return email;
}
/**
* Is primary boolean.
*
* @return the boolean
*/
public boolean isPrimary() {
return primary;
}
/**
* Is verified boolean.
*
* @return the boolean
*/
public boolean isVerified() {
return verified;
}
@Override
public String toString() {
return "Email:"+email;
return "Email:" + email;
}
@Override

View File

@@ -1,7 +1,11 @@
package org.kohsuke.github;
import org.kohsuke.github.internal.EnumUtils;
import java.util.Locale;
import javax.annotation.Nonnull;
/**
* Hook event type.
*
@@ -10,57 +14,121 @@ import java.util.Locale;
* @see <a href="https://developer.github.com/v3/activity/events/types/">Event type reference</a>
*/
public enum GHEvent {
CHECK_RUN,
CHECK_SUITE,
CODE_SCANNING_ALERT,
COMMIT_COMMENT,
CONTENT_REFERENCE,
CREATE,
DELETE,
DEPLOY_KEY,
DEPLOYMENT,
DEPLOYMENT_STATUS,
DOWNLOAD,
FOLLOW,
FORK,
FORK_APPLY,
GITHUB_APP_AUTHORIZATION,
GIST,
GOLLUM,
INSTALLATION,
INSTALLATION_REPOSITORIES,
INTEGRATION_INSTALLATION_REPOSITORIES,
CHECK_SUITE,
ISSUE_COMMENT,
ISSUES,
LABEL,
MARKETPLACE_PURCHASE,
MEMBER,
MEMBERSHIP,
META,
MILESTONE,
ORGANIZATION,
ORG_BLOCK,
PACKAGE,
PAGE_BUILD,
PROJECT_CARD,
PROJECT_COLUMN,
PROJECT,
PING,
PUBLIC,
PULL_REQUEST,
PULL_REQUEST_REVIEW,
PULL_REQUEST_REVIEW_COMMENT,
PUSH,
REGISTRY_PACKAGE,
RELEASE,
REPOSITORY, // only valid for org hooks
REPOSITORY_DISPATCH, // only valid for org hooks
REPOSITORY,
REPOSITORY_IMPORT,
REPOSITORY_VULNERABILITY_ALERT,
SCHEDULE,
SECURITY_ADVISORY,
STAR,
STATUS,
TEAM,
TEAM_ADD,
WATCH,
PING,
WORKFLOW_DISPATCH,
WORKFLOW_RUN,
/**
* Special event type that means we haven't found an enum value corresponding to the event.
*/
UNKNOWN,
/**
* Special event type that means "every possible event"
*/
ALL;
/**
* Returns GitHub's internal representation of this event.
*/
String symbol() {
if (this==ALL) return "*";
if (this == ALL)
return "*";
return name().toLowerCase(Locale.ENGLISH);
}
/**
* Representation of GitHub Event Type
*
* @see <a href="https://docs.github.com/en/developers/webhooks-and-events/github-event-types">GitHub event
* types</a>
*/
enum GitHubEventType {
CommitCommentEvent(COMMIT_COMMENT),
CreateEvent(CREATE),
DeleteEvent(DELETE),
ForkEvent(FORK),
GollumEvent(GOLLUM),
IssueCommentEvent(ISSUE_COMMENT),
IssuesEvent(ISSUES),
MemberEvent(MEMBER),
PublicEvent(PUBLIC),
PullRequestEvent(PULL_REQUEST),
PullRequestReviewEvent(PULL_REQUEST_REVIEW),
PullRequestReviewCommentEvent(PULL_REQUEST_REVIEW_COMMENT),
PushEvent(PUSH),
ReleaseEvent(RELEASE),
WatchEvent(WATCH),
UnknownEvent(UNKNOWN);
private final GHEvent event;
GitHubEventType(GHEvent event) {
this.event = event;
}
/**
* Required due to different naming conventions between different GitHub event names for Webhook events and
* GitHub events
*
* @param event
* the github event as a string to convert to Event enum
* @return GHEvent
*/
static GHEvent transformToGHEvent(@Nonnull String event) {
return EnumUtils.getEnumOrDefault(GitHubEventType.class, event, UnknownEvent).event;
}
}
}

View File

@@ -2,6 +2,7 @@ package org.kohsuke.github;
import com.fasterxml.jackson.databind.node.ObjectNode;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.kohsuke.github.GHEvent.GitHubEventType;
import java.io.IOException;
import java.util.Date;
@@ -12,9 +13,7 @@ import java.util.Date;
* @author Kohsuke Kawaguchi
*/
@SuppressFBWarnings(value = "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", justification = "JSON API")
public class GHEventInfo {
private GitHub root;
public class GHEventInfo extends GitHubInteractiveObject {
// we don't want to expose Jackson dependency to the user. This needs databinding
private ObjectNode payload;
@@ -30,76 +29,114 @@ public class GHEventInfo {
/**
* Inside the event JSON model, GitHub uses a slightly different format.
*/
@SuppressFBWarnings(value = {"UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD",
"UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR" }, justification = "JSON API")
@SuppressFBWarnings(
value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD",
"UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR" },
justification = "JSON API")
public static class GHEventRepository {
@SuppressFBWarnings(value = "UUF_UNUSED_FIELD", justification = "We don't provide it in API now")
private long id;
@SuppressFBWarnings(value = "UUF_UNUSED_FIELD", justification = "We don't provide it in API now")
private String url; // repository API URL
private String name; // owner/repo
private String url; // repository API URL
private String name; // owner/repo
}
/**
* Gets type.
*
* @return the type
*/
public GHEvent getType() {
String t = type;
if (t.endsWith("Event")) t=t.substring(0,t.length()-5);
for (GHEvent e : GHEvent.values()) {
if (e.name().replace("_","").equalsIgnoreCase(t))
return e;
}
return null; // unknown event type
return GitHubEventType.transformToGHEvent(type);
}
/*package*/ GHEventInfo wrapUp(GitHub root) {
GHEventInfo wrapUp(GitHub root) {
this.root = root;
return this;
}
/**
* Gets id.
*
* @return the id
*/
public long getId() {
return id;
}
/**
* Gets created at.
*
* @return the created at
*/
public Date getCreatedAt() {
return GitHub.parseDate(created_at);
return GitHubClient.parseDate(created_at);
}
/**
* Repository where the change was made.
* Gets repository.
*
* @return Repository where the change was made.
* @throws IOException
* on error
*/
@SuppressFBWarnings(value = {"UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR" },
@SuppressFBWarnings(value = { "UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR" },
justification = "The field comes from JSON deserialization")
public GHRepository getRepository() throws IOException {
return root.getRepository(repo.name);
}
@SuppressFBWarnings(value = {"UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR" },
/**
* Gets actor.
*
* @return the {@link GHUser} actor for this event.
* @throws IOException
* on error
*/
@SuppressFBWarnings(value = { "UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR" },
justification = "The field comes from JSON deserialization")
public GHUser getActor() throws IOException {
return root.getUser(actor.getLogin());
}
/**
* Quick way to just get the actor of the login.
* Gets actor login.
*
* @return the login of the actor.
* @throws IOException
* on error
*/
public String getActorLogin() throws IOException {
return actor.getLogin();
}
@SuppressFBWarnings(value = {"UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR" },
/**
* Gets organization.
*
* @return the organization
* @throws IOException
* the io exception
*/
@SuppressFBWarnings(value = { "UWF_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR" },
justification = "The field comes from JSON deserialization")
public GHOrganization getOrganization() throws IOException {
return (org==null || org.getLogin()==null) ? null : root.getOrganization(org.getLogin());
return (org == null || org.getLogin() == null) ? null : root.getOrganization(org.getLogin());
}
/**
* Retrieves the payload.
*
*
* @param <T>
* the type parameter
* @param type
* Specify one of the {@link GHEventPayload} subtype that defines a type-safe access to the payload.
* This must match the {@linkplain #getType() event type}.
* Specify one of the {@link GHEventPayload} subtype that defines a type-safe access to the payload. This
* must match the {@linkplain #getType() event type}.
* @return parsed event payload
* @throws IOException
* if payload cannot be parsed
*/
public <T extends GHEventPayload> T getPayload(Class<T> type) throws IOException {
T v = GitHub.MAPPER.readValue(payload.traverse(), type);
T v = GitHubClient.getMappingObjectReader(root).readValue(payload.traverse(), type);
v.wrapUp(root);
return v;
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,13 +1,29 @@
package org.kohsuke.github;
/**
* The type GHException.
*
* @author Kohsuke Kawaguchi
*/
public class GHException extends RuntimeException {
/**
* Instantiates a new Gh exception.
*
* @param message
* the message
*/
public GHException(String message) {
super(message);
}
/**
* Instantiates a new Gh exception.
*
* @param message
* the message
* @param cause
* the cause
*/
public GHException(String message, Throwable cause) {
super(message, cause);
}

View File

@@ -1,34 +1,61 @@
package org.kohsuke.github;
import javax.annotation.CheckForNull;
import java.io.FileNotFoundException;
import java.net.HttpURLConnection;
import java.util.List;
import java.util.Map;
import javax.annotation.CheckForNull;
import javax.annotation.Nonnull;
/**
* Request/responce contains useful metadata.
* Custom exception allows store info for next diagnostics.
* Request/responce contains useful metadata. Custom exception allows store info for next diagnostics.
*
* @author Kanstantsin Shautsou
*/
public class GHFileNotFoundException extends FileNotFoundException {
protected Map<String, List<String>> responseHeaderFields;
/**
* Instantiates a new Gh file not found exception.
*/
public GHFileNotFoundException() {
}
public GHFileNotFoundException(String s) {
super(s);
/**
* Instantiates a new Gh file not found exception.
*
* @param message
* the message
*/
public GHFileNotFoundException(String message) {
super(message);
}
/**
* Instantiates a new Gh file not found exception.
*
* @param message
* the message
* @param cause
* the cause
*/
public GHFileNotFoundException(String message, Throwable cause) {
super(message);
this.initCause(cause);
}
/**
* Gets response header fields.
*
* @return the response header fields
*/
@CheckForNull
public Map<String, List<String>> getResponseHeaderFields() {
return responseHeaderFields;
}
GHFileNotFoundException withResponseHeaderFields(HttpURLConnection urlConnection) {
this.responseHeaderFields = urlConnection.getHeaderFields();
GHFileNotFoundException withResponseHeaderFields(@Nonnull Map<String, List<String>> headerFields) {
this.responseHeaderFields = headerFields;
return this;
}
}

View File

@@ -1,12 +1,13 @@
package org.kohsuke.github;
import com.fasterxml.jackson.annotation.JacksonInject;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import org.apache.commons.lang3.StringUtils;
import java.io.IOException;
import java.net.URL;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
@@ -14,14 +15,14 @@ import java.util.Map.Entry;
* Gist
*
* @author Kohsuke Kawaguchi
* @see GHUser#listGists()
* @see GitHub#getGist(String)
* @see GitHub#createGist()
* @see GHUser#listGists() GHUser#listGists()
* @see GitHub#getGist(String) GitHub#getGist(String)
* @see GitHub#createGist() GitHub#createGist()
* @see <a href="https://developer.github.com/v3/gists/">documentation</a>
*/
public class GHGist extends GHObject {
/*package almost final*/ GHUser owner;
/*package almost final*/ GitHub root;
final GHUser owner;
private String forks_url, commits_url, id, git_pull_url, git_push_url, html_url;
@@ -34,87 +35,154 @@ public class GHGist extends GHObject {
private String comments_url;
private Map<String,GHGistFile> files = new HashMap<String, GHGistFile>();
private final Map<String, GHGistFile> files;
/**
* User that owns this Gist.
*/
public GHUser getOwner() throws IOException {
return root.intern(owner);
@JsonCreator
private GHGist(@JacksonInject GitHub root,
@JsonProperty("owner") GHUser owner,
@JsonProperty("files") Map<String, GHGistFile> files) {
this.root = root;
for (Entry<String, GHGistFile> e : files.entrySet()) {
e.getValue().fileName = e.getKey();
}
this.files = Collections.unmodifiableMap(files);
this.owner = root.getUser(owner);
}
/**
* Unlike most other GitHub objects, the id for Gists can be non-numeric, such as "aa5a315d61ae9438b18d". If the id
* is numeric, this method will get it. If id is not numeric, this will throw a runtime
* {@link NumberFormatException}.
*
* @return id of the Gist.
* @deprecated Use {@link #getGistId()} instead.
*/
@Deprecated
@Override
public long getId() {
return Long.parseLong(getGistId());
}
/**
* Gets the id for this Gist. Unlike most other GitHub objects, the id for Gists can be non-numeric, such as
* "aa5a315d61ae9438b18d". This should be used instead of {@link #getId()}.
*
* @return id of this Gist
*/
public String getGistId() {
return this.id;
}
/**
* Gets owner.
*
* @return User that owns this Gist.
* @throws IOException
* the io exception
*/
public GHUser getOwner() throws IOException {
return owner;
}
/**
* Gets forks url.
*
* @return the forks url
*/
public String getForksUrl() {
return forks_url;
}
/**
* Gets commits url.
*
* @return the commits url
*/
public String getCommitsUrl() {
return commits_url;
}
/**
* URL like https://gist.github.com/gists/12345.git
* Gets git pull url.
*
* @return URL like https://gist.github.com/gists/12345.git
*/
public String getGitPullUrl() {
return git_pull_url;
}
/**
* Gets git push url.
*
* @return the git push url
*/
public String getGitPushUrl() {
return git_push_url;
}
/**
* Get the html url.
*
* @return the github html url
*/
public URL getHtmlUrl() {
return GitHub.parseURL(html_url);
return GitHubClient.parseURL(html_url);
}
/**
* Is public boolean.
*
* @return the boolean
*/
public boolean isPublic() {
return _public;
}
/**
* Gets description.
*
* @return the description
*/
public String getDescription() {
return description;
}
/**
* Gets comment count.
*
* @return the comment count
*/
public int getCommentCount() {
return comments;
}
/**
* API URL of listing comments.
* Gets comments url.
*
* @return API URL of listing comments.
*/
public String getCommentsUrl() {
return comments_url;
}
/**
* Gets file.
*
* @param name
* the name
* @return the file
*/
public GHGistFile getFile(String name) {
return files.get(name);
}
public Map<String,GHGistFile> getFiles() {
return Collections.unmodifiableMap(files);
}
/*package*/ GHGist wrapUp(GHUser owner) {
this.owner = owner;
this.root = owner.root;
wrapUp();
return this;
}
/**
* Used when caller obtains {@link GHGist} without knowing its owner.
* A partially constructed owner object is interned.
* Gets files.
*
* @return the files
*/
/*package*/ GHGist wrapUp(GitHub root) {
this.owner = root.getUser(owner);
this.root = root;
wrapUp();
return this;
}
private void wrapUp() {
for (Entry<String, GHGistFile> e : files.entrySet()) {
e.getValue().fileName = e.getKey();
}
public Map<String, GHGistFile> getFiles() {
return files;
}
String getApiTailUrl(String tail) {
@@ -125,42 +193,73 @@ public class GHGist extends GHObject {
return result;
}
/**
* Star.
*
* @throws IOException
* the io exception
*/
public void star() throws IOException {
new Requester(root).method("PUT").to(getApiTailUrl("star"));
root.createRequest().method("PUT").withUrlPath(getApiTailUrl("star")).send();
}
/**
* Unstar.
*
* @throws IOException
* the io exception
*/
public void unstar() throws IOException {
new Requester(root).method("DELETE").to(getApiTailUrl("star"));
root.createRequest().method("DELETE").withUrlPath(getApiTailUrl("star")).send();
}
/**
* Is starred boolean.
*
* @return the boolean
* @throws IOException
* the io exception
*/
public boolean isStarred() throws IOException {
return root.retrieve().asHttpStatusCode(getApiTailUrl("star"))/100==2;
return root.createRequest().withUrlPath(getApiTailUrl("star")).fetchHttpStatusCode() / 100 == 2;
}
/**
* Forks this gist into your own.
*
* @return the gh gist
* @throws IOException
* the io exception
*/
public GHGist fork() throws IOException {
return new Requester(root).to(getApiTailUrl("forks"),GHGist.class).wrapUp(root);
return root.createRequest().method("POST").withUrlPath(getApiTailUrl("forks")).fetch(GHGist.class);
}
/**
* List forks paged iterable.
*
* @return the paged iterable
*/
public PagedIterable<GHGist> listForks() {
return root.retrieve()
.asPagedIterable(
getApiTailUrl("forks"),
GHGist[].class,
item -> item.wrapUp(root) );
return root.createRequest().withUrlPath(getApiTailUrl("forks")).toIterable(GHGist[].class, null);
}
/**
* Deletes this gist.
*
* @throws IOException
* the io exception
*/
public void delete() throws IOException {
new Requester(root).method("DELETE").to("/gists/" + id);
root.createRequest().method("DELETE").withUrlPath("/gists/" + id).send();
}
/**
* Updates this gist via a builder.
*
* @return the gh gist updater
* @throws IOException
* the io exception
*/
public GHGistUpdater update() throws IOException {
return new GHGistUpdater(this);
@@ -168,8 +267,10 @@ public class GHGist extends GHObject {
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
GHGist ghGist = (GHGist) o;
return id.equals(ghGist.id);
@@ -179,10 +280,4 @@ public class GHGist extends GHObject {
public int hashCode() {
return id.hashCode();
}
GHGist wrap(GHUser owner) {
this.owner = owner;
this.root = owner.root;
return this;
}
}

View File

@@ -4,45 +4,75 @@ import java.io.IOException;
import java.util.Collections;
import java.util.LinkedHashMap;
import javax.annotation.Nonnull;
/**
* Builder pattern for creating a new Gist.
*
* @author Kohsuke Kawaguchi
* @see GitHub#createGist()
* @see GitHub#createGist() GitHub#createGist()
*/
public class GHGistBuilder {
private final GitHub root;
private final Requester req;
private final LinkedHashMap<String,Object> files = new LinkedHashMap<String, Object>();
private final LinkedHashMap<String, Object> files = new LinkedHashMap<String, Object>();
/**
* Instantiates a new Gh gist builder.
*
* @param root
* the root
*/
public GHGistBuilder(GitHub root) {
this.root = root;
req = new Requester(root);
req = root.createRequest().method("POST");
}
/**
* Description gh gist builder.
*
* @param desc
* the desc
* @return the gh gist builder
*/
public GHGistBuilder description(String desc) {
req.with("description",desc);
return this;
}
public GHGistBuilder public_(boolean v) {
req.with("public",v);
req.with("description", desc);
return this;
}
/**
* Adds a new file.
* Public gh gist builder.
*
* @param v
* the v
* @return the gh gist builder
*/
public GHGistBuilder file(String fileName, String content) {
public GHGistBuilder public_(boolean v) {
req.with("public", v);
return this;
}
/**
* File gh gist builder.
*
* @param fileName
* the file name
* @param content
* the content
* @return Adds a new file.
*/
public GHGistBuilder file(@Nonnull String fileName, @Nonnull String content) {
files.put(fileName, Collections.singletonMap("content", content));
return this;
}
/**
* Creates a Gist based on the parameters specified thus far.
*
* @return created Gist
* @throws IOException
* if Gist cannot be created.
*/
public GHGist create() throws IOException {
req._with("files",files);
return req.to("/gists",GHGist.class).wrapUp(root);
req.with("files", files);
return req.withUrlPath("/gists").fetch(GHGist.class);
}
}

View File

@@ -4,23 +4,29 @@ package org.kohsuke.github;
* A file inside {@link GHGist}
*
* @author Kohsuke Kawaguchi
* @see GHGist#getFile(String)
* @see GHGist#getFiles()
* @see GHGist#getFile(String) GHGist#getFile(String)
* @see GHGist#getFiles() GHGist#getFiles()
*/
public class GHGistFile {
/*package almost final*/ String fileName;
/* package almost final */ String fileName;
private int size;
private String raw_url, type, language, content;
private boolean truncated;
/**
* Gets file name.
*
* @return the file name
*/
public String getFileName() {
return fileName;
}
/**
* File size in bytes.
*
* @return the size
*/
public int getSize() {
return size;
@@ -28,6 +34,8 @@ public class GHGistFile {
/**
* URL that serves this file as-is.
*
* @return the raw url
*/
public String getRawUrl() {
return raw_url;
@@ -35,17 +43,26 @@ public class GHGistFile {
/**
* Content type of this Gist, such as "text/plain"
*
* @return the type
*/
public String getType() {
return type;
}
/**
* Gets language.
*
* @return the language
*/
public String getLanguage() {
return language;
}
/**
* Content of this file.
*
* @return the content
*/
public String getContent() {
return content;
@@ -53,6 +70,8 @@ public class GHGistFile {
/**
* (?) indicates if {@link #getContent()} contains a truncated content.
*
* @return the boolean
*/
public boolean isTruncated() {
return truncated;

View File

@@ -1,8 +1,11 @@
package org.kohsuke.github;
import java.io.IOException;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import javax.annotation.Nonnull;
/**
* Builder pattern for updating a Gist.
@@ -12,49 +15,113 @@ import java.util.LinkedHashMap;
public class GHGistUpdater {
private final GHGist base;
private final Requester builder;
LinkedHashMap<String,Object> files;
LinkedHashMap<String, Map<String, String>> files;
GHGistUpdater(GHGist base) {
this.base = base;
this.builder = new Requester(base.root);
this.builder = base.root.createRequest();
files = new LinkedHashMap<>();
}
public GHGistUpdater addFile(String fileName, String content) throws IOException {
/**
* Add file gh gist updater.
*
* @param fileName
* the file name
* @param content
* the content
* @return the gh gist updater
* @throws IOException
* the io exception
*/
public GHGistUpdater addFile(@Nonnull String fileName, @Nonnull String content) throws IOException {
updateFile(fileName, content);
return this;
}
// // This method does not work.
// public GHGistUpdater deleteFile(String fileName) throws IOException {
// files.put(fileName, Collections.singletonMap("filename", null));
// return this;
// }
public GHGistUpdater renameFile(String fileName, String newFileName) throws IOException
{
files.put(fileName, Collections.singletonMap("filename", newFileName));
public GHGistUpdater deleteFile(@Nonnull String fileName) throws IOException {
files.put(fileName, null);
return this;
}
public GHGistUpdater updateFile(String fileName, String content) throws IOException {
files.put(fileName, Collections.singletonMap("content", content));
/**
* Rename file gh gist updater.
*
* @param fileName
* the file name
* @param newFileName
* the new file name
* @return the gh gist updater
* @throws IOException
* the io exception
*/
public GHGistUpdater renameFile(@Nonnull String fileName, @Nonnull String newFileName) throws IOException {
Map<String, String> file = files.computeIfAbsent(fileName, d -> new HashMap<>());
file.put("filename", newFileName);
return this;
}
/**
* Update file gh gist updater.
*
* @param fileName
* the file name
* @param content
* the content
* @return the gh gist updater
* @throws IOException
* the io exception
*/
public GHGistUpdater updateFile(@Nonnull String fileName, @Nonnull String content) throws IOException {
Map<String, String> file = files.computeIfAbsent(fileName, d -> new HashMap<>());
file.put("content", content);
return this;
}
/**
* Update file name and content
*
* @param fileName
* the file name
* @param newFileName
* the new file name
* @param content
* the content
* @return the gh gist updater
* @throws IOException
* the io exception
*/
public GHGistUpdater updateFile(@Nonnull String fileName, @Nonnull String newFileName, @Nonnull String content)
throws IOException {
Map<String, String> file = files.computeIfAbsent(fileName, d -> new HashMap<>());
file.put("content", content);
file.put("filename", newFileName);
files.put(fileName, file);
return this;
}
/**
* Description gh gist updater.
*
* @param desc
* the desc
* @return the gh gist updater
*/
public GHGistUpdater description(String desc) {
builder.with("description",desc);
builder.with("description", desc);
return this;
}
/**
* Updates the Gist based on the parameters specified thus far.
*
* @return the gh gist
* @throws IOException
* the io exception
*/
public GHGist update() throws IOException {
builder._with("files", files);
return builder
.method("PATCH")
.to(base.getApiTailUrl(""), GHGist.class).wrap(base.owner);
builder.with("files", files);
return builder.method("PATCH").withUrlPath(base.getApiTailUrl("")).fetch(GHGist.class);
}
}

View File

@@ -11,49 +11,80 @@ import java.util.Locale;
import java.util.Map;
/**
* The type GHHook.
*
* @author Kohsuke Kawaguchi
*/
@SuppressFBWarnings(value = {"UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD",
"NP_UNWRITTEN_FIELD"}, justification = "JSON API")
@SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD" },
justification = "JSON API")
public abstract class GHHook extends GHObject {
String name;
List<String> events;
boolean active;
Map<String,String> config;
Map<String, String> config;
/**
* Gets name.
*
* @return the name
*/
public String getName() {
return name;
}
/**
* Gets events.
*
* @return the events
*/
public EnumSet<GHEvent> getEvents() {
EnumSet<GHEvent> s = EnumSet.noneOf(GHEvent.class);
for (String e : events) {
if (e.equals("*")) s.add(GHEvent.ALL);
else s.add(Enum.valueOf(GHEvent.class, e.toUpperCase(Locale.ENGLISH)));
if (e.equals("*"))
s.add(GHEvent.ALL);
else
s.add(Enum.valueOf(GHEvent.class, e.toUpperCase(Locale.ENGLISH)));
}
return s;
}
/**
* Is active boolean.
*
* @return the boolean
*/
public boolean isActive() {
return active;
}
/**
* Gets config.
*
* @return the config
*/
public Map<String, String> getConfig() {
return Collections.unmodifiableMap(config);
}
/**
* Ping.
*
* @throws IOException
* the io exception
* @see <a href="https://developer.github.com/v3/repos/hooks/#ping-a-hook">Ping hook</a>
*/
public void ping() throws IOException {
new Requester(getRoot()).method("POST").to(getApiRoute() + "/pings");
getRoot().createRequest().method("POST").withUrlPath(getApiRoute() + "/pings").send();
}
/**
* Deletes this hook.
*
* @throws IOException
* the io exception
*/
public void delete() throws IOException {
new Requester(getRoot()).method("DELETE").to(getApiRoute());
getRoot().createRequest().method("DELETE").withUrlPath(getApiRoute()).send();
}
/**

View File

@@ -12,41 +12,77 @@ import java.util.Map;
* functionality
*/
class GHHooks {
static abstract class Context {
private final GitHub root;
static abstract class Context extends GitHubInteractiveObject {
private Context(GitHub root) {
this.root = root;
this.root = root;
}
/**
* Gets hooks.
*
* @return the hooks
* @throws IOException
* the io exception
*/
public List<GHHook> getHooks() throws IOException {
GHHook [] hookArray = root.retrieve().to(collection(),collectionClass()); // jdk/eclipse bug requires this to be on separate line
GHHook[] hookArray = root.createRequest().withUrlPath(collection()).fetch(collectionClass()); // jdk/eclipse
// bug
// requires this
// to be on separate line
List<GHHook> list = new ArrayList<GHHook>(Arrays.asList(hookArray));
for (GHHook h : list)
wrap(h);
wrap(h);
return list;
}
/**
* Gets hook.
*
* @param id
* the id
* @return the hook
* @throws IOException
* the io exception
*/
public GHHook getHook(int id) throws IOException {
GHHook hook = root.retrieve().to(collection() + "/" + id, clazz());
GHHook hook = root.createRequest().withUrlPath(collection() + "/" + id).fetch(clazz());
return wrap(hook);
}
public GHHook createHook(String name, Map<String, String> config, Collection<GHEvent> events, boolean active) throws IOException {
/**
* Create hook gh hook.
*
* @param name
* the name
* @param config
* the config
* @param events
* the events
* @param active
* the active
* @return the gh hook
* @throws IOException
* the io exception
*/
public GHHook createHook(String name, Map<String, String> config, Collection<GHEvent> events, boolean active)
throws IOException {
List<String> ea = null;
if (events!=null) {
ea = new ArrayList<String>();
for (GHEvent e : events)
ea.add(e.symbol());
if (events != null) {
ea = new ArrayList<String>();
for (GHEvent e : events)
ea.add(e.symbol());
}
GHHook hook = new Requester(root)
.with("name", name)
.with("active", active)
._with("config", config)
._with("events", ea)
.to(collection(), clazz());
GHHook hook = root.createRequest()
.method("POST")
.with("name", name)
.with("active", active)
.with("config", config)
.with("events", ea)
.withUrlPath(collection())
.fetch(clazz());
return wrap(hook);
}
@@ -87,7 +123,7 @@ class GHHooks {
@Override
GHHook wrap(GHHook hook) {
return ((GHRepoHook)hook).wrap(repository);
return ((GHRepoHook) hook).wrap(repository);
}
}
@@ -116,15 +152,15 @@ class GHHooks {
@Override
GHHook wrap(GHHook hook) {
return ((GHOrgHook)hook).wrap(organization);
return ((GHOrgHook) hook).wrap(organization);
}
}
static Context repoContext(GHRepository repository, GHUser owner) {
return new RepoContext(repository, owner);
}
static Context repoContext(GHRepository repository, GHUser owner) {
return new RepoContext(repository, owner);
}
static Context orgContext(GHOrganization organization) {
return new OrgContext(organization);
}
static Context orgContext(GHOrganization organization) {
return new OrgContext(organization);
}
}

View File

@@ -1,34 +1,62 @@
package org.kohsuke.github;
import javax.annotation.CheckForNull;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.util.List;
import java.util.Map;
import javax.annotation.CheckForNull;
import javax.annotation.Nonnull;
/**
* Request/responce contains useful metadata.
* Custom exception allows store info for next diagnostics.
* Request/responce contains useful metadata. Custom exception allows store info for next diagnostics.
*
* @author Kanstantsin Shautsou
*/
public class GHIOException extends IOException {
protected Map<String, List<String>> responseHeaderFields;
/**
* Instantiates a new Ghio exception.
*/
public GHIOException() {
}
/**
* Instantiates a new Ghio exception.
*
* @param message
* the message
*/
public GHIOException(String 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.
*
* @return the response header fields
*/
@CheckForNull
public Map<String, List<String>> getResponseHeaderFields() {
return responseHeaderFields;
}
GHIOException withResponseHeaderFields(HttpURLConnection urlConnection) {
this.responseHeaderFields = urlConnection.getHeaderFields();
GHIOException withResponseHeaderFields(@Nonnull Map<String, List<String>> headerFields) {
this.responseHeaderFields = headerFields;
return this;
}
}

View File

@@ -6,13 +6,16 @@ import java.io.IOException;
import java.net.URL;
/**
* @see GitHub#getMyInvitations()
* @see GHRepository#listInvitations()
* The type GHInvitation.
*
* @see GitHub#getMyInvitations() GitHub#getMyInvitations()
* @see GHRepository#listInvitations() GHRepository#listInvitations()
*/
@SuppressFBWarnings(value = {"UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD",
"NP_UNWRITTEN_FIELD", "UUF_UNUSED_FIELD"}, justification = "JSON API")
@SuppressFBWarnings(
value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD",
"UUF_UNUSED_FIELD" },
justification = "JSON API")
public class GHInvitation extends GHObject {
/*package almost final*/ GitHub root;
private int id;
private GHRepository repository;
@@ -20,27 +23,33 @@ public class GHInvitation extends GHObject {
private String permissions;
private String html_url;
/*package*/ GHInvitation wrapUp(GitHub root) {
GHInvitation wrapUp(GitHub root) {
this.root = root;
return this;
}
/**
* Accept a repository invitation.
*
* @throws IOException
* the io exception
*/
public void accept() throws IOException {
root.retrieve().method("PATCH").to("/user/repository_invitations/" + id);
root.createRequest().method("PATCH").withUrlPath("/user/repository_invitations/" + id).send();
}
/**
* Decline a repository invitation.
*
* @throws IOException
* the io exception
*/
public void decline() throws IOException {
root.retrieve().method("DELETE").to("/user/repository_invitations/" + id);
root.createRequest().method("DELETE").withUrlPath("/user/repository_invitations/" + id).send();
}
@Override
public URL getHtmlUrl() {
return GitHub.parseURL(html_url);
return GitHubClient.parseURL(html_url);
}
}

View File

@@ -24,10 +24,10 @@
package org.kohsuke.github;
import static org.kohsuke.github.Previews.SQUIRREL_GIRL;
import com.infradna.tool.bridge_method_injector.WithBridgeMethods;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.apache.commons.lang3.StringUtils;
import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
@@ -35,28 +35,28 @@ import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
import java.util.Set;
import java.util.Objects;
import static org.kohsuke.github.internal.Previews.SQUIRREL_GIRL;
/**
* Represents an issue on GitHub.
*
* @author Eric Maupin
* @author Kohsuke Kawaguchi
* @see GHRepository#getIssue(int)
* @see GitHub#searchIssues()
* @see GHRepository#getIssue(int) GHRepository#getIssue(int)
* @see GitHub#searchIssues() GitHub#searchIssues()
* @see GHIssueSearchBuilder
*/
public class GHIssue extends GHObject implements Reactable{
public class GHIssue extends GHObject implements Reactable {
private static final String ASSIGNEES = "assignees";
GitHub root;
GHRepository owner;
// API v3
protected GHUser assignee; // not sure what this field is now that 'assignees' exist
protected GHUser assignee; // not sure what this field is now that 'assignees' exist
protected GHUser[] assignees;
protected String state;
protected int number;
@@ -64,8 +64,7 @@ public class GHIssue extends GHObject implements Reactable{
protected int comments;
@SkipFromToString
protected String body;
// for backward compatibility with < 1.63, this collection needs to hold instances of Label, not GHLabel
protected List<Label> labels;
protected List<GHLabel> labels;
protected GHUser user;
protected String title, html_url;
protected GHIssue.PullRequest pull_request;
@@ -73,35 +72,30 @@ public class GHIssue extends GHObject implements Reactable{
protected GHUser closed_by;
protected boolean locked;
/**
* @deprecated use {@link GHLabel}
*/
public static class Label extends GHLabel {
}
/*package*/ GHIssue wrap(GHRepository owner) {
GHIssue wrap(GHRepository owner) {
this.owner = owner;
if(milestone != null) milestone.wrap(owner);
if (milestone != null)
milestone.wrap(owner);
return wrap(owner.root);
}
/*package*/ GHIssue wrap(GitHub root) {
GHIssue wrap(GitHub root) {
this.root = root;
if(assignee != null) assignee.wrapUp(root);
if(assignees!=null) GHUser.wrap(assignees,root);
if(user != null) user.wrapUp(root);
if(closed_by != null) closed_by.wrapUp(root);
if (assignee != null)
assignee.wrapUp(root);
if (assignees != null)
GHUser.wrap(assignees, root);
if (user != null)
user.wrapUp(root);
if (closed_by != null)
closed_by.wrapUp(root);
return this;
}
/*package*/ static GHIssue[] wrap(GHIssue[] issues, GHRepository owner) {
for (GHIssue i : issues)
i.wrap(owner);
return issues;
}
/**
* Repository to which the issue belongs.
*
* @return the repository
*/
public GHRepository getRepository() {
return owner;
@@ -109,6 +103,8 @@ public class GHIssue extends GHObject implements Reactable{
/**
* The description of this pull request.
*
* @return the body
*/
public String getBody() {
return body;
@@ -116,76 +112,138 @@ public class GHIssue extends GHObject implements Reactable{
/**
* ID.
*
* @return the number
*/
public int getNumber() {
return number;
}
/**
* 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() {
return GitHub.parseURL(html_url);
return GitHubClient.parseURL(html_url);
}
/**
* Gets title.
*
* @return the title
*/
public String getTitle() {
return title;
}
/**
* Is locked boolean.
*
* @return the boolean
*/
public boolean isLocked() {
return locked;
}
/**
* Gets state.
*
* @return the state
*/
public GHIssueState getState() {
return Enum.valueOf(GHIssueState.class, state.toUpperCase(Locale.ENGLISH));
}
public Collection<GHLabel> getLabels() throws IOException {
if(labels == null){
/**
* Gets labels.
*
* @return the labels
*/
public Collection<GHLabel> getLabels() {
if (labels == null) {
return Collections.emptyList();
}
return Collections.<GHLabel>unmodifiableList(labels);
return Collections.unmodifiableList(labels);
}
/**
* Gets closed at.
*
* @return the closed at
*/
public Date getClosedAt() {
return GitHub.parseDate(closed_at);
return GitHubClient.parseDate(closed_at);
}
public URL getApiURL(){
return GitHub.parseURL(url);
/**
* Gets api url.
*
* @return API URL of this object.
* @deprecated use {@link #getUrl()}
*/
@Deprecated
public URL getApiURL() {
return getUrl();
}
/**
* Lock.
*
* @throws IOException
* the io exception
*/
public void lock() throws IOException {
new Requester(root).method("PUT").to(getApiRoute()+"/lock");
root.createRequest().method("PUT").withUrlPath(getApiRoute() + "/lock").send();
}
/**
* Unlock.
*
* @throws IOException
* the io exception
*/
public void unlock() throws IOException {
new Requester(root).method("PUT").to(getApiRoute()+"/lock");
root.createRequest().method("PUT").withUrlPath(getApiRoute() + "/lock").send();
}
/**
* Updates the issue by adding a comment.
*
* @return
* Newly posted comment.
* @param message
* the message
* @return Newly posted comment.
* @throws IOException
* the io exception
*/
@WithBridgeMethods(void.class)
public GHIssueComment comment(String message) throws IOException {
GHIssueComment r = new Requester(root).with("body",message).to(getIssuesApiRoute() + "/comments", GHIssueComment.class);
GHIssueComment r = root.createRequest()
.method("POST")
.with("body", message)
.withUrlPath(getIssuesApiRoute() + "/comments")
.fetch(GHIssueComment.class);
return r.wrapUp(this);
}
private void edit(String key, Object value) throws IOException {
new Requester(root)._with(key, value).method("PATCH").to(getApiRoute());
root.createRequest().with(key, value).method("PATCH").withUrlPath(getApiRoute()).send();
}
/**
* Identical to edit(), but allows null for the value.
*/
private void editNullable(String key, Object value) throws IOException {
root.createRequest().withNullable(key, value).method("PATCH").withUrlPath(getApiRoute()).send();
}
private void editIssue(String key, Object value) throws IOException {
new Requester(root)._with(key, value).method("PATCH").to(getIssuesApiRoute());
root.createRequest().withNullable(key, value).method("PATCH").withUrlPath(getIssuesApiRoute()).send();
}
/**
* Closes this issue.
*
* @throws IOException
* the io exception
*/
public void close() throws IOException {
edit("state", "closed");
@@ -193,171 +251,394 @@ public class GHIssue extends GHObject implements Reactable{
/**
* Reopens this issue.
*
* @throws IOException
* the io exception
*/
public void reopen() throws IOException {
edit("state", "open");
}
/**
* Sets title.
*
* @param title
* the title
* @throws IOException
* the io exception
*/
public void setTitle(String title) throws IOException {
edit("title",title);
edit("title", title);
}
/**
* Sets body.
*
* @param body
* the body
* @throws IOException
* the io exception
*/
public void setBody(String body) throws IOException {
edit("body",body);
edit("body", body);
}
/**
* Sets the milestone for this issue.
*
* @param milestone
* The milestone to assign this issue to. Use null to remove the milestone for this issue.
* @throws IOException
* The io exception
*/
public void setMilestone(GHMilestone milestone) throws IOException {
edit("milestone",milestone.getNumber());
if (milestone == null) {
editIssue("milestone", null);
} else {
editIssue("milestone", milestone.getNumber());
}
}
/**
* Assign to.
*
* @param user
* the user
* @throws IOException
* the io exception
*/
public void assignTo(GHUser user) throws IOException {
setAssignees(user);
}
/**
* Sets labels on the target to a specific list.
*
* @param labels
* the labels
* @throws IOException
* the io exception
*/
public void setLabels(String... labels) throws IOException {
editIssue("labels",labels);
editIssue("labels", labels);
}
/**
* Adds labels to the issue.
*
* @param names Names of the label
* Labels that are already present on the target are ignored.
*
* @return the complete list of labels including the new additions
* @param names
* Names of the label
* @throws IOException
* the io exception
*/
public void addLabels(String... names) throws IOException {
_addLabels(Arrays.asList(names));
@WithBridgeMethods(void.class)
public List<GHLabel> addLabels(String... names) throws IOException {
return _addLabels(Arrays.asList(names));
}
public void addLabels(GHLabel... labels) throws IOException {
addLabels(Arrays.asList(labels));
/**
* Add labels.
*
* Labels that are already present on the target are ignored.
*
* @return the complete list of labels including the new additions
* @param labels
* the labels
* @throws IOException
* the io exception
*/
@WithBridgeMethods(void.class)
public List<GHLabel> addLabels(GHLabel... labels) throws IOException {
return addLabels(Arrays.asList(labels));
}
public void addLabels(Collection<GHLabel> labels) throws IOException {
_addLabels(GHLabel.toNames(labels));
/**
* Add labels.
*
* Labels that are already present on the target are ignored.
*
* @return the complete list of labels including the new additions
* @param labels
* the labels
* @throws IOException
* the io exception
*/
@WithBridgeMethods(void.class)
public List<GHLabel> addLabels(Collection<GHLabel> labels) throws IOException {
return _addLabels(GHLabel.toNames(labels));
}
private void _addLabels(Collection<String> names) throws IOException {
List<String> newLabels = new ArrayList<String>();
private List<GHLabel> _addLabels(Collection<String> names) throws IOException {
return Arrays.asList(root.createRequest()
.with("labels", names)
.method("POST")
.withUrlPath(getIssuesApiRoute() + "/labels")
.fetch(GHLabel[].class));
}
for (GHLabel label : getLabels()) {
newLabels.add(label.getName());
}
/**
* Remove a single label.
*
* Attempting to remove a label that is not present throws {@link GHFileNotFoundException}.
*
* @return the remaining list of labels
* @param name
* the name
* @throws IOException
* the io exception, throws {@link GHFileNotFoundException} if label was not present.
*/
@WithBridgeMethods(void.class)
public List<GHLabel> removeLabel(String name) throws IOException {
return Arrays.asList(root.createRequest()
.method("DELETE")
.withUrlPath(getIssuesApiRoute() + "/labels", name)
.fetch(GHLabel[].class));
}
/**
* Remove a collection of labels.
*
* Attempting to remove labels that are not present on the target are ignored.
*
* @return the remaining list of labels
* @param names
* the names
* @throws IOException
* the io exception
*/
@WithBridgeMethods(void.class)
public List<GHLabel> removeLabels(String... names) throws IOException {
return _removeLabels(Arrays.asList(names));
}
/**
* Remove a collection of labels.
*
* Attempting to remove labels that are not present on the target are ignored.
*
* @return the remaining list of labels
* @param labels
* the labels
* @throws IOException
* the io exception
* @see #removeLabels(String...) #removeLabels(String...)
*/
@WithBridgeMethods(void.class)
public List<GHLabel> removeLabels(GHLabel... labels) throws IOException {
return removeLabels(Arrays.asList(labels));
}
/**
* Remove a collection of labels.
*
* Attempting to remove labels that are not present on the target are ignored.
*
* @return the remaining list of labels
* @param labels
* the labels
* @throws IOException
* the io exception
*/
@WithBridgeMethods(void.class)
public List<GHLabel> removeLabels(Collection<GHLabel> labels) throws IOException {
return _removeLabels(GHLabel.toNames(labels));
}
private List<GHLabel> _removeLabels(Collection<String> names) throws IOException {
List<GHLabel> remainingLabels = Collections.emptyList();
for (String name : names) {
if (!newLabels.contains(name)) {
newLabels.add(name);
try {
remainingLabels = removeLabel(name);
} catch (GHFileNotFoundException e) {
// when trying to remove multiple labels, we ignore already removed
}
}
setLabels(newLabels.toArray(new String[0]));
}
/**
* Remove a given label by name from this issue.
*/
public void removeLabels(String... names) throws IOException {
_removeLabels(Arrays.asList(names));
}
/**
* @see #removeLabels(String...)
*/
public void removeLabels(GHLabel... labels) throws IOException {
removeLabels(Arrays.asList(labels));
}
public void removeLabels(Collection<GHLabel> labels) throws IOException {
_removeLabels(GHLabel.toNames(labels));
}
private void _removeLabels(Collection<String> names) throws IOException {
List<String> newLabels = new ArrayList<String>();
for (GHLabel l : getLabels()) {
if (!names.contains(l.getName())) {
newLabels.add(l.getName());
}
}
setLabels(newLabels.toArray(new String[0]));
return remainingLabels;
}
/**
* Obtains all the comments associated with this issue.
*
* @see #listComments()
*
* @return the comments
* @throws IOException
* the io exception
* @see #listComments() #listComments()
*/
public List<GHIssueComment> getComments() throws IOException {
return listComments().asList();
return listComments().toList();
}
/**
* Obtains all the comments associated with this issue.
*
* @return the paged iterable
* @throws IOException
* the io exception
*/
public PagedIterable<GHIssueComment> listComments() throws IOException {
return root.retrieve()
.asPagedIterable(
getIssuesApiRoute() + "/comments",
GHIssueComment[].class,
item -> item.wrapUp(GHIssue.this) );
return root.createRequest()
.withUrlPath(getIssuesApiRoute() + "/comments")
.toIterable(GHIssueComment[].class, item -> item.wrapUp(this));
}
@Preview @Deprecated
@Preview(SQUIRREL_GIRL)
@Deprecated
public GHReaction createReaction(ReactionContent content) throws IOException {
return new Requester(owner.root)
return root.createRequest()
.method("POST")
.withPreview(SQUIRREL_GIRL)
.with("content", content.getContent())
.to(getApiRoute()+"/reactions", GHReaction.class).wrap(root);
.withUrlPath(getApiRoute() + "/reactions")
.fetch(GHReaction.class)
.wrap(root);
}
@Preview @Deprecated
@Preview(SQUIRREL_GIRL)
@Deprecated
public PagedIterable<GHReaction> listReactions() {
return owner.root.retrieve().withPreview(SQUIRREL_GIRL)
.asPagedIterable(
getApiRoute()+"/reactions",
GHReaction[].class,
item -> item.wrap(owner.root) );
return root.createRequest()
.withPreview(SQUIRREL_GIRL)
.withUrlPath(getApiRoute() + "/reactions")
.toIterable(GHReaction[].class, item -> item.wrap(root));
}
/**
* Add assignees.
*
* @param assignees
* the assignees
* @throws IOException
* the io exception
*/
public void addAssignees(GHUser... assignees) throws IOException {
addAssignees(Arrays.asList(assignees));
}
/**
* Add assignees.
*
* @param assignees
* the assignees
* @throws IOException
* the io exception
*/
public void addAssignees(Collection<GHUser> assignees) throws IOException {
root.retrieve().method("POST").withLogins(ASSIGNEES,assignees).to(getIssuesApiRoute()+"/assignees",this);
root.createRequest()
.method("POST")
.with(ASSIGNEES, getLogins(assignees))
.withUrlPath(getIssuesApiRoute() + "/assignees")
.fetchInto(this);
}
/**
* Sets assignees.
*
* @param assignees
* the assignees
* @throws IOException
* the io exception
*/
public void setAssignees(GHUser... assignees) throws IOException {
setAssignees(Arrays.asList(assignees));
}
/**
* Sets assignees.
*
* @param assignees
* the assignees
* @throws IOException
* the io exception
*/
public void setAssignees(Collection<GHUser> assignees) throws IOException {
new Requester(root).withLogins(ASSIGNEES, assignees).method("PATCH").to(getIssuesApiRoute());
root.createRequest()
.method("PATCH")
.with(ASSIGNEES, getLogins(assignees))
.withUrlPath(getIssuesApiRoute())
.send();
}
/**
* Remove assignees.
*
* @param assignees
* the assignees
* @throws IOException
* the io exception
*/
public void removeAssignees(GHUser... assignees) throws IOException {
removeAssignees(Arrays.asList(assignees));
}
/**
* Remove assignees.
*
* @param assignees
* the assignees
* @throws IOException
* the io exception
*/
public void removeAssignees(Collection<GHUser> assignees) throws IOException {
root.retrieve().method("DELETE").withLogins(ASSIGNEES,assignees).inBody().to(getIssuesApiRoute()+"/assignees",this);
root.createRequest()
.method("DELETE")
.with(ASSIGNEES, getLogins(assignees))
.inBody()
.withUrlPath(getIssuesApiRoute() + "/assignees")
.fetchInto(this);
}
/**
* Gets api route.
*
* @return the api route
*/
protected String getApiRoute() {
return getIssuesApiRoute();
}
/**
* Gets issues api route.
*
* @return the issues api route
*/
protected String getIssuesApiRoute() {
return "/repos/"+owner.getOwnerName()+"/"+owner.getName()+"/issues/"+number;
if (owner == null) {
// Issues returned from search to do not have an owner. Attempt to use url.
final URL url = Objects.requireNonNull(getUrl(), "Missing instance URL!");
return StringUtils.prependIfMissing(url.toString().replace(root.getApiUrl(), ""), "/");
}
return "/repos/" + owner.getOwnerName() + "/" + owner.getName() + "/issues/" + number;
}
/**
* Gets assignee.
*
* @return the assignee
* @throws IOException
* the io exception
*/
public GHUser getAssignee() throws IOException {
return root.intern(assignee);
}
/**
* Gets assignees.
*
* @return the assignees
*/
public List<GHUser> getAssignees() {
return Collections.unmodifiableList(Arrays.asList(assignees));
}
/**
* User who submitted the issue.
*
* @return the user
* @throws IOException
* the io exception
*/
public GHUser getUser() throws IOException {
return root.intern(user);
@@ -367,67 +648,114 @@ public class GHIssue extends GHObject implements Reactable{
* Reports who has closed the issue.
*
* <p>
* Note that GitHub doesn't always seem to report this information
* even for an issue that's already closed. See
* Note that GitHub doesn't always seem to report this information even for an issue that's already closed. See
* https://github.com/kohsuke/github-api/issues/60.
*
* @return the closed by
* @throws IOException
* the io exception
*/
public GHUser getClosedBy() throws IOException {
if(!"closed".equals(state)) return null;
if (!"closed".equals(state))
return null;
//TODO
// TODO
/*
if (closed_by==null) {
closed_by = owner.getIssue(number).getClosed_by();
}
*/
* if (closed_by==null) { closed_by = owner.getIssue(number).getClosed_by(); }
*/
return root.intern(closed_by);
}
public int getCommentsCount(){
/**
* Gets comments count.
*
* @return the comments count
*/
public int getCommentsCount() {
return comments;
}
/**
* Returns non-null if this issue is a shadow of a pull request.
*
* @return the pull request
*/
public PullRequest getPullRequest() {
return pull_request;
}
/**
* Is pull request boolean.
*
* @return the boolean
*/
public boolean isPullRequest() {
return pull_request!=null;
return pull_request != null;
}
/**
* Gets milestone.
*
* @return the milestone
*/
public GHMilestone getMilestone() {
return milestone;
}
@SuppressFBWarnings(value = {"UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD"},
justification = "JSON API")
public static class PullRequest{
/**
* The type PullRequest.
*/
@SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD" },
justification = "JSON API")
public static class PullRequest {
private String diff_url, patch_url, html_url;
/**
* Gets diff url.
*
* @return the diff url
*/
public URL getDiffUrl() {
return GitHub.parseURL(diff_url);
return GitHubClient.parseURL(diff_url);
}
/**
* Gets patch url.
*
* @return the patch url
*/
public URL getPatchUrl() {
return GitHub.parseURL(patch_url);
return GitHubClient.parseURL(patch_url);
}
/**
* Gets url.
*
* @return the url
*/
public URL getUrl() {
return GitHub.parseURL(html_url);
return GitHubClient.parseURL(html_url);
}
}
protected static List<String> getLogins(Collection<GHUser> users) {
List<String> names = new ArrayList<String>(users.size());
for (GHUser a : users) {
names.add(a.getLogin());
}
return names;
}
/**
* Lists events for this issue.
* See https://developer.github.com/v3/issues/events/
* Lists events for this issue. See https://developer.github.com/v3/issues/events/
*
* @return the paged iterable
* @throws IOException
* the io exception
*/
public PagedIterable<GHIssueEvent> listEvents() throws IOException {
return root.retrieve().asPagedIterable(
owner.getApiTailUrl(String.format("/issues/%s/events", number)),
GHIssueEvent[].class,
item -> item.wrapUp(GHIssue.this) );
return root.createRequest()
.withUrlPath(owner.getApiTailUrl(String.format("/issues/%s/events", number)))
.toIterable(GHIssueEvent[].class, item -> item.wrapUp(this));
}
}

View File

@@ -5,6 +5,8 @@ import java.util.ArrayList;
import java.util.List;
/**
* The type GHIssueBuilder.
*
* @author Kohsuke Kawaguchi
*/
public class GHIssueBuilder {
@@ -15,46 +17,86 @@ public class GHIssueBuilder {
GHIssueBuilder(GHRepository repo, String title) {
this.repo = repo;
this.builder = new Requester(repo.root);
builder.with("title",title);
this.builder = repo.root.createRequest().method("POST");
builder.with("title", title);
}
/**
* Sets the main text of an issue, which is arbitrary multi-line text.
*
* @param str
* the str
* @return the gh issue builder
*/
public GHIssueBuilder body(String str) {
builder.with("body",str);
builder.with("body", str);
return this;
}
/**
* Assignee gh issue builder.
*
* @param user
* the user
* @return the gh issue builder
*/
public GHIssueBuilder assignee(GHUser user) {
if (user!=null)
if (user != null)
assignees.add(user.getLogin());
return this;
}
/**
* Assignee gh issue builder.
*
* @param user
* the user
* @return the gh issue builder
*/
public GHIssueBuilder assignee(String user) {
if (user!=null)
if (user != null)
assignees.add(user);
return this;
}
/**
* Milestone gh issue builder.
*
* @param milestone
* the milestone
* @return the gh issue builder
*/
public GHIssueBuilder milestone(GHMilestone milestone) {
if (milestone!=null)
builder.with("milestone",milestone.getNumber());
if (milestone != null)
builder.with("milestone", milestone.getNumber());
return this;
}
/**
* Label gh issue builder.
*
* @param label
* the label
* @return the gh issue builder
*/
public GHIssueBuilder label(String label) {
if (label!=null)
if (label != null)
labels.add(label);
return this;
}
/**
* Creates a new issue.
*
* @return the gh issue
* @throws IOException
* the io exception
*/
public GHIssue create() throws IOException {
return builder.with("labels",labels).with("assignees",assignees).to(repo.getApiTailUrl("issues"),GHIssue.class).wrap(repo);
return builder.with("labels", labels)
.with("assignees", assignees)
.withUrlPath(repo.getApiTailUrl("issues"))
.fetch(GHIssue.class)
.wrap(repo);
}
}

View File

@@ -0,0 +1,49 @@
package org.kohsuke.github;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
/**
* Wrapper to define changed fields on issues action="edited"
*
* @see GHEventPayload.Issue
*/
@SuppressFBWarnings("UWF_UNWRITTEN_FIELD")
public class GHIssueChanges {
private GHFrom title;
private GHFrom body;
/**
* Old issue title.
*
* @return old issue title (or null if not changed)
*/
public GHFrom getTitle() {
return title;
}
/**
* Old issue body.
*
* @return old issue body (or null if not changed)
*/
public GHFrom getBody() {
return body;
}
/**
* Wrapper for changed values.
*/
public static class GHFrom {
private String from;
/**
* Previous value that was changed.
*
* @return previous value
*/
public String getFrom() {
return from;
}
}
}

View File

@@ -26,14 +26,14 @@ package org.kohsuke.github;
import java.io.IOException;
import java.net.URL;
import static org.kohsuke.github.Previews.*;
import static org.kohsuke.github.internal.Previews.SQUIRREL_GIRL;
/**
* Comment to the issue
*
* @author Kohsuke Kawaguchi
* @see GHIssue#comment(String)
* @see GHIssue#listComments()
* @see GHIssue#comment(String) GHIssue#comment(String)
* @see GHIssue#listComments() GHIssue#listComments()
*/
public class GHIssueComment extends GHObject implements Reactable {
GHIssue owner;
@@ -41,13 +41,15 @@ public class GHIssueComment extends GHObject implements Reactable {
private String body, gravatar_id, html_url, author_association;
private GHUser user; // not fully populated. beware.
/*package*/ GHIssueComment wrapUp(GHIssue owner) {
GHIssueComment wrapUp(GHIssue owner) {
this.owner = owner;
return this;
}
/**
* Gets the issue to which this comment is associated.
*
* @return the parent
*/
public GHIssue getParent() {
return owner;
@@ -55,6 +57,8 @@ public class GHIssueComment extends GHObject implements Reactable {
/**
* The comment itself.
*
* @return the body
*/
public String getBody() {
return body;
@@ -62,6 +66,8 @@ public class GHIssueComment extends GHObject implements Reactable {
/**
* Gets the ID of the user who posted this comment.
*
* @return the user name
*/
@Deprecated
public String getUserName() {
@@ -70,54 +76,79 @@ public class GHIssueComment extends GHObject implements Reactable {
/**
* Gets the user who posted this comment.
*
* @return the user
* @throws IOException
* the io exception
*/
public GHUser getUser() throws IOException {
return owner == null || owner.root.isOffline() ? user : owner.root.getUser(user.getLogin());
}
@Override
public URL getHtmlUrl() {
return GitHub.parseURL(html_url);
return GitHubClient.parseURL(html_url);
}
/**
* Gets author association.
*
* @return the author association
*/
public GHCommentAuthorAssociation getAuthorAssociation() {
return GHCommentAuthorAssociation.valueOf(author_association);
}
/**
* Updates the body of the issue comment.
*
* @param body
* the body
* @throws IOException
* the io exception
*/
public void update(String body) throws IOException {
new Requester(owner.root).with("body", body).method("PATCH").to(getApiRoute(), GHIssueComment.class);
owner.root.createRequest()
.method("PATCH")
.with("body", body)
.withUrlPath(getApiRoute())
.fetch(GHIssueComment.class);
this.body = body;
}
/**
* Deletes this issue comment.
*
* @throws IOException
* the io exception
*/
public void delete() throws IOException {
new Requester(owner.root).method("DELETE").to(getApiRoute());
owner.root.createRequest().method("DELETE").withUrlPath(getApiRoute()).send();
}
@Preview @Deprecated
@Preview(SQUIRREL_GIRL)
@Deprecated
public GHReaction createReaction(ReactionContent content) throws IOException {
return new Requester(owner.root)
return owner.root.createRequest()
.method("POST")
.withPreview(SQUIRREL_GIRL)
.with("content", content.getContent())
.to(getApiRoute()+"/reactions", GHReaction.class).wrap(owner.root);
.withUrlPath(getApiRoute() + "/reactions")
.fetch(GHReaction.class)
.wrap(owner.root);
}
@Preview @Deprecated
@Preview(SQUIRREL_GIRL)
@Deprecated
public PagedIterable<GHReaction> listReactions() {
return owner.root.retrieve()
.withPreview(SQUIRREL_GIRL)
.asPagedIterable(
getApiRoute()+"/reactions",
GHReaction[].class,
item -> item.wrap(owner.root) );
return owner.root.createRequest()
.withPreview(SQUIRREL_GIRL)
.withUrlPath(getApiRoute() + "/reactions")
.toIterable(GHReaction[].class, item -> item.wrap(owner.root));
}
private String getApiRoute() {
return "/repos/"+owner.getRepository().getOwnerName()+"/"+owner.getRepository().getName()+"/issues/comments/" + id;
return "/repos/" + owner.getRepository().getOwnerName() + "/" + owner.getRepository().getName()
+ "/issues/comments/" + getId();
}
}

View File

@@ -3,11 +3,13 @@ package org.kohsuke.github;
import java.util.Date;
/**
* The type GHIssueEvent.
*
* @see <a href="https://developer.github.com/v3/issues/events/">Github documentation for issue events</a>
*
* @author Martin van Zijl
*/
public class GHIssueEvent {
private GitHub root;
public class GHIssueEvent extends GitHubInteractiveObject {
private long id;
private String node_id;
private String url;
@@ -16,49 +18,132 @@ public class GHIssueEvent {
private String commit_id;
private String commit_url;
private String created_at;
private GHMilestone milestone;
private GHLabel label;
private GHUser assignee;
private GHIssue issue;
/**
* Gets id.
*
* @return the id
*/
public long getId() {
return id;
}
/**
* Gets node id.
*
* @return the node id
*/
public String getNodeId() {
return node_id;
}
/**
* Gets url.
*
* @return the url
*/
public String getUrl() {
return url;
}
/**
* Gets actor.
*
* @return the actor
*/
public GHUser getActor() {
return actor;
}
/**
* Gets event.
*
* @return the event
*/
public String getEvent() {
return event;
}
/**
* Gets commit id.
*
* @return the commit id
*/
public String getCommitId() {
return commit_id;
}
/**
* Gets commit url.
*
* @return the commit url
*/
public String getCommitUrl() {
return commit_url;
}
/**
* Gets created at.
*
* @return the created at
*/
public Date getCreatedAt() {
return GitHub.parseDate(created_at);
return GitHubClient.parseDate(created_at);
}
/**
* Gets root.
*
* @return the root
*/
public GitHub getRoot() {
return root;
}
/**
* Gets issue.
*
* @return the issue
*/
public GHIssue getIssue() {
return issue;
}
/**
* Get the {@link GHMilestone} that this issue was added to or removed from. Only present for events "milestoned"
* and "demilestoned", <code>null</code> otherwise.
*
* @return the milestone
*/
public GHMilestone getMilestone() {
return milestone;
}
/**
* Get the {@link GHLabel} that was added to or removed from the issue. Only present for events "labeled" and
* "unlabeled", <code>null</code> otherwise.
*
* @return the label
*/
public GHLabel getLabel() {
return label;
}
/**
* Get the {@link GHUser} that was assigned or unassigned from the issue. Only present for events "assigned" and
* "unassigned", <code>null</code> otherwise.
*
* @return the user
*/
public GHUser getAssignee() {
return assignee;
}
GHIssueEvent wrapUp(GitHub root) {
this.root = root;
return this;

View File

@@ -4,11 +4,11 @@ package org.kohsuke.github;
* Search issues.
*
* @author Kohsuke Kawaguchi
* @see GitHub#searchIssues()
* @see GitHub#searchIssues() GitHub#searchIssues()
*/
public class GHIssueSearchBuilder extends GHSearchBuilder<GHIssue> {
/*package*/ GHIssueSearchBuilder(GitHub root) {
super(root,IssueSearchResult.class);
GHIssueSearchBuilder(GitHub root) {
super(root, IssueSearchResult.class);
}
/**
@@ -19,43 +19,91 @@ public class GHIssueSearchBuilder extends GHSearchBuilder<GHIssue> {
return this;
}
/**
* Mentions gh issue search builder.
*
* @param u
* the u
* @return the gh issue search builder
*/
public GHIssueSearchBuilder mentions(GHUser u) {
return mentions(u.getLogin());
}
/**
* Mentions gh issue search builder.
*
* @param login
* the login
* @return the gh issue search builder
*/
public GHIssueSearchBuilder mentions(String login) {
return q("mentions:"+login);
return q("mentions:" + login);
}
/**
* Is open gh issue search builder.
*
* @return the gh issue search builder
*/
public GHIssueSearchBuilder isOpen() {
return q("is:open");
}
/**
* Is closed gh issue search builder.
*
* @return the gh issue search builder
*/
public GHIssueSearchBuilder isClosed() {
return q("is:closed");
}
/**
* Is merged gh issue search builder.
*
* @return the gh issue search builder
*/
public GHIssueSearchBuilder isMerged() {
return q("is:merged");
}
/**
* Order gh issue search builder.
*
* @param v
* the v
* @return the gh issue search builder
*/
public GHIssueSearchBuilder order(GHDirection v) {
req.with("order",v);
req.with("order", v);
return this;
}
/**
* Sort gh issue search builder.
*
* @param sort
* the sort
* @return the gh issue search builder
*/
public GHIssueSearchBuilder sort(Sort sort) {
req.with("sort",sort);
req.with("sort", sort);
return this;
}
public enum Sort { COMMENTS, CREATED, UPDATED }
/**
* The enum Sort.
*/
public enum Sort {
COMMENTS, CREATED, UPDATED
}
private static class IssueSearchResult extends SearchResult<GHIssue> {
private GHIssue[] items;
@Override
/*package*/ GHIssue[] getItems(GitHub root) {
GHIssue[] getItems(GitHub root) {
for (GHIssue i : items)
i.wrap(root);
return items;

View File

@@ -25,10 +25,10 @@
package org.kohsuke.github;
/**
* @see GHPullRequestQueryBuilder#state(GHIssueState)
* The enum GHIssueState.
*
* @see GHPullRequestQueryBuilder#state(GHIssueState) GHPullRequestQueryBuilder#state(GHIssueState)
*/
public enum GHIssueState {
OPEN,
CLOSED,
ALL
}
OPEN, CLOSED, ALL
}

View File

@@ -9,46 +9,71 @@ import org.apache.commons.lang3.builder.ToStringBuilder;
* @author Kohsuke Kawaguchi
*/
@SuppressFBWarnings(value = "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", justification = "JSON API")
public class GHKey {
/*package almost final*/ GitHub root;
public class GHKey extends GitHubInteractiveObject {
protected String url, key, title;
protected boolean verified;
protected int id;
/**
* Gets id.
*
* @return the id
*/
public int getId() {
return id;
}
/**
* Gets key.
*
* @return the key
*/
public String getKey() {
return key;
}
/**
* Gets title.
*
* @return the title
*/
public String getTitle() {
return title;
}
/**
* Something like "https://api.github.com/user/keys/73593"
*
* @return the url
*/
public String getUrl() {
return url;
}
/**
* Gets root.
*
* @return the root
*/
public GitHub getRoot() {
return root;
}
/**
* Is verified boolean.
*
* @return the boolean
*/
public boolean isVerified() {
return verified;
}
/*package*/ GHKey wrap(GitHub root) {
GHKey wrap(GitHub root) {
this.root = root;
return this;
}
public String toString() {
return new ToStringBuilder(this).append("title",title).append("id",id).append("key",key).toString();
return new ToStringBuilder(this).append("title", title).append("id", id).append("key", key).toString();
}
}

View File

@@ -1,101 +1,297 @@
package org.kohsuke.github;
import com.fasterxml.jackson.annotation.JacksonInject;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Objects;
import static org.kohsuke.github.Previews.SYMMETRA;
/**
* @author Kohsuke Kawaguchi
* @see GHIssue#getLabels()
* @see GHRepository#listLabels()
*/
public class GHLabel {
private String url, name, color, description;
private GHRepository repo;
import javax.annotation.CheckForNull;
import javax.annotation.Nonnull;
/**
* The type GHLabel.
*
* @author Kohsuke Kawaguchi
* @see <a href="https://developer.github.com/v3/issues/labels/">Labels</a>
* @see GHIssue#getLabels() GHIssue#getLabels()
* @see GHRepository#listLabels() GHRepository#listLabels()
*/
public class GHLabel extends GitHubInteractiveObject {
private long id;
private String nodeId;
@JsonProperty("default")
private boolean default_;
@Nonnull
private String url, name, color;
@CheckForNull
private String description;
@JsonCreator
private GHLabel(@JacksonInject @Nonnull GitHub root) {
this.root = root;
url = "";
name = "";
color = "";
description = null;
}
@Nonnull
GitHub getApiRoot() {
return Objects.requireNonNull(root);
}
/**
* Gets id.
*
* @return the id
*/
public long getId() {
return id;
}
/**
* Gets node id.
*
* @return the node id.
*/
public String getNodeId() {
return nodeId;
}
/**
* Gets url.
*
* @return the url
*/
@Nonnull
public String getUrl() {
return url;
}
/**
* Gets name.
*
* @return the name
*/
@Nonnull
public String getName() {
return name;
}
/**
* Color code without leading '#', such as 'f29513'
*
* @return the color
*/
@Nonnull
public String getColor() {
return color;
}
/**
* Purpose of Label
*
* @return the description
*/
@Preview @Deprecated
@CheckForNull
public String getDescription() {
return description;
}
/*package*/ GHLabel wrapUp(GHRepository repo) {
this.repo = repo;
return this;
}
public void delete() throws IOException {
repo.root.retrieve().method("DELETE").to(url);
/**
* If the label is one of the default labels created by GitHub automatically.
*
* @return true if the label is a default one
*/
public boolean isDefault() {
return default_;
}
/**
* Sets color.
*
* @param newColor
* 6-letter hex color code, like "f29513"
* 6-letter hex color code, like "f29513"
* @throws IOException
* the io exception
* @deprecated use {@link #set()} or {@link #update()} instead
*/
@Deprecated
public void setColor(String newColor) throws IOException {
repo.root.retrieve().method("PATCH")
.withPreview(SYMMETRA)
.with("name", name)
.with("color", newColor)
.with("description", description)
.to(url);
set().color(newColor);
}
/**
* Sets description.
*
* @param newDescription
* Description of label
* Description of label
* @throws IOException
* the io exception
* @deprecated use {@link #set()} or {@link #update()} instead
*/
@Preview @Deprecated
@Deprecated
public void setDescription(String newDescription) throws IOException {
repo.root.retrieve().method("PATCH")
.withPreview(SYMMETRA)
.with("name", name)
.with("color", color)
.with("description", newDescription)
.to(url);
set().description(newDescription);
}
/*package*/ static Collection<String> toNames(Collection<GHLabel> labels) {
List<String> r = new ArrayList<String>();
static Collection<String> toNames(Collection<GHLabel> labels) {
List<String> r = new ArrayList<>();
for (GHLabel l : labels) {
r.add(l.getName());
}
return r;
}
/**
* Begins the creation of a new instance.
*
* Consumer must call {@link Creator#done()} to commit changes.
*
* @param repository
* the repository in which the label will be created.
* @return a {@link Creator}
* @throws IOException
* the io exception
*/
@BetaApi
@Deprecated
static Creator create(GHRepository repository) throws IOException {
return new Creator(repository);
}
/**
* Reads a label from a repository.
*
* @param repository
* the repository to read from
* @param name
* the name of the label
* @return a label
* @throws IOException
* the io exception
*/
static GHLabel read(@Nonnull GHRepository repository, @Nonnull String name) throws IOException {
return repository.root.createRequest()
.withUrlPath(repository.getApiTailUrl("labels"), name)
.fetch(GHLabel.class);
}
/**
* Reads all labels from a repository.
*
* @param repository
* the repository to read from
* @return iterable of all labels
* @throws IOException
* the io exception
*/
static PagedIterable<GHLabel> readAll(@Nonnull final GHRepository repository) throws IOException {
return repository.root.createRequest()
.withUrlPath(repository.getApiTailUrl("labels"))
.toIterable(GHLabel[].class, null);
}
/**
* Begins a batch update
*
* Consumer must call {@link Updater#done()} to commit changes.
*
* @return a {@link Updater}
*/
@BetaApi
@Deprecated
public Updater update() {
return new Updater(this);
}
/**
* Begins a single property update.
*
* @return a {@link Setter}
*/
@BetaApi
@Deprecated
public Setter set() {
return new Setter(this);
}
/**
* Delete this label from the repository.
*
* @throws IOException
* the io exception
*/
public void delete() throws IOException {
root.createRequest().method("DELETE").setRawUrlPath(getUrl()).send();
}
@Override
public boolean equals(final Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (this == o)
return true;
if (o == null || getClass() != o.getClass())
return false;
final GHLabel ghLabel = (GHLabel) o;
return Objects.equals(url, ghLabel.url) &&
Objects.equals(name, ghLabel.name) &&
Objects.equals(color, ghLabel.color) &&
Objects.equals(repo, ghLabel.repo);
return Objects.equals(url, ghLabel.url) && Objects.equals(name, ghLabel.name)
&& Objects.equals(color, ghLabel.color) && Objects.equals(description, ghLabel.description);
}
@Override
public int hashCode() {
return Objects.hash(url, name, color, repo);
return Objects.hash(url, name, color, description);
}
/**
* A {@link GHLabelBuilder} that updates a single property per request
*
* {@link #done()} is called automatically after the property is set.
*/
@BetaApi
@Deprecated
public static class Setter extends GHLabelBuilder<GHLabel> {
private Setter(@Nonnull GHLabel base) {
super(GHLabel.class, base.getApiRoot(), base);
requester.method("PATCH").setRawUrlPath(base.getUrl());
}
}
/**
* A {@link GHLabelBuilder} that allows multiple properties to be updated per request.
*
* Consumer must call {@link #done()} to commit changes.
*/
@BetaApi
@Deprecated
public static class Updater extends GHLabelBuilder<Updater> {
private Updater(@Nonnull GHLabel base) {
super(Updater.class, base.getApiRoot(), base);
requester.method("PATCH").setRawUrlPath(base.getUrl());
}
}
/**
* A {@link GHLabelBuilder} that creates a new {@link GHLabel}
*
* Consumer must call {@link #done()} to create the new instance.
*/
@BetaApi
@Deprecated
public static class Creator extends GHLabelBuilder<Creator> {
private Creator(@Nonnull GHRepository repository) {
super(Creator.class, repository.root, null);
requester.method("POST").withUrlPath(repository.getApiTailUrl("labels"));
}
}
}

View File

@@ -0,0 +1,60 @@
package org.kohsuke.github;
import java.io.IOException;
import javax.annotation.CheckForNull;
import javax.annotation.Nonnull;
/**
*
* @param <S>
* Intermediate return type for this builder returned by calls to {@link #with(String, Object)}. If {@link S}
* the same as {@link GHLabel}, this builder will commit changes after each call to
* {@link #with(String, Object)}.
*/
class GHLabelBuilder<S> extends AbstractBuilder<GHLabel, S> {
/**
*
* @param intermediateReturnType
* Intermediate return type for this builder returned by calls to {@link #with(String, Object)}. If
* {@link S} the same as {@link GHLabel}, this builder will commit changes after each call to
* {@link #with(String, Object)}.
* @param root
* the GitHub instance to which updates will be sent
* @param baseInstance
* instance on which to base this builder. If {@code null} a new instance will be created.
*/
protected GHLabelBuilder(@Nonnull Class<S> intermediateReturnType,
@Nonnull GitHub root,
@CheckForNull GHLabel baseInstance) {
super(GHLabel.class, intermediateReturnType, root, baseInstance);
if (baseInstance != null) {
requester.with("name", baseInstance.getName());
requester.with("color", baseInstance.getColor());
requester.with("description", baseInstance.getDescription());
}
}
@Nonnull
@BetaApi
@Deprecated
public S name(String value) throws IOException {
return with("name", value);
}
@Nonnull
@BetaApi
@Deprecated
public S color(String value) throws IOException {
return with("color", value);
}
@Nonnull
@BetaApi
@Deprecated
public S description(String value) throws IOException {
return with("description", value);
}
}

View File

@@ -0,0 +1,49 @@
package org.kohsuke.github;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
/**
* Wrapper to define changed fields on label action="edited"
*
* @see GHEventPayload.Label
*/
@SuppressFBWarnings("UWF_UNWRITTEN_FIELD")
public class GHLabelChanges {
private GHFrom name;
private GHFrom color;
/**
* Old label name.
*
* @return old label name (or null if not changed)
*/
public GHFrom getName() {
return name;
}
/**
* Old label color.
*
* @return old label color (or null if not changed)
*/
public GHFrom getColor() {
return color;
}
/**
* Wrapper for changed values.
*/
public static class GHFrom {
private String from;
/**
* Previous value that was changed.
*
* @return previous value
*/
public String getFrom() {
return from;
}
}
}

View File

@@ -24,29 +24,26 @@
package org.kohsuke.github;
import com.infradna.tool.bridge_method_injector.WithBridgeMethods;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.io.IOException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
/**
* The GitHub Preview API's license information
* <p>
*
* @author Duncan Dickinson
* @see GitHub#getLicense(String)
* @see GHRepository#getLicense()
* @see GitHub#getLicense(String) GitHub#getLicense(String)
* @see GHRepository#getLicense() GHRepository#getLicense()
* @see <a href="https://developer.github.com/v3/licenses/">https://developer.github.com/v3/licenses/</a>
*/
@SuppressWarnings({"UnusedDeclaration"})
@SuppressFBWarnings(value = {"UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD",
"NP_UNWRITTEN_FIELD"}, justification = "JSON API")
@SuppressWarnings({ "UnusedDeclaration" })
@SuppressFBWarnings(value = { "UWF_UNWRITTEN_PUBLIC_OR_PROTECTED_FIELD", "UWF_UNWRITTEN_FIELD", "NP_UNWRITTEN_FIELD" },
justification = "JSON API")
public class GHLicense extends GHObject {
@SuppressFBWarnings("IS2_INCONSISTENT_SYNC") // root is set before the object is returned to the app
/*package almost final*/ GitHub root;
// these fields are always present, even in the short form
protected String key, name;
@@ -61,6 +58,8 @@ public class GHLicense extends GHObject {
protected List<String> forbidden = new ArrayList<String>();
/**
* Gets key.
*
* @return a mnemonic for the license
*/
public String getKey() {
@@ -68,24 +67,20 @@ public class GHLicense extends GHObject {
}
/**
* Gets name.
*
* @return the license name
*/
public String getName() {
return name;
}
/**
* @return API URL of this object.
*/
@WithBridgeMethods(value = String.class, adapterMethod = "urlToString")
public URL getUrl() {
return GitHub.parseURL(url);
}
/**
* Featured licenses are bold in the new repository drop-down
*
* @return True if the license is featured, false otherwise
* @throws IOException
* the io exception
*/
public Boolean isFeatured() throws IOException {
populate();
@@ -94,39 +89,88 @@ public class GHLicense extends GHObject {
public URL getHtmlUrl() throws IOException {
populate();
return GitHub.parseURL(html_url);
return GitHubClient.parseURL(html_url);
}
/**
* Gets description.
*
* @return the description
* @throws IOException
* the io exception
*/
public String getDescription() throws IOException {
populate();
return description;
}
/**
* Gets category.
*
* @return the category
* @throws IOException
* the io exception
*/
public String getCategory() throws IOException {
populate();
return category;
}
/**
* Gets implementation.
*
* @return the implementation
* @throws IOException
* the io exception
*/
public String getImplementation() throws IOException {
populate();
return implementation;
}
/**
* Gets required.
*
* @return the required
* @throws IOException
* the io exception
*/
public List<String> getRequired() throws IOException {
populate();
return required;
}
/**
* Gets permitted.
*
* @return the permitted
* @throws IOException
* the io exception
*/
public List<String> getPermitted() throws IOException {
populate();
return permitted;
}
/**
* Gets forbidden.
*
* @return the forbidden
* @throws IOException
* the io exception
*/
public List<String> getForbidden() throws IOException {
populate();
return forbidden;
}
/**
* Gets body.
*
* @return the body
* @throws IOException
* the io exception
*/
public String getBody() throws IOException {
populate();
return body;
@@ -134,30 +178,43 @@ public class GHLicense extends GHObject {
/**
* Fully populate the data by retrieving missing data.
*
* <p>
* Depending on the original API call where this object is created, it may not contain everything.
*
* @throws IOException
* the io exception
*/
protected synchronized void populate() throws IOException {
if (description!=null) return; // already populated
if (description != null)
return; // already populated
root.retrieve().to(url, this);
if (root == null || root.isOffline()) {
return; // cannot populate, will have to live with what we have
}
URL url = getUrl();
if (url != null) {
root.createRequest().setRawUrlPath(url.toString()).fetchInto(this);
}
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof GHLicense)) return false;
if (this == o)
return true;
if (!(o instanceof GHLicense))
return false;
GHLicense that = (GHLicense) o;
return this.url.equals(that.url);
return Objects.equals(getUrl(), that.getUrl());
}
@Override
public int hashCode() {
return url.hashCode();
return Objects.hashCode(getUrl());
}
/*package*/ GHLicense wrap(GitHub root) {
GHLicense wrap(GitHub root) {
this.root = root;
return this;
}

View File

@@ -0,0 +1,86 @@
package org.kohsuke.github;
import java.net.URL;
/**
* Base class for Github Marketplace Account.
*
* @author Paulo Miguel Almeida
* @see GitHub#getMyMarketplacePurchases()
* @see GHMarketplaceListAccountBuilder#createRequest()
*/
public class GHMarketplaceAccount extends GitHubInteractiveObject {
private String url;
private long id;
private String login;
private String email;
private String organizationBillingEmail;
private GHMarketplaceAccountType type;
/**
* Wrap up gh marketplace account.
*
* @param root
* the root
* @return an instance of the GHMarketplaceAccount class
*/
GHMarketplaceAccount wrapUp(GitHub root) {
this.root = root;
return this;
}
/**
* Gets url.
*
* @return the url
*/
public URL getUrl() {
return GitHubClient.parseURL(url);
}
/**
* Gets id.
*
* @return the id
*/
public long getId() {
return id;
}
/**
* Gets login.
*
* @return the login
*/
public String getLogin() {
return login;
}
/**
* Gets email.
*
* @return the email
*/
public String getEmail() {
return email;
}
/**
* Gets organization billing email.
*
* @return the organization billing email
*/
public String getOrganizationBillingEmail() {
return organizationBillingEmail;
}
/**
* Gets type.
*
* @return the type
*/
public GHMarketplaceAccountType getType() {
return type;
}
}

View File

@@ -0,0 +1,53 @@
package org.kohsuke.github;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
/**
* A Github Marketplace Account Plan.
*
* @author Paulo Miguel Almeida
* @see GHMarketplaceListAccountBuilder#createRequest()
*/
public class GHMarketplaceAccountPlan extends GHMarketplaceAccount {
@SuppressFBWarnings(value = "UWF_UNWRITTEN_FIELD", justification = "Field comes from JSON deserialization")
private GHMarketplacePendingChange marketplacePendingChange;
@SuppressFBWarnings(value = "UWF_UNWRITTEN_FIELD", justification = "Field comes from JSON deserialization")
private GHMarketplacePurchase marketplacePurchase;
/**
* Wrap up gh marketplace account.
*
* @param root
* the root
* @return an instance of the GHMarketplaceAccount class
*/
GHMarketplaceAccountPlan wrapUp(GitHub root) {
super.wrapUp(root);
if (this.marketplacePendingChange != null)
this.marketplacePendingChange.wrapUp(this.root);
if (this.marketplacePurchase != null)
this.marketplacePurchase.wrapUp(this.root);
return this;
}
/**
* Gets marketplace pending change.
*
* @return the marketplace pending change
*/
public GHMarketplacePendingChange getMarketplacePendingChange() {
return marketplacePendingChange;
}
/**
* Gets marketplace purchase.
*
* @return the marketplace purchase
*/
public GHMarketplacePurchase getMarketplacePurchase() {
return marketplacePurchase;
}
}

View File

@@ -0,0 +1,22 @@
package org.kohsuke.github;
import org.apache.commons.lang3.StringUtils;
import java.util.Locale;
/**
* GitHub Marketplace Account type.
*
* @author Paulo Miguel Almeida
* @see GHMarketplaceAccount
*/
public enum GHMarketplaceAccountType {
ORGANIZATION, USER;
/**
* Returns GitHub's internal representation of this event.
*/
String symbol() {
return StringUtils.capitalize(name().toLowerCase(Locale.ENGLISH));
}
}

View File

@@ -0,0 +1,70 @@
package org.kohsuke.github;
import java.io.IOException;
/**
* Returns any accounts associated with a plan, including free plans
*
* @author Paulo Miguel Almeida
* @see GHMarketplacePlan#listAccounts()
*/
public class GHMarketplaceListAccountBuilder extends GitHubInteractiveObject {
private final Requester builder;
private final long planId;
GHMarketplaceListAccountBuilder(GitHub root, long planId) {
this.root = root;
this.builder = root.createRequest();
this.planId = planId;
}
/**
* Sorts the GitHub accounts by the date they were created or last updated. Can be one of created or updated.
* <p>
* If omitted, the default sorting strategy will be "CREATED"
*
* @param sort
* the sort strategy
* @return a GHMarketplaceListAccountBuilder
*/
public GHMarketplaceListAccountBuilder sort(Sort sort) {
this.builder.with("sort", sort);
return this;
}
/**
* Orders the GitHub accounts results, Can be one of asc or desc. Ignored without the sort parameter.
*
* @param direction
* the order strategy
* @return a GHMarketplaceListAccountBuilder
*/
public GHMarketplaceListAccountBuilder direction(GHDirection direction) {
this.builder.with("direction", direction);
return this;
}
/**
* The enum Sort.
*/
public enum Sort {
CREATED, UPDATED
}
/**
* List any accounts associated with the plan specified on construction with all the order/sort parameters set.
* <p>
* GitHub Apps must use a JWT to access this endpoint.
* <p>
* OAuth Apps must use basic authentication with their client ID and client secret to access this endpoint.
*
* @return a paged iterable instance of GHMarketplaceAccountPlan
* @throws IOException
* on error
*/
public PagedIterable<GHMarketplaceAccountPlan> createRequest() throws IOException {
return builder.withUrlPath(String.format("/marketplace_listing/plans/%d/accounts", this.planId))
.toIterable(GHMarketplaceAccountPlan[].class, item -> item.wrapUp(root));
}
}

View File

@@ -0,0 +1,73 @@
package org.kohsuke.github;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.util.Date;
/**
* A Github Marketplace purchase pending change.
*
* @author Paulo Miguel Almeida
* @see GHMarketplaceListAccountBuilder#createRequest()
*/
public class GHMarketplacePendingChange extends GitHubInteractiveObject {
private long id;
@SuppressFBWarnings(value = "UWF_UNWRITTEN_FIELD", justification = "Field comes from JSON deserialization")
private Long unitCount;
@SuppressFBWarnings(value = "UWF_UNWRITTEN_FIELD", justification = "Field comes from JSON deserialization")
private GHMarketplacePlan plan;
@SuppressFBWarnings(value = "UWF_UNWRITTEN_FIELD", justification = "Field comes from JSON deserialization")
private String effectiveDate;
/**
* Wrap up gh marketplace pending change.
*
* @param root
* the root
* @return an instance of the GHMarketplacePendingChange class
*/
GHMarketplacePendingChange wrapUp(GitHub root) {
this.root = root;
if (plan != null) { // sanity check
this.plan.wrapUp(this.root);
}
return this;
}
/**
* Gets id.
*
* @return the id
*/
public long getId() {
return id;
}
/**
* Gets unit count.
*
* @return the unit count
*/
public Long getUnitCount() {
return unitCount;
}
/**
* Gets plan.
*
* @return the plan
*/
public GHMarketplacePlan getPlan() {
return plan;
}
/**
* Gets effective date.
*
* @return the effective date
*/
public Date getEffectiveDate() {
return GitHubClient.parseDate(effectiveDate);
}
}

View File

@@ -0,0 +1,182 @@
package org.kohsuke.github;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.net.URL;
import java.util.List;
/**
* A Github Marketplace plan.
*
* @author Paulo Miguel Almeida
* @see GitHub#listMarketplacePlans()
*/
public class GHMarketplacePlan extends GitHubInteractiveObject {
private String url;
private String accountsUrl;
private long id;
private long number;
private String name;
private String description;
private long monthlyPriceInCents;
private long yearlyPriceInCents;
private GHMarketplacePriceModel priceModel;
@JsonProperty("has_free_trial")
private boolean freeTrial; // JavaBeans Spec 1.01 section 8.3.2 forces us to have is<propertyName>
private String unitName;
private String state;
private List<String> bullets;
/**
* Wrap up gh marketplace plan.
*
* @param root
* the root
* @return an instance of the GHMarketplacePlan class
*/
GHMarketplacePlan wrapUp(GitHub root) {
this.root = root;
return this;
}
/**
* Gets url.
*
* @return the url
*/
public URL getUrl() {
return GitHubClient.parseURL(url);
}
/**
* Gets accounts url.
*
* @return the accounts url
*/
public String getAccountsUrl() {
return accountsUrl;
}
/**
* Gets id.
*
* @return the id
*/
public long getId() {
return id;
}
/**
* Gets number.
*
* @return the number
*/
public long getNumber() {
return number;
}
/**
* Gets name.
*
* @return the name
*/
public String getName() {
return name;
}
/**
* Gets description.
*
* @return the description
*/
public String getDescription() {
return description;
}
/**
* Gets monthly price in cents.
*
* @return the monthly price in cents
*/
public long getMonthlyPriceInCents() {
return monthlyPriceInCents;
}
/**
* Gets yearly price in cents.
*
* @return the yearly price in cents
*/
public long getYearlyPriceInCents() {
return yearlyPriceInCents;
}
/**
* Gets price model.
*
* @return the price model
*/
public GHMarketplacePriceModel getPriceModel() {
return priceModel;
}
/**
* Is free trial boolean.
*
* @return the boolean
*/
public boolean isFreeTrial() {
return freeTrial;
}
/**
* Gets unit name.
*
* @return the unit name
*/
public String getUnitName() {
return unitName;
}
/**
* Gets state.
*
* @return the state
*/
public String getState() {
return state;
}
/**
* Gets bullets.
*
* @return the bullets
*/
public List<String> getBullets() {
return bullets;
}
/**
* Starts a builder that list any accounts associated with a plan, including free plans. For per-seat pricing, you
* see the list of accounts that have purchased the plan, including the number of seats purchased. When someone
* submits a plan change that won't be processed until the end of their billing cycle, you will also see the
* upcoming pending change.
*
* <p>
* You use the returned builder to set various properties, then call
* {@link GHMarketplaceListAccountBuilder#createRequest()} to finally list the accounts related to this plan.
*
* <p>
* GitHub Apps must use a JWT to access this endpoint.
* <p>
* OAuth Apps must use basic authentication with their client ID and client secret to access this endpoint.
*
* @return a GHMarketplaceListAccountBuilder instance
* @see <a href=
* "https://developer.github.com/v3/apps/marketplace/#list-all-github-accounts-user-or-organization-on-a-specific-plan">List
* all GitHub accounts (user or organization) on a specific plan</a>
*/
public GHMarketplaceListAccountBuilder listAccounts() {
return new GHMarketplaceListAccountBuilder(root, this.id);
}
}

View File

@@ -0,0 +1,29 @@
package org.kohsuke.github;
import com.fasterxml.jackson.annotation.JsonValue;
/**
* GitHub Marketplace plan pricing model.
*
* @author Paulo Miguel Almeida
* @see GHMarketplacePlan
*/
public enum GHMarketplacePriceModel {
FREE("free"), PER_UNIT("per-unit"), FLAT_RATE("flat-rate");
@JsonValue
private final String internalName;
GHMarketplacePriceModel(String internalName) {
this.internalName = internalName;
}
/**
* Returns GitHub's internal representation of this event.
*
* @return a string containing GitHub's internal representation of this event.
*/
public String symbol() {
return internalName;
}
}

View File

@@ -0,0 +1,101 @@
package org.kohsuke.github;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.util.Date;
/**
* A Github Marketplace purchase.
*
* @author Paulo Miguel Almeida
* @see GHMarketplaceListAccountBuilder#createRequest() GHMarketplaceListAccountBuilder#createRequest()
*/
public class GHMarketplacePurchase extends GitHubInteractiveObject {
private String billingCycle;
private String nextBillingDate;
private boolean onFreeTrial;
private String freeTrialEndsOn;
private Long unitCount;
private String updatedAt;
@SuppressFBWarnings(value = "UWF_UNWRITTEN_FIELD", justification = "Field comes from JSON deserialization")
private GHMarketplacePlan plan;
/**
* Wrap up gh marketplace purchase.
*
* @param root
* the root
* @return an instance of the GHMarketplacePurchase class
*/
GHMarketplacePurchase wrapUp(GitHub root) {
this.root = root;
if (plan != null) { // sanity check
this.plan.wrapUp(this.root);
}
return this;
}
/**
* Gets billing cycle.
*
* @return the billing cycle
*/
public String getBillingCycle() {
return billingCycle;
}
/**
* Gets next billing date.
*
* @return the next billing date
*/
public Date getNextBillingDate() {
return GitHubClient.parseDate(nextBillingDate);
}
/**
* Is on free trial boolean.
*
* @return the boolean
*/
public boolean isOnFreeTrial() {
return onFreeTrial;
}
/**
* Gets free trial ends on.
*
* @return the free trial ends on
*/
public Date getFreeTrialEndsOn() {
return GitHubClient.parseDate(freeTrialEndsOn);
}
/**
* Gets unit count.
*
* @return the unit count
*/
public Long getUnitCount() {
return unitCount;
}
/**
* Gets updated at.
*
* @return the updated at
*/
public Date getUpdatedAt() {
return GitHubClient.parseDate(updatedAt);
}
/**
* Gets plan.
*
* @return the plan
*/
public GHMarketplacePlan getPlan() {
return plan;
}
}

View File

@@ -0,0 +1,112 @@
package org.kohsuke.github;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.util.Date;
/**
* Github Marketplace User Purchase
*
* @author Paulo Miguel Almeida
* @see GitHub#getMyMarketplacePurchases()
*/
public class GHMarketplaceUserPurchase extends GitHubInteractiveObject {
private String billingCycle;
private String nextBillingDate;
private boolean onFreeTrial;
private String freeTrialEndsOn;
private Long unitCount;
private String updatedAt;
@SuppressFBWarnings(value = "UWF_UNWRITTEN_FIELD", justification = "Field comes from JSON deserialization")
private GHMarketplaceAccount account;
@SuppressFBWarnings(value = "UWF_UNWRITTEN_FIELD", justification = "Field comes from JSON deserialization")
private GHMarketplacePlan plan;
/**
* Wrap up GHMarketplaceUserPurchase.
*
* @param root
* the root
* @return an instance of the GHMarketplaceUserPurchase class
*/
GHMarketplaceUserPurchase wrapUp(GitHub root) {
this.root = root;
if (this.account != null)
this.account.wrapUp(this.root);
if (this.plan != null)
this.plan.wrapUp(this.root);
return this;
}
/**
* Gets billing cycle.
*
* @return the billing cycle
*/
public String getBillingCycle() {
return billingCycle;
}
/**
* Gets next billing date.
*
* @return the next billing date
*/
public Date getNextBillingDate() {
return GitHubClient.parseDate(nextBillingDate);
}
/**
* Is on free trial boolean.
*
* @return the boolean
*/
public boolean isOnFreeTrial() {
return onFreeTrial;
}
/**
* Gets free trial ends on.
*
* @return the free trial ends on
*/
public Date getFreeTrialEndsOn() {
return GitHubClient.parseDate(freeTrialEndsOn);
}
/**
* Gets unit count.
*
* @return the unit count
*/
public Long getUnitCount() {
return unitCount;
}
/**
* Gets updated at.
*
* @return the updated at
*/
public Date getUpdatedAt() {
return GitHubClient.parseDate(updatedAt);
}
/**
* Gets account.
*
* @return the account
*/
public GHMarketplaceAccount getAccount() {
return account;
}
/**
* Gets plan.
*
* @return the plan
*/
public GHMarketplacePlan getPlan() {
return plan;
}
}

View File

@@ -8,33 +8,56 @@ import java.util.Locale;
* Represents a membership of a user in an organization.
*
* @author Kohsuke Kawaguchi
* @see GHMyself#listOrgMemberships()
* @see GHMyself#listOrgMemberships() GHMyself#listOrgMemberships()
*/
public class GHMembership /* extends GHObject --- but it doesn't have id, created_at, etc. */ {
GitHub root;
public class GHMembership extends GitHubInteractiveObject {
String url;
String state;
String role;
GHUser user;
GHOrganization organization;
/**
* Gets url.
*
* @return the url
*/
public URL getUrl() {
return GitHub.parseURL(url);
return GitHubClient.parseURL(url);
}
/**
* Gets state.
*
* @return the state
*/
public State getState() {
return Enum.valueOf(State.class, state.toUpperCase(Locale.ENGLISH));
}
/**
* Gets role.
*
* @return the role
*/
public Role getRole() {
return Enum.valueOf(Role.class, role.toUpperCase(Locale.ENGLISH));
}
/**
* Gets user.
*
* @return the user
*/
public GHUser getUser() {
return user;
}
/**
* Gets organization.
*
* @return the organization
*/
public GHOrganization getOrganization() {
return organization;
}
@@ -42,24 +65,23 @@ public class GHMembership /* extends GHObject --- but it doesn't have id, create
/**
* Accepts a pending invitation to an organization.
*
* @see GHMyself#getMembership(GHOrganization)
* @throws IOException
* the io exception
* @see GHMyself#getMembership(GHOrganization) GHMyself#getMembership(GHOrganization)
*/
public void activate() throws IOException {
root.retrieve().method("PATCH").with("state",State.ACTIVE).to(url,this);
root.createRequest().method("PATCH").with("state", State.ACTIVE).withUrlPath(url).fetchInto(this);
}
/*package*/ GHMembership wrap(GitHub root) {
GHMembership wrap(GitHub root) {
this.root = root;
if (user!=null) user = root.getUser(user.wrapUp(root));
if (organization!=null) organization.wrapUp(root);
if (user != null)
user = root.getUser(user.wrapUp(root));
if (organization != null)
organization.wrapUp(root);
return this;
}
/*package*/ static void wrap(GHMembership[] page, GitHub root) {
for (GHMembership m : page)
m.wrap(root);
}
/**
* Role of a user in an organization.
*/
@@ -78,7 +100,6 @@ public class GHMembership /* extends GHObject --- but it doesn't have id, create
* Whether a role is currently active or waiting for acceptance (pending)
*/
public enum State {
ACTIVE,
PENDING;
ACTIVE, PENDING;
}
}

View File

@@ -0,0 +1,89 @@
package org.kohsuke.github;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
/**
* Class that wraps the list of GitHub's IP addresses.
*
* @author Paulo Miguel Almeida
* @see GitHub#getMeta() GitHub#getMeta()
* @see <a href="https://developer.github.com/v3/meta/#meta">Get Meta</a>
*/
public class GHMeta {
@JsonProperty("verifiable_password_authentication")
private boolean verifiablePasswordAuthentication;
private List<String> hooks;
private List<String> git;
private List<String> web;
private List<String> api;
private List<String> pages;
private List<String> importer = new ArrayList<>();
/**
* Is verifiable password authentication boolean.
*
* @return the boolean
*/
public boolean isVerifiablePasswordAuthentication() {
return verifiablePasswordAuthentication;
}
/**
* Gets hooks.
*
* @return the hooks
*/
public List<String> getHooks() {
return Collections.unmodifiableList(hooks);
}
/**
* Gets git.
*
* @return the git
*/
public List<String> getGit() {
return Collections.unmodifiableList(git);
}
/**
* Gets web.
*
* @return the web
*/
public List<String> getWeb() {
return Collections.unmodifiableList(web);
}
/**
* Gets api.
*
* @return the api
*/
public List<String> getApi() {
return Collections.unmodifiableList(api);
}
/**
* Gets pages.
*
* @return the pages
*/
public List<String> getPages() {
return Collections.unmodifiableList(pages);
}
/**
* Gets importer.
*
* @return the importer
*/
public List<String> getImporter() {
return Collections.unmodifiableList(importer);
}
}

View File

@@ -6,12 +6,11 @@ import java.util.Date;
import java.util.Locale;
/**
*
* @author Yusuke Kokubo
* The type GHMilestone.
*
* @author Yusuke Kokubo
*/
public class GHMilestone extends GHObject {
GitHub root;
GHRepository owner;
GHUser creator;
@@ -19,60 +18,120 @@ public class GHMilestone extends GHObject {
private int closed_issues, open_issues, number;
protected String closed_at;
/**
* Gets root.
*
* @return the root
*/
public GitHub getRoot() {
return root;
}
/**
* Gets owner.
*
* @return the owner
*/
public GHRepository getOwner() {
return owner;
}
/**
* Gets creator.
*
* @return the creator
* @throws IOException
* the io exception
*/
public GHUser getCreator() throws IOException {
return root.intern(creator);
}
/**
* Gets due on.
*
* @return the due on
*/
public Date getDueOn() {
if (due_on == null) return null;
return GitHub.parseDate(due_on);
if (due_on == null)
return null;
return GitHubClient.parseDate(due_on);
}
/**
* When was this milestone closed?
*
* @return the closed at
* @throws IOException
* the io exception
*/
public Date getClosedAt() throws IOException {
return GitHub.parseDate(closed_at);
return GitHubClient.parseDate(closed_at);
}
/**
* Gets title.
*
* @return the title
*/
public String getTitle() {
return title;
}
/**
* Gets description.
*
* @return the description
*/
public String getDescription() {
return description;
}
/**
* Gets closed issues.
*
* @return the closed issues
*/
public int getClosedIssues() {
return closed_issues;
}
/**
* Gets open issues.
*
* @return the open issues
*/
public int getOpenIssues() {
return open_issues;
}
/**
* Gets number.
*
* @return the number
*/
public int getNumber() {
return number;
}
public URL getHtmlUrl() {
return GitHub.parseURL(html_url);
return GitHubClient.parseURL(html_url);
}
/**
* Gets state.
*
* @return the state
*/
public GHMilestoneState getState() {
return Enum.valueOf(GHMilestoneState.class, state.toUpperCase(Locale.ENGLISH));
}
/**
* Closes this milestone.
*
* @throws IOException
* the io exception
*/
public void close() throws IOException {
edit("state", "closed");
@@ -80,6 +139,9 @@ public class GHMilestone extends GHObject {
/**
* Reopens this milestone.
*
* @throws IOException
* the io exception
*/
public void reopen() throws IOException {
edit("state", "open");
@@ -87,31 +149,70 @@ public class GHMilestone extends GHObject {
/**
* Deletes this milestone.
*
* @throws IOException
* the io exception
*/
public void delete() throws IOException {
root.retrieve().method("DELETE").to(getApiRoute());
root.createRequest().method("DELETE").withUrlPath(getApiRoute()).send();
}
private void edit(String key, Object value) throws IOException {
new Requester(root)._with(key, value).method("PATCH").to(getApiRoute());
root.createRequest().with(key, value).method("PATCH").withUrlPath(getApiRoute()).send();
}
/**
* Sets title.
*
* @param title
* the title
* @throws IOException
* the io exception
*/
public void setTitle(String title) throws IOException {
edit("title", title);
}
/**
* Sets description.
*
* @param description
* the description
* @throws IOException
* the io exception
*/
public void setDescription(String description) throws IOException {
edit("description", description);
}
/**
* Sets due on.
*
* @param dueOn
* the due on
* @throws IOException
* the io exception
*/
public void setDueOn(Date dueOn) throws IOException {
edit("due_on", GitHub.printDate(dueOn));
edit("due_on", GitHubClient.printDate(dueOn));
}
/**
* Gets api route.
*
* @return the api route
*/
protected String getApiRoute() {
return "/repos/"+owner.getOwnerName()+"/"+owner.getName()+"/milestones/"+number;
return "/repos/" + owner.getOwnerName() + "/" + owner.getName() + "/milestones/" + number;
}
/**
* Wrap gh milestone.
*
* @param repo
* the repo
* @return the gh milestone
*/
public GHMilestone wrap(GHRepository repo) {
this.owner = repo;
this.root = repo.root;

View File

@@ -1,11 +1,10 @@
package org.kohsuke.github;
/**
*
* @author Yusuke Kokubo
* The enum GHMilestoneState.
*
* @author Yusuke Kokubo
*/
public enum GHMilestoneState {
OPEN,
CLOSED
}
OPEN, CLOSED
}

Some files were not shown because too many files have changed in this diff Show More