Skip to content

Instantly share code, notes, and snippets.

@plutov
Created April 27, 2020 10:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save plutov/9fc659650dbdcfae06598e611e8d0983 to your computer and use it in GitHub Desktop.
Save plutov/9fc659650dbdcfae06598e611e8d0983 to your computer and use it in GitHub Desktop.
api-client-5.go
func (c *Client) GetFaces(ctx context.Context, options *FacesListOptions) (*FacesList, error) {
limit := 100
page := 1
if options != nil {
limit = options.Limit
page = options.Page
}
req, err := http.NewRequest("GET", fmt.Sprintf("%s/faces?limit=%d&page=%d", c.BaseURL, limit, page), nil)
if err != nil {
return nil, err
}
req = req.WithContext(ctx)
res := FacesList{}
if err := c.sendRequest(req, &res); err != nil {
return nil, err
}
return &res, nil
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment