github.go

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