From c4a207622a894ba9839f1a3c47c9d78beff9b861 Mon Sep 17 00:00:00 2001 From: Michael Muré Date: Mon, 24 Sep 2018 19:22:32 +0200 Subject: github: query most of the data --- bridge/github/github.go | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) (limited to 'bridge/github/github.go') diff --git a/bridge/github/github.go b/bridge/github/github.go index 4f7a3b94..a8371637 100644 --- a/bridge/github/github.go +++ b/bridge/github/github.go @@ -1,10 +1,11 @@ package github import ( - "fmt" + "context" "github.com/MichaelMure/git-bug/bridge/core" - "github.com/MichaelMure/git-bug/cache" + "github.com/shurcooL/githubv4" + "golang.org/x/oauth2" ) func init() { @@ -25,18 +26,11 @@ func (*Github) Exporter() core.Exporter { return nil } -type githubImporter struct{} +func buildClient(conf core.Configuration) *githubv4.Client { + src := oauth2.StaticTokenSource( + &oauth2.Token{AccessToken: conf[keyToken]}, + ) + httpClient := oauth2.NewClient(context.TODO(), src) -func (*githubImporter) ImportAll(repo *cache.RepoCache, conf core.Configuration) error { - fmt.Println(conf) - fmt.Println("IMPORT ALL") - - return nil -} - -func (*githubImporter) Import(repo *cache.RepoCache, conf core.Configuration, id string) error { - fmt.Println(conf) - fmt.Println("IMPORT") - - return nil + return githubv4.NewClient(httpClient) } -- cgit