Documentation
¶
Index ¶
- Variables
- func ErrorMmsg(code int) string
- func IsHttpNOK(err error, code int) bool
- type APIResponse
- type Base
- func (b *Base) GetJson(url string, opt interface{}, result interface{}) error
- func (b *Base) GetPb(url string, opt interface{}, result protoreflect.ProtoMessage) error
- func (b *Base) Init() error
- func (b *Base) MakeRequest(method, url string, opt interface{}, body []byte) (*http.Response, error)
- func (b *Base) Post(path string, values url.Values, body []byte, result interface{}) error
- type BaseLogger
- type HttpNOK
- type NoLogger
Constants ¶
This section is empty.
Variables ¶
View Source
var ( APIEndpoint = "https://api.bilibili.com" APILiveEndpoint = "https://api.live.bilibili.com" DefaultUA = "" /* 132-byte string literal not displayed */ )
Functions ¶
Types ¶
type APIResponse ¶
type APIResponse struct {
Code int `json:"code"`
Message string `json:"message"`
TTL int `json:"ttl"`
Data *json.RawMessage `json:"data"`
}
type Base ¶
type Base struct {
Client *http.Client
Log BaseLogger
UserAgent string
}
func (*Base) GetPb ¶
func (b *Base) GetPb(url string, opt interface{}, result protoreflect.ProtoMessage) error
func (*Base) MakeRequest ¶
type BaseLogger ¶
type BaseLogger interface {
Println(v ...interface{})
Printf(format string, v ...interface{})
}
Click to show internal directories.
Click to hide internal directories.