-
Notifications
You must be signed in to change notification settings - Fork 151
Add branch listing #66
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
Conversation
This commit adds the ability to fetch a list of branches from Bitbucket via pagination.
| } | ||
|
|
||
| urlStr := r.c.requestUrl("/repositories/%s/%s/refs/branches?%s", rbo.Owner, rbo.RepoSlug, params.Encode()) | ||
| response, err := r.c.executeRaw("GET", urlStr, "") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The existing call to execute presumed pagination, but for some reason came back malformed. I opted to manually map the data on the response instead.
| page, ok := branchResponseMap["page"].(float64) | ||
| if !ok { | ||
| page = 0 | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm curious as to your thoughts on this section. This set of conditionals that evaluate the metadata (page, pagelen, size) in the response from Bitbucket should always be valued; however, if something is missing, the current behavior will default it to a value of 0. I'm not certain how consumers would treat or view this response; any insights on a possibly better idea?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is no problem, I think. At the struct definition, 0 is correct If you use int types as Page int.
(https://github.com/ktrysmt/go-bitbucket/pull/66/files#diff-ab2c7209d94fb144c8d55246ad821816R47)
So gopher would be care to use to struct and zero types. @mfb2
|
Hello! I tested this and it works well for me, though I'd sleep much better if someone else could validate/confirm. Please let me know if you have any feedback or questions, I'm happy to help out! |
This commit converts a pointer to branches to an actual object reference in order to keep the response immutable.
Adds ability to specify number of records to be returned on each page.
ktrysmt
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your contribution!
| page, ok := branchResponseMap["page"].(float64) | ||
| if !ok { | ||
| page = 0 | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is no problem, I think. At the struct definition, 0 is correct If you use int types as Page int.
(https://github.com/ktrysmt/go-bitbucket/pull/66/files#diff-ab2c7209d94fb144c8d55246ad821816R47)
So gopher would be care to use to struct and zero types. @mfb2
|
Thank you for approving! I am happy to contribute, and there's a chance I may submit a few more improvements in the near future. Please let me know if I can provide any other assistance – I look forward to the merge! 😄 |
This commit adds the ability to fetch a list of branches from Bitbucket
via pagination.