The truth is, this change makes me sad. It's a breaking change
for all clients and it adds more complexity to the library surface. In
most cases, clients will simply drop the Response object on the floor
(which is actually all the library itself was doing before this
change... now we're just pushing that off to the client).
Initially, the Response object will be primarily of interest for
functions that return paginated result sets, since the Response.NextPage
field is the only way to know for sure if there are more pages that
should be fetched. And this is really the cleanest way to get at that
data, so in that respect this change isn't so bad.
It's also worth noting that returning the raw Response object makes a
lot more since in a GitHub library than it may in others, given how
GitHub makes liberal (read: proper) use of HTTP request and response
headers. Other APIs, like Google's various APIs for example, tend to
push things like pagination links into the response body. While this is
certainly less of a purist view in terms of REST, it does make the lives
of client developers a lot easier, since then the response body contains
everything you need to know. But whatever; this is how GitHub rolls, so
we'll roll right along with them. (Somewhat ironically we are ignoring
the RESTful links in the GitHub response bodies, since we're actually
calling the API in an RPC style and don't do anything with those links.)
We still don't have an easy way to set arbitrary request headers, but
that's a problem for another day.
Fixes#22
This allows use to provide convenience methods for accessing the
paginations links that are returned in HTTP Link headers. To expose
that, we'll need to return the Response from all API methods, which will
also allow users of the client to do any other kind of inspection of the
response. This adds additional complexity to the API and will be a
breaking change, but seems to be the cleanest way to enable this sort of
thing.
Refs #22
This was done so that timestamp_test.go would have a corresponding file that
could easily be found. It did not make sense to move timestamp_test.go into
github_test.go if we are trying to move to a more specific source structure.
Repository service:
ListLanguages : Allows a user to list the languages for a repository
Activity service:
ListStarred : Allows a user to list the starred repositories for a user
This provides the structs needed to unmarshal the "old-style" post
receive hooks that are sent for push events. Because the formats
differ in sometimes subtle ways from the rest of the API, some types are
duplicated. I suspect we may also need to duplicate the Repository
type at some point, since there are some differences there as well. For
now this is just using the normal Repository type.
Thanks to both @wlynch92 and @imjasonh who kept pushing on this and
provided the original patches that this is based on.
Added a timestamp struct to handle different incoming time formats from
GitHub. Only modified the repo struct to reflect this new time struct
for now since it is currently the only location I am currently aware of
where this is an issue.
Issue: #1
The main purpose of adding this (aside from simply implementing the full
GitHub API) is to establish the basic Commit type, so that we can build
around it for things like Events (see #4) and WebHooks (see #20).
- complete the rename from TreesService to GitService. For example,
renaming Get to GetTree, and Create to CreateTree.
- rename GitTree to TreeEntry. I really have no idea why GitHub chose
to use the field name "tree" for this, since these aren't necessarily
trees in the git sense. Looking at it more closely, these are really
just the entries within a tree, hence the rename.
- simplify several tests and shuffle some things for consistency with
the rest of the library
Because the reset date is expressed as a Unix timestamp (rather than an
ISO 8601 timstamp), we can't directly unmarshal the JSON response.
Instead we have to do a little weird indirection to unmarshal it as an
int first, and then convert it into a proper Time object.
Since the library has received external contributions, Google is no
longer the sole copyright holder. Update the boilerplate at the top of
each file to reflect that, and add AUTHORS and CONTRIBUTORS files to
track this information.
This includes most API methods on pull requests (with the exception of
listing commits and the merge functions), as well as all of the methods
for pull request comments. (Fixes#13)
This also fixes a few oversights in the issues API.
This adds basic methods for working with issues, assignees, and issue
comments. Issue events, labels, and milestones are not included in this
commit. (Fixes#7)