Rate is now a method, not a field.
Mention RateLimits rather than RateLimit since the latter is deprecated.
Use Go convention for marking deprecated identifiers. See
257114af91.
For more information about the preview see here:
https://developer.github.com/changes/2015-11-11-protected-branches-api/
This adds only retrieving the information and not setting it. Setting
will come in a later commit (if that one here is okay).
I tried to follow the naming guidelines as much as possible and
hopefully I made it right the first time. :-)
Add a new error type, TwoFactorAuthError, which identifies the need to
include a one-time password when using Basic Auth for a user with
two-factor auth enabled.
An example of using both the new transport and error type can be seen in
examples/basicauth/main.go.
fixes#258
- allow setting permission when adding a team repository
- update IsTeamRepo to return a *Repository instead of a bool, since the
Repository contains the permission data for the team. This is a
BREAKING CHANGE, however I don't think this is an often used method.
- update docs for setting the team permission when creating or editing a
team.
Ref #187
These changes are now official, so the custom media type is no longer
needed. This does go ahead and remove RepositoryListOptions.IncludeOrg
which was being used to trigger the custom media type. Even though this
is a breaking change, it was only in for a month and I don't think it
was too widely used during that time.
Fixes#219
/cc @captncraig who may have been using this
Change-Id: Ib54ced78c51a9c4e54e470136d36f91bf4716e8c
Supports the updated starring API as mentioned in issue #188.
There is now a new struct called StarredRepository which holds a Repository and the new `starred_at` timestamp.
For now there is a special media type to request the new API. I've added a TODO for it to be deleted when the new API fully launches.
The client_id and client_secret URL variables,
containing sensitive app information, are leaked
to users if the Go error is returned to them. To
prevent this, sanitizeURL redacts the fields from
ErrorResponse's Error method. Therefore making the
error message safe to expose to users.
depending on who people are using rate.Reset this may or may not be a
breaking change, since Timestamp supports all of the exported methods
from time.Time.
Inspired by the Ruby version [1], UploadReleaseAsset now accepts a
simple path to a file.
The Content-Type is now determined internally using the
mime.TypeByExtension() function.
Note this version is also more flexible. Indeed, the previous version
needed an io.Reader, but actually only 3 kinds of io.Reader were bore.
This is because of http.NewRequest needs to determine the Content-Length
of the body, and it can only determine it for bytes.Buffer, bytes.Reader
or strings.Reader [2]. Note there is an issue raised about this [3].
With a path to a file, we can easily determine the file size, and then
manually add it to the request.
[1]
https://github.com/octokit/octokit.rb/blob/master/lib/octokit/client/releases.rb#L85
[2] http://golang.org/src/pkg/net/http/request.go#L447
[3] https://code.google.com/p/go/issues/detail?id=6738
Like a51d6b4303, this change makes me sad, mainly because it is a
breaking change for all clients, and makes common tasks like reading
data out of structs slightly more work, with no direct benefit. Notably,
developers will need to make sure and check for nil values before trying
to dereference these pointers. Sadly, the change is still necessary, as
is more fully explained in issue #19. We can make the nil pointer
checks a little easier by adding some Get* funcs like goprotobuf does.
I spent a lot of time over the last few weeks exploring this change
(switching fields to pointers) versus the much larger change of using
protocol buffers for all GitHub data types. While the goprotobuf
library is very mature and feature-rich (it's used heavily inside of
Google), it's the wrong tool for this task, since we're not actually
using the proto wire format. While it does address the immediate
concern in #19, it makes way too many other things terribly awkward.
One of the biggest drawbacks of this change is that it will make the
string output from fmt.Printf("%v") next to useless, since all pointer
values are displayed as their memory address. To handle that, I'll be
writing a custom String() function for these structs that is heavily
inspired by goprotobuf and internals from go's fmt package.
our package docs are too long yet to really need to be in their own
file, but I'd like to flesh them out a bit more, particularly once #19
is resolved.
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
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