Documentation ¶
Index ¶
- Constants
- Variables
- func ApiCall[P any, T any](c *Client, api string) func(ctx context.Context, payload P) (_ T, err error)
- func MergeHeader(dst, src http.Header) http.Header
- type App
- type AppClose
- type AppInfo
- type AppKeepAlive
- type AppOpen
- type BatchKeepAlive
- type BatchKeepAliveInfo
- type Client
- func (c *Client) BatchKeepAlive(ctx context.Context, ids []string) (_ BatchKeepAliveInfo, err error)
- func (c *Client) CreateSignature(header http.Header) string
- func (c *Client) NewApiRequest(req *http.Request) (_ *http.Request, err error)
- func (c *Client) NewBaseHeader(data []byte) http.Header
- func (c *Client) Open(ctx context.Context, appid int64, code string) (_ *App, err error)
- func (client *Client) VerifyH5Params(q url.Values) error
- type Response
- type SignatureHeader
- type Time
- type WebsocketInfo
Constants ¶
View Source
const TimeLayout = "2006-01-02 15:04:05"
View Source
const TimeOffset = 8 * 60 * 60
View Source
const TimeZero = "0000-00-00 00:00:00"
Variables ¶
View Source
var ErrBilibiliApiError = errors.New("bilibili 接口返回报错")
View Source
var ErrBilibiliApiSupportOnlyPost = errors.New("bilibili 接口仅支持 POST 请求")
View Source
var TimeLocation *time.Location = time.FixedZone("Asia/Shanghai", TimeOffset)
Functions ¶
Types ¶
type AppInfo ¶
type AppInfo struct { // 场次信息 GameInfo struct { GameId string `json:"game_id"` } `json:"game_info"` // 长连信息 WebsocketInfo WebsocketInfo `json:"websocket_info"` }
type AppKeepAlive ¶
type AppKeepAlive struct {
GameId string `json:"game_id"`
}
type BatchKeepAlive ¶ added in v0.2.0
type BatchKeepAlive struct { // 场次id GameIDs []string `json:"game_ids"` }
type BatchKeepAliveInfo ¶ added in v0.2.0
type BatchKeepAliveInfo struct { // 心跳失败的id FailedGameIDs []string `json:"failed_game_ids"` }
type Client ¶
func (*Client) BatchKeepAlive ¶ added in v0.2.0
func (*Client) NewApiRequest ¶
type Response ¶
type SignatureHeader ¶
func (SignatureHeader) ToBytes ¶
func (header SignatureHeader) ToBytes() []byte
type Time ¶ added in v0.0.8
func (*Time) UnmarshalJSON ¶ added in v0.0.8
type WebsocketInfo ¶
Click to show internal directories.
Click to hide internal directories.