-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsearch.go
26 lines (23 loc) · 812 Bytes
/
search.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package applemaps
import (
"context"
"net/url"
)
// Search performs a search to find places that match specific criteria.
func (c *client) Search(ctx context.Context, query string, opts ...RequestOption) (*SearchResponse, error) {
values := url.Values{}
values.Add("q", query)
for _, opt := range opts {
opt(values)
}
return exec[SearchResponse](ctx, c, searchEndpoint, values)
}
// SearchAutocomplete performs a request to find results for places that you can use to autocomplete searches.
func (c *client) SearchAutocomplete(ctx context.Context, query string, opts ...RequestOption) (*SearchAutocompleteResult, error) {
values := url.Values{}
values.Add("q", query)
for _, opt := range opts {
opt(values)
}
return exec[SearchAutocompleteResult](ctx, c, searchAutocompleteEndpoint, values)
}