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