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