git-bug/bridge/github/github.go
2019-11-09 13:26:48 +01:00

35 lines
642 B
Go

// Package github contains the Github bridge implementation
package github
import (
"context"
"github.com/shurcooL/githubv4"
"golang.org/x/oauth2"
"github.com/MichaelMure/git-bug/bridge/core"
)
type Github struct{}
func (*Github) Target() string {
return target
}
func (*Github) NewImporter() core.Importer {
return &githubImporter{}
}
func (*Github) NewExporter() core.Exporter {
return &githubExporter{}
}
func buildClient(token string) *githubv4.Client {
src := oauth2.StaticTokenSource(
&oauth2.Token{AccessToken: token},
)
httpClient := oauth2.NewClient(context.TODO(), src)
return githubv4.NewClient(httpClient)
}