mirror of
https://github.com/jlengrand/github-api.git
synced 2026-04-04 08:21:23 +00:00
Clean up Requester interface a bit
This commit is contained in:
@@ -237,11 +237,11 @@ public class GHIssue extends GHObject implements Reactable {
|
||||
}
|
||||
|
||||
private void edit(String key, Object value) throws IOException {
|
||||
new Requester(root)._with(key, value).method("PATCH").to(getApiRoute());
|
||||
new Requester(root).with(key, value).method("PATCH").to(getApiRoute());
|
||||
}
|
||||
|
||||
private void editIssue(String key, Object value) throws IOException {
|
||||
new Requester(root)._with(key, value).method("PATCH").to(getIssuesApiRoute());
|
||||
new Requester(root).with(key, value).method("PATCH").to(getIssuesApiRoute());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -482,7 +482,8 @@ public class GHIssue extends GHObject implements Reactable {
|
||||
* the io exception
|
||||
*/
|
||||
public void addAssignees(Collection<GHUser> assignees) throws IOException {
|
||||
root.retrieve().method("POST").withLogins(ASSIGNEES, assignees).to(getIssuesApiRoute() + "/assignees", this);
|
||||
root.retrieve().method("POST").with(ASSIGNEES, getLogins(assignees)).to(getIssuesApiRoute() + "/assignees",
|
||||
this);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -506,7 +507,7 @@ public class GHIssue extends GHObject implements Reactable {
|
||||
* the io exception
|
||||
*/
|
||||
public void setAssignees(Collection<GHUser> assignees) throws IOException {
|
||||
new Requester(root).withLogins(ASSIGNEES, assignees).method("PATCH").to(getIssuesApiRoute());
|
||||
new Requester(root).with(ASSIGNEES, getLogins(assignees)).method("PATCH").to(getIssuesApiRoute());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -530,7 +531,7 @@ public class GHIssue extends GHObject implements Reactable {
|
||||
* the io exception
|
||||
*/
|
||||
public void removeAssignees(Collection<GHUser> assignees) throws IOException {
|
||||
root.retrieve().method("DELETE").withLogins(ASSIGNEES, assignees).inBody()
|
||||
root.retrieve().method("DELETE").with(ASSIGNEES, getLogins(assignees)).inBody()
|
||||
.to(getIssuesApiRoute() + "/assignees", this);
|
||||
}
|
||||
|
||||
@@ -677,6 +678,14 @@ public class GHIssue extends GHObject implements Reactable {
|
||||
}
|
||||
}
|
||||
|
||||
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/
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user