TODO: Chatty, BTTV, Homies endpoints
This commit is contained in:
parent
0bd6137ab4
commit
53344090f2
4 changed files with 245 additions and 91 deletions
|
@ -3,6 +3,7 @@ package main
|
||||||
import (
|
import (
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
func root(w http.ResponseWriter, r *http.Request) {
|
func root(w http.ResponseWriter, r *http.Request) {
|
||||||
|
@ -13,6 +14,27 @@ func getAllBadges(w http.ResponseWriter, r *http.Request) {
|
||||||
io.WriteString(w, formatAllBadges())
|
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) {
|
// func sevenTvPaints(w http.ResponseWriter, r *http.Request) {
|
||||||
// svt := &SevenTv{}
|
// svt := &SevenTv{}
|
||||||
// badges, err := svt.getPaints()
|
// badges, err := svt.getPaints()
|
||||||
|
@ -32,15 +54,3 @@ func getAllBadges(w http.ResponseWriter, r *http.Request) {
|
||||||
// }
|
// }
|
||||||
// io.WriteString(w, badges)
|
// io.WriteString(w, badges)
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// func sevenTvUserCosmetics(w http.ResponseWriter, r *http.Request) {
|
|
||||||
// svt := &SevenTv{}
|
|
||||||
// user := strings.TrimPrefix(r.URL.Path, "/7tv/cosmetics/")
|
|
||||||
// logger.Trace().Msg("sevenTvUserCosmetics: user: " + user)
|
|
||||||
// badges, err := svt.getUserCosmetics(user)
|
|
||||||
// if err != nil {
|
|
||||||
// http.Error(w, err.Error(), http.StatusInternalServerError)
|
|
||||||
// return
|
|
||||||
// }
|
|
||||||
// io.WriteString(w, badges)
|
|
||||||
// }
|
|
||||||
|
|
|
@ -59,12 +59,12 @@ func main() {
|
||||||
|
|
||||||
mux.HandleFunc("/", root)
|
mux.HandleFunc("/", root)
|
||||||
mux.HandleFunc("/badges", middleware(getAllBadges))
|
mux.HandleFunc("/badges", middleware(getAllBadges))
|
||||||
// mux.HandleFunc("/7tv/paints", middleware(sevenTvPaints))
|
mux.HandleFunc("/7tv/badges", middleware(getSevenTvBadges))
|
||||||
// mux.HandleFunc("/7tv/badges", middleware(sevenTvBadges))
|
mux.HandleFunc("/7tv/paints", middleware(getSevenTvPaints))
|
||||||
// // CONSIDERATION: github.com/gorilla/mux may be an option to make use of something like this:
|
// CONSIDERATION: github.com/gorilla/mux may be an option to make use of something like this:
|
||||||
// // mux.HandleFunc("/7tv/cosmetics/{user}", middleware(sevenTvUserCosmetics))
|
// mux.HandleFunc("/7tv/cosmetics/{user}", middleware(sevenTvUserCosmetics))
|
||||||
// // For now I will just trim the path
|
// For now I will just trim the path
|
||||||
// mux.HandleFunc("/7tv/cosmetics/", middleware(sevenTvUserCosmetics))
|
mux.HandleFunc("/7tv/cosmetics/", middleware(sevenTvUserCosmetics))
|
||||||
|
|
||||||
srv := &http.Server{
|
srv := &http.Server{
|
||||||
Addr: config.HTTPServer.Addr + ":" + config.HTTPServer.Port,
|
Addr: config.HTTPServer.Addr + ":" + config.HTTPServer.Port,
|
||||||
|
|
|
@ -3,6 +3,7 @@ package main
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"sync"
|
||||||
)
|
)
|
||||||
|
|
||||||
type _Chatterino struct {
|
type _Chatterino struct {
|
||||||
|
@ -13,16 +14,6 @@ type _Chatterino struct {
|
||||||
} `json:"badges"`
|
} `json:"badges"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type _SevenTv struct {
|
|
||||||
Badges []struct {
|
|
||||||
Name string `json:"name"`
|
|
||||||
Url string `json:"url"`
|
|
||||||
Users []string `json:"users"`
|
|
||||||
} `json:"badges"`
|
|
||||||
// Paints []struct {
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
type _Bttv struct {
|
type _Bttv struct {
|
||||||
Badges []struct {
|
Badges []struct {
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
|
@ -40,6 +31,7 @@ type _FrankerFz struct {
|
||||||
} `json:"badges"`
|
} `json:"badges"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO
|
||||||
type _Chatty struct{}
|
type _Chatty struct{}
|
||||||
|
|
||||||
type _DankChat struct {
|
type _DankChat struct {
|
||||||
|
@ -51,11 +43,6 @@ type _DankChat struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type _Homies struct {
|
type _Homies struct {
|
||||||
CustomBadges []struct {
|
|
||||||
Name string `json:"name"`
|
|
||||||
Url string `json:"url"`
|
|
||||||
Users []string `json:"users"`
|
|
||||||
} `json:"customBadges"`
|
|
||||||
Badges []struct {
|
Badges []struct {
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Url string `json:"url"`
|
Url string `json:"url"`
|
||||||
|
@ -77,17 +64,19 @@ type _PurpleTv struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type Format struct {
|
type Format struct {
|
||||||
|
wg sync.WaitGroup
|
||||||
Chatterino _Chatterino `json:"chatterino"`
|
Chatterino _Chatterino `json:"chatterino"`
|
||||||
SevenTv _SevenTv `json:"seventv"`
|
|
||||||
Ffz _FrankerFz `json:"ffz"`
|
Ffz _FrankerFz `json:"ffz"`
|
||||||
Bttv _Bttv `json:"bttv"`
|
Bttv _Bttv `json:"bttv"`
|
||||||
DankChat _DankChat `json:"dankchat"`
|
DankChat _DankChat `json:"dankchat"`
|
||||||
Homies _Homies `json:"homies"`
|
Homies _Homies `json:"homies"`
|
||||||
PurpleTv _PurpleTv `json:"purpletv"`
|
PurpleTv _PurpleTv `json:"purpletv"`
|
||||||
|
Chatty _Chatty `json:"chatty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Done
|
// Done
|
||||||
func formatChatterino(format *Format) {
|
func formatChatterino(format *Format) {
|
||||||
|
defer format.wg.Done()
|
||||||
chatterino := &Chatterino{}
|
chatterino := &Chatterino{}
|
||||||
chatterino.getBadges()
|
chatterino.getBadges()
|
||||||
|
|
||||||
|
@ -104,15 +93,9 @@ func formatChatterino(format *Format) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO
|
|
||||||
func formatSevenTv(format *Format) {
|
|
||||||
data := &SevenTv{}
|
|
||||||
data.getBadges()
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Done
|
// Done
|
||||||
func formatFfz(format *Format) {
|
func formatFfz(format *Format) {
|
||||||
|
defer format.wg.Done()
|
||||||
data := &FrankerFz{}
|
data := &FrankerFz{}
|
||||||
data.getBadges()
|
data.getBadges()
|
||||||
|
|
||||||
|
@ -146,8 +129,17 @@ func formatFfz(format *Format) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Done
|
||||||
|
func formatBttv(format *Format) {
|
||||||
|
defer format.wg.Done()
|
||||||
|
data := &Bttv{}
|
||||||
|
data.getBadges()
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
// Done
|
// Done
|
||||||
func formatDankChat(format *Format) {
|
func formatDankChat(format *Format) {
|
||||||
|
defer format.wg.Done()
|
||||||
data := &DankChat{}
|
data := &DankChat{}
|
||||||
data.getBadges()
|
data.getBadges()
|
||||||
|
|
||||||
|
@ -164,25 +156,40 @@ func formatDankChat(format *Format) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// func parseHomies(format *Format) {
|
func formatHomiesBadges(format *Format) {
|
||||||
// data := &Homies{}
|
defer format.wg.Done()
|
||||||
// data.getBadges()
|
data := &Homies{}
|
||||||
|
data.getBadges()
|
||||||
|
data.getBadgesTwo()
|
||||||
|
|
||||||
// for _, badge := range data.Badges {
|
for _, badge := range data.Badges.Badges {
|
||||||
// format.Homies.Badges = append(format.Homies.Badges, struct {
|
format.Homies.Badges = append(format.Homies.Badges, struct {
|
||||||
// Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
// Url string `json:"url"`
|
Url string `json:"url"`
|
||||||
// Users []string `json:"users"`
|
Users []string `json:"users"`
|
||||||
// }{
|
}{
|
||||||
// Name: badge.Tooltip,
|
Name: badge.Tooltip,
|
||||||
// Url: badge.Image3,
|
Url: badge.Image3,
|
||||||
// Users: []string{badge.Username},
|
Users: badge.Users,
|
||||||
// })
|
})
|
||||||
// }
|
}
|
||||||
// }
|
|
||||||
|
for _, badge := range data.BadgesTwo.Badges {
|
||||||
|
format.Homies.BadgesTwo = append(format.Homies.BadgesTwo, struct {
|
||||||
|
Name string `json:"name"`
|
||||||
|
Url string `json:"url"`
|
||||||
|
Users []string `json:"users"`
|
||||||
|
}{
|
||||||
|
Name: badge.Tooltip,
|
||||||
|
Url: badge.Image3,
|
||||||
|
Users: badge.Users,
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Done
|
// Done
|
||||||
func formatPurpleTv(format *Format) {
|
func formatPurpleTv(format *Format) {
|
||||||
|
defer format.wg.Done()
|
||||||
data := &PurpleTV{}
|
data := &PurpleTV{}
|
||||||
data.getBadges()
|
data.getBadges()
|
||||||
|
|
||||||
|
@ -202,22 +209,75 @@ func formatPurpleTv(format *Format) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
func formatChatty(format *Format) {
|
||||||
|
defer format.wg.Done()
|
||||||
|
data := &Chatty{}
|
||||||
|
data.getBadges()
|
||||||
|
|
||||||
|
// var users []string
|
||||||
|
// for _, user := range data.Users {
|
||||||
|
// users = append(users, user.UserName)
|
||||||
|
// }
|
||||||
|
|
||||||
|
// format.PurpleTv.Badges = append(format.PurpleTv.Badges, struct {
|
||||||
|
// Name string `json:"name"`
|
||||||
|
// Url string `json:"url"`
|
||||||
|
// Users []string `json:"users"`
|
||||||
|
// }{
|
||||||
|
// Name: "PurpleTV Supporter",
|
||||||
|
// Url: data.DefaultBadgeURL,
|
||||||
|
// Users: users,
|
||||||
|
// })
|
||||||
|
}
|
||||||
|
|
||||||
|
func formatSevenTvBadges() string {
|
||||||
|
data := &SevenTv{}
|
||||||
|
data.getBadges()
|
||||||
|
|
||||||
|
badges, err := json.Marshal(data.Badges.Data.Cosmetics)
|
||||||
|
if err != nil {
|
||||||
|
logger.Error().Msg(err.Error())
|
||||||
|
}
|
||||||
|
return string(badges)
|
||||||
|
}
|
||||||
|
|
||||||
|
func formatSevenTvPaints() string {
|
||||||
|
data := &SevenTv{}
|
||||||
|
data.getPaints()
|
||||||
|
|
||||||
|
paints, err := json.Marshal(data.Paints.Data.Cosmetics)
|
||||||
|
if err != nil {
|
||||||
|
logger.Error().Msg(err.Error())
|
||||||
|
}
|
||||||
|
return string(paints)
|
||||||
|
}
|
||||||
|
|
||||||
|
func formatSevenTvUserCosmetics(stvUserID string) string {
|
||||||
|
data := &SevenTv{}
|
||||||
|
data.getUserCosmetics(stvUserID)
|
||||||
|
|
||||||
|
cosmetics, err := json.Marshal(data.UserCosmetics.Data.User.Cosmetics)
|
||||||
|
if err != nil {
|
||||||
|
logger.Error().Msg(err.Error())
|
||||||
|
}
|
||||||
|
return string(cosmetics)
|
||||||
|
}
|
||||||
|
|
||||||
func formatAllBadges() string {
|
func formatAllBadges() string {
|
||||||
format := &Format{}
|
format := &Format{}
|
||||||
|
format.wg.Add(7)
|
||||||
|
|
||||||
// formatChatterino(format)
|
go formatChatterino(format)
|
||||||
// formatSevenTv(format)
|
go formatFfz(format)
|
||||||
formatFfz(format)
|
go formatDankChat(format)
|
||||||
// formatDankChat(format)
|
go formatBttv(format)
|
||||||
// parseHomies(format)
|
go formatHomiesBadges(format)
|
||||||
// formatPurpleTv(format)
|
go formatPurpleTv(format)
|
||||||
|
go formatChatty(format)
|
||||||
|
|
||||||
|
format.wg.Wait()
|
||||||
|
|
||||||
json, _ := json.Marshal(format)
|
json, _ := json.Marshal(format)
|
||||||
return string(json)
|
return string(json)
|
||||||
// bttv := &Bttv{}
|
|
||||||
// ffz := &FrankerFz{}
|
|
||||||
// chatterino := &Chatterino{}
|
|
||||||
// chatty := &Chatty{}
|
|
||||||
// homies := &Homies{}
|
|
||||||
// ptv := &PurpleTV{}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,8 +26,25 @@ type Chatterino struct {
|
||||||
} `json:"badges"`
|
} `json:"badges"`
|
||||||
}
|
}
|
||||||
type SevenTv struct {
|
type SevenTv struct {
|
||||||
Query GqlQuery `json:"query"`
|
Query GqlQuery `json:"query"`
|
||||||
UserID string
|
User struct {
|
||||||
|
ID string `json:"id"`
|
||||||
|
} `json:"user"`
|
||||||
|
UserCosmetics struct {
|
||||||
|
Data struct {
|
||||||
|
User struct {
|
||||||
|
ID string `json:"id"`
|
||||||
|
Cosmetics []struct {
|
||||||
|
ID string `json:"id"`
|
||||||
|
Kind string `json:"kind"`
|
||||||
|
Selected bool `json:"selected"`
|
||||||
|
Typename string `json:"__typename"`
|
||||||
|
} `json:"cosmetics"`
|
||||||
|
Typename string `json:"__typename"`
|
||||||
|
} `json:"user"`
|
||||||
|
} `json:"data"`
|
||||||
|
}
|
||||||
|
// 7tv Badges
|
||||||
Badges struct {
|
Badges struct {
|
||||||
Data struct {
|
Data struct {
|
||||||
Cosmetics struct {
|
Cosmetics struct {
|
||||||
|
@ -38,12 +55,45 @@ type SevenTv struct {
|
||||||
Tooltip string `json:"tooltip"`
|
Tooltip string `json:"tooltip"`
|
||||||
Tag string `json:"tag"`
|
Tag string `json:"tag"`
|
||||||
Typename string `json:"__typename"`
|
Typename string `json:"__typename"`
|
||||||
}
|
} `json:"badges"`
|
||||||
Typename string `json:"__typename"`
|
Typename string `json:"__typename"`
|
||||||
} `json:"cosmetics"`
|
} `json:"cosmetics"`
|
||||||
} `json:"data"`
|
} `json:"data"`
|
||||||
} `json:"sevenTvBadges"`
|
} `json:"sevenTvBadges"`
|
||||||
|
// 7tv Paints
|
||||||
|
Paints struct {
|
||||||
|
Data struct {
|
||||||
|
Cosmetics struct {
|
||||||
|
Paints []struct {
|
||||||
|
ID string `json:"id"`
|
||||||
|
Kind string `json:"kind"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Function string `json:"function"`
|
||||||
|
Color interface{} `json:"color"`
|
||||||
|
Angle int64 `json:"angle"`
|
||||||
|
Shape string `json:"shape"`
|
||||||
|
ImageURL string `json:"image_url"`
|
||||||
|
Repeat bool `json:"repeat"`
|
||||||
|
Stops []struct {
|
||||||
|
At float64 `json:"at"`
|
||||||
|
Color int64 `json:"color"`
|
||||||
|
Typename string `json:"__typename"`
|
||||||
|
} `json:"stops"`
|
||||||
|
Shadows []struct {
|
||||||
|
XOffset float64 `json:"x_offset"`
|
||||||
|
YOffset float64 `json:"y_offset"`
|
||||||
|
Radius float64 `json:"radius"`
|
||||||
|
Color int64 `json:"color"`
|
||||||
|
Typename string `json:"__typename"`
|
||||||
|
} `json:"shadows"`
|
||||||
|
Typename string `json:"__typename"`
|
||||||
|
} `json:"paints"`
|
||||||
|
Typename string `json:"__typename"`
|
||||||
|
} `json:"cosmetics"`
|
||||||
|
} `json:"data"`
|
||||||
|
} `json:"sevenTvPaints"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type FrankerFz struct {
|
type FrankerFz struct {
|
||||||
Badges []struct {
|
Badges []struct {
|
||||||
ID int64 `json:"id"`
|
ID int64 `json:"id"`
|
||||||
|
@ -59,9 +109,17 @@ type FrankerFz struct {
|
||||||
Users map[string][]int64 `json:"users"`
|
Users map[string][]int64 `json:"users"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type Bttv struct{}
|
type Bttv []struct {
|
||||||
|
ID string `json:"id"`
|
||||||
type Chatty struct{}
|
Name string `json:"name"`
|
||||||
|
DisplayName string `json:"displayName"`
|
||||||
|
ProviderID string `json:"providerId"`
|
||||||
|
Badge struct {
|
||||||
|
Type int64 `json:"type"`
|
||||||
|
Description string `json:"description"`
|
||||||
|
} `json:"badge"`
|
||||||
|
SVG string `json:"svg"`
|
||||||
|
}
|
||||||
|
|
||||||
type DankChat struct {
|
type DankChat struct {
|
||||||
Badges []struct {
|
Badges []struct {
|
||||||
|
@ -118,6 +176,20 @@ type PurpleTV struct {
|
||||||
} `json:"users"`
|
} `json:"users"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type Chatty []struct {
|
||||||
|
ID string `json:"id"`
|
||||||
|
Version string `json:"version"`
|
||||||
|
ImageURL string `json:"image_url"`
|
||||||
|
ImageURL2 string `json:"image_url_2"`
|
||||||
|
ImageURL4 string `json:"image_url_4"`
|
||||||
|
Color *string `json:"color"`
|
||||||
|
Position *string `json:"position,omitempty"`
|
||||||
|
MetaTitle string `json:"meta_title"`
|
||||||
|
MetaURL *string `json:"meta_url"`
|
||||||
|
Usernames []string `json:"usernames"`
|
||||||
|
Userids []string `json:"userids,omitempty"`
|
||||||
|
}
|
||||||
|
|
||||||
func doGetRequest(url string) []byte {
|
func doGetRequest(url string) []byte {
|
||||||
request, err := http.NewRequest("GET", url, nil)
|
request, err := http.NewRequest("GET", url, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -152,7 +224,8 @@ func doPostRequest(url string, data []byte) []byte {
|
||||||
|
|
||||||
func (s *SevenTv) getUserID(userId string) (string, error) {
|
func (s *SevenTv) getUserID(userId string) (string, error) {
|
||||||
req := doGetRequest("https://7tv.io/v3/users/twitch/" + userId)
|
req := doGetRequest("https://7tv.io/v3/users/twitch/" + userId)
|
||||||
return string(req), nil
|
json.Unmarshal(req, &s)
|
||||||
|
return string(s.User.ID), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *SevenTv) getBadges() *SevenTv {
|
func (s *SevenTv) getBadges() *SevenTv {
|
||||||
|
@ -160,12 +233,12 @@ func (s *SevenTv) getBadges() *SevenTv {
|
||||||
query GetCosmestics($list: [ObjectID!]) {
|
query GetCosmestics($list: [ObjectID!]) {
|
||||||
cosmetics(list: $list) {
|
cosmetics(list: $list) {
|
||||||
badges {
|
badges {
|
||||||
id
|
id
|
||||||
kind
|
kind
|
||||||
name
|
name
|
||||||
tooltip
|
tooltip
|
||||||
tag
|
tag
|
||||||
__typename
|
__typename
|
||||||
}
|
}
|
||||||
__typename
|
__typename
|
||||||
}
|
}
|
||||||
|
@ -207,16 +280,16 @@ func (s *SevenTv) getPaints() (string, error) {
|
||||||
image_url
|
image_url
|
||||||
repeat
|
repeat
|
||||||
stops {
|
stops {
|
||||||
at
|
at
|
||||||
color
|
color
|
||||||
__typename
|
__typename
|
||||||
}
|
}
|
||||||
shadows {
|
shadows {
|
||||||
x_offset
|
x_offset
|
||||||
y_offset
|
y_offset
|
||||||
radius
|
radius
|
||||||
color
|
color
|
||||||
__typename
|
__typename
|
||||||
}
|
}
|
||||||
__typename
|
__typename
|
||||||
}
|
}
|
||||||
|
@ -232,9 +305,14 @@ func (s *SevenTv) getPaints() (string, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
logger.Trace().Msg(string(data))
|
|
||||||
|
|
||||||
res := doPostRequest("https://7tv.io/v3/gql", data)
|
res := doPostRequest("https://7tv.io/v3/gql", data)
|
||||||
|
// logger.Trace().Msg(string(res))
|
||||||
|
|
||||||
|
err = json.Unmarshal(res, &s.Paints)
|
||||||
|
if err != nil {
|
||||||
|
logger.Error().Msg(err.Error())
|
||||||
|
}
|
||||||
return string(res), nil
|
return string(res), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -267,9 +345,15 @@ func (s *SevenTv) getUserCosmetics(userId string) (string, error) {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
logger.Trace().Msg(string(data))
|
// logger.Trace().Msg(string(data))
|
||||||
|
|
||||||
res := doPostRequest("https://7tv.io/v3/gql", data)
|
res := doPostRequest("https://7tv.io/v3/gql", data)
|
||||||
|
|
||||||
|
err = json.Unmarshal(res, &s.UserCosmetics)
|
||||||
|
if err != nil {
|
||||||
|
logger.Error().Msg(err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
return string(res), nil
|
return string(res), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue