github: Rename `GithubAPI::load_` methods in `get_`
authorAlexandre Terrasa <alexandre@moz-code.org>
Fri, 21 Jun 2019 00:33:20 +0000 (20:33 -0400)
committerAlexandre Terrasa <alexandre@moz-code.org>
Thu, 11 Jul 2019 01:42:15 +0000 (21:42 -0400)
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

lib/github/api.nit
lib/github/cache.nit
lib/github/loader.nit
lib/github/tests/test_api.nit
lib/github/wallet.nit
lib/popcorn/pop_auth.nit

index 2384fae..9d28990 100644 (file)
@@ -43,11 +43,11 @@ import json
 # The API client allows you to get Github API entities.
 #
 # ~~~nitish
-# var repo = api.load_repo("nitlang/nit")
+# var repo = api.get_repo("nitlang/nit")
 # assert repo != null
 # assert repo.name == "nit"
 #
-# var user = api.load_user("Morriar")
+# var user = api.get_user("Morriar")
 # assert user != null
 # assert user.login == "Morriar"
 # ~~~
@@ -193,10 +193,10 @@ class GithubAPI
        #
        # ~~~nitish
        # var api = new GithubAPI(get_github_oauth)
-       # var user = api.load_auth_user
+       # var user = api.get_auth_user
        # assert user.login == "Morriar"
        # ~~~
-       fun load_auth_user: nullable User do
+       fun get_auth_user: nullable User do
                return get("/user").as(nullable User)
        end
 
@@ -206,11 +206,11 @@ class GithubAPI
        #
        # ~~~nitish
        # var api = new GithubAPI(get_github_oauth)
-       # var user = api.load_user("Morriar")
+       # var user = api.get_user("Morriar")
        # print user or else "null"
        # assert user.login == "Morriar"
        # ~~~
-       fun load_user(login: String): nullable User do
+       fun get_user(login: String): nullable User do
                return get("/users/{login}").as(nullable User)
        end
 
@@ -220,17 +220,17 @@ class GithubAPI
        #
        # ~~~nitish
        # var api = new GithubAPI(get_github_oauth)
-       # var repo = api.load_repo("nitlang/nit")
+       # var repo = api.get_repo("nitlang/nit")
        # assert repo.name == "nit"
        # assert repo.owner.login == "nitlang"
        # assert repo.default_branch == "master"
        # ~~~
-       fun load_repo(full_name: String): nullable Repo do
+       fun get_repo(full_name: String): nullable Repo do
                return get("/repos/{full_name}").as(nullable Repo)
        end
 
        # List of branches associated with their names.
-       fun load_repo_branches(repo: Repo): Array[Branch] do
+       fun get_repo_branches(repo: Repo): Array[Branch] do
                message(1, "Get branches for {repo.full_name}")
                var array = get("/repos/{repo.full_name}/branches")
                var res = new Array[Branch]
@@ -243,14 +243,14 @@ class GithubAPI
        end
 
        # List of issues associated with their ids.
-       fun load_repo_issues(repo: Repo): Array[Issue] do
+       fun get_repo_issues(repo: Repo): Array[Issue] do
                message(1, "Get issues for {repo.full_name}")
                var res = new Array[Issue]
-               var issue = load_repo_last_issue(repo)
+               var issue = get_repo_last_issue(repo)
                if issue == null then return res
                res.add issue
                while issue != null and issue.number > 1 do
-                       issue = load_issue(repo, issue.number - 1)
+                       issue = get_issue(repo, issue.number - 1)
                        if issue == null then continue
                        res.add issue
                end
@@ -276,7 +276,7 @@ class GithubAPI
        end
 
        # Get the last published issue.
-       fun load_repo_last_issue(repo: Repo): nullable Issue do
+       fun get_repo_last_issue(repo: Repo): nullable Issue do
                var array = get("/repos/{repo.full_name}/issues")
                if not array isa JsonArray then return null
                if array.is_empty then return null
@@ -286,7 +286,7 @@ class GithubAPI
        end
 
        # List of labels associated with their names.
-       fun load_repo_labels(repo: Repo): Array[Label] do
+       fun get_repo_labels(repo: Repo): Array[Label] do
                message(1, "Get labels for {repo.full_name}")
                var array = get("repos/{repo.full_name}/labels")
                if not array isa JsonArray then return new Array[Label]
@@ -294,7 +294,7 @@ class GithubAPI
        end
 
        # List of milestones associated with their ids.
-       fun load_repo_milestones(repo: Repo): Array[Milestone] do
+       fun get_repo_milestones(repo: Repo): Array[Milestone] do
                message(1, "Get milestones for {repo.full_name}")
                var array = get("/repos/{repo.full_name}/milestones")
                if not array isa JsonArray then return new Array[Milestone]
@@ -306,7 +306,7 @@ class GithubAPI
        # Implementation notes: because PR numbers are not consecutive,
        # PR are loaded from pages.
        # See: https://developer.github.com/v3/pulls/#list-pull-requests
-       fun load_repo_pulls(repo: Repo): Array[PullRequest] do
+       fun get_repo_pulls(repo: Repo): Array[PullRequest] do
                message(1, "Get pulls for {repo.full_name}")
                var key = "/repos/{repo.full_name}"
                var res = new Array[PullRequest]
@@ -326,7 +326,7 @@ class GithubAPI
        end
 
        # List of contributor related statistics.
-       fun load_repo_contrib_stats(repo: Repo): Array[ContributorStats] do
+       fun get_repo_contrib_stats(repo: Repo): Array[ContributorStats] do
                message(1, "Get contributor stats for {repo.full_name}")
                var res = new Array[ContributorStats]
                var array = get("/repos/{repo.full_name}/stats/contributors")
@@ -340,13 +340,13 @@ class GithubAPI
        #
        # ~~~nitish
        # var api = new GithubAPI(get_github_oauth)
-       # var repo = api.load_repo("nitlang/nit")
+       # var repo = api.get_repo("nitlang/nit")
        # assert repo != null
-       # var branch = api.load_branch(repo, "master")
+       # var branch = api.get_branch(repo, "master")
        # assert branch.name == "master"
        # assert branch.commit isa Commit
        # ~~~
-       fun load_branch(repo: Repo, name: String): nullable Branch do
+       fun get_branch(repo: Repo, name: String): nullable Branch do
                return get("/repos/{repo.full_name}/branches/{name}").as(nullable Branch)
        end
 
@@ -354,7 +354,7 @@ class GithubAPI
        #
        # This can be long depending on the branch size.
        # Commit are returned in an unspecified order.
-       fun load_branch_commits(branch: Branch): Array[Commit] do
+       fun get_branch_commits(branch: Branch): Array[Commit] do
                var res = new Array[Commit]
                var done = new HashSet[String]
                var todos = new Array[Commit]
@@ -380,12 +380,12 @@ class GithubAPI
        #
        # ~~~nitish
        # var api = new GithubAPI(get_github_oauth)
-       # var repo = api.load_repo("nitlang/nit")
+       # var repo = api.get_repo("nitlang/nit")
        # assert repo != null
-       # var commit = api.load_commit(repo, "64ce1f")
+       # var commit = api.get_commit(repo, "64ce1f")
        # assert commit isa Commit
        # ~~~
-       fun load_commit(repo: Repo, sha: String): nullable Commit do
+       fun get_commit(repo: Repo, sha: String): nullable Commit do
                return get("/repos/{repo.full_name}/commits/{sha}").as(nullable Commit)
        end
 
@@ -395,17 +395,17 @@ class GithubAPI
        #
        # ~~~nitish
        # var api = new GithubAPI(get_github_oauth)
-       # var repo = api.load_repo("nitlang/nit")
+       # var repo = api.get_repo("nitlang/nit")
        # assert repo != null
-       # var issue = api.load_issue(repo, 1)
+       # var issue = api.get_issue(repo, 1)
        # assert issue.title == "Doc"
        # ~~~
-       fun load_issue(repo: Repo, number: Int): nullable Issue do
+       fun get_issue(repo: Repo, number: Int): nullable Issue do
                return get("/repos/{repo.full_name}/issues/{number}").as(nullable Issue)
        end
 
        # List of event on this issue.
-       fun load_issue_comments(repo: Repo, issue: Issue): Array[IssueComment] do
+       fun get_issue_comments(repo: Repo, issue: Issue): Array[IssueComment] do
                var res = new Array[IssueComment]
                var count = issue.comments or else 0
                var page = 1
@@ -416,7 +416,7 @@ class GithubAPI
                        for obj in array do
                                if not obj isa JsonObject then continue
                                var id = obj["id"].as(Int)
-                               var comment = load_issue_comment(repo, id)
+                               var comment = get_issue_comment(repo, id)
                                if comment == null then continue
                                res.add(comment)
                        end
