-
Notifications
You must be signed in to change notification settings - Fork 736
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move array population to single iterator code path #623
Changes from 4 commits
1b55b5f
3296cef
60700d5
0f94828
40f05e4
305267d
52dd90e
049db83
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -135,7 +135,7 @@ public String getBrowserDownloadUrl() { | |
} | ||
|
||
private void edit(String key, Object value) throws IOException { | ||
new Requester(root).with(key, value).method("PATCH").to(getApiRoute()); | ||
root.retrieve().method("POST").with(key, value).method("PATCH").withUrlPath(getApiRoute()).to(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe remove the |
||
} | ||
|
||
/** | ||
|
@@ -145,7 +145,7 @@ private void edit(String key, Object value) throws IOException { | |
* the io exception | ||
*/ | ||
public void delete() throws IOException { | ||
new Requester(root).method("DELETE").to(getApiRoute()); | ||
root.retrieve().method("DELETE").withUrlPath(getApiRoute()).to(); | ||
} | ||
|
||
private String getApiRoute() { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,7 @@ public class GHBlobBuilder { | |
|
||
GHBlobBuilder(GHRepository repo) { | ||
this.repo = repo; | ||
req = new Requester(repo.root); | ||
req = repo.root.retrieve().method("POST"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here |
||
} | ||
|
||
/** | ||
|
@@ -55,6 +55,6 @@ private String getApiTail() { | |
* 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()).to(GHBlob.class); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,7 +44,7 @@ public class GHBranchProtection { | |
@Preview | ||
@Deprecated | ||
public void enabledSignedCommits() throws IOException { | ||
requester().method("POST").to(url + REQUIRE_SIGNATURES_URI, RequiredSignatures.class); | ||
requester().method("POST").withUrlPath(url + REQUIRE_SIGNATURES_URI).to(RequiredSignatures.class); | ||
} | ||
|
||
/** | ||
|
@@ -56,7 +56,7 @@ public void enabledSignedCommits() throws IOException { | |
@Preview | ||
@Deprecated | ||
public void disableSignedCommits() throws IOException { | ||
requester().method("DELETE").to(url + REQUIRE_SIGNATURES_URI); | ||
requester().method("DELETE").withUrlPath(url + REQUIRE_SIGNATURES_URI).to(); | ||
} | ||
|
||
/** | ||
|
@@ -87,7 +87,7 @@ public RequiredReviews getRequiredReviews() { | |
@Preview | ||
@Deprecated | ||
public boolean getRequiredSignatures() throws IOException { | ||
return requester().method("GET").to(url + REQUIRE_SIGNATURES_URI, RequiredSignatures.class).enabled; | ||
return requester().method("GET").withUrlPath(url + REQUIRE_SIGNATURES_URI).to(RequiredSignatures.class).enabled; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you implement the suggestion of the |
||
} | ||
|
||
/** | ||
|
@@ -123,7 +123,7 @@ GHBranchProtection wrap(GHBranch branch) { | |
} | ||
|
||
private Requester requester() { | ||
return new Requester(root).withPreview(ZZZAX); | ||
return root.retrieve().method("POST").withPreview(ZZZAX); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe replace this with |
||
} | ||
|
||
/** | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -113,16 +113,24 @@ public GHCommit getCommit() throws IOException { | |
* the io exception | ||
*/ | ||
public void update(String body) throws IOException { | ||
new Requester(owner.root).with("body", body).method("PATCH").to(getApiTail(), GHCommitComment.class); | ||
owner.root.retrieve() | ||
.method("POST") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe remove this line as you're overriding the method value a few lines below |
||
.with("body", body) | ||
.method("PATCH") | ||
.withUrlPath(getApiTail()) | ||
.to(GHCommitComment.class); | ||
this.body = body; | ||
} | ||
|
||
@Preview | ||
@Deprecated | ||
public GHReaction createReaction(ReactionContent content) throws IOException { | ||
return new Requester(owner.root).withPreview(SQUIRREL_GIRL) | ||
return owner.root.retrieve() | ||
.method("POST") | ||
.withPreview(SQUIRREL_GIRL) | ||
.with("content", content.getContent()) | ||
.to(getApiTail() + "/reactions", GHReaction.class) | ||
.withUrlPath(getApiTail() + "/reactions") | ||
.to(GHReaction.class) | ||
.wrap(owner.root); | ||
} | ||
|
||
|
@@ -141,7 +149,7 @@ public PagedIterable<GHReaction> listReactions() { | |
* the io exception | ||
*/ | ||
public void delete() throws IOException { | ||
new Requester(owner.root).method("DELETE").to(getApiTail()); | ||
owner.root.retrieve().method("DELETE").withUrlPath(getApiTail()).to(); | ||
} | ||
|
||
private String getApiTail() { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't that be just
root.retrieve()
as we are setting the method on thecreate()
method?