github.com/abhinav/git-pr@v0.6.1-0.20171029234004-54218d68c11b/pr/service.go (about) 1 package pr 2 3 import ( 4 "github.com/abhinav/git-pr/gateway" 5 "github.com/abhinav/git-pr/service" 6 ) 7 8 // ServiceConfig specifies the different parameters for a PR service. 9 type ServiceConfig struct { 10 GitHub gateway.GitHub 11 Git gateway.Git 12 } 13 14 // Service is a PR service. 15 type Service struct { 16 gh gateway.GitHub 17 git gateway.Git 18 19 // Hidden option to customize how we rebase pull requests. 20 rebasePullRequests func(rebasePRConfig) (map[int]rebasedPullRequest, error) 21 } 22 23 // NewService builds a new PR service with the given configuration. 24 func NewService(cfg ServiceConfig) *Service { 25 return &Service{ 26 gh: cfg.GitHub, 27 git: cfg.Git, 28 rebasePullRequests: rebasePullRequests, 29 } 30 } 31 32 var _ service.PR = (*Service)(nil)