electric

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 11, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package electric contains parameters and stable response models for Bilibili's public and account-scoped charging APIs.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChallengeInfo

type ChallengeInfo struct {
	ID               string            `json:"challenge_id"`
	Description      string            `json:"description"`
	Type             int64             `json:"challenge_type"`
	RemainingDays    int64             `json:"remaining_days"`
	EndTime          string            `json:"end_time"`
	Progress         int64             `json:"progress"`
	Targets          []json.RawMessage `json:"targets"`
	State            int64             `json:"state"`
	EndTimeUnix      int64             `json:"end_time_unix"`
	PublishedDynamic int64             `json:"pub_dyn"`
	DynamicContent   string            `json:"dyn_content"`
}

type ChargeItem

type ChargeItem struct {
	PrivilegeType uint64  `json:"privilege_type"`
	Icon          string  `json:"icon"`
	Name          string  `json:"name"`
	ExpireTime    uint64  `json:"expire_time"`
	Renew         *Renew  `json:"renew"`
	StartTime     uint64  `json:"start_time"`
	RenewList     []Renew `json:"renew_list"`
}

type ChargeRecord

type ChargeRecord struct {
	List       []ChargeUP `json:"list"`
	Page       uint64     `json:"page"`
	PageSize   uint64     `json:"page_size"`
	TotalPage  uint64     `json:"total_page"`
	TotalCount uint64     `json:"total_num"`
	HasMore    uint8      `json:"is_more"`
}

type ChargeRecordParams

type ChargeRecordParams struct {
	// contains filtered or unexported fields
}

func NewChargeRecordParams

func NewChargeRecordParams(page uint64, chargeType uint32) (ChargeRecordParams, error)

func (ChargeRecordParams) EncodeQuery

func (p ChargeRecordParams) EncodeQuery() (url.Values, error)

type ChargeUP

type ChargeUP struct {
	UPMID          uint64       `json:"up_uid"`
	Name           string       `json:"user_name"`
	Face           string       `json:"user_face"`
	Items          []ChargeItem `json:"item"`
	Start          uint64       `json:"start"`
	HighLevelState uint8        `json:"high_level_state"`
	ReplyState     uint8        `json:"elec_reply_state"`
}

type ChargeUser

type ChargeUser struct {
	Name    string        `json:"uname"`
	Avatar  string        `json:"avatar"`
	MID     int64         `json:"mid"`
	PayMID  int64         `json:"pay_mid"`
	Rank    int32         `json:"rank"`
	VIP     ChargeVIPInfo `json:"vip_info"`
	Message string        `json:"message"`
}

type ChargeVIPInfo

type ChargeVIPInfo struct {
	DueMilliseconds int64 `json:"vipDueMsec"`
	Status          int32 `json:"vipStatus"`
	Type            int32 `json:"vipType"`
}

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client provides charging-support operations.

func NewClient

func NewClient(client *core.Client) Client

NewClient binds the electric module to a shared client.

func (Client) ChargeFollowInfo

func (e Client) ChargeFollowInfo(ctx context.Context, params UpMIDParams) (FollowInfo, error)

func (Client) ChargeRecord

func (e Client) ChargeRecord(ctx context.Context, params ChargeRecordParams) (ChargeRecord, error)

func (Client) ItemDetail

func (e Client) ItemDetail(ctx context.Context, params UpMIDParams) (ItemDetail, error)

func (Client) MemberRank

func (e Client) MemberRank(ctx context.Context, params MemberRankParams) (MemberRank, error)

func (Client) MonthUpList

func (e Client) MonthUpList(ctx context.Context, params MonthUpListParams) (MonthUpList, error)

func (Client) RankRecent

func (e Client) RankRecent(ctx context.Context, params PaginationParams) (RecentRank, error)

func (Client) RechargeList

func (e Client) RechargeList(ctx context.Context, params RechargeListParams) (RechargeList, error)

func (Client) RemarkDetail

func (e Client) RemarkDetail(ctx context.Context, params RemarkDetailParams) (RemarkDetail, error)

func (Client) RemarkList

func (e Client) RemarkList(ctx context.Context, params RemarkListParams) (RemarkList, error)

func (Client) VideoShow

func (e Client) VideoShow(ctx context.Context, params VideoShowParams) (VideoShow, error)

type FollowInfo

type FollowInfo struct {
	Days              uint64        `json:"days"`
	UPCard            UPCard        `json:"up_card"`
	UserCard          UserCard      `json:"user_card"`
	RemainingDays     int64         `json:"remain_days"`
	RemainingLessDay  uint8         `json:"remain_less_1day"`
	Rank              UpowerRank    `json:"upower_rank"`
	Icon              string        `json:"upower_icon"`
	RightCount        int64         `json:"upower_right_count"`
	OnlyContainsMedal bool          `json:"only_contain_medal"`
	PrivilegeType     uint64        `json:"privilege_type"`
	Challenge         ChallengeInfo `json:"challenge_info"`
}

type ItemDetail

