58 lines
1.2 KiB
Go
58 lines
1.2 KiB
Go
package fsq
|
|
|
|
type Query struct {
|
|
APIKey string `url:"-"`
|
|
Query string `url:"query,omitempty"`
|
|
LL string `url:"ll"`
|
|
Radius int32 `url:"radius,omitempty"`
|
|
Categories string `url:"categories,omitempty"`
|
|
Chains string `url:"chains,omitempty"`
|
|
Limit int32 `url:"limit,omitempty"`
|
|
Sort string `url:"sort,omitempty"`
|
|
}
|
|
|
|
type DetailQuery struct {
|
|
APIKey string `url:"-"`
|
|
fsqID string `url:"-"`
|
|
Fields string `url:"fields"`
|
|
}
|
|
|
|
func NewQueryForLocation(apiKey string, lat string, lon string, query string, radius int32, modifierType string, modifier string) Query {
|
|
category := ""
|
|
chain := ""
|
|
|
|
// &sort=DISTANCE&limit=30
|
|
|
|
if modifier != "0" {
|
|
if modifierType == "chain" {
|
|
chain = modifier
|
|
}
|
|
|
|
if modifierType == "category" {
|
|
category = modifier
|
|
}
|
|
|
|
}
|
|
|
|
return Query{
|
|
APIKey: apiKey,
|
|
LL: lat + "," + lon,
|
|
Radius: radius,
|
|
Query: query,
|
|
Categories: category,
|
|
Chains: chain,
|
|
Sort: "DISTANCE",
|
|
}
|
|
}
|
|
|
|
func NewQueryPlaceDetails(apiKey string, fsqID string) DetailQuery {
|
|
|
|
fields := "name,categories,fsq_id,location,description,social_media,link,geocodes"
|
|
|
|
return DetailQuery{
|
|
APIKey: apiKey,
|
|
fsqID: fsqID,
|
|
Fields: fields,
|
|
}
|
|
}
|