URL returns URL to the global search in web GUI (i.e. github.com/search).
(query Query)
| 266 | |
| 267 | // URL returns URL to the global search in web GUI (i.e. github.com/search). |
| 268 | func (s searcher) URL(query Query) string { |
| 269 | path := fmt.Sprintf("https://%s/search", s.host) |
| 270 | qs := url.Values{} |
| 271 | qs.Set("type", query.Kind) |
| 272 | |
| 273 | // TODO advancedSearchFuture |
| 274 | // Currently, the global search GUI does not support the advanced issue |
| 275 | // search syntax (even for the issues/PRs tab on the sidebar). When the GUI |
| 276 | // is updated, we can use feature detection, and, if available, use the |
| 277 | // advanced search syntax. |
| 278 | qs.Set("q", query.StandardSearchString()) |
| 279 | |
| 280 | if query.Order != "" { |
| 281 | qs.Set(orderKey, query.Order) |
| 282 | } |
| 283 | if query.Sort != "" { |
| 284 | qs.Set(sortKey, query.Sort) |
| 285 | } |
| 286 | url := fmt.Sprintf("%s?%s", path, qs.Encode()) |
| 287 | return url |
| 288 | } |
| 289 | |
| 290 | func (err httpError) Error() string { |
| 291 | if err.StatusCode != 422 || len(err.Errors) == 0 { |
nothing calls this directly
no test coverage detected