OpenWeather-gRPC-API/test-client/location.go

23 lines
479 B
Go
Raw Normal View History

2022-07-26 17:28:33 -04:00
package main
import (
"context"
"log"
pb "codeberg.org/andcscott/OpenWeatherMap-gRPC-API/proto"
)
func doLocation(c pb.WeatherServiceClient) {
res, err := c.Location(context.Background(), &pb.RequestLocation{
LocationType: pb.LocationType_LOCATION_TYPE_CITY,
Location: &pb.OneOfLocation{
LocationId: &pb.OneOfLocation_City{City: "Corvallis"}},
2022-07-26 17:28:33 -04:00
})
2022-07-26 17:28:33 -04:00
if err != nil {
log.Fatalln(err)
}
log.Printf("Latitude: %v, Longitude: %v\n", res.Latitude, res.Longitude)
}