@@ -427,7 +427,7 @@ class GithubAPI
        end
 
        # List of events on this issue.
-       fun load_issue_events(repo: Repo, issue: Issue): Array[IssueEvent] do
+       fun get_issue_events(repo: Repo, issue: Issue): Array[IssueEvent] do
                var res = new Array[IssueEvent]
                var key = "/repos/{repo.full_name}/issues/{issue.number}"
                var page = 1
@@ -451,13 +451,13 @@ class GithubAPI
        #
        # ~~~nitish
        # var api = new GithubAPI(get_github_oauth)
-       # var repo = api.load_repo("nitlang/nit")
+       # var repo = api.get_repo("nitlang/nit")
        # assert repo != null
-       # var pull = api.load_pull(repo, 1)
+       # var pull = api.get_pull(repo, 1)
        # assert pull.title == "Doc"
        # assert pull.user.login == "Morriar"
        # ~~~
-       fun load_pull(repo: Repo, number: Int): nullable PullRequest do
+       fun get_pull(repo: Repo, number: Int): nullable PullRequest do
                return get("/repos/{repo.full_name}/pulls/{number}").as(nullable PullRequest)
        end
 
@@ -467,12 +467,12 @@ class GithubAPI
        #
        # ~~~nitish
        # var api = new GithubAPI(get_github_oauth)
-       # var repo = api.load_repo("nitlang/nit")
+       # var repo = api.get_repo("nitlang/nit")
        # assert repo != null
-       # var labl = api.load_label(repo, "ok_will_merge")
+       # var labl = api.get_label(repo, "ok_will_merge")
        # assert labl != null
        # ~~~
-       fun load_label(repo: Repo, name: String): nullable Label do
+       fun get_label(repo: Repo, name: String): nullable Label do
                return get("/repos/{repo.full_name}/labels/{name}").as(nullable Label)
        end
 
@@ -482,12 +482,12 @@ class GithubAPI
        #
        # ~~~nitish
        # var api = new GithubAPI(get_github_oauth)
-       # var repo = api.load_repo("nitlang/nit")
+       # var repo = api.get_repo("nitlang/nit")
        # assert repo != null
-       # var stone = api.load_milestone(repo, 4)
+       # var stone = api.get_milestone(repo, 4)
        # assert stone.title == "v1.0prealpha"
        # ~~~
-       fun load_milestone(repo: Repo, id: Int): nullable Milestone do
+       fun get_milestone(repo: Repo, id: Int): nullable Milestone do
                return get("/repos/{repo.full_name}/milestones/{id}").as(nullable Milestone)
        end
 
@@ -497,16 +497,16 @@ class GithubAPI
        #
        # ~~~nitish
        # var api = new GithubAPI(get_github_oauth)
-       # var repo = api.load_repo("nitlang/nit")
+       # var repo = api.get_repo("nitlang/nit")
        # assert repo isa Repo
-       # var event = api.load_issue_event(repo, 199674194)
+       # var event = api.get_issue_event(repo, 199674194)
        # assert event isa IssueEvent
        # assert event.actor.login == "privat"
        # assert event.event == "labeled"
        # assert event.labl isa Label
        # assert event.labl.name == "need_review"
        # ~~~
-       fun load_issue_event(repo: Repo, id: Int): nullable IssueEvent do
+       fun get_issue_event(repo: Repo, id: Int): nullable IssueEvent do
                return get("/repos/{repo.full_name}/issues/events/{id}").as(nullable IssueEvent)
        end
 
@@ -516,14 +516,14 @@ class GithubAPI
        #
        # ~~~nitish
        # var api = new GithubAPI(get_github_oauth)
-       # var repo = api.load_repo("nitlang/nit")
+       # var repo = api.get_repo("nitlang/nit")
        # assert repo != null
-       # var comment = api.load_commit_comment(repo, 8982707)
+       # var comment = api.get_commit_comment(repo, 8982707)
        # assert comment.user.login == "Morriar"
        # assert comment.body == "For testing purposes...\n"
        # assert comment.commit_id == "7eacb86d1e24b7e72bc9ac869bf7182c0300ceca"
        # ~~~
-       fun load_commit_comment(repo: Repo, id: Int): nullable CommitComment do
+       fun get_commit_comment(repo: Repo, id: Int): nullable CommitComment do
                return get("/repos/{repo.full_name}/comments/{id}").as(nullable CommitComment)
        end
 
