package main import ( "io" "net/http" "strings" ) func root(w http.ResponseWriter, r *http.Request) { io.WriteString(w, "WIP Vanity Tester Backend") } func getAllBadges(w http.ResponseWriter, r *http.Request) { io.WriteString(w, formatAllBadges()) } func getSevenTvPaints(w http.ResponseWriter, r *http.Request) { io.WriteString(w, formatSevenTvPaints()) } func getSevenTvBadges(w http.ResponseWriter, r *http.Request) { io.WriteString(w, formatSevenTvBadges()) } func sevenTvUserCosmetics(w http.ResponseWriter, r *http.Request) { svt := &SevenTv{} user := strings.TrimPrefix(r.URL.Path, "/7tv/cosmetics/") userID, err := svt.getUserID(user) if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) return } logger.Trace().Msg("sevenTvUserCosmetics: user: " + userID) io.WriteString(w, formatSevenTvUserCosmetics(userID)) } // func sevenTvPaints(w http.ResponseWriter, r *http.Request) { // svt := &SevenTv{} // badges, err := svt.getPaints() // if err != nil { // http.Error(w, err.Error(), http.StatusInternalServerError) // return // } // io.WriteString(w, badges) // } // func sevenTvBadges(w http.ResponseWriter, r *http.Request) { // svt := &SevenTv{} // badges, err := svt.getBadges() // if err != nil { // http.Error(w, err.Error(), http.StatusInternalServerError) // return // } // io.WriteString(w, badges) // }