Skip to content

Instantly share code, notes, and snippets.

@nkreiger
Created June 23, 2021 02:16
Show Gist options
  • Save nkreiger/6c75de462649475447e63eb6e9f803f1 to your computer and use it in GitHub Desktop.
Save nkreiger/6c75de462649475447e63eb6e9f803f1 to your computer and use it in GitHub Desktop.
url basic
package main
import (
"log"
)
type endpoint struct {
Path string `yaml:"path"`
Method string `yaml:"method"`
}
type weatherAPI struct {
Scheme string `yaml:"scheme"`
Host string `yaml:"host"`
Endpoints weatherEndpoints `yaml:"endpoints"`
}
type weatherEndpoints struct {
Forecast endpoint `yaml:"forecast"`
Sports endpoint `yaml:"sports"`
}
func main() {
conn := weatherAPI{
Scheme: "https",
Host: "api.weatherapi.com/v1",
Endpoints: weatherEndpoints{
Forecast: endpoint{
Path: "/forecast.json",
Method: "GET",
},
Sports: endpoint{
Path: "/sports.json",
Method: "GET",
},
},
}
log.Println(conn)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment