45 lines
712 B
Go
45 lines
712 B
Go
package cmd
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"io"
|
|
"os"
|
|
|
|
"googlemaps.github.io/maps"
|
|
)
|
|
|
|
func Main(ctx context.Context) error {
|
|
c, err := maps.NewClient(maps.WithAPIKey(os.Getenv("GOOGLE_PLACES_API_KEY")))
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
resp, err := c.TextSearch(ctx, &maps.TextSearchRequest{
|
|
Query: os.Args[1],
|
|
Location: nil,
|
|
Radius: uint(0),
|
|
})
|
|
if err != nil {
|
|
return err
|
|
}
|
|
return fmt.Errorf("%+v", resp)
|
|
|
|
/*
|
|
resp, err := c.NearbySearch(ctx, &maps.NearbySearchRequest{
|
|
Location: &maps.LatLng{},
|
|
Radius: uint(0),
|
|
Keyword: os.Args[1],
|
|
Name: "",
|
|
OpenNow: false,
|
|
})
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
return fmt.Errorf("%+v", resp)
|
|
*/
|
|
|
|
return io.EOF
|
|
}
|