initial commit

This commit is contained in:
2020-02-23 21:01:12 -06:00
parent 25fd03b1b1
commit 7358c00200
4 changed files with 99 additions and 0 deletions

18
endpoints.go Normal file
View File

@ -0,0 +1,18 @@
package lifx
import (
"fmt"
"net/url"
"path"
)
func BuildURL(rawurl, rawpath string) string {
u, _ := url.Parse(rawurl)
u.Path = path.Join(u.Path, rawpath)
return u.String()
}
var (
Endpoint = "https://api.lifx.com/v1"
EndpointState = func(selector string) string { return BuildURL(Endpoint, fmt.Sprintf("/lights/%s/state", selector)) }
)