@@ -533,14 +533,14 @@ class GithubAPI
        #
        # ~~~nitish
        # var api = new GithubAPI(get_github_oauth)
-       # var repo = api.load_repo("nitlang/nit")
+       # var repo = api.get_repo("nitlang/nit")
        # assert repo != null
-       # var comment = api.load_issue_comment(repo, 6020149)
+       # var comment = api.get_issue_comment(repo, 6020149)
        # assert comment.user.login == "privat"
        # assert comment.created_at.to_s == "2012-05-30T20:16:54Z"
        # assert comment.issue_number == 10
        # ~~~
-       fun load_issue_comment(repo: Repo, id: Int): nullable IssueComment do
+       fun get_issue_comment(repo: Repo, id: Int): nullable IssueComment do
                return get("/repos/{repo.full_name}/issues/comments/{id}").as(nullable IssueComment)
        end
 
@@ -550,14 +550,14 @@ class GithubAPI
        #
        # ~~~nitish
        # var api = new GithubAPI(get_github_oauth)
-       # var repo = api.load_repo("nitlang/nit")
+       # var repo = api.get_repo("nitlang/nit")
        # assert repo != null
-       # var comment = api.load_review_comment(repo, 21010363)
+       # var comment = api.get_review_comment(repo, 21010363)
        # assert comment.path == "src/modelize/modelize_property.nit"
        # assert comment.original_position == 26
        # assert comment.pull_number == 945
        # ~~~
-       fun load_review_comment(repo: Repo, id: Int): nullable ReviewComment do
+       fun get_review_comment(repo: Repo, id: Int): nullable ReviewComment do
                return get("/repos/{repo.full_name}/pulls/comments/{id}").as(nullable ReviewComment)
        end
 end
@@ -605,7 +605,7 @@ end
 # A Github user
 #
 # Provides access to [Github user data](https://developer.github.com/v3/users/).
-# Should be accessed from `GithubAPI::load_user`.
+# Should be accessed from `GithubAPI::get_user`.
 class User
        super GitUser
        serialize
@@ -629,7 +629,7 @@ end
 # A Github repository.
 #
 # Provides access to [Github repo data](https://developer.github.com/v3/repos/).
-# Should be accessed from `GithubAPI::load_repo`.
+# Should be accessed from `GithubAPI::get_repo`.
 class Repo
        super GithubEntity
        serialize
@@ -649,7 +649,7 @@ end
 
 # A Github branch.
 #
-# Should be accessed from `GithubAPI::load_branch`.
+# Should be accessed from `GithubAPI::get_branch`.
 #
 # See <https://developer.github.com/v3/repos/#list-branches>.
 class Branch
@@ -665,7 +665,7 @@ end
 
 # A Github commit.
 #
-# Should be accessed from `GithubAPI::load_commit`.
+# Should be accessed from `GithubAPI::get_commit`.
 #
 # See <https://developer.github.com/v3/repos/commits/>.
 class Commit
@@ -753,7 +753,7 @@ end
 
 # A Github issue.
 #
-# Should be accessed from `GithubAPI::load_issue`.
+# Should be accessed from `GithubAPI::get_issue`.
 #
 # See <https://developer.github.com/v3/issues/>.
 class Issue
@@ -830,7 +830,7 @@ end
 
 # A Github pull request.
 #
-# Should be accessed from `GithubAPI::load_pull`.
+# Should be accessed from `GithubAPI::get_pull`.
 #
 # PullRequest are basically Issues with more data.
 # See <https://developer.github.com/v3/pulls/>.
@@ -914,7 +914,7 @@ end
 
 # A Github label.
 #
-# Should be accessed from `GithubAPI::load_label`.
+# Should be accessed from `GithubAPI::get_label`.
 #
 # See <https://developer.github.com/v3/issues/labels/>.
 class Label
@@ -930,7 +930,7 @@ end
 
 # A Github milestone.
 #
-# Should be accessed from `GithubAPI::load_milestone`.
+# Should be accessed from `GithubAPI::get_milestone`.
 #
 # See <https://developer.github.com/v3/issues/milestones/>.
 class Milestone
@@ -1063,7 +1063,7 @@ end
 
 # Comments made on Github issue and pull request pages.
 #
-# Should be accessed from `GithubAPI::load_issue_comment`.
+# Should be accessed from `GithubAPI::get_issue_comment`.
 #
 # See <https://developer.github.com/v3/issues/comments/>.
 class IssueComment
