Created
June 23, 2021 02:16
-
-
Save nkreiger/6c75de462649475447e63eb6e9f803f1 to your computer and use it in GitHub Desktop.
url basic
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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