Documentation
¶
Index ¶
- Constants
- type APIRequest
- type APIResponse
- type Account
- type Album
- type Artist
- type Binding
- type Collection
- type H
- type ImplicitResult
- type LoginResult
- type Profile
- type RequestOption
- func (ro *RequestOption) AddCookie(name, value string) *RequestOption
- func (ro *RequestOption) AddCookies(cookies ...*http.Cookie) *RequestOption
- func (ro *RequestOption) Cookie(name string) string
- func (ro *RequestOption) CookieOr(name string, dvalue string) string
- func (ro *RequestOption) SetCookies(cookies []*http.Cookie) *RequestOption
- func (ro *RequestOption) SetCrypto(c necmcrypto.Crypto) *RequestOption
- func (ro *RequestOption) SetRealIP(ip string) *RequestOption
- func (ro *RequestOption) SetUA(ua UserAgentType) *RequestOption
- func (ro *RequestOption) SetURL(u string) *RequestOption
- type ResourceType
- type ResourceTypeCode
- type SearchAlbumResult
- type SearchArtistResult
- type SearchCollectionResult
- type SearchResult
- type SearchSongResult
- type Song
- type UserAgentType
Constants ¶
View Source
const ( SearchTypeSong = 1 SearchTypeAlbum = 10 SearchTypeArtist = 100 SearchTypeCollection = 1000 SearchTypeUser = 1002 SearchTypeMV = 1004 SearchTypeLyric = 1006 SearchTypePodcast = 1009 SearchTypeVideo = 1014 )
1: 单曲, 10: 专辑, 100: 歌手, 1000: 歌单, 1002: 用户, 1004: MV, 1006: 歌词, 1009: 电台, 1014: 视频
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type APIRequest ¶
type APIRequest struct {
Method string
URL string
Data H
Option *RequestOption
}
func NewAPIRequest ¶
func NewAPIRequest(method, url string, data H, opt *RequestOption) *APIRequest
func (*APIRequest) ID ¶
func (r *APIRequest) ID() string
type APIResponse ¶
type APIResponse struct {
// kind of useless, reserve for future using
Header *http.Header
// bytes of http.Response.Body
Data []byte
}
func NewAPIResponse ¶
func NewAPIResponse(header *http.Header, data []byte) *APIResponse
func (*APIResponse) Deserialize ¶
func (r *APIResponse) Deserialize(v interface{}) error
func (*APIResponse) DeserializeToImplicitResult ¶
func (r *APIResponse) DeserializeToImplicitResult() (*ImplicitResult, error)
4 testing, otherwise had better return []byte ? remind me never ever do this aggin
func (*APIResponse) String ¶
func (r *APIResponse) String() string
type Account ¶
type Account struct {
ID int `json:"id"`
Username string `json:"userName"`
Type int `json:"type"`
Status int `json:"status"`
WhitelistAuthority int `json:"whitelistAuthority"`
CreateTime int `json:"createTime"`
Salt string `json:"salt"`
TokenVersion int `json:"tokenVersion"`
Ban int `json:"ban"`
BaoyueVersion int `json:"baoyueVersion"`
DonateVersion int `json:"donateVersion"`
VipType int `json:"vipType"`
ViptypeVersion int `json:"viptypeVersion"`
AnonimousUser bool `json:"anonimousUser"`
}
type Collection ¶
type Collection struct {
ID int `json:"id"`
Name string `json:"name"`
UserID int `json:"userId"`
Cover string `json:"coverImgUrl"`
Subscribers int `json:"bookCount"`
Description string `json:"description"`
Subscribed bool `json:"subscribed"`
SongCount int `json:"trackCount"`
SpecialType int `json:"specialType"`
HighQuality bool `json:"highQuality"`
PlayCount int `json:"playCount"`
}
type ImplicitResult ¶
type ImplicitResult struct {
Code int `json:"code"`
Msg string `json:"msg"`
Message string `json:"message"`
Time int `json:"time"`
Result interface{} `json:"result"`
Data interface{} `json:"data"`
}
basic json response
type LoginResult ¶
type Profile ¶
type Profile struct {
City int `json:"city"`
Description string `json:"description"`
DjStatus int `json:"djStatus"`
AvatarImgId int `json:"avatarImgId"`
AvatarUrl string `json:"avatarUrl"`
BackgroundImgId int `json:"backgroundImgId"`
VipType int `json:"vipType"`
Province int `json:"province"`
AccountStatus int `json:"accountStatus"`
Gender int `json:"gender"`
Mutual bool `json:"mutual"`
AuthStatus int `json:"authStatus"`
Birthday int `json:"birthday"`
DefaultAvatar bool `json:"defaultAvatar"`
Nickname string `json:"nickname"`
Followed bool `json:"followed"`
BackgroundUrl string `json:"backgroundUrl"`
DetailDescription string `json:"detailDescription"`
UserId int `json:"userId"`
UserType int `json:"userType"`
AvatarImgIdStr string `json:"avatarImgIdStr"`
BackgroundImgIdStr string `json:"backgroundImgIdStr"`
Signature string `json:"signature"`
Authority int `json:"authority"`
AvatarImgId_str string `json:"avatarImgId_str"`
Followeds int `json:"followeds"`
Follows int `json:"follows"`
EventCount int `json:"eventCount"`
PlaylistCount int `json:"playlistCount"`
PlaylistBeSubscribedCount int `json:"playlistBeSubscribedCount"`
}
type RequestOption ¶
type RequestOption struct {
Crypto necmcrypto.Crypto
UA UserAgentType
Cookies []*http.Cookie
RealIP string
URL string
}
func DefaultRequestOption ¶
func DefaultRequestOption() *RequestOption
func (*RequestOption) AddCookie ¶
func (ro *RequestOption) AddCookie(name, value string) *RequestOption
func (*RequestOption) AddCookies ¶
func (ro *RequestOption) AddCookies(cookies ...*http.Cookie) *RequestOption
func (*RequestOption) Cookie ¶
func (ro *RequestOption) Cookie(name string) string
func (*RequestOption) CookieOr ¶
func (ro *RequestOption) CookieOr(name string, dvalue string) string
func (*RequestOption) SetCookies ¶
func (ro *RequestOption) SetCookies(cookies []*http.Cookie) *RequestOption
func (*RequestOption) SetCrypto ¶
func (ro *RequestOption) SetCrypto(c necmcrypto.Crypto) *RequestOption
func (*RequestOption) SetRealIP ¶
func (ro *RequestOption) SetRealIP(ip string) *RequestOption
func (*RequestOption) SetUA ¶
func (ro *RequestOption) SetUA(ua UserAgentType) *RequestOption
func (*RequestOption) SetURL ¶
func (ro *RequestOption) SetURL(u string) *RequestOption
type ResourceType ¶
type ResourceType uint8
const ( ResourceTypeSong ResourceType = iota ResourceTypeMV ResourceTypeCollection ResourceTypeAlbum ResourceTypePodcast ResourceTypeVideo ResourceTypeMoment )
type ResourceTypeCode ¶
type ResourceTypeCode string
const ( ResourceTypeCodeSong ResourceTypeCode = "R_SO_4_" ResourceTypeCodeMV ResourceTypeCode = "R_MV_5_" ResourceTypeCodeCollect ResourceTypeCode = "A_PL_0_" ResourceTypeCodeAlbum ResourceTypeCode = "R_AL_3_" ResourceTypeCodePodcast ResourceTypeCode = "A_DJ_1_" ResourceTypeCodeVideo ResourceTypeCode = "R_VI_62_" ResourceTypeCodeMoment ResourceTypeCode = "A_EV_2_" )
type SearchAlbumResult ¶
type SearchArtistResult ¶
type SearchCollectionResult ¶
type SearchResult ¶
type SearchSongResult ¶
type UserAgentType ¶
type UserAgentType uint8
const ( UAChrome UserAgentType = iota + 1 UAFirefox UAAndroid UASafari UAIPhone )
Click to show internal directories.
Click to hide internal directories.