code: explicitly call init in some named constructors
[nit.git] / lib / github / api.nit
index 91cc006..59917c5 100644 (file)
@@ -557,8 +557,7 @@ abstract class RepoEntity
 
        # 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
@@ -732,6 +731,12 @@ class Issue
                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)
 
@@ -1566,8 +1571,7 @@ class ContributorStats
 
        # 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.