1package github
2
3import (
4 "time"
5
6 "github.com/MichaelMure/git-bug/bridge/core"
7 "github.com/MichaelMure/git-bug/cache"
8)
9
10// githubImporter implement the Importer interface
11type githubExporter struct {
12 conf core.Configuration
13}
14
15func (ge *githubExporter) Init(conf core.Configuration) error {
16 ge.conf = conf
17 return nil
18}
19
20// ExportAll export all event made by the current user to Github
21func (ge *githubExporter) ExportAll(repo *cache.RepoCache, since time.Time) error {
22 identity, err := repo.GetUserIdentity()
23 if err != nil {
24 return err
25 }
26
27 allBugsIds := repo.AllBugsIds()
28
29 //
30 bugs := make([]*cache.BugCache, 0)
31 for _, id := range allBugsIds {
32 b, err := repo.ResolveBug(id)
33 if err != nil {
34 return err
35 }
36
37 // check if user participated in the issue
38 participants := b.Snapshot().Participants
39 for _, p := range participants {
40 if p.Id() == identity.Id() {
41 bugs = append(bugs, b)
42 }
43 }
44 }
45
46 //TODO: Export bugs/events/editions
47
48 return nil
49}