51 Commits
Author SHA1 Message Date
Steve Hipwell 9fbf4bef19 feat!: Refactor request context (#4151)
BREAKING CHANGE: All internal calls now provide `Context` via the `Request` itself.
2026-04-24 14:45:31 -04:00
Oleksandr Redko 33cf038ac1 docs: Add apiVersion to GitHub API link (#4147) 2026-04-11 10:47:17 -04:00
Oleksandr Redko d14f4f3d8d docs: Improve displaying GitHub API links on pkg.go.dev (#3845) 2025-12-01 14:55:37 -05:00
WillAbides a54bc7da1d Use metadata to reconcile go-github with GitHub's OpenAPI descriptions (#2919) 2023-11-03 10:26:59 -04:00
Glenn Lewis 7a7a7f0943 Update URLs (#2373)
Fixes: #2360.
2022-05-24 08:43:48 -04:00
Glenn Lewis a64f3a6d08 Update URLs (#1659) 2020-12-02 10:39:08 -05:00
Glenn Lewis 159b448168 Switch to new GitHub v3 API Documentation website (#1621) 2020-09-01 18:30:47 -04:00
Glenn Lewis 0683ca03b4 Update URLs (#1558) 2020-06-24 19:27:03 -04:00
Glenn Lewis 259aa56b9e Create tool to update and validate GitHub v3 API URLs (#1477)
Fixes #1476.
2020-04-09 21:28:23 -04:00
kadern0 69231319df Change opt param to opts (#1417)
Fixes #1415.
2020-02-09 20:01:54 -05:00
Glenn Lewis f9794a89ca Move event-related code to event.go (#1057) 2018-11-26 10:22:09 -08:00
Akhil Mohan 4c1b69f57a Add Repository Vulnerability alert patch (#1025) 2018-10-04 07:08:10 -04:00
Avinash Sridhar b93adc1c7f Add checks api (#914)
Fixes #913.
2018-07-24 21:06:01 -04:00
Aravind df47db1628 Add support for MarketplacePurchaseEvent. (#789)
GitHub API docs: https://developer.github.com/v3/activity/events/types/#marketplacepurchaseevent.

Fixes #704.
2017-11-22 15:57:21 -05:00
Sahil Dua 5b98d873ba Add missing ",omitempty" option for pointer struct fields. (#787)
This change improves consistency by adding missing ",omitempty"
option where they belong. This makes it so that `nil` values get
omitted when/if marshaled to JSON. Non-nil values are always
included.
2017-11-22 15:38:21 -05:00
Bradley Falzon a117bb2595 Rename GitHub Apps installation and installation_repositories events.
With the release of GitHub Apps (was GitHub Integrations), GitHub
have renamed the integration_installation and integration_installation_repositories
event to installation and installation_repositories respectively.

This is a breaking change for those using this API, and can be fixed with:

gofmt -w -r 'IntegrationInstallationEvent -> InstallationEvent' [path ...]
gofmt -w -r 'IntegrationInstallationRepositoriesEvent -> InstallationRepositoriesEvent' [path ...]

Closes #627.
Updates #434.
2017-06-03 22:50:28 -04:00
Katrina Owen 1ae0b685ed Add support for 'team' events (#653)
The team event was announced in this post:
https://developer.github.com/changes/2016-11-29-user-management-webhooks/

The API documentation is at:
https://developer.github.com/v3/activity/events/types/#teamevent

The "Changes" object in the response is not illustrated in
the example payload, but it is documented in the table of fields.

Closes #652.
2017-06-02 12:19:21 -07:00
avr2j 0e391815d4 #569:3 Webhooks for OrgBlockEvent (#630)
Add Webhook for OrgBlockEvent

Fixes #569.
2017-05-06 07:35:50 -07:00
Brian Egizi 4ede6a6c61 Don't panic when processing event payload (#583)
The `Event.Payload` function can fail in instances when it receives invalid
json. (example: when parsing a webhook that is set to application/x-www-form-urlencoded)
If this happens, we shouldn't panic but instead return an error to let the
caller know about the failure.

Added in a new function, `Event.ParsePayload` to take its place and depreciated
the old function.
2017-03-08 12:42:59 -08:00
avr2j 2694dcaaa6 Issue530: Resolves fully Issue 530: new web hooks project, project card and project column (#544)
* #514: added inviter to Invitation for orgs and teams invite

* #514: go fmt

* #514: removed prints

* #514: changed time data types and included them in test

* #514 Added Org List Pending Invitations

* #514 removed typos in error handling

* #514: Modified to pointer time.Time in Invitation

* #514: Set up Naming conventions for multi words, pointer to bool

* #514: multi word variable format

* #514 : used User instead of new struct

* #514 : removed Inviter struct

* #514: Added quotes to list values in comment

* implementation of webhooks for project, projectcard and project column

* Added Changes in event types

* Added Comment for variables populated by webhook

* #530: Made all Changes struct inline

* #530: Modified Changes Structs to include the full names of Changes

* #530 : Review comments from gmlewis fixed

* #530 : Fixed Consistency issues with GitHub docs #562

* #530:generator code
2017-03-08 07:53:16 -08:00
Dmitri Shuralyov 23d6cb9cac Add support for context package to all endpoints. (#529)
This is a large breaking API change. It is unavoidable and necessary
to resolve #526. This breaking change is part of bump to libraryVersion 3.

It adds ctx context.Context as first parameter to all endpoint methods,
including Do.

Updating for this API change should be easy and the compiler will help
catch instances that need to be updated. For example:

	main.go:193: not enough arguments in call to gh.Activity.MarkRepositoryNotificationsRead
		have (string, string, time.Time)
		want (context.Context, string, string, time.Time)
	...

You should pass the available context as first parameter. If your code
does not have context.Context available and you want to maintain previous
normal behavior, use context.Background(). Don't pass nil context; use
context.TODO() instead if you wish to delay figuring out the best context
to use. Then you can address the TODO at a later time.

Refer to documentation of package context at https://godoc.org/context
for more information.

This commit also changes ./tests/fields to use context.Background()
instead of deprecated oauth2.NoContext.

Resolves #526.
2017-02-20 16:05:42 -05:00
Dmitri Shuralyov 2a4b92075e Remove deprecated identifiers. (#555)
This is a breaking API change. However, it removes things that were
deprecated and shouldn't be used anymore (including something that's
available in standard library).

Next commit will be a large breaking API change anyway (which we need
to do in order to resolve #526 in a reasonable way), so it makes more
sense to get rid of the deprecated things instead of updating their API.

http.StatusUnprocessableEntity was added in Go 1.7, and so we can use it
instead of own equivalent constant. Anyone who was previously using it
should switch to using http.StatusUnprocessableEntity as well. Consider
this commit to deprecate StatusUnprocessableEntity and remove it in one.

Helps #526.
2017-02-18 14:32:01 -05:00
Kevin Burke 82629e0459 Use HTTPS for all developer.github.com links. (#551)
Avoids a redirect and possible tampering.
2017-02-17 20:59:02 -05:00
Glenn Lewis f7b63ba4fc Change new([]*...) to slice zero value
This change is a proposal and is open for discussion.

Also fixed a couple locations that were returning nil
instead of returning the valid err.

Change-Id: I62da2980c76d6220ce2ef12e6a1e64b60769ab01
2017-01-31 10:12:48 -08:00
Kookheon Kwon 596563d28d Add pending invitation API and OrganizationEvent struct, modify typo
Closes #504.

Change-Id: I8d880bf90f30add0f28b224f687c10d38b8c5ccd
2016-12-29 21:14:46 -08:00
Florian Forster b272bb85ab Add the "PingEvent" structure. (#499)
GitHub docs: https://developer.github.com/webhooks/#ping-event
2016-12-22 18:17:52 -05:00
Will Maier c6e655bba7 Return IssueEvent in ListIssueEventsForRepository
Fixes #176.
Closes #475.

Change-Id: I37f80bedbc689e1a8f97488e83dd69179dedcad4
2016-11-28 12:31:44 -08:00
Parker Moore 511bc5f4a8 Add support for PullRequestReviewEvent webhook.
Fixes #450.
Closes #451.

Change-Id: Iebdd2bd35a8ddd1346b2268e4e837d6145e990dc
2016-11-28 11:36:16 -08:00
Lucas Alcantara f8a2c9578e Add new webhooks for Labels and Milestones
Fixes #460.
Closes #463.

Change-Id: I34688c42a9328af10b4b61546e8bfd2c95c893aa
2016-11-04 16:33:15 -07:00
Timothée Peignier b0b867f2d5 Add installation webhook events
Add support for the new webhooks event for installations.
See: https://developer.github.com/early-access/integrations/webhooks/

Closes #434.

Change-Id: I74d3d50cb6b350322fc4515ad70097f0f70ae478
2016-09-27 09:37:50 -07:00
Glenn Lewis 4ea1b10b74 replace []Issue with []*Issue and for other large structs as well
Note that this is an API-breaking change but should have minimal
impact on users of this package due to the nice inference
properties of the Go programming language.

Bumped `libraryVersion` to `2` due to API-breaking change as
discussed in #376.

Fixes #180.

Change-Id: Ib386135e6b8f306d1f54278968c576f3ceccc4e7
2016-06-19 19:42:35 -07:00
Glenn Lewis 842c551fde add more payloads to event.Payload
Closes #349

Change-Id: I733568c73e1bc2cd748c5c5cd3d16654c7dd7828
2016-05-04 08:31:43 -07:00
Glenn Lewis d91d6cc927 go-github: move event types into event_types.go
fixes #283
2016-02-16 13:39:24 -08:00
Piotr Zurek d722750ab1 new repo struct for push events
fixes: #131,#271
2016-02-08 10:55:18 -08:00
Cami Diez 0a0089e759 Fixed method name 2015-09-18 13:45:37 -07:00
Will Norris 5ad9fb32b1 fix typo: s/comitempty/omitempty/
fixes #143
2014-10-17 18:48:16 -07:00
Piotr Zurek c9fbdda595 Add several event structs
Adds PullRequestEvent, IssueCommentEvent, and IssueActivityEvent
2014-08-25 13:35:14 -07:00
Tobias Schmidt 3a1d485aee Fix PushEvent JSON representation of size attribute 2014-06-06 20:58:03 -04:00
Piotr Zurek 36ceba87eb add PushEvent file stats and repository 2014-06-02 08:14:07 -07:00
Will Norris 2ab27f559f use go-querystring to construct all request URLs
this is a breaking change for a handful of Option structs that were
defining the Page option directly (they now embed ListOptions).

finishes fixing #56
2013-09-24 14:13:01 -07:00
Will Norris 7452bae91f return nil resource on error
this change also includes some additional minor code cleanup

fixes #58
2013-09-24 11:44:46 -07:00
Will Norris 303846dd04 redeclare String() as value method throughout 2013-08-21 15:17:53 -07:00
Will Norris 822e5c6d98 simplify function names for listing public data
in the case of org members, combine ListPublicMembers() into
ListMembers(). fixes #8
2013-08-20 15:44:24 -07:00
Will Norris 60b4ca0712 golint fixes: function docs 2013-08-20 15:38:52 -07:00
Will Norris 8f77def830 add Stringify function
This provides somewhat reasonable string representations of GitHub
structs.  This is specifically designed for this library and takes a
number of shortcuts where it can, so is not suitable as a general
purpose solution.  That said, I am exporting this function because it is
useful for things like printing out slices of GitHub structs, as can be
seen in examples/example.go.

I am certainly open to suggestions for what exactly the stringified
output should look like.  Currently, I think I've found a reasonable
compromise between fmt's "%v" and "%s" output.
2013-08-20 13:39:59 -07:00
Will Norris 3072d069f2 switch singular GitHub struct fields to pointers
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.
2013-08-20 13:21:47 -07:00
Arıl Bozoluk f899cc42b1 Added remaining list event functions
Added Functionality:
ListPublicEvents
ListRepositoryEvents
ListIssueEventsForRepository
ListEventsForRepoNetwork
ListEventsForOrganization
2013-08-20 10:42:17 -07:00
Arıl Bozoluk ba525e8a1c Added ListEventsForOrganization 2013-08-19 15:57:00 -07:00
Arıl Bozoluk 719fe70855 Added ListEventsRecievedByUser
Added functionality for ListEventsRecievedByUser. Api reference: http://developer.github.com/v3/activity/events/#list-events-that-a-user-has-received
2013-08-19 08:54:10 -07:00
Will Norris a51d6b4303 return Response object from all API functions
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
2013-08-01 14:31:55 -07:00