@@ -1079,7 +1079,7 @@ end
 
 # Comments made on Github pull request diffs.
 #
-# Should be accessed from `GithubAPI::load_diff_comment`.
+# Should be accessed from `GithubAPI::get_diff_comment`.
 #
 # See <https://developer.github.com/v3/pulls/comments/>.
 class ReviewComment
@@ -1113,7 +1113,7 @@ end
 
 # An event that occurs on a Github `Issue`.
 #
-# Should be accessed from `GithubAPI::load_issue_event`.
+# Should be accessed from `GithubAPI::get_issue_event`.
 #
 # See <https://developer.github.com/v3/issues/events/>.
 class IssueEvent
index 82d102a..8384030 100644 (file)
@@ -28,9 +28,9 @@
 #
 # var name = "nitlang/nit"
 # assert not api.has_cache(name)
-# var repo = api.load_repo(name) # load from GitHub
+# var repo = api.get_repo(name) # load from GitHub
 # #assert api.has_cache(name) FIXME bring back this assert
-# repo = api.load_repo(name) # load from cache
+# repo = api.get_repo(name) # load from cache
 #
 # api.clear_cache
 # assert not api.has_cache(name)
index 6a60c5d..175f3d7 100644 (file)
@@ -245,8 +245,8 @@ class Loader
                        log.info "Resuming pending job for `{repo_full_name}`"
                end
                print "Load history for {job}..."
-               load_branches(job)
-               load_issues(job)
+               get_branches(job)
+               get_issues(job)
                finish_job(job)
        end
 
@@ -275,7 +275,7 @@ class Loader
 
        # Add a new job
        fun add_job(repo_full_name: String): LoaderJob do
-               var repo = config.wallet.api.load_repo(repo_full_name)
+               var repo = config.wallet.api.get_repo(repo_full_name)
                assert repo != null else
                        error "Repository `{repo_full_name}` not found"
                end
@@ -291,27 +291,27 @@ class Loader
                jobs.remove_by_id(job.id)
        end
 
-       fun load_branches(job: LoaderJob) do
+       fun get_branches(job: LoaderJob) do
                if config.no_branches then return
 
                var api = config.wallet.api
                var repo = job.repo
-               for branch in api.load_repo_branches(repo) do
+               for branch in api.get_repo_branches(repo) do
                        branch.repo = repo
                        branches.save branch
-                       load_commits(job, branch)
+                       get_commits(job, branch)
                end
        end
 
-       fun load_commits(job: LoaderJob, branch: Branch) do
+       fun get_commits(job: LoaderJob, branch: Branch) do
                if config.no_commits then return
-               load_commit(job, branch.commit.sha)
+               get_commit(job, branch.commit.sha)
        end
 
-       fun load_commit(job: LoaderJob, commit_sha: String) do
+       fun get_commit(job: LoaderJob, commit_sha: String) do
                if commits.find_by_id(commit_sha) != null then return
                var api = config.wallet.api
-               var commit = api.load_commit(job.repo, commit_sha)
+               var commit = api.get_commit(job.repo, commit_sha)
                # print commit or else "NULL"
                if commit == null then return
                var message = commit.message or else "no message"
@@ -321,19 +321,19 @@ class Loader
                var parents = commit.parents
                if parents == null then return
                for parent in parents do
-                       load_commit(job, parent.sha)
+                       get_commit(job, parent.sha)
                end
        end
 
        # Load game for `repo_name`.
-       fun load_issues(job: LoaderJob) do
+       fun get_issues(job: LoaderJob) do
                if config.no_issues then return
 
                var i = job.last_issue
-               var last_issue = load_last_issue(job)
+               var last_issue = get_last_issue(job)
                if last_issue != null then
                        while i <= last_issue.number do
-                               load_issue(job, i)
+                               get_issue(job, i)
                                job.last_issue = i
                                jobs.save job
                                i += 1
@@ -342,72 +342,72 @@ class Loader
        end
 
        # Load the `repo` last issue or abort.
-       private fun load_last_issue(job: LoaderJob): nullable Issue do
+       private fun get_last_issue(job: LoaderJob): nullable Issue do
                var api = config.wallet.api
-               return api.load_repo_last_issue(job.repo)
+               return api.get_repo_last_issue(job.repo)
        end
 
        # Load an issue or abort.
