1package github
2
3import (
4 "context"
5
6 "github.com/MichaelMure/git-bug/bridge/core"
7 "github.com/shurcooL/githubv4"
8 "golang.org/x/oauth2"
9)
10
11func init() {
12 core.Register(&Github{})
13}
14
15type Github struct{}
16
17func (*Github) Target() string {
18 return "github"
19}
20
21func (*Github) Importer() core.Importer {
22 return &githubImporter{}
23}
24
25func (*Github) Exporter() core.Exporter {
26 return nil
27}
28
29func buildClient(conf core.Configuration) *githubv4.Client {
30 src := oauth2.StaticTokenSource(
31 &oauth2.Token{AccessToken: conf[keyToken]},
32 )
33 httpClient := oauth2.NewClient(context.TODO(), src)
34
35 return githubv4.NewClient(httpClient)
36}