It's not obvious from reading the GitHub API docs or the go-github docs
that RepositoryContent.Content may be base64 encoded. This adds
clarifying docs for that as well as the String method.
Also add an example of using the GetReadme method.
Fixes#322Fixes#323
Decode only works if r.Content is actually encoded, which I'm not sure
that it always will be. GetContent will return the content, decoding it
only if necessary. Deprecate the old Decode method.
Also expand and cleanup the tests for both of these methods.
Related to #323
The RepositoryContent struct doesn't quite map to the API because it is
missing a download link. This link is very useful because while the API
doesn't allow large files to be downloaded, the link allows the raw
files to be downloaded outside the API.
With this code it should be possible to tick the ‘Content’ box in issue
#37. The code is written after reviewing PR #64 and so is (very)
loosely based on that PR. So big thanks for the work already done by
@octavore! I did however had some different insights about a few fixes
and as the PR hasn’t moved for the last 5 months, I thought to just
rewrite and PR and I send in a new PR hoping to come to a merge…