go-bitbucket icon indicating copy to clipboard operation
go-bitbucket copied to clipboard

Support BitBucket Server api v1.0

Open petemounce opened this issue 8 years ago • 7 comments

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...

petemounce avatar Feb 02 '17 02:02 petemounce

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.

ktrysmt avatar Feb 02 '17 10:02 ktrysmt

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.

petemounce avatar Feb 02 '17 10:02 petemounce

Oops. but thank you for your information. I will try to read docs or codes. I wish we had BitbucketServer's API sandbox/browser..

ktrysmt avatar Feb 02 '17 12:02 ktrysmt

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.

petemounce avatar Feb 02 '17 12:02 petemounce

Oh looked closely, it is need to use jdk, it's heavy :cry: . But It looks like I can test it for checking behaviors.

ktrysmt avatar Feb 02 '17 13:02 ktrysmt

Atlassian say it's in their issue tracker, but shelved; https://twitter.com/ddbennett/status/827195762530357248.

petemounce avatar Feb 02 '17 17:02 petemounce

I'm doing some work on this internally, and will PR it once I'm through.

petemounce avatar Feb 07 '17 10:02 petemounce