42 Commits
Author SHA1 Message Date
Jam Balaya c4176b1a18 refactor!: Rename EditComment to UpdateComment on IssuesService, pass a new IssueCommentRequest by value, and add missing IssueComment fields (#4444)
BREAKING CHANGE: `IssuesService.CreateComment` now takes `IssueCommentRequest` by value; `IssuesService.EditComment` is now `UpdateComment` and takes `IssueCommentRequest` by value.
2026-08-20 20:19:39 -04:00
Oleksandr Redko 3f47638460 refactor: Fix parameters in method endpoints (#4300) 2026-06-17 07:19:34 -04:00
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
Glenn Lewis a2063a76fb chore: Remove unnecessary use of new and &SomeStruct{} and add new extraneousnew custom linter (#4106) 2026-03-18 17:12:53 -04:00
Oleksandr Redko d14f4f3d8d docs: Improve displaying GitHub API links on pkg.go.dev (#3845) 2025-12-01 14:55:37 -05:00
Oleksandr Redko 025030e2dc Return back preview headers for search; remove TODOs for custom headers (#3824) 2025-11-13 07:29:48 -05:00
Glenn Lewis 4505771989 Prefer %v over %d,%s and add fmtpercentv custom linter (#3756) 2025-10-05 21:39:53 -04:00
Roman Wu 2eec208059 Document upcoming changes to events payload (#3667) 2025-08-12 10:02:16 -04:00
Oleksandr Redko a81b973f77 refactor: Fix gocritic.paramTypeCombine lint issues (#3655) 2025-07-28 11:26:12 -04:00
WillAbides a54bc7da1d Use metadata to reconcile go-github with GitHub's OpenAPI descriptions (#2919) 2023-11-03 10:26:59 -04:00
Victory Osikwemhe cdecead485 Change all fields from time.Time to github.Timestamp (#2646) 2023-01-26 16:39:42 -05:00
Glenn Lewis 7a7a7f0943 Update URLs (#2373)
Fixes: #2360.
2022-05-24 08:43:48 -04:00
Glenn Lewis cceb4d4573 Revert "Fix: Remove Sort & Direction Fields From IssueListCommentsOptions" (#1857) 2021-04-24 08:22:26 -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
Juan 512c5836f1 Remove Sort & Direction Fields From IssueComments (#1584) 2020-08-10 19:42:07 -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
Taketoshi Fujiwara 1ceaa95a5d Make IssueListCommentsOptions consistent with GitHub API (#1340)
Fixes #1339.
2019-12-05 07:40:22 -05:00
Michael Spiegel d045c4a7dd Add NodeID to IssueComments (#1016) 2018-09-24 20:20:10 -04:00
David Symonds d170093f3f Add AuthorAssociation field to IssueComment and PullRequestComment. (#892)
It's currently undocumented in GitHub API v3 docs, but is present in API v4,
and is also returned in API v3 responses.

GitHub support have confirmed that the field is meant to be included
in GitHub API v3 responses, and the documentation will be updated.

It's documented in GitHub API v4 docs at
https://developer.github.com/v4/reference/object/issuecomment/#fields and
https://developer.github.com/v4/reference/enum/commentauthorassociation/.
2018-04-12 19:13:25 -04:00
Dmitri Shuralyov 437797734d Rename id parameter to commentID in IssuesService comment methods. (#886)
Also document which IssueComment fields need to be set in EditComment
method.

This should help improve clarity of the API, and reduce the chance to
mix up the issue vs comment IDs.

Resolves #885.
2018-03-29 14:54:43 -04:00
Michael Spiegel 60131d1571 Replace int id with int64 in OrganizationsService (#883) 2018-03-29 09:01:15 -07:00
Kshitij Saraogi e48060a28f Migrate IDs to int64 type (#816)
A helper function "Int64" is also implemented to assist the migration of
unit tests.

Refer #597.
2018-01-25 10:59:44 -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
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
Dmitri Shuralyov 493b233dca Use single space after period. (#549)
This commit was largely generated by:

	perl -i -npe 's,^(\s*// .+[a-z]\.)  +([A-Z]),$1 $2,' $(git grep -l -E '^\s*//(.+\.)  +([A-Z])')

With additional manual followups to catch the few remaining missed
cases, such as inside non-go files, spaces after question marks, etc.

Fixes #548.
2017-02-15 16:14:26 -05:00
Sahil Dua bf1c40135d Return nil error explicitly when err is nil. (#542)
Helps #536.
2017-02-02 19:01:00 -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
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 09a37d57ac add support for Reactions API
Fixes #356.

Change-Id: Iecc8d7d7c11a8ce9ed38c6d024683815495cb8b4
2016-05-14 12:28:10 -07:00
Mat Geist 64bf2296e6 Add pagination for listing comments
Add ListOptions to PullRequestListCommentsOptions and
IssueListCommentsOptions
2014-10-24 21:23:59 -07:00
Piotr Zurek 203acc7707 added url fields to IssueComment and PullRequest 2014-08-25 13:35:56 -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 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
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
Billy Lynch a61f2c454c Restructured Issues Service files. 2013-08-01 11:20:53 -04:00