Skip to content

Add FromPullRequest to GetDiffStat #282

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 14 additions & 12 deletions bitbucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ type RepositoryBranchDeleteOptions struct {
RepoSlug string `json:"repo_slug"`
RepoUUID string `json:"uuid"`
RefName string `json:"name"`
RefUUID string `json:uuid`
RefUUID string `json:"uuid"`
}

type RepositoryBranchTarget struct {
Expand Down Expand Up @@ -382,17 +382,19 @@ type DiffOptions struct {
}

type DiffStatOptions struct {
Owner string `json:"owner"`
RepoSlug string `json:"repo_slug"`
Spec string `json:"spec"`
Whitespace bool `json:"ignore_whitespace"`
Merge bool `json:"merge"`
Path string `json:"path"`
Renames bool `json:"renames"`
PageNum int `json:"page"`
Pagelen int `json:"pagelen"`
MaxDepth int `json:"max_depth"`
Fields []string
Owner string `json:"owner"`
RepoSlug string `json:"repo_slug"`
Spec string `json:"spec"`
FromPullRequestID int `json:"from_pullrequest_id"`
Whitespace bool `json:"ignore_whitespace"`
Merge bool `json:"merge"`
Path string `json:"path"`
Renames bool `json:"renames"`
Topic bool `json:"topic"`
PageNum int `json:"page"`
Pagelen int `json:"pagelen"`
MaxDepth int `json:"max_depth"`
Fields []string
}

type WebhooksOptions struct {
Expand Down
14 changes: 11 additions & 3 deletions diff.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,22 +44,30 @@ func (d *Diff) GetPatch(do *DiffOptions) (interface{}, error) {
func (d *Diff) GetDiffStat(dso *DiffStatOptions) (*DiffStatRes, error) {

params := url.Values{}
if dso.Whitespace == true {
if dso.FromPullRequestID > 0 {
params.Add("from_pullrequest_id", strconv.Itoa(dso.FromPullRequestID))
}

if dso.Whitespace {
params.Add("ignore_whitespace", strconv.FormatBool(dso.Whitespace))
}

if dso.Merge == false {
if !dso.Merge {
params.Add("merge", strconv.FormatBool(dso.Merge))
}

if dso.Path != "" {
params.Add("path", dso.Path)
}

if dso.Renames == false {
if !dso.Renames {
params.Add("renames", strconv.FormatBool(dso.Renames))
}

if dso.Topic {
params.Add("topic", strconv.FormatBool(dso.Topic))
}

if dso.PageNum > 0 {
params.Add("page", strconv.Itoa(dso.PageNum))
}
Expand Down