Skip to content

Add missing query parameters to GetDiff #291

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
merged 1 commit into from
Aug 8, 2024
Merged

Conversation

CescHolly
Copy link
Contributor

Changes:

Added the additional fields:

  • context
  • path
  • from_pullrequest_id
  • ignore_whitespace
  • binary
  • renames
  • topic

to GetDiff.

Justified by the documentation page, and adding from_pullrequest_id as it appears in pullRequest.Links.Diff.Href:

"diff": {
    "href": "https://api.bitbucket.org/2.0/repositories/OWNER/REPO_SLUG/diff/SPEC?from_pullrequest_id=3&topic=true"
}

When using GetDiff with from_pullrequest_id (as also happens with GetDiffStat) the SPEC would follow the format: REPO_SLUG:hash.

NOTE: I am aware that the DiffOptions type is also used as a parameter to GetPatch, which does not seem to support all these query parameters. I was tempted to create a new type:

type PatchOptions struct {
	Owner             string `json:"owner"`
	RepoSlug          string `json:"repo_slug"`
	Spec              string `json:"spec"`
}

but replacing the current parameter in GetPatch with this new type would break backwards compatibility with any current consumers of this library.

So I just mention it in case you want to do that separately in a future version change ;)

Copy link
Owner

@ktrysmt ktrysmt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@ktrysmt ktrysmt merged commit c56d071 into ktrysmt:master Aug 8, 2024
fernandoStrong pushed a commit to strong-network/go-bitbucket that referenced this pull request Oct 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants