mirror of
https://github.com/kataras/iris.git
synced 2025-12-18 10:27:06 +00:00
more improvements to the x/client new sub-package
This commit is contained in:
21
_examples/http-client/weatherapi/main.go
Normal file
21
_examples/http-client/weatherapi/main.go
Normal file
@@ -0,0 +1,21 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/kataras/iris/v12/_examples/http-client/weatherapi/client"
|
||||
)
|
||||
|
||||
func main() {
|
||||
c := client.NewClient(client.Options{
|
||||
APIKey: "{YOUR_API_KEY_HERE}",
|
||||
})
|
||||
|
||||
resp, err := c.GetCurrentByCity(context.Background(), "Xanthi/GR")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Printf("Temp: %.2f(C), %.2f(F)\n", resp.Current.TempC, resp.Current.TempF)
|
||||
}
|
||||
Reference in New Issue
Block a user