go-bitbucket
go-bitbucket copied to clipboard
Support BitBucket Server api v1.0
I discovered that BitBucket Server does not support the v2.0 API that bitbucket.org does.
One could add this via 1-suffixed functions, for example on PullRequests:
func (p *PullRequests) Gets1(po *PullRequestsOptions) interface{} {
url := GetApiBaseUrl() + "/projects/" + po.Owner + "/repos/" + po.Repo_slug + "/pull-requests/"
return p.c.execute("GET", url, "")
}
Or one could make a new struct, like PullRequests1 and inject that into the client, so client.Repositories.PullRequests1.Blah(...) would be the calling code.
Or I think it would be possible to parameterise which API version being used (probably when creating the client), and then use that to key into a map of url-generation funcs.
Would you be open to PRs that add v1 APIs? If so, by which means of the above, or another?
Alternatively, I'd love to find out I'm wrong about BB Server only exposing v1.0...
I think so too but I did not know whether that Bitbucket Server use V1 interfaces still. I'm going to survey that and consider how to switch the versions of 1 and 2.
It definitely does use them :(
At any rate, its API browser does not list v2. Possible to check via Atlassian sdk; that allows an instance to be spun up locally.
Oops. but thank you for your information. I will try to read docs or codes. I wish we had BitbucketServer's API sandbox/browser..
I had to create a plugin recently and used https://developer.atlassian.com/docs/getting-started/set-up-the-atlassian-plugin-sdk-and-build-a-project. I was able to test against the API there fine.
Oh looked closely, it is need to use jdk, it's heavy :cry: . But It looks like I can test it for checking behaviors.
Atlassian say it's in their issue tracker, but shelved; https://twitter.com/ddbennett/status/827195762530357248.
I'm doing some work on this internally, and will PR it once I'm through.