Get all invitees to a specific repository#1513
Get all invitees to a specific repository#1513ShalomGottesman wants to merge 2 commits intojcabi:masterfrom ShalomGottesman:master
Conversation
|
Job #1513 is now in scope, role is |
amihaiemil
left a comment
There was a problem hiding this comment.
@ShalomGottesman Please see my comments :)
Also, for future reference, please make only one PR/ topic. This PR contains changes in both Repo and User -- there should be 2 separate PRs. But we leave it like this for now :D
|
|
||
| public Iterable<String> invitees() throws IOException { | ||
| Iterator<JsonValue> iter = this.request.uri().path("/invitations").back().method(Request.GET) | ||
| .body().set(Json.createArrayBuilder().build()).back() |
There was a problem hiding this comment.
@ShalomGottesman Why do you specify an empty Json body? I am pretty sure it is not needed :)
| @Override | ||
| public Iterable<Coordinates> invitations() throws IOException { | ||
| Iterator<JsonValue> iter = this.github().entry().uri().path("/user/repository_invitations").back().method(Request.GET) | ||
| .body().set(Json.createArrayBuilder().build()).back() |
There was a problem hiding this comment.
@ShalomGottesman Same here, why the empty Json body?
| String repoName = obj.getString("name"); | ||
| String owner = obj.getJsonObject("owner").getString("login"); | ||
| Coordinates coords = new Coordinates.Simple(owner, repoName); | ||
| coordsSet.add(coords); |
There was a problem hiding this comment.
@ShalomGottesman I think you can simplify these 4 lines to just:
coordsSet.add(
new Coordinates.Simple(
obj.getString("name"),
obj.getJsonObject("owner").getString("login")
)
);|
|
||
| @Override | ||
| public Iterable<Coordinates> invitations() throws IOException { | ||
| throw new UnsupportedOperationException(); |
There was a problem hiding this comment.
@ShalomGottesman Can you also specify "Not yet implemented."?
|
|
||
| @Override | ||
| public boolean acceptInvitation(Coordinates coords) throws IOException { | ||
| throw new UnsupportedOperationException(); |
| } | ||
|
|
||
| @Override | ||
| public boolean acceptInvitation(Coordinates coords) throws IOException { |
There was a problem hiding this comment.
@ShalomGottesman Can you make coorde final? Generally, it's good to work only with final variables and parameters.
Final variables are immutable: this means that an object with immutable fields is thread-safe by default and also a method that works only with final variables will be easier to understand, there will be only one initialization per variable :)
| return coordsSet; | ||
| } | ||
|
|
||
| public boolean acceptInvitation(Coordinates coords) throws IOException { |
There was a problem hiding this comment.
@ShalomGottesman You forgot the @Override annotation
Changes: