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 "github.com/MichaelMure/git-bug/bridge/core/auth"
12)
13
14type Github struct{}
15
16func (*Github) Target() string {
17 return target
18}
19
20func (*Github) NewImporter() core.Importer {
21 return &githubImporter{}
22}
23
24func (*Github) NewExporter() core.Exporter {
25 return &githubExporter{}
26}
27
28func buildClient(token *auth.Token) *githubv4.Client {
29 src := oauth2.StaticTokenSource(
30 &oauth2.Token{AccessToken: token.Value},
31 )
32 httpClient := oauth2.NewClient(context.TODO(), src)
33
34 return githubv4.NewClient(httpClient)
35}