Skip to content

Commit ee3a3ac

Browse files
authored
Create comment on PR not working (#7)
* Changes: - Delete tests folder - tidy up go.mod * Fix bug when creating/update pr comments
1 parent 76c28be commit ee3a3ac

File tree

8 files changed

+17
-187
lines changed

8 files changed

+17
-187
lines changed

bitbucket/bitbucket-accessors.go

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bitbucket/pull_requests_comments.go

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ type PRComment struct {
1515
Deleted *bool `json:"deleted,omitempty"`
1616
}
1717

18+
// PRCommentRequest represents a request to create or update a pull request comment.
19+
type PRCommentRequest struct {
20+
Content *Content `json:"content,omitempty"`
21+
}
22+
1823
// ListComments returns a paginated list of the pull request's comments.
1924
//
2025
// This includes both global, inline comments and replies.
@@ -36,7 +41,7 @@ func (p *PullRequestsService) ListComments(owner, repoSlug string, pullRequestID
3641
// CreateComment creates a new pull request comment.
3742
//
3843
// Bitbucket API docs: https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/pullrequests/%7Bpull_request_id%7D/comments#post
39-
func (p *PullRequestsService) CreateComment(owner, repoSlug string, pullRequestID int64, po *Content) (*PRComment, *Response, error) {
44+
func (p *PullRequestsService) CreateComment(owner, repoSlug string, pullRequestID int64, po *PRCommentRequest) (*PRComment, *Response, error) {
4045
result := new(PRComment)
4146
urlStr := p.client.requestURL("/repositories/%s/%s/pullrequests/%v/comments", owner, repoSlug, pullRequestID)
4247
response, err := p.client.execute("POST", urlStr, result, po)
@@ -63,7 +68,7 @@ func (p *PullRequestsService) GetComment(owner, repoSlug string, prID, cID int64
6368
// UpdateComment updates a specific pull request comment.
6469
//
6570
// Bitbucket API docs: https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Busername%7D/%7Brepo_slug%7D/pullrequests/%7Bpull_request_id%7D/comments#put
66-
func (p *PullRequestsService) UpdateComment(owner, repoSlug string, prID, cID int64, po *Content) (*PRComment, *Response, error) {
71+
func (p *PullRequestsService) UpdateComment(owner, repoSlug string, prID, cID int64, po *PRCommentRequest) (*PRComment, *Response, error) {
6772
result := new(PRComment)
6873
urlStr := p.client.requestURL("/repositories/%s/%s/pullrequests/%v/comments/%v", owner, repoSlug, prID, cID)
6974
response, err := p.client.execute("PUT", urlStr, result, po)

go.mod

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@ module github.com/davidji99/bitbucket-go
22

33
require (
44
github.com/google/go-querystring v1.0.0
5-
github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88 // indirect
6-
github.com/k0kubun/pp v3.0.1+incompatible
7-
github.com/mattn/go-colorable v0.1.2 // indirect
85
github.com/stretchr/testify v1.3.0
96
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45
107
gopkg.in/urfave/cli.v1 v1.20.0
118
)
9+
10+
go 1.13

go.sum

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,6 @@ github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM
55
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
66
github.com/google/go-querystring v1.0.0 h1:Xkwi/a1rcvNg1PPYe5vI8GbeBY/jrVuDX5ASuANWTrk=
77
github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck=
8-
github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88 h1:uC1QfSlInpQF+M0ao65imhwqKnz3Q2z/d8PWZRMQvDM=
9-
github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88/go.mod h1:3w7q1U84EfirKl04SVQ/s7nPm1ZPhiXd34z40TNz36k=
10-
github.com/k0kubun/pp v3.0.1+incompatible h1:3tqvf7QgUnZ5tXO6pNAZlrvHgl6DvifjDrd9g2S9Z40=
11-
github.com/k0kubun/pp v3.0.1+incompatible/go.mod h1:GWse8YhT0p8pT4ir3ZgBbfZild3tgzSScAn6HmfYukg=
12-
github.com/mattn/go-colorable v0.1.2 h1:/bC9yWikZXAL9uJdulbSfyVNIR3n3trXl+v8+1sx8mU=
13-
github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
14-
github.com/mattn/go-isatty v0.0.8 h1:HLtExJ+uU2HOZ+wI0Tt5DtUDrx8yhUqDcp7fYERX4CE=
15-
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
168
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
179
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
1810
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
@@ -25,8 +17,6 @@ golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 h1:SVwTIAaPC2U/AvvLNZ2a7O
2517
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
2618
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 h1:YUO/7uOKsKeq9UokNS62b8FYywz3ker1l1vDZRCRefw=
2719
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
28-
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223 h1:DH4skfRX4EBpamg7iV4ZlCpblAHI6s6TDM39bFZumv8=
29-
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
3020
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
3121
google.golang.org/appengine v1.4.0 h1:/wp5JvzpHIxhs/dumFmF7BXTf3Z+dd4uXta4kVyO508=
3222
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=

tests/branchrestrictions_test.go

Lines changed: 0 additions & 76 deletions
This file was deleted.

tests/client_test.go

Lines changed: 0 additions & 18 deletions
This file was deleted.

tests/repository_test.go

Lines changed: 0 additions & 46 deletions
This file was deleted.

tests/user_test.go

Lines changed: 0 additions & 32 deletions
This file was deleted.

0 commit comments

Comments
 (0)