end
redef fun to_s do return json.to_json
+
+ # Github page url.
+ fun html_url: String do return json["html_url"].to_s
end
# A Github user.
self.json = json
end
- # Github User page url.
- fun html_url: String do return json["html_url"].to_s
-
# Avatar image url for this user.
fun avatar_url: String do return json["avatar_url"].to_s
end
# Repo short name on Github.
fun name: String do return json["name"].to_s
- # Github User page url.
- fun html_url: String do return json["html_url"].to_s
-
# Get the repo owner.
fun owner: User do
return new User.from_json(api, json["owner"].as(JsonObject))
return res
end
+ # Search issues in this repo form an advanced query.
+ #
+ # Example:
+ #
+ # ~~~nitish
+ # var issues = repo.search_issues("is:open label:need_review")
+ # ~~~
+ #
+ # See <https://developer.github.com/v3/search/#search-issues>.
+ fun search_issues(query: String): nullable Array[Issue] do
+ query = "search/issues?q={query} repo:{full_name}"
+ var response = api.get(query)
+ if api.was_error then return null
+ var arr = response.as(JsonObject)["items"].as(JsonArray)
+ var res = new Array[Issue]
+ for obj in arr do
+ res.add new Issue.from_json(api, self, obj.as(JsonObject))
+ end
+ return res
+ end
+
# Get the last published issue.
fun last_issue: nullable Issue do
var array = api.get("repos/{full_name}/issues")
# Comment body text.
fun body: String do return json["body"].to_s
+
+ # Does the comment contain an acknowledgement (+1)
+ fun is_ack: Bool
+ do
+ return body.has("\\+1\\b".to_re) or body.has(":+1:") or body.has(":shipit:")
+ end
end
# A comment made on a commit.