51 Commits
Author SHA1 Message Date
Kelsey Myers 34349a88ba feat: Add search_type support to issue search (#4414) 2026-07-28 14:58:57 -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 c02c318a0f chore: Update golangci-lint and enable some revive rules (#4025) 2026-02-20 12:05:40 -05:00
Scott Dawson 06ab3a2735 feat: Add advanced_search parameter to SearchOptions (#3868) 2025-12-08 20:25:04 -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
Oleksandr Redko 39591381dc fix: Remove custom Accept headers from search endpoints (#3820) 2025-11-11 21:23:13 -05:00
Glenn Lewis 4505771989 Prefer %v over %d,%s and add fmtpercentv custom linter (#3756) 2025-10-05 21:39:53 -04:00
zyfy29 3a062d174a chore: Add new lint rule to make sure exported names documented (#3682) 2025-08-18 09:45:29 -04:00
Oleksandr Redko e1db5e628a chore: Migrate golangci-lint to v2 (#3587) 2025-06-05 14:40:29 -04:00
Oleksandr Redko 3c5408e78f chore: Use any instead of interface{} (#3584) 2025-06-03 09:33:46 -04:00
Oleksandr Redko 1ffcddbd4e docs: Add dots at the end of sentences (#3325) 2024-10-11 12:08:23 -04: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 f6bffcf431 Bump version of go-github library to v46 (#2437) 2022-08-19 10:22:28 -04:00
DarkMatterV 744a645ee7 Add TextMatch custom header to other search type custom headers (#2388)
Fixes: #2385.
2022-08-13 18:18:19 -04:00
Glenn Lewis 7a7a7f0943 Update URLs (#2373)
Fixes: #2360.
2022-05-24 08:43:48 -04:00
Glenn Lewis 3e8a7f0fbe Clean up method return consistency (#2318) 2022-03-24 23:16:22 -04:00
Simon Davis 5a468cec5e Add reactions preview to search (#1818) 2021-03-05 10:40:40 -05: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 259aa56b9e Create tool to update and validate GitHub v3 API URLs (#1477)
Fixes #1476.
2020-04-09 21:28:23 -04:00
Glenn Lewis e4b511744f Add pointers to structs in slices (#1443) 2020-02-28 09:37:37 -05:00
kadern0 69231319df Change opt param to opts (#1417)
Fixes #1415.
2020-02-09 20:01:54 -05:00
Vaibhav Singh 40fcc261cf Remove custom preview headers from "graduated" APIs (#1355)
Fixes #1351.
2019-12-26 10:09:21 -05:00
lucmski 2b5cb2d7cd Add search topics (#1285)
Fixes #1284.
2019-12-05 07:36:59 -05:00
Quang Le Hong 740806ae9d Add document for query of search functions (#1300)
* Add document for search query

* Add more detail of using search query
2019-10-06 09:59:32 -04:00
Yosuke Akatsuka 7462feb203 Use url.QueryEscape instead of url.PathEscape to escape query string (#1125)
Fixes #1122.
2019-02-27 21:49:24 -05:00
Glenn Lewis 8c40ff417d Use PathEscape on search query instead of QueryEscape (#966)
Fixes #963.
2018-08-08 13:56:05 -04:00
Guillaume Jacquet 64f8f21e24 Add support for label description
Closes #866
2018-04-16 07:45:54 -07:00
Elliott Beach 12126fbfe0 Document search API; add test to cover search query encoding. (#711)
Fixes #707.
2017-09-07 16:09:01 -04:00
RaviTeja e062a8cd85 Add preview support to Topics API (#672)
Fixes #670.
2017-07-19 10:03:00 -07:00
Aleksandar Mirilovic 175a6b4bae Fixing issue with commit search results deserialization #601 (#602)
Fix issue with commit search results deserialization

Fixes #601.
2017-03-31 14:57:54 -07:00
Dmitri Shuralyov 02ed769756 Use Values.Set over Values.Add in SearchService.search.
params is the result of calling
"github.com/google/go-querystring/query".Values function on opt, where
type of opt is SearchOptions.

SearchOptions struct does not contain any fields with struct tag value
`url:"q"`. As a result, it's guaranteed that there will never be a "q"
entry in params by the time params.Add("q", query) is called.

Therefore, it's sufficient to use params.Set("q", query) instead.
Prefer to do that because it's simpler, easier to reason about, more
readable. It's clear that this is the only place that controls the "q"
query parameter, and there will not be multiple copies of it (which
would not be intended).
2017-03-08 15:20:42 -05:00
Dmitri Shuralyov b59d3a6479 Improve consistency of "GitHub API docs" strings in comments. (#562)
There were various slight variations in the phrasing of comments with
the form:

	// GitHub API docs: https://developer.github.com/v3/...

This change makes them all consistent.

Also fix "GitHub" misspelled as "Github" in a few places.

Followup to #551.
2017-02-23 11:22:02 -05: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 3b59f32154 Add support for Commit Search endpoint
Added support for this new preview endpoint which lets users
search for commits based on various conditions.

GitHub announcement -
https://developer.github.com/changes/2017-01-05-commit-search-api/
Docs - https://developer.github.com/v3/search/#search-commits

Fixes #508.
Closes #520.

Change-Id: I2210fafe3da530716075f9113851e09e3bc671f8
2017-01-31 14:21:44 -08:00
Maryum 6d1b527d46 fix comment typo
Closes #424
2016-09-02 13:35:59 -07:00
Juan Basso b969816466 Adding missing field to search results
Added the field incomplete_results. It is docummented on https://developer.github.com/v3/search/#timeouts-and-incomplete-results
2016-08-12 20:13:39 -04:00
Matthew Dempsky 8808be6605 Avoid unnecessary FooService allocations
Fixes #389
Fixes #390
2016-06-29 07:21:34 -07:00
Georgy Buranov e81e98e6a9 check options for nil
Fixes #318
2016-03-31 16:09:03 +00:00
Kyle Kelley e840a8a0e6 Provide text match metadata 2014-06-02 14:53:15 -07:00
Thomas Bruyelle 0ca38ec285 Accepted mime type fixes
According to various blog posts of the official github developer website
[1] [2], the mime preview for Releases and Search are no longer needed.
Moreover, they recommend to use `application/vnd.github.v3+json` for
every requests.

[1] http://developer.github.com/changes/2013-11-04-releases-api-is-official/
[2] http://developer.github.com/changes/2013-10-29-search-api-becomes-an-official-part-of-github-api-v3/
2013-11-21 14:52:51 -08: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