Skip to content

Commit 963900f

Browse files
committed
Streamlining
1 parent 2397b07 commit 963900f

File tree

12 files changed

+23
-68
lines changed

12 files changed

+23
-68
lines changed

pom.xml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,9 +163,6 @@
163163
<!-- V2.x changes -->
164164
<exclude>org.kohsuke.github.GHRepositorySearchBuilder.Fork</exclude>
165165

166-
<!-- Deprecated -->
167-
<exclude>org.kohsuke.github.GHPerson.1</exclude>
168-
169166
<!-- Sample only -->
170167
<exclude>org.kohsuke.github.example.*</exclude>
171168

src/main/java/org/kohsuke/github/GHAppCreateTokenBuilder.java

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
* Creates a access token for a GitHub App Installation.
1111
*
1212
* @author Paulo Miguel Almeida
13-
* @see GHAppInstallation#createToken(Map) GHAppInstallation#createToken(Map)
1413
* @see GHAppInstallation#createToken() GHAppInstallation#createToken()
1514
*/
1615
public class GHAppCreateTokenBuilder extends GitHubInteractiveObject {
@@ -34,22 +33,6 @@ public class GHAppCreateTokenBuilder extends GitHubInteractiveObject {
3433
this.builder = root.createRequest();
3534
}
3635

37-
/**
38-
* Instantiates a new GH app create token builder.
39-
*
40-
* @param root
41-
* the root
42-
* @param apiUrlTail
43-
* the api url tail
44-
* @param permissions
45-
* the permissions
46-
*/
47-
@BetaApi
48-
GHAppCreateTokenBuilder(GitHub root, String apiUrlTail, Map<String, GHPermissionType> permissions) {
49-
this(root, apiUrlTail);
50-
permissions(permissions);
51-
}
52-
5336
/**
5437
* By default the installation token has access to all repositories that the installation can access. To restrict
5538
* the access to specific repositories, you can provide the repository_ids when creating the token. When you omit

src/main/java/org/kohsuke/github/GHAppInstallation.java

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -221,12 +221,9 @@ public void deleteInstallation() throws IOException {
221221
* @return a GHAppCreateTokenBuilder instance
222222
* @deprecated Use {@link GHAppInstallation#createToken()} instead.
223223
*/
224-
@BetaApi
225224
@Deprecated
226225
public GHAppCreateTokenBuilder createToken(Map<String, GHPermissionType> permissions) {
227-
return new GHAppCreateTokenBuilder(root(),
228-
String.format("/app/installations/%d/access_tokens", getId()),
229-
permissions);
226+
return createToken().permissions(permissions);
230227
}
231228

232229
/**
@@ -238,7 +235,6 @@ public GHAppCreateTokenBuilder createToken(Map<String, GHPermissionType> permiss
238235
*
239236
* @return a GHAppCreateTokenBuilder instance
240237
*/
241-
@BetaApi
242238
public GHAppCreateTokenBuilder createToken() {
243239
return new GHAppCreateTokenBuilder(root(), String.format("/app/installations/%d/access_tokens", getId()));
244240
}

src/main/java/org/kohsuke/github/GHAppInstallationToken.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* A Github App Installation Token.
99
*
1010
* @author Paulo Miguel Almeida
11-
* @see GHAppInstallation#createToken(Map) GHAppInstallation#createToken(Map)
11+
* @see GHAppInstallation#createToken() GHAppInstallation#createToken()
1212
*/
1313
public class GHAppInstallationToken extends GitHubInteractiveObject {
1414
private String token;

src/main/java/org/kohsuke/github/GHBranchProtectionBuilder.java

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import java.util.List;
1212
import java.util.Map;
1313
import java.util.Set;
14-
import java.util.stream.Collectors;
1514

1615
// TODO: Auto-generated Javadoc
1716
/**
@@ -54,34 +53,6 @@ public GHBranchProtectionBuilder addRequiredStatusChecks(Collection<GHBranchProt
5453
return this;
5554
}
5655

57-
/**
58-
* Add required checks gh branch protection builder.
59-
*
60-
* @param checks
61-
* the checks
62-
* @return the gh branch protection builder
63-
*/
64-
@Deprecated
65-
public GHBranchProtectionBuilder addRequiredChecks(Collection<String> checks) {
66-
getStatusChecks().checks.addAll(checks.stream()
67-
.map(context -> new GHBranchProtection.Check(context, null))
68-
.collect(Collectors.toList()));
69-
return this;
70-
}
71-
72-
/**
73-
* Add required checks gh branch protection builder.
74-
*
75-
* @param checks
76-
* the checks
77-
* @return the gh branch protection builder
78-
*/
79-
@Deprecated
80-
public GHBranchProtectionBuilder addRequiredChecks(String... checks) {
81-
addRequiredChecks(Arrays.asList(checks));
82-
return this;
83-
}
84-
8556
/**
8657
* Add required checks gh branch protection builder.
8758
*

src/main/java/org/kohsuke/github/GHContent.java

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ public String getTarget() {
124124
@Deprecated
125125
@SuppressFBWarnings("DM_DEFAULT_ENCODING")
126126
public String getContent() throws IOException {
127-
return new String(Base64.getMimeDecoder().decode(getEncodedContent()));
127+
return new String(readDecodedContent());
128128
}
129129

130130
/**
@@ -180,11 +180,22 @@ public String getHtmlUrl() {
180180
* the io exception
181181
*/
182182
public InputStream read() throws IOException {
183-
refresh(content);
183+
return new ByteArrayInputStream(readDecodedContent());
184+
}
185+
186+
/**
187+
* Retrieves the decoded bytes of the blob.
188+
*
189+
* @return the input stream
190+
* @throws IOException
191+
* the io exception
192+
*/
193+
private byte[] readDecodedContent() throws IOException {
194+
String encodedContent = getEncodedContent();
184195
if (encoding.equals("base64")) {
185196
try {
186197
Base64.Decoder decoder = Base64.getMimeDecoder();
187-
return new ByteArrayInputStream(decoder.decode(content.getBytes(StandardCharsets.US_ASCII)));
198+
return decoder.decode(encodedContent.getBytes(StandardCharsets.US_ASCII));
188199
} catch (IllegalArgumentException e) {
189200
throw new AssertionError(e); // US-ASCII is mandatory
190201
}

src/main/java/org/kohsuke/github/GHPullRequest.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -295,11 +295,8 @@ public Boolean getMergeable() throws IOException {
295295
* for test purposes only.
296296
*
297297
* @return the mergeable no refresh
298-
* @throws IOException
299-
* Signals that an I/O exception has occurred.
300298
*/
301-
@Deprecated
302-
Boolean getMergeableNoRefresh() throws IOException {
299+
Boolean getMergeableNoRefresh() {
303300
return mergeable;
304301
}
305302

src/main/java/org/kohsuke/github/GHTeamBuilder.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ public GHTeamBuilder repositories(String... repoNames) {
7676
* @param permission
7777
* permssion to be applied
7878
* @return a builder to continue with building
79-
* @deprecated https://docs.github.com/en/free-pro-team@latest/rest/teams/teams?apiVersion=2022-11-28#create-a-team
79+
* @deprecated see
80+
* https://docs.github.com/en/free-pro-team@latest/rest/teams/teams?apiVersion=2022-11-28#create-a-team
8081
*/
8182
@Deprecated
8283
public GHTeamBuilder permission(GHOrganization.Permission permission) {

src/main/java/org/kohsuke/github/GitHub.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ public class GitHub {
9797
* The URL of GitHub (or GitHub enterprise) API endpoint, such as "https://api.github.com" or
9898
* "http://ghe.acme.com/api/v3". Note that GitHub Enterprise has <code>/api/v3</code> in the URL. For
9999
* historical reasons, this parameter still accepts the bare domain name, but that's considered
100-
* deprecated. Password is also considered deprecated as it is no longer required for api usage.
100+
* deprecated.
101101
* @param connector
102102
* a connector
103103
* @param rateLimitHandler

src/main/java/org/kohsuke/github/GitHubBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ public GitHubBuilder withAuthorizationProvider(final AuthorizationProvider autho
238238
* @param appInstallationToken
239239
* A string containing the GitHub App installation token
240240
* @return the configured Builder from given GitHub App installation token.
241-
* @see GHAppInstallation#createToken(java.util.Map) GHAppInstallation#createToken(java.util.Map)
241+
* @see GHAppInstallation#createToken() GHAppInstallation#createToken()
242242
*/
243243
public GitHubBuilder withAppInstallationToken(String appInstallationToken) {
244244
return withAuthorizationProvider(ImmutableAuthorizationProvider.fromAppInstallationToken(appInstallationToken));

0 commit comments

Comments
 (0)