octokit / go-octokit

Simple Go wrapper for the GitHub API
https://github.com/octokit/go-octokit
MIT License
258 stars 79 forks source link

Add Gist API #65

Closed owenthereal closed 9 years ago

owenthereal commented 9 years ago

This PR is to support https://github.com/github/hub/pull/601.

/cc @mislav

owenthereal commented 9 years ago

In general it looks good to me. But the API GistService#Raw seems pretty specific to Hub's use, since it only returns the raw of the first file. What do you think we actually create a GistFileService#Raw that returns the raw based on the file URL? That'll make it more generic.

mislav commented 9 years ago

Good point about the #Raw, but if you think about this being a method that returns to you the same representation that you get when you tackle .txt onto a gist URL, then it matches because GitHub also only picks the first file when serving the plaintext version of a gist. For most uses, that is good enough.

I don't think we need a GistFileService. Because raw gist files don't require authentication, people can just iterate of the the list of files in a Gist and manually fetch the contents themselves if they need to. What do you think?

owenthereal commented 9 years ago

Let's go ahead and merge this first. We could revisit if there's request for a more generic service.