From f5c63cde56eb35c0125a0545f084441cdd4340ab Mon Sep 17 00:00:00 2001 From: Keuin Date: Tue, 11 Jul 2023 22:56:07 +0800 Subject: Refactor: move data structures to a separate package to avoid circular dependency. --- common/testing/testutil.go | 20 ++------------------ 1 file changed, 2 insertions(+), 18 deletions(-) (limited to 'common') diff --git a/common/testing/testutil.go b/common/testing/testutil.go index 509c619..f99bec8 100644 --- a/common/testing/testutil.go +++ b/common/testing/testutil.go @@ -3,7 +3,7 @@ package testing import ( "encoding/json" "fmt" - "github.com/keuin/slbr/bilibili" + "github.com/keuin/slbr/types" "io" "net/http" ) @@ -12,23 +12,7 @@ import ( Some utility function for test-purpose only. */ -type LiveList struct { - Code int `json:"code"` - Message string `json:"message"` - TTL int `json:"ttl"` - Data struct { - Count int `json:"count"` - Data []struct { - Face string `json:"face"` - Link string `json:"link"` - Roomid bilibili.RoomId `json:"roomid"` - Roomname string `json:"roomname"` - Nickname string `json:"nickname"` - } `json:"data"` - } `json:"data"` -} - -func GetLiveListForGuestUser() (liveList LiveList, err error) { +func GetLiveListForGuestUser() (liveList types.LiveList, err error) { url := "https://api.live.bilibili.com/xlive/web-interface/v1/index/WebGetUnLoginRecList" resp, err := http.Get(url) if err != nil { -- cgit v1.2.3