Skip to content

Commit

Permalink
Merge pull request #7 from blackducksoftware/cl-options
Browse files Browse the repository at this point in the history
add options to ListCodeLocations
  • Loading branch information
mattfenwick authored May 8, 2018
2 parents 59c982f + 5ee4072 commit bca82a6
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions hubclient/codelocations-client.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,23 @@
package hubclient

import (
"fmt"

"github.com/blackducksoftware/hub-client-go/hubapi"
log "github.com/sirupsen/logrus"
)

func (c *Client) ListCodeLocations(link hubapi.ResourceLink) (*hubapi.CodeLocationList, error) {
func (c *Client) ListCodeLocations(link hubapi.ResourceLink, options *hubapi.GetListOptions) (*hubapi.CodeLocationList, error) {

// Need offset/limit
// Should we abstract list fetching like we did with a single Get?
params := ""
if options != nil {
params = fmt.Sprintf("?%s", hubapi.ParameterString(options))
}

codeLocationsURL := fmt.Sprintf("%s%s", link.Href, params)

var codeLocationList hubapi.CodeLocationList
err := c.HttpGetJSON(link.Href, &codeLocationList, 200)
err := c.HttpGetJSON(codeLocationsURL, &codeLocationList, 200)

if err != nil {
log.Errorf("Error trying to retrieve code location list: %+v.", err)
Expand Down

0 comments on commit bca82a6

Please sign in to comment.