diff options
author | Keuin <[email protected]> | 2023-07-11 22:56:07 +0800 |
---|---|---|
committer | Keuin <[email protected]> | 2023-07-11 22:56:07 +0800 |
commit | f5c63cde56eb35c0125a0545f084441cdd4340ab (patch) | |
tree | cf24779daaa3067902bef91d21bcdee7a78fd059 /bilibili/room_profile.go | |
parent | 7fd817f6d1ead3de85294c1893a6e1572a1d12e3 (diff) |
Refactor: move data structures to a separate package to avoid circular dependency.
Diffstat (limited to 'bilibili/room_profile.go')
-rw-r--r-- | bilibili/room_profile.go | 82 |
1 files changed, 3 insertions, 79 deletions
diff --git a/bilibili/room_profile.go b/bilibili/room_profile.go index 98cc790..1d5bdf4 100644 --- a/bilibili/room_profile.go +++ b/bilibili/room_profile.go @@ -2,86 +2,10 @@ package bilibili import ( "fmt" + "github.com/keuin/slbr/types" ) -type roomProfile struct { - UID int `json:"uid"` - RoomID RoomId `json:"room_id"` - ShortID int `json:"short_id"` - Attention int `json:"attention"` - Online int `json:"online"` - IsPortrait bool `json:"is_portrait"` - Description string `json:"description"` - LiveStatus int `json:"live_status"` - AreaID int `json:"area_id"` - ParentAreaID int `json:"parent_area_id"` - ParentAreaName string `json:"parent_area_name"` - OldAreaID int `json:"old_area_id"` - Background string `json:"background"` - Title string `json:"title"` - UserCover string `json:"user_cover"` - Keyframe string `json:"keyframe"` - IsStrictRoom bool `json:"is_strict_room"` - LiveTime string `json:"live_time"` - Tags string `json:"tags"` - IsAnchor int `json:"is_anchor"` - RoomSilentType string `json:"room_silent_type"` - RoomSilentLevel int `json:"room_silent_level"` - RoomSilentSecond int `json:"room_silent_second"` - AreaName string `json:"area_name"` - Pendants string `json:"pendants"` - AreaPendants string `json:"area_pendants"` - HotWords []string `json:"hot_words"` - HotWordsStatus int `json:"hot_words_status"` - Verify string `json:"verify"` - NewPendants struct { - Frame struct { - Name string `json:"name"` - Value string `json:"value"` - Position int `json:"position"` - Desc string `json:"desc"` - Area int `json:"area"` - AreaOld int `json:"area_old"` - BgColor string `json:"bg_color"` - BgPic string `json:"bg_pic"` - UseOldArea bool `json:"use_old_area"` - } `json:"frame"` - Badge struct { - Name string `json:"name"` - Position int `json:"position"` - Value string `json:"value"` - Desc string `json:"desc"` - } `json:"badge"` - MobileFrame struct { - Name string `json:"name"` - Value string `json:"value"` - Position int `json:"position"` - Desc string `json:"desc"` - Area int `json:"area"` - AreaOld int `json:"area_old"` - BgColor string `json:"bg_color"` - BgPic string `json:"bg_pic"` - UseOldArea bool `json:"use_old_area"` - } `json:"mobile_frame"` - MobileBadge interface{} `json:"mobile_badge"` - } `json:"new_pendants"` - UpSession string `json:"up_session"` - PkStatus int `json:"pk_status"` - PkID int `json:"pk_id"` - BattleID int `json:"battle_id"` - AllowChangeAreaTime int `json:"allow_change_area_time"` - AllowUploadCoverTime int `json:"allow_upload_cover_time"` - StudioInfo struct { - Status int `json:"status"` - MasterList []interface{} `json:"master_list"` - } `json:"studio_info"` -} - -type RoomProfileResponse = BaseResponse[roomProfile] - -func (b Bilibili) GetRoomProfile(roomId RoomId) (resp RoomProfileResponse, err error) { +func (b Bilibili) GetRoomProfile(roomId types.RoomId) (resp types.RoomProfileResponse, err error) { url := fmt.Sprintf("https://api.live.bilibili.com/room/v1/Room/get_info?room_id=%d", roomId) - return callGet[RoomProfileResponse](b, url) + return callGet[types.RoomProfileResponse](b, url) } - -type RoomId uint64 |