33 Commits
Author SHA1 Message Date
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 49af123778 fix!: Simplify Git.ListMatchingRefs by removing ReferenceListOptions (#3924)
BREAKING CHANGE: `Git.ListMatchingRefs` accepts `ref` instead of `ReferenceListOptions`.
2026-01-18 12:18:09 -05:00
Rupok Ghosh db8be8bc7f refactor!: Change GitService methods to pass required params by-value instead of by-ref (#3654)
BREAKING CHANGE: `GitService` methods now pass required params by-value instead of by-ref.
2025-08-04 15:02:50 -04:00
Oleksandr Redko a81b973f77 refactor: Fix gocritic.paramTypeCombine lint issues (#3655) 2025-07-28 11:26:12 -04:00
Oleksandr Redko d88d529592 fix: Add validation for nil inputs in various services (#3636) 2025-07-24 12:41:25 -04:00
Oleksandr Redko 5b4176472a docs: Extend the description of ref parameters (#3643) 2025-07-24 09:00:45 -04:00
Oleksandr Redko f66ed85955 feat: Deprecate and replace Bool,Int,Int64,String with Ptr using generics (#3355) 2024-12-10 21:36:09 -05:00
WillAbides a54bc7da1d Use metadata to reconcile go-github with GitHub's OpenAPI descriptions (#2919) 2023-11-03 10:26:59 -04:00
Shravan Konduru ae774d0751 Escape special characters in ref name for update ref (#2454)
Fixes: #2453.
2022-09-12 08:49:09 -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
Billy Keyes da2666cfac Use new endpoints to get and list references (#1513)
Fixes #1512.
2020-05-06 22:14:22 -04:00
Hanno Hecker cb1e3f4500 Do not encode / in ref names (#1433)
Fixes: #1432.
2020-02-22 09:44:04 -05:00
kadern0 69231319df Change opt param to opts (#1417)
Fixes #1415.
2020-02-09 20:01:54 -05:00
Dave Protasowski eaf0d7dfd9 Update git_refs.go (#1240) 2019-09-07 16:36:08 -04:00
William Cooke 035bec247b Consistent errors for GetRef when a Ref doesn't exist (#1207)
Fixes #1208.
2019-07-08 18:02:04 -04:00
Atsushi Tanaka 56cb1dd990 Escape commit ref with percent encoding (#1099) 2019-01-18 20:11:13 -05:00
Shagun Khemka 29a3681d05 Remove custom media type for global node IDs (#925)
Fixes #919.
2018-08-10 11:23:19 -04:00
Anubha Kushwaha cbeb72eaf5 Support preview GraphQL API v4 Node IDs. (#817)
Add NodeID field to objects that now expose it.

Reference: https://developer.github.com/changes/2017-12-19-graphql-node-id/.
2018-01-09 16:35:34 -05:00
Aleks Clark 06a55d192d Add GitService.GetRefs method for multiple refs; update GetRef. (#603)
The Get a Reference "GET /repos/:owner/:repo/git/refs/:ref" endpoint,
documented at https://developer.github.com/v3/git/refs/#get-a-reference,
can return multiple references if there is no exact match for ref.

This change adds GitService.GetRefs method that is a more 1:1 mapping
to that GitHub API endpoint. It returns a slice of references.
The slice contains 1 reference if there was an exact match, otherwise
multiple references that begin with ref. If there are no such
references, a not found error is returned.

The current behavior and signature of GitService.GetRef method is
unmodified. Its purpose is to fetch a single exact match for a
reference, or return a not found error if there's no exact match.
The returned error text is improved for situations when there's no
exact match but GitHub API returns an array containing multiple refs
that have ref as prefix. Previously, it was a JSON decoding error,
now it says "no exact match found for this ref".

Fixes #588.
2017-04-20 21:17:29 -04: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
Nick Spragg 30a21ee1a3 Return nil error explicitly when there is no error. (#546)
Helps #536.
Follows #542.
2017-02-13 17:27:33 -05: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
Will Norris 212ef69ded support refs with or without 'refs/' prefix
The git ref methods were mostly written to not expect the 'refs/' prefix
on ref names, even though it is included the ref.Ref value returned by
GitHub.  This resulted in ref values returned from some methods that
couldn't be passed to other methods.  In reality, ref names passed to
these methods should normally include the prefix, but this change
supports either form for backwards compatibility.

Fixes #133
2014-09-04 08:04:46 -07:00
Will Norris 7aa0972552 add pagination support for more methods
This includes all of the methods mentioned in this blog post:
https://developer.github.com/changes/2014-03-18-paginating-method-changes/
as well as a handful of others I found.  Sadly, this is a breaking
change for many of these methods because it changes the method
signature, but with yesterday's API change these methods are now broken
anyway. :(
2014-04-17 16:49:17 -07:00
Will Norris cc2d2c1c98 add options to Git.ListRefs
this is a breaking change, but this was only recently added so I'm not
too worried.  This also seems the best way to handle sub-namespaces on
this method.
2014-04-11 08:50:42 -07:00
Ondrej Kupka cab36cd2eb GitService: Add support for refs
This commit adds support for Git refs.

Listing of refs does not support sub-namespaces.
2013-12-02 11:23:09 -08:00