-       private fun load_issue(job: LoaderJob, issue_number: Int) do
+       private fun get_issue(job: LoaderJob, issue_number: Int) do
                if issues.find_by_id("{job.repo.mongo_id}/{issue_number}") != null then return
 
                var api = config.wallet.api
-               var issue = api.load_issue(job.repo, issue_number)
+               var issue = api.get_issue(job.repo, issue_number)
                assert issue != null else
                        check_error(api, "Issue #{issue_number} not found")
                end
                if issue.is_pull_request then
-                       load_pull(job, issue)
+                       get_pull(job, issue)
                else
                        log.info "Load issue #{issue.number}: {issue.title.split("\n").first}"
                        issue.repo = job.repo
                        issues.save issue
-                       load_issue_events(job, issue)
+                       get_issue_events(job, issue)
                end
-               load_issue_comments(job, issue)
+               get_issue_comments(job, issue)
        end
 
        # Load issue comments.
-       private fun load_issue_comments(job: LoaderJob, issue: Issue) do
+       private fun get_issue_comments(job: LoaderJob, issue: Issue) do
                if config.no_comments then return
                var api = config.wallet.api
-               for comment in api.load_issue_comments(job.repo, issue) do
+               for comment in api.get_issue_comments(job.repo, issue) do
                        comment.repo = job.repo
                        issue_comments.save comment
                end
        end
 
        # Load issue events.
-       private fun load_issue_events(job: LoaderJob, issue: Issue) do
+       private fun get_issue_events(job: LoaderJob, issue: Issue) do
                if config.no_events then return
 
                var api = config.wallet.api
-               for event in api.load_issue_events(job.repo, issue) do
+               for event in api.get_issue_events(job.repo, issue) do
                        event.repo = job.repo
                        issue_events.save event
                end
        end
 
        # Load a pull request or abort.
-       private fun load_pull(job: LoaderJob, issue: Issue): PullRequest do
+       private fun get_pull(job: LoaderJob, issue: Issue): PullRequest do
                var api = config.wallet.api
-               var pr = api.load_pull(job.repo, issue.number)
+               var pr = api.get_pull(job.repo, issue.number)
                assert pr != null else
                        check_error(api, "Pull request #{issue.number} not found")
                end
                log.info "Load pull request #{issue.number}: {pr.title.split("\n").first}"
                pr.repo = job.repo
                pulls.save pr
-               load_pull_events(job, pr)
+               get_pull_events(job, pr)
                return pr
        end
 
        # Load pull events.
-       private fun load_pull_events(job: LoaderJob, pull: PullRequest) do
+       private fun get_pull_events(job: LoaderJob, pull: PullRequest) do
                if config.no_events then return
 
                var api = config.wallet.api
-               for event in api.load_issue_events(job.repo, pull) do
+               for event in api.get_issue_events(job.repo, pull) do
                        event.repo = job.repo
                        issue_events.save event
                end
@@ -593,7 +593,7 @@ if loader.config.opt_clear.value then
 else
        loader.start args.first
 
-       var repo = loader.config.wallet.api.load_repo(args.first)
+       var repo = loader.config.wallet.api.get_repo(args.first)
        if repo == null then return
        print "Loaded"
        print "* {if loader.repos.find_by_id(args.first) != null then 1 else 0} repos"
index fa84b67..a2ea73d 100644 (file)
@@ -184,7 +184,7 @@ class TestGithubAPI
        # TODO test more error cases
 
        fun test_get_auth_user is test do
-               var user = api.load_auth_user
+               var user = api.get_auth_user
                assert user isa User
                assert user.login == "Morriar"
                assert user.avatar_url == "https://avatars2.githubusercontent.com/u/583144?v=4"
@@ -194,7 +194,7 @@ class TestGithubAPI
        end
 
        fun test_get_user is test do
-               var user = api.load_user("Morriar")
+               var user = api.get_user("Morriar")
                assert user isa User
                assert user.login == "Morriar"
                assert user.avatar_url == "https://avatars2.githubusercontent.com/u/583144?v=4"
@@ -204,7 +204,7 @@ class TestGithubAPI
        end
 
        fun test_get_repo is test do
-               var repo = api.load_repo("nitlang/nit")
+               var repo = api.get_repo("nitlang/nit")
                assert repo isa Repo
                assert repo.full_name == "nitlang/nit"
                assert repo.name == "nit"
