|
26 | 26 | import java.io.IOException; |
27 | 27 | import java.net.URL; |
28 | 28 |
|
| 29 | +import static org.kohsuke.github.Previews.SQUIRREL_GIRL; |
| 30 | + |
29 | 31 | /** |
30 | 32 | * Comment to the issue |
31 | 33 | * |
32 | 34 | * @author Kohsuke Kawaguchi |
33 | 35 | */ |
34 | | -public class GHIssueComment extends GHObject { |
| 36 | +public class GHIssueComment extends GHObject implements Reactable { |
35 | 37 | GHIssue owner; |
36 | 38 |
|
37 | 39 | private String body, gravatar_id; |
@@ -93,7 +95,30 @@ public void update(String body) throws IOException { |
93 | 95 | public void delete() throws IOException { |
94 | 96 | new Requester(owner.root).method("DELETE").to(getApiRoute()); |
95 | 97 | } |
96 | | - |
| 98 | + |
| 99 | + @Preview @Deprecated |
| 100 | + public GHReaction createReaction(ReactionContent content) throws IOException { |
| 101 | + return new Requester(owner.root) |
| 102 | + .withPreview(SQUIRREL_GIRL) |
| 103 | + .with("content", content.getContent()) |
| 104 | + .to(getApiRoute()+"/reactions", GHReaction.class).wrap(owner.root); |
| 105 | + } |
| 106 | + |
| 107 | + @Preview @Deprecated |
| 108 | + public PagedIterable<GHReaction> listReactions() { |
| 109 | + return new PagedIterable<GHReaction>() { |
| 110 | + public PagedIterator<GHReaction> _iterator(int pageSize) { |
| 111 | + return new PagedIterator<GHReaction>(owner.root.retrieve().withPreview(SQUIRREL_GIRL).asIterator(getApiRoute()+"/reactions", GHReaction[].class, pageSize)) { |
| 112 | + @Override |
| 113 | + protected void wrapUp(GHReaction[] page) { |
| 114 | + for (GHReaction c : page) |
| 115 | + c.wrap(owner.root); |
| 116 | + } |
| 117 | + }; |
| 118 | + } |
| 119 | + }; |
| 120 | + } |
| 121 | + |
97 | 122 | private String getApiRoute() { |
98 | 123 | return "/repos/"+owner.getRepository().getOwnerName()+"/"+owner.getRepository().getName()+"/issues/comments/" + id; |
99 | 124 | } |
|
0 commit comments