github.com/abhinav/git-pr@v0.6.1-0.20171029234004-54218d68c11b/service/pr.go (about) 1 package service 2 3 import ( 4 "context" 5 6 "github.com/abhinav/git-pr/editor" 7 8 "github.com/google/go-github/github" 9 ) 10 11 // LandRequest is a request to land the given pull request. 12 type LandRequest struct { 13 // PullRqeuest to land 14 PullRequest *github.PullRequest 15 16 // Name of the local branch that points to this PR or an empty string if a 17 // local branch for this PR is not known. 18 LocalBranch string 19 20 // Editor to use for editing the commit message. 21 Editor editor.Editor 22 } 23 24 // LandResponse is the response of a land request. 25 type LandResponse struct { 26 BranchesNotUpdated []string 27 } 28 29 // RebaseRequest is a request to rebase the given list of pull requests and 30 // their dependencies onto the given base branch. 31 // 32 // If the base branch for the given PRs on GitHub is not the same as Base, 33 // this will be updated too. 34 type RebaseRequest struct { 35 PullRequests []*github.PullRequest 36 Base string 37 38 // If non-empy, only pull requests by the given user will be rebased. 39 Author string 40 } 41 42 // RebaseResponse is the response of the Rebase operation. 43 type RebaseResponse struct { 44 // Local branches that were not updated because their heads did not match 45 // the remotes. 46 BranchesNotUpdated []string 47 } 48 49 // PR is the service that provides pull request related operations. 50 type PR interface { 51 // Lands a pull request 52 Land(context.Context, *LandRequest) (*LandResponse, error) 53 54 // Rebases a pull request. 55 Rebase(context.Context, *RebaseRequest) (*RebaseResponse, error) 56 }