Skip to content
This repository has been archived by the owner on Jun 20, 2022. It is now read-only.

Adding commit APIs #66

Merged
merged 4 commits into from
Jul 30, 2014
Merged

Adding commit APIs #66

merged 4 commits into from
Jul 30, 2014

Conversation

owenthereal
Copy link
Contributor

This is to support mislav/hub#601

/cc @mislav

@mislav
Copy link
Contributor

mislav commented Jul 29, 2014

It still doesn't support getting a raw patch for a commit?

@owenthereal
Copy link
Contributor Author

@mislav For raw patch, I'm thinking to achieve like this:

url, _ := octokit.CommitURL.Expand(xxx)
req := client.NewRequest(url)
req.Header.Add("Accept", "application/vnd.github.v3.patch")
resp, _ := req.Get()
ioutil.ReadAll(resp.Body) // patch

I'm still thinking whether we should expose it as an API to CommitsService. Similar situation for gist and pull request.

@mislav
Copy link
Contributor

mislav commented Jul 29, 2014

I'm still thinking whether we should expose it as an API to CommitsService. Similar situation for gist and pull request.

Making a dedicated API for this use case would be great for users because they shouldn't be concerned with implementation details of GitHub API such as custom MIME types in request.

However, if you're fine with a lower-level API like you've just demonstrated, it will work for our purposes as well.

@owenthereal
Copy link
Contributor Author

Making a dedicated API for this use case would be great for users because they shouldn't be
concerned with implementation details of GitHub API such as custom MIME types in request.

I think I'm convinced this would be best solution for now, although it seems the patching API is only useful for very particular use case.

@mislav
Copy link
Contributor

mislav commented Jul 29, 2014

On Tue, Jul 29, 2014 at 4:45 PM, Jingwen Owen Ou notifications@github.com
wrote:

I think I'm convinced this would be best solution for now, although it
seems the patching API is only useful for very particular use case.

DO ITTT 👍

This API is to get a commit patch. It returns a read IO and the response result.
@owenthereal
Copy link
Contributor Author

@mislav How does 88741d5 taste? CommitsService#Patch returns a IO for reading the patch.

@mislav
Copy link
Contributor

mislav commented Jul 30, 2014

Looks pretty good. Perfect abstraction level for this kind of stuff.

owenthereal added a commit that referenced this pull request Jul 30, 2014
@owenthereal owenthereal merged commit 3c9d2ae into master Jul 30, 2014
@owenthereal owenthereal deleted the commits_api branch July 30, 2014 04:27
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants