+
+# An event that occurs on a Github `Issue`.
+#
+# Should be accessed from `GithubAPI::load_issue_event`.
+#
+# See <https://developer.github.com/v3/issues/events/>.
+class IssueEvent
+ super RepoEntity
+
+ redef var key is lazy do return "{repo.key}/issues/events/{id}"
+
+ # Event id on Github.
+ var id: Int
+
+ redef init from_json(api, repo, json) do
+ self.id = json["id"].as(Int)
+ super
+ end
+
+ # Issue that contains `self`.
+ fun issue: Issue do
+ return new Issue.from_json(api, repo, json["issue"].as(JsonObject))
+ end
+
+ # User that initiated the event.
+ fun actor: User do
+ return new User.from_json(api, json["actor"].as(JsonObject))
+ end
+
+ # Creation time in ISODate format.
+ fun created_at: ISODate do
+ return new ISODate.from_string(json["created_at"].to_s)
+ end
+
+ # Event descriptor.
+ fun event: String do return json["event"].to_s
+
+ # Commit linked to this event (if any).
+ fun commit_id: nullable String do
+ var res = json["commit_id"]
+ if res == null then return null
+ return res.to_s
+ end
+
+ # Label linked to this event (if any).
+ fun labl: nullable Label do
+ var res = json["label"]
+ if not res isa JsonObject then return null
+ return new Label.from_json(api, repo, res)
+ end
+
+ # User linked to this event (if any).
+ fun assignee: nullable User do
+ var res = json["assignee"]
+ if not res isa JsonObject then return null
+ return new User.from_json(api, res)
+ end
+
+ # Milestone linked to this event (if any).
+ fun milestone: nullable Milestone do
+ var res = json["milestone"]
+ if not res isa JsonObject then return null
+ return new Milestone.from_json(api, repo, res)
+ end
+
+ # Rename linked to this event (if any).
+ fun rename: nullable RenameAction do
+ var res = json["rename"]
+ if res == null then return null
+ return new RenameAction(res.as(JsonObject))
+ end
+end
+
+# A rename action maintains the name before and after a renaming action.
+class RenameAction
+
+ # JSON content.
+ var json: JsonObject
+
+ # Name before renaming.
+ fun from: String do return json["from"].to_s
+
+ # Name after renaming.
+ fun to: String do return json["to"].to_s
+end
+
+# Contributors list with additions, deletions, and commit counts.
+#
+# Should be accessed from `Repo::contrib_stats`.
+#
+# See <https://developer.github.com/v3/repos/statistics/>.
+class ContributorStats
+ super Comparable
+
+ redef type OTHER: ContributorStats
+
+ # Github API client.
+ var api: GithubAPI
+
+ # Json content.
+ var json: JsonObject
+
+ # Init `self` from a `json` object.
+ init from_json(api: GithubAPI, json: JsonObject) do
+ self.api = api
+ self.json = json
+ end
+
+ # User these statistics are about.
+ fun author: User do
+ return new User.from_json(api, json["author"].as(JsonObject))
+ end
+
+ # Total number of commit.
+ fun total: Int do return json["total"].to_s.to_i
+
+ # Are of weeks of activity with detailed statistics.
+ fun weeks: JsonArray do return json["weeks"].as(JsonArray)
+
+ # ContributorStats can be compared on the total amount of commits.
+ redef fun <(o) do return total < o.total
+end
+
+# A Github file representation.
+#
+# Mostly a wrapper around a json object.
+class GithubFile
+
+ # Json content.
+ var json: JsonObject
+
+ # File name.
+ fun filename: String do return json["filename"].to_s
+end