vanity-tester-backend-go/cmd/vanity-tester-backend/providers.go
2025-01-07 23:42:16 -03:00

61 lines
1.2 KiB
Go

package main
import (
"io"
"net/http"
)
type SevenTv struct{}
type Bttv struct{}
type FrankerFz struct{}
type Chatterino struct{}
type Chatty struct{}
type DankChat struct{}
type Homies struct{}
type PurpleTV struct{}
func doGetRequest(url string) string {
request, err := http.Get(url)
if err != nil {
logger.Error().Msg(err.Error())
}
res, err := client.Do(request.Request)
if err != nil {
logger.Error().Msg(err.Error())
}
defer res.Body.Close()
body, err := io.ReadAll(res.Body)
return string(body)
}
func (s *SevenTv) getUserID(userId string) string {
req := doGetRequest("https://7tv.io/v3/users/twitch/" + userId)
return req
}
func (s *Bttv) getBadges() string {
req := doGetRequest("https://api.betterttv.net/3/cached/badges/twitch")
return req
}
func (s *FrankerFz) getBadges() string {
req := doGetRequest("https://api.frankerfacez.com/v1/badges/ids")
return req
}
func (s *Chatty) getBadges() string {
req := doGetRequest("https://api.betterttv.net/3/cached/badges/twitch")
return req
}
func (s *DankChat) getBadges() string {
req := doGetRequest("https://flxrs.com/api/badges")
return req
}
func (s *Chatterino) getBadges() string {
req := doGetRequest("https://api.chatterino.com/badges")
return req
}