URL returns URL to the global search in web GUI (i.e. github.com/search).
(query Query)
| 289 | |
| 290 | // URL returns URL to the global search in web GUI (i.e. github.com/search). |
| 291 | func (s searcher) URL(query Query) string { |
| 292 | path := fmt.Sprintf("https://%s/search", s.host) |
| 293 | qs := url.Values{} |
| 294 | qs.Set("type", query.Kind) |
| 295 | |
| 296 | // TODO advancedSearchFuture |
| 297 | // Currently, the global search GUI does not support the advanced issue |
| 298 | // search syntax (even for the issues/PRs tab on the sidebar). When the GUI |
| 299 | // is updated, we can use feature detection, and, if available, use the |
| 300 | // advanced search syntax. |
| 301 | qs.Set("q", query.StandardSearchString()) |
| 302 | |
| 303 | if query.Order != "" { |
| 304 | qs.Set(orderKey, query.Order) |
| 305 | } |
| 306 | if query.Sort != "" { |
| 307 | qs.Set(sortKey, query.Sort) |
| 308 | } |
| 309 | url := fmt.Sprintf("%s?%s", path, qs.Encode()) |
| 310 | return url |
| 311 | } |
| 312 | |
| 313 | func (err httpError) Error() string { |
| 314 | if err.StatusCode != 422 || len(err.Errors) == 0 { |
nothing calls this directly
no test coverage detected