type ItemDetail struct {
	Rank              UpowerRank        `json:"upower_rank"`
	Item              ItemIntro         `json:"item"`
	UserCard          UserCard          `json:"user_card"`
	Level             uint8             `json:"upower_level"`
	ReplyState        uint8             `json:"elec_reply_state"`
	VoucherState      json.RawMessage   `json:"voucher_state"`
	RightCounts       map[string]uint64 `json:"upower_right_count"`
	OnlyContainsMedal bool              `json:"only_contain_medal"`
	PrivilegeType     uint64            `json:"privilege_type"`
}

type ItemIntro

type ItemIntro struct {
	IntroVideoAID string `json:"intro_video_aid"`
	Welcome       string `json:"welcomes"`
}

type LevelInfo

type LevelInfo struct {
	PrivilegeType uint64 `json:"privilege_type"`
	Name          string `json:"name"`
	Price         uint64 `json:"price"`
	MemberTotal   uint64 `json:"member_total"`
}

type MemberInfo

type MemberInfo struct {
	MID           uint64 `json:"mid"`
	Nickname      string `json:"nickname"`
	Avatar        string `json:"avatar"`
	Rank          int64  `json:"rank"`
	Day           uint64 `json:"day"`
	ExpiresAt     uint64 `json:"expire_at"`
	RemainingDays uint64 `json:"remain_days"`
}

type MemberRank

type MemberRank struct {
	UPInfo        UPInfo       `json:"up_info"`
	RankInfo      []MemberInfo `json:"rank_info"`
	UserInfo      MemberInfo   `json:"user_info"`
	MemberTotal   uint64       `json:"member_total"`
	PrivilegeType uint64       `json:"privilege_type"`
	Charged       bool         `json:"is_charge"`
	Tabs          []uint64     `json:"tabs"`
	Levels        []LevelInfo  `json:"level_info"`
}

type MemberRankParams

type MemberRankParams struct {
	// contains filtered or unexported fields
}

func NewMemberRankParams

func NewMemberRankParams(upMID ids.MID, page, pageSize uint64) (MemberRankParams, error)

func (MemberRankParams) EncodeQuery

func (p MemberRankParams) EncodeQuery() (url.Values, error)

func (MemberRankParams) WithPrivilegeType

func (p MemberRankParams) WithPrivilegeType(privilegeType uint64) MemberRankParams

type MonthUpList

type MonthUpList struct {
	Count      int32        `json:"count"`
	List       []ChargeUser `json:"list"`
	TotalCount int32        `json:"total_count"`
}

type MonthUpListParams

type MonthUpListParams struct {
	// contains filtered or unexported fields
}

func NewMonthUpListParams

func NewMonthUpListParams(upMID ids.MID) MonthUpListParams

func (MonthUpListParams) EncodeQuery

func (p MonthUpListParams) EncodeQuery() (url.Values, error)

type PaginationParams

type PaginationParams struct {
	// contains filtered or unexported fields
}

func NewPaginationParams

func NewPaginationParams(page, pageSize uint64) (PaginationParams, error)

func (PaginationParams) EncodeQuery

func (p PaginationParams) EncodeQuery() (url.Values, error)

type RankPager

type RankPager struct {
	Current uint64 `json:"current"`
	Size    uint64 `json:"size"`
	Total   uint64 `json:"total"`
}

type RankUser

type RankUser struct {
	Rank     uint64 `json:"rank"`
	MID      uint64 `json:"mid"`
	Nickname string `json:"nickname"`
	Avatar   string `json:"avatar"`
}

type RecentRank

type RecentRank struct {
	List  []RecentRankRecord `json:"list"`
	Pager RankPager          `json:"pager"`
}

type RecentRankRecord

type RecentRankRecord struct {
	AID       uint64  `json:"aid"`
	BVID      string  `json:"bvid"`
	Electric  float64 `json:"elec_num"`
	Title     string  `json:"title"`
	Name      string  `json:"uname"`
	Avatar    string  `json:"avatar"`
	CreatedAt string  `json:"ctime"`
}

type RechargeList

type RechargeList struct {
	Page   RechargePage     `json:"page"`
	Result []RechargeRecord `json:"result"`
}

type RechargeListParams

type RechargeListParams struct {
	// contains filtered or unexported fields
}

func NewRechargeListParams

func NewRechargeListParams(page, pageSize uint64) (RechargeListParams, error)

func (RechargeListParams) EncodeQuery

func (p RechargeListParams) EncodeQuery() (url.Values, error)

func (RechargeListParams) WithDateRange

func (p RechargeListParams) WithDateRange(begin, end time.Time) (RechargeListParams, error)

type RechargePage

type RechargePage struct {
	CurrentPage uint64 `json:"currentPage"`
	PageSize    uint64 `json:"pageSize"`
	TotalCount  uint64 `json:"totalCount"`
	TotalPage   uint64 `json:"totalPage"`
}

type RechargeRecord

type RechargeRecord struct {
	MID               uint64  `json:"mid"`
	Name              string  `json:"name"`
	Avatar            string  `json:"avatar"`
	OriginalThirdCoin float64 `json:"originalThirdCoin"`
	Brokerage         float64 `json:"brokerage"`
	Remark            string  `json:"remark"`
	CreatedAt         string  `json:"ctime"`
}

