mirror of
https://github.com/Threnklyn/jira.git
synced 2026-05-18 20:23:28 +02:00
refactor trivial objects in favor of arguments to static functions
This commit is contained in:
@@ -70,13 +70,17 @@ func (o *SearchOptions) ProvideSearchRequest() *jiradata.SearchRequest {
|
||||
|
||||
// https://docs.atlassian.com/jira/REST/cloud/#api/2/search-searchUsingSearchRequest
|
||||
func (j *Jira) Search(sp SearchProvider) (*jiradata.SearchResults, error) {
|
||||
return Search(j.UA, j.Endpoint, sp)
|
||||
}
|
||||
|
||||
func Search(ua HttpClient, endpoint string, sp SearchProvider) (*jiradata.SearchResults, error) {
|
||||
req := sp.ProvideSearchRequest()
|
||||
encoded, err := json.Marshal(req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
uri := fmt.Sprintf("%s/rest/api/2/search", j.Endpoint)
|
||||
resp, err := j.UA.Post(uri, "application/json", bytes.NewBuffer(encoded))
|
||||
uri := fmt.Sprintf("%s/rest/api/2/search", endpoint)
|
||||
resp, err := ua.Post(uri, "application/json", bytes.NewBuffer(encoded))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user