forked from jenkins-x/go-scm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpr.go
77 lines (63 loc) · 2.06 KB
/
pr.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// Copyright 2017 Drone.IO Inc. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package scm
import (
"context"
"time"
)
type (
// PullRequest represents a repository pull request.
PullRequest struct {
Number int
Title string
Body string
Sha string
Ref string
Source string
Target string
Fork string
Link string
Closed bool
Merged bool
Author User
Created time.Time
Updated time.Time
}
// PullRequestListOptions provides options for querying
// a list of repository merge requests.
PullRequestListOptions struct {
Page int
Size int
Open bool
Closed bool
}
// Change represents a changed file.
Change struct {
Path string
Added bool
Renamed bool
Deleted bool
}
// PullRequestService provides access to pull request resources.
PullRequestService interface {
// Find returns the repository pull request by number.
Find(context.Context, string, int) (*PullRequest, *Response, error)
// FindComment returns the pull request comment by id.
FindComment(context.Context, string, int, int) (*Comment, *Response, error)
// Find returns the repository pull request list.
List(context.Context, string, PullRequestListOptions) ([]*PullRequest, *Response, error)
// ListChanges returns the pull request changeset.
ListChanges(context.Context, string, int, ListOptions) ([]*Change, *Response, error)
// ListComments returns the pull request comment list.
ListComments(context.Context, string, int, ListOptions) ([]*Comment, *Response, error)
// Merge merges the repository pull request.
Merge(context.Context, string, int) (*Response, error)
// Close closes the repository pull request.
Close(context.Context, string, int) (*Response, error)
// CreateComment creates a new pull request comment.
CreateComment(context.Context, string, int, *CommentInput) (*Comment, *Response, error)
// DeleteComment deletes an pull request comment.
DeleteComment(context.Context, string, int, int) (*Response, error)
}
)