use go-querystring for constructing URLs #56
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This demonstrates the use of go-querystring (which isn't actually published yet... I'm still waiting on an internal code review at Google) to construct request URLs. This also starts using
ListOptions
as an embedded struct inside our otherOptions
structs that include pagination.I ended up creating a new library rather than using uritemplates like I had originally mentioned in #50. A number of GitHub's API URLs have different bases depending on whether or not you are making a request on behalf of the authenticated user (e.g.
/user/repos
vs/users/foo/repos
), which made using uritemplates a little awkward. Additionally, using uritemplates would still require changes in two places whenever a new parameter gets added... once in the Options struct, and once in the uri template string. Writing a custom library for this means we can drive everything from tags on the struct fields, which I really like.@ktoso: see what you think, since you were previously working to clean up this code as well.