README.md: add NewWithAPIToken usage
@@ -72,8 +72,10 @@ import (
)
func main() {
- // Construct a new API object
+ // Construct a new API object using a global API key
api, err := cloudflare.New(os.Getenv("CLOUDFLARE_API_KEY"), os.Getenv("CLOUDFLARE_API_EMAIL"))
+ // alternatively, you can use a scoped API token
+ // api, err := cloudflare.NewWithAPIToken(os.Getenv("CLOUDFLARE_API_TOKEN"))
if err != nil {
log.Fatal(err)
}
