mirror of
https://github.com/kevin-DL/services.git
synced 2026-01-19 05:55:19 +00:00
@@ -117,8 +117,20 @@ func (w *Weather) Forecast(ctx context.Context, req *pb.ForecastRequest, rsp *pb
|
||||
IconUrl: day["condition"].(map[string]interface{})["icon"].(string),
|
||||
Sunrise: fc["astro"].(map[string]interface{})["sunrise"].(string),
|
||||
Sunset: fc["astro"].(map[string]interface{})["sunset"].(string),
|
||||
MaxWindMph: day["maxwind_mph"].(float64),
|
||||
MaxWindKph: day["maxwind_kph"].(float64),
|
||||
})
|
||||
}
|
||||
location := respBody["location"].(map[string]interface{})
|
||||
|
||||
// set the location
|
||||
rsp.Location = location["name"].(string)
|
||||
rsp.Region = location["region"].(string)
|
||||
rsp.Country = location["region"].(string)
|
||||
rsp.Latitude = location["lat"].(float64)
|
||||
rsp.Longitude = location["lon"].(float64)
|
||||
rsp.Timezone = location["tz_id"].(string)
|
||||
rsp.LocalTime = location["localtime"].(string)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user