@@ -212,10 +212,10 @@ class TestGithubAPI
                assert repo.default_branch == "master"
        end
 
-       private var repo: Repo is lazy do return api.load_repo("nitlang/nit").as(not null)
+       private var repo: Repo is lazy do return api.get_repo("nitlang/nit").as(not null)
 
        fun test_get_branches is test do
-               var branches = api.load_repo_branches(repo)
+               var branches = api.get_repo_branches(repo)
                assert branches.length == 2
                assert branches.first.name == "master"
                assert branches.last.name == "next"
@@ -229,7 +229,7 @@ class TestGithubAPI
        # TODO contrib_stats
 
        fun test_get_branch is test do
-               var branch = api.load_branch(repo, "master")
+               var branch = api.get_branch(repo, "master")
                assert branch isa Branch
                assert branch.name == "master"
        end
@@ -237,14 +237,14 @@ class TestGithubAPI
        # TODO branch commits
 
        fun test_get_commit is test do
-               var commit = api.load_commit(repo, "64ce1f")
+               var commit = api.get_commit(repo, "64ce1f")
                assert commit isa Commit
                assert commit.sha == "64ce1f587209024f5de46d06c70526a569ff537f"
                # TODO other fields
        end
 
        fun test_get_issue is test do
-               var issue = api.load_issue(repo, 1000)
+               var issue = api.get_issue(repo, 1000)
                assert issue isa Issue
                assert issue.number == 1000
                assert issue.title == "Raise nitc from the dead"
@@ -261,7 +261,7 @@ class TestGithubAPI
        # TODO issue events
 
        fun test_get_pull is test do
-               var pull = api.load_pull(repo, 1000)
+               var pull = api.get_pull(repo, 1000)
                assert pull isa Issue
                assert pull.number == 1000
                assert pull.title == "Raise nitc from the dead"
@@ -274,20 +274,20 @@ class TestGithubAPI
        end
 
        fun test_get_label is test do
-               var labl = api.load_label(repo, "ok_will_merge")
+               var labl = api.get_label(repo, "ok_will_merge")
                assert labl isa Label
                assert labl.name == "ok_will_merge"
        end
 
        fun test_get_milestone is test do
-               var milestone = api.load_milestone(repo, 4)
+               var milestone = api.get_milestone(repo, 4)
                assert milestone isa Milestone
                assert milestone.title == "v1.0prealpha"
                # TODO other fields
        end
 
        fun test_get_issue_event is test do
-               var event = api.load_issue_event(repo, 199674194)
+               var event = api.get_issue_event(repo, 199674194)
                assert event isa IssueEvent
                assert event.actor.login == "privat"
                assert event.event == "labeled"
@@ -295,7 +295,7 @@ class TestGithubAPI
        end
 
        fun test_get_issue_comment is test do
-               var comment = api.load_issue_comment(repo, 6020149)
+               var comment = api.get_issue_comment(repo, 6020149)
                assert comment isa IssueComment
                assert comment.user.login == "privat"
                assert comment.created_at.to_s == "2012-05-30T20:16:54Z"
@@ -303,7 +303,7 @@ class TestGithubAPI
        end
 
        fun test_get_comment is test do
-               var comment = api.load_commit_comment(repo, 8982707)
+               var comment = api.get_commit_comment(repo, 8982707)
                assert comment isa CommitComment
                assert comment.user.login == "Morriar"
                assert comment.body == "For testing purposes...\n"
@@ -311,7 +311,7 @@ class TestGithubAPI
        end
 
        fun test_get_review_comments is test do
-               var comment = api.load_review_comment(repo, 21010363)
+               var comment = api.get_review_comment(repo, 21010363)
                assert comment isa ReviewComment
                assert comment.path == "src/modelize/modelize_property.nit"
                assert comment.original_position == 26
index 985f7aa..ecad4c2 100644 (file)
@@ -153,7 +153,7 @@ class GithubWallet
        fun check_token(token: String): Bool do
                message "Try token {token}"
                var api = new GithubAPI(token)
-               api.load_repo("nitlang/nit")
+               api.get_repo("nitlang/nit")
                return not api.was_error
        end
 
index 3dd71fb..285d032 100644 (file)
@@ -199,7 +199,7 @@ class GithubOAuthCallBack
 
                # Load github user
                var gh_api = new GithubAPI(access_token)
-               var user = gh_api.load_auth_user
+               var user = gh_api.get_auth_user
                if user == null then
                        res.error 401
                        return