# Init `self` from a `json` object.
init from_json(api: GithubAPI, repo: Repo, json: JsonObject) do
- self.api = api
- self.repo = repo
+ init(api, repo)
self.json = json
end
end
super
end
+ # Issue id.
+ fun id: Int do return json["id"].as(Int)
+
+ # Set issue id.
+ fun id=(id: Int) do json["id"] = id
+
# Issue title.
fun title: String do return json["title"].as(String)
for obj in array do
if not obj isa JsonObject then continue
var id = obj["id"].as(Int)
- res.add(api.load_issue_comment(repo, id).as(not null))
+ var comment = api.load_issue_comment(repo, id)
+ if comment == null then continue
+ res.add(comment)
end
page += 1
- array = api.get("{key}/comments?page={page}").as(JsonArray)
+ var json = api.get("{key}/comments?page={page}")
+ if not json isa JsonArray then
+ return res
+ end
+ array = json
end
return res
end
json["closed_by"] = user.json
end
end
+
+ # Is this issue linked to a pull request?
+ fun is_pull_request: Bool do return json.has_key("pull_request")
end
# A Github pull request.
# Init `self` from a `json` object.
init from_json(api: GithubAPI, json: JsonObject) do
- self.api = api
- self.json = json
+ init(api, json)
end
# User these statistics are about.