type RemarkDetail

type RemarkDetail = RemarkRecord

type RemarkDetailParams

type RemarkDetailParams struct {
	// contains filtered or unexported fields
}

func NewRemarkDetailParams

func NewRemarkDetailParams(id uint64) (RemarkDetailParams, error)

func (RemarkDetailParams) EncodeQuery

func (p RemarkDetailParams) EncodeQuery() (url.Values, error)

type RemarkList

type RemarkList struct {
	List  []RemarkRecord `json:"list"`
	Pager RankPager      `json:"pager"`
}

type RemarkListParams

type RemarkListParams struct {
	// contains filtered or unexported fields
}

func NewRemarkListParams

func NewRemarkListParams(page, pageSize uint64) (RemarkListParams, error)

func (RemarkListParams) EncodeQuery

func (p RemarkListParams) EncodeQuery() (url.Values, error)

func (RemarkListParams) WithDateRange

func (p RemarkListParams) WithDateRange(begin, end time.Time) (RemarkListParams, error)

type RemarkRecord

type RemarkRecord struct {
	AID          uint64 `json:"aid"`
	BVID         string `json:"bvid"`
	ID           uint64 `json:"id"`
	MID          uint64 `json:"mid"`
	ReplyMID     uint64 `json:"reply_mid"`
	Electric     uint64 `json:"elec_num"`
	State        uint8  `json:"state"`
	Message      string `json:"msg"`
	ArchiveName  string `json:"aname"`
	UserName     string `json:"uname"`
	Avatar       string `json:"avator"`
	ReplyName    string `json:"reply_name"`
	ReplyAvatar  string `json:"reply_avator"`
	ReplyMessage string `json:"reply_msg"`
	CreatedAt    uint64 `json:"ctime"`
	ReplyTime    uint64 `json:"reply_time"`
}

type Renew

type Renew struct {
	UID             uint64 `json:"uid"`
	RUID            uint64 `json:"ruid"`
	GoodsID         uint64 `json:"goods_id"`
	Status          uint8  `json:"status"`
	NextExecuteTime uint64 `json:"next_execute_time"`
	SignedTime      uint64 `json:"signed_time"`
	SignedPrice     uint64 `json:"signed_price"`
	PayChannel      uint8  `json:"pay_channel"`
	Period          uint64 `json:"period"`
	MobileApp       string `json:"mobile_app"`
}

type UPCard

type UPCard struct {
	MID           uint64 `json:"mid"`
	Nickname      string `json:"nickname"`
	OfficialTitle string `json:"official_title"`
	Avatar        string `json:"avatar"`
}

type UPInfo

type UPInfo struct {
	MID         uint64 `json:"mid"`
	Nickname    string `json:"nickname"`
	Avatar      string `json:"avatar"`
	Type        int32  `json:"type"`
	Title       string `json:"title"`
	UpowerState uint8  `json:"upower_state"`
}

type UpMIDParams

type UpMIDParams struct {
	// contains filtered or unexported fields
}

func NewUpMIDParams

func NewUpMIDParams(upMID ids.MID) UpMIDParams

func (UpMIDParams) EncodeQuery

func (p UpMIDParams) EncodeQuery() (url.Values, error)

type UpowerRank

type UpowerRank struct {
	Total       uint64     `json:"total"`
	Description string     `json:"total_desc"`
	List        []RankUser `json:"list"`
}

type UserCard

type UserCard struct {
	Avatar   string `json:"avatar"`
	Nickname string `json:"nickname"`
}

type VideoShow

type VideoShow struct {
	ShowInfo   VideoShowInfo `json:"show_info"`
	AVCount    int32         `json:"av_count"`
	Count      int32         `json:"count"`
	TotalCount int32         `json:"total_count"`
	List       []ChargeUser  `json:"list"`
}

type VideoShowHighLevel

type VideoShowHighLevel struct {
	PrivilegeType int32  `json:"privilege_type"`
	Title         string `json:"title"`
	Subtitle      string `json:"sub_title"`
	ShowButton    bool   `json:"show_button"`
}

type VideoShowInfo

type VideoShowInfo struct {
	Show       bool               `json:"show"`
	State      int32              `json:"state"`
	Title      string             `json:"title"`
	JumpURL    string             `json:"jump_url"`
	Icon       string             `json:"icon"`
	HighLevel  VideoShowHighLevel `json:"high_level"`
	QuestionID int64              `json:"with_qa_id"`
}

type VideoShowParams

type VideoShowParams struct {
	// contains filtered or unexported fields
}

func NewVideoShowParams

func NewVideoShowParams(mid ids.MID) VideoShowParams

func (VideoShowParams) EncodeQuery

func (p VideoShowParams) EncodeQuery() (url.Values, error)

func (VideoShowParams) WithAID

func (p VideoShowParams) WithAID(aid ids.AID) VideoShowParams

func (VideoShowParams) WithBVID

func (p VideoShowParams) WithBVID(bvid ids.BVID) VideoShowParams

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL