Skip to content

Commit a9635e6

Browse files
committed
Sort by visibility
1 parent 29cb82c commit a9635e6

File tree

124 files changed

+3992
-3991
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

124 files changed

+3992
-3991
lines changed

pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,7 @@
487487
<version>4.35</version>
488488
<file>${basedir}/src/build/eclipse/formatter.xml</file>
489489
<sortMembersEnabled>true</sortMembersEnabled>
490+
<sortMembersVisibilityOrderEnabled>true</sortMembersVisibilityOrderEnabled>
490491
</eclipse>
491492

492493
<importOrder>

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

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,22 @@ protected AbstractBuilder(@Nonnull Class<R> finalReturnType,
9494
this.updateInPlace = false;
9595
}
9696

97+
/**
98+
* {@inheritDoc}
99+
*/
100+
@Override
101+
@Nonnull
102+
@BetaApi
103+
public R done() throws IOException {
104+
R result;
105+
if (updateInPlace && baseInstance != null) {
106+
result = requester.fetchInto(baseInstance);
107+
} else {
108+
result = requester.fetch(returnType);
109+
}
110+
return result;
111+
}
112+
97113
/**
98114
* Chooses whether to return a continuing builder or an updated data record
99115
*
@@ -122,22 +138,6 @@ protected S continueOrDone() throws IOException {
122138
}
123139
}
124140

125-
/**
126-
* {@inheritDoc}
127-
*/
128-
@Override
129-
@Nonnull
130-
@BetaApi
131-
public R done() throws IOException {
132-
R result;
133-
if (updateInPlace && baseInstance != null) {
134-
result = requester.fetchInto(baseInstance);
135-
} else {
136-
result = requester.fetch(returnType);
137-
}
138-
return result;
139-
}
140-
141141
/**
142142
* Applies a value to a name for this builder.
143143
*

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,17 @@ class EnterpriseManagedSupport {
2020

2121
private static final Logger LOGGER = Logger.getLogger(EnterpriseManagedSupport.class.getName());
2222

23-
static EnterpriseManagedSupport forOrganization(final GHOrganization org) {
24-
return new EnterpriseManagedSupport(org);
25-
}
26-
2723
private static String logUnexpectedFailure(final JsonProcessingException exception, final String payload) {
2824
final StringWriter sw = new StringWriter();
2925
final PrintWriter pw = new PrintWriter(sw);
3026
exception.printStackTrace(pw);
3127
return String.format("Could not parse GitHub error response: '%s'. Full stacktrace follows:%n%s", payload, sw);
3228
}
3329

30+
static EnterpriseManagedSupport forOrganization(final GHOrganization org) {
31+
return new EnterpriseManagedSupport(org);
32+
}
33+
3434
private final GHOrganization organization;
3535

3636
private EnterpriseManagedSupport(GHOrganization organization) {

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,20 @@ class GHAppInstallationsPage {
99
private GHAppInstallation[] installations;
1010

1111
/**
12-
* Gets the installations.
12+
* Gets the total count.
1313
*
14-
* @return the installations
14+
* @return the total count
1515
*/
16-
GHAppInstallation[] getInstallations() {
17-
return installations;
16+
public int getTotalCount() {
17+
return totalCount;
1818
}
1919

2020
/**
21-
* Gets the total count.
21+
* Gets the installations.
2222
*
23-
* @return the total count
23+
* @return the installations
2424
*/
25-
public int getTotalCount() {
26-
return totalCount;
25+
GHAppInstallation[] getInstallations() {
26+
return installations;
2727
}
2828
}

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,6 @@ public <T> T download(InputStreamFunction<T> streamFunction) throws IOException
6565
return root().createRequest().method("GET").withUrlPath(getApiRoute(), "zip").fetchStream(streamFunction);
6666
}
6767

68-
private String getApiRoute() {
69-
if (owner == null) {
70-
// Workflow runs returned from search to do not have an owner. Attempt to use url.
71-
final URL url = Objects.requireNonNull(getUrl(), "Missing instance URL!");
72-
return StringUtils.prependIfMissing(url.toString().replace(root().getApiUrl(), ""), "/");
73-
}
74-
return "/repos/" + owner.getOwnerName() + "/" + owner.getName() + "/actions/artifacts/" + getId();
75-
}
76-
7768
/**
7869
* Gets the archive download URL.
7970
*
@@ -130,6 +121,15 @@ public boolean isExpired() {
130121
return expired;
131122
}
132123

124+
private String getApiRoute() {
125+
if (owner == null) {
126+
// Workflow runs returned from search to do not have an owner. Attempt to use url.
127+
final URL url = Objects.requireNonNull(getUrl(), "Missing instance URL!");
128+
return StringUtils.prependIfMissing(url.toString().replace(root().getApiUrl(), ""), "/");
129+
}
130+
return "/repos/" + owner.getOwnerName() + "/" + owner.getName() + "/actions/artifacts/" + getId();
131+
}
132+
133133
/**
134134
* Wrap up.
135135
*

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,15 @@ class GHArtifactsPage {
1212
private int totalCount;
1313
private GHArtifact[] artifacts;
1414

15+
/**
16+
* Gets the total count.
17+
*
18+
* @return the total count
19+
*/
20+
public int getTotalCount() {
21+
return totalCount;
22+
}
23+
1524
/**
1625
* Gets the artifacts.
1726
*
@@ -25,13 +34,4 @@ GHArtifact[] getArtifacts(GHRepository owner) {
2534
}
2635
return artifacts;
2736
}
28-
29-
/**
30-
* Gets the total count.
31-
*
32-
* @return the total count
33-
*/
34-
public int getTotalCount() {
35-
return totalCount;
36-
}
3737
}

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,6 @@ public void delete() throws IOException {
5454
root().createRequest().method("DELETE").withUrlPath(getApiRoute()).send();
5555
}
5656

57-
private void edit(String key, Object value) throws IOException {
58-
root().createRequest().with(key, value).method("PATCH").withUrlPath(getApiRoute()).send();
59-
}
60-
61-
private String getApiRoute() {
62-
return "/repos/" + owner.getOwnerName() + "/" + owner.getName() + "/releases/assets/" + getId();
63-
}
64-
6557
/**
6658
* Gets browser download url.
6759
*
@@ -161,6 +153,14 @@ public void setLabel(String label) throws IOException {
161153
this.label = label;
162154
}
163155

156+
private void edit(String key, Object value) throws IOException {
157+
root().createRequest().with(key, value).method("PATCH").withUrlPath(getApiRoute()).send();
158+
}
159+
160+
private String getApiRoute() {
161+
return "/repos/" + owner.getOwnerName() + "/" + owner.getName() + "/releases/assets/" + getId();
162+
}
163+
164164
/**
165165
* Wrap.
166166
*

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,6 @@ public GHAutolink create() throws IOException {
4747
return autolink.lateBind(repo);
4848
}
4949

50-
private String getApiTail() {
51-
return String.format("/repos/%s/%s/autolinks", repo.getOwnerName(), repo.getName());
52-
}
53-
5450
/**
5551
* With is alphanumeric gh autolink builder.
5652
*
@@ -87,4 +83,8 @@ public GHAutolinkBuilder withUrlTemplate(String urlTemplate) {
8783
return this;
8884
}
8985

86+
private String getApiTail() {
87+
return String.format("/repos/%s/%s/autolinks", repo.getOwnerName(), repo.getName());
88+
}
89+
9090
}

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,6 @@ public GHBlob create() throws IOException {
4747
return req.method("POST").withUrlPath(getApiTail()).fetch(GHBlob.class);
4848
}
4949

50-
private String getApiTail() {
51-
return String.format("/repos/%s/%s/git/blobs", repo.getOwnerName(), repo.getName());
52-
}
53-
5450
/**
5551
* Configures a blob with the specified text {@code content}.
5652
*
@@ -63,4 +59,8 @@ public GHBlobBuilder textContent(String content) {
6359
req.with("encoding", "utf-8");
6460
return this;
6561
}
62+
63+
private String getApiTail() {
64+
return String.format("/repos/%s/%s/git/blobs", repo.getOwnerName(), repo.getName());
65+
}
6666
}

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,6 @@ public GHBranchProtectionBuilder enableProtection() {
8080
return new GHBranchProtectionBuilder(this);
8181
}
8282

83-
/**
84-
* Gets the api route.
85-
*
86-
* @return the api route
87-
*/
88-
String getApiRoute() {
89-
return owner.getApiTailUrl("/branches/" + name);
90-
}
91-
9283
/**
9384
* Gets name.
9485
*
@@ -210,6 +201,15 @@ public String toString() {
210201
return "Branch:" + name + " in " + url;
211202
}
212203

204+
/**
205+
* Gets the api route.
206+
*
207+
* @return the api route
208+
*/
209+
String getApiRoute() {
210+
return owner.getApiTailUrl("/branches/" + name);
211+
}
212+
213213
/**
214214
* Wrap.
215215
*

0 commit comments

Comments
 (0)