start write twitch api

This commit is contained in:
Jay
2018-09-11 17:58:08 +08:00
parent fcc12ed82c
commit bf325401d4
3 changed files with 65 additions and 11 deletions
+28
View File
@@ -0,0 +1,28 @@
package twitch
import (
"fmt"
"net/url"
)
var baseURL = "https://api.twitch.tv"
func getURL(p string) (string, bool) {
u, err := url.Parse(baseURL)
if err != nil {
return "", false
}
ref, err := u.Parse(p)
if err != nil {
return "", false
}
str := ref.String()
return str, true
}
func getHeaders(token string) map[string]string {
m := make(map[string]string)
m["Content-Type"] = "application/json"
m["Authorization"] = fmt.Sprintf("Bearer %s", token)
return m
}