miyoushe

package
v1.2.6 Latest Latest
Warning

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

Go to latest
Published: May 29, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AddrTakumi       = "https://api-takumi.mihoyo.com"
	AddrTakumiRecord = "https://api-takumi-record.mihoyo.com"
	AddrBBS          = "https://bbs-api.miyoushe.com"
)

Variables

View Source
var AllGames = json.MustUnmarshalTo[[]*Game](`
[
  {
    "id": 1,
    "name": "崩坏3",
    "en_name": "bh3",
    "op_name": "bh3"
  },
  {
    "id": 2,
    "name": "原神",
    "en_name": "ys",
    "op_name": "hk4e"
  },
  {
    "id": 3,
    "name": "崩坏学园2",
    "en_name": "bh2",
    "op_name": "bh2"
  },
  {
    "id": 4,
    "name": "未定事件簿",
    "en_name": "wd",
    "op_name": "nxx"
  },
  {
    "id": 5,
    "name": "大别野",
    "en_name": "dby",
    "op_name": "plat"
  },
  {
    "id": 6,
    "name": "崩坏:星穹铁道",
    "en_name": "sr",
    "op_name": "hkrpg"
  },
  {
    "id": 8,
    "name": "绝区零",
    "en_name": "zzz",
    "op_name": "nap"
  }
]
`)
View Source
var AllGamesById = func() map[string]*Game {
	m := map[string]*Game{}
	for i := range AllGames {
		m[strconv.Itoa(AllGames[i].Id)] = AllGames[i]
	}
	return m
}()

Functions

func CollectPost added in v1.1.0

func CollectPost(postId string, cancel bool, account config.Account) error

func Login added in v1.1.0

func Login(account config.Account) error

func UpvotePost added in v1.0.5

func UpvotePost(postId string, cancel bool, account config.Account) error

Types

type CreateVerificationData added in v1.0.4

type CreateVerificationData struct {
	Challenge  string `json:"challenge"`
	Gt         string `json:"gt"`
	NewCaptcha int    `json:"new_captcha"`
	Success    int    `json:"success"`
}

func CreateVerification added in v1.0.4

func CreateVerification(account config.Account) (*CreateVerificationData, error)

type Game

type Game struct {
	Id     int    `json:"id"`
	Name   string `json:"name"`
	EnName string `json:"en_name"`
	OpName string `json:"op_name"`
}

type GameCard added in v1.1.10

type GameCard struct {
	HasRole    bool            `json:"has_role"`
	IsPublic   bool            `json:"is_public"`
	GameId     int             `json:"game_id"`
	GameRoleId string          `json:"game_role_id"`
	Region     string          `json:"region"`
	RegionName string          `json:"region_name"`
	Level      int             `json:"level"`
	Nickname   string          `json:"nickname"`
	Data       []*GameCardItem `json:"data"`
}

type GameCardItem added in v1.1.10

type GameCardItem struct {
	Type  int    `json:"type"`
	Name  string `json:"name"`
	Value string `json:"value"`
}

type GameRole

type GameRole struct {
	GameBiz    string `json:"game_biz"`
	Region     string `json:"region"`
	GameUid    string `json:"game_uid"`
	Nickname   string `json:"nickname"`
	Level      int    `json:"level"`
	IsChosen   bool   `json:"is_chosen"`
	RegionName string `json:"region_name"`
	IsOfficial bool   `json:"is_official"`
}

type GetBusinessesData added in v1.1.0

type GetBusinessesData struct {
	Businesses []string `json:"businesses"`
}

func GetBusinesses added in v1.1.0

func GetBusinesses(account config.Account) (*GetBusinessesData, error)

type GetPostData added in v1.0.5

type GetPostData struct {
	Post *PostData `json:"post"`
}

func GetPost added in v1.0.5

func GetPost(postId string, account config.Account) (*GetPostData, error)

type GetSignForumData added in v1.1.0

type GetSignForumData struct {
	IsSigned bool `json:"is_signed"`
}

func GetSignForum added in v1.1.0

func GetSignForum(gameId string, account config.Account) (*GetSignForumData, error)

type GetSignGameData added in v1.1.0

type GetSignGameData struct {
	TotalSignDay  int    `json:"total_sign_day"`
	Today         string `json:"today"`
	IsSign        bool   `json:"is_sign"`
	IsSub         bool   `json:"is_sub"`
	Region        string `json:"region"`
	SignCntMissed int    `json:"sign_cnt_missed"`
	ShortSignDay  int    `json:"short_sign_day"`
}

func GetSignGame added in v1.1.0

func GetSignGame(gameName, actId, region, uid string, account config.Account) (*GetSignGameData, error)

type GetUserData added in v1.1.0

type GetUserData struct {
	UserInfo *UserInfo `json:"user_info"`
}

func GetUser

func GetUser(uid string, account ...config.Account) (*GetUserData, error)

type Home added in v1.1.0

type Home struct {
	Navigator []*HomeNav    `json:"navigator"`
	Official  *HomeOfficial `json:"official"`
}

func GetHome added in v1.1.0

func GetHome(gameId string) (*Home, error)

func (*Home) GetSignActId added in v1.1.0

func (h *Home) GetSignActId() string

type HomeNav added in v1.1.0

type HomeNav struct {
	Id      int    `json:"id"`
	Name    string `json:"name"`
	AppPath string `json:"app_path"`
}

type HomeOfficial added in v1.1.0

type HomeOfficial struct {
	ForumId int `json:"forum_id"`
}

type ListGameCardData added in v1.1.10

type ListGameCardData struct {
	List []*GameCard `json:"list"`
}

func ListGameCard added in v1.1.10

func ListGameCard(account config.Account) (*ListGameCardData, error)

type ListGameData

type ListGameData struct {
	List []*Game `json:"list"`
}

func ListGame

func ListGame() (*ListGameData, error)

type ListGameRoleData

type ListGameRoleData struct {
	List []*GameRole `json:"list"`
}

func ListGameRole

func ListGameRole(gameBiz string, account config.Account) (*ListGameRoleData, error)

type ListPostData added in v1.0.5

type ListPostData struct {
	IsLast   bool        `json:"is_last"`
	IsOrigin bool        `json:"is_origin"`
	LastId   string      `json:"last_id"`
	List     []*PostData `json:"list"`
}

func ListFeedPost added in v1.1.0

func ListFeedPost(gameId string, account config.Account) (*ListPostData, error)

func ListPost added in v1.0.5

func ListPost(forumId, lastId string, account config.Account) (*ListPostData, error)

type ListSignGameAwardData added in v1.1.0

type ListSignGameAwardData struct {
	Total int            `json:"total"`
	List  SignGameAwards `json:"list"`
}

type ListSignGameData added in v1.1.0

type ListSignGameData struct {
	Month      int                 `json:"month"`
	Biz        string              `json:"biz"`
	Resign     bool                `json:"resign"`
	Awards     []*SignGameAward    `json:"awards"`
	ExtraAward *SignGameExtraAward `json:"short_extra_award"`
}

func ListSignGame added in v1.1.0

func ListSignGame(gameName, actId string, account config.Account) (*ListSignGameData, error)

type PostData added in v1.1.0

type PostData struct {
	Post          *PostInfo          `json:"post"`
	Stat          *PostStat          `json:"stat"`
	User          *PostUser          `json:"user"`
	SelfOperation *PostSelfOperation `json:"self_operation"`
}

func (*PostData) IsCollected added in v1.1.0

func (p *PostData) IsCollected() bool

func (*PostData) IsUpvote added in v1.1.0

func (p *PostData) IsUpvote() bool

type PostInfo added in v1.0.5

type PostInfo struct {
	PostId    string `json:"post_id"`
	Subject   string `json:"subject"`
	Content   string `json:"content"`
	MaxFloor  int    `json:"max_floor"`
	ReplyTime string `json:"reply_time"`
	CreatedAt int    `json:"created_at"`
	UpdatedAt int    `json:"updated_at"`
}

type PostSelfOperation added in v1.0.5

type PostSelfOperation struct {
	Attitude    int  `json:"attitude"`
	IsCollected bool `json:"is_collected"`
	UpvoteType  int  `json:"upvote_type"`
}

type PostStat added in v1.0.5

type PostStat struct {
	BookmarkNum int `json:"bookmark_num"`
	ForwardNum  int `json:"forward_num"`
	LikeNum     int `json:"like_num"`
	ReplyNum    int `json:"reply_num"`
	ViewNum     int `json:"view_num"`
}

type PostUser added in v1.0.5

type PostUser struct {
	Uid      string `json:"uid"`
	Nickname string `json:"nickname"`
}

type SharePostData added in v1.0.5

type SharePostData struct {
	Title   string `json:"title"`
	Content string `json:"content"`
	Icon    string `json:"icon"`
	Url     string `json:"url"`
}

func SharePost added in v1.0.5

func SharePost(postId string, account config.Account) (*SharePostData, error)

type SignForumData added in v1.1.0

type SignForumData struct {
	Points int `json:"points"`
}

func SignForum added in v1.1.0

func SignForum(gameId string, account config.Account, verification *common.Verification) (*SignForumData, error)

type SignGameAward added in v1.1.0

type SignGameAward struct {
	Name      string `json:"name"`
	Cnt       int    `json:"cnt"`
	CreatedAt string `json:"created_at,omitempty"`
}

type SignGameAwards added in v1.1.0

type SignGameAwards []*SignGameAward

func ListSignGameAward added in v1.1.0

func ListSignGameAward(gameName, actId, region, uid string, account config.Account) (list SignGameAwards, _ error)

func (SignGameAwards) ShortString added in v1.1.0

func (v1 SignGameAwards) ShortString() string

func (SignGameAwards) Today added in v1.1.0

func (v1 SignGameAwards) Today() (v2 SignGameAwards)

type SignGameData added in v1.1.0

type SignGameData struct {
	Code      string `json:"code"`
	Success   int    `json:"success"`
	IsRisk    bool   `json:"is_risk"`
	RiskCode  int    `json:"risk_code"`
	Gt        string `json:"gt"`
	Challenge string `json:"challenge"`
}

func SignGame added in v1.1.0

func SignGame(gameName, actId, region, uid string, account config.Account, validate *common.Verification) (*SignGameData, error)

func (*SignGameData) IsRisky added in v1.1.0

func (t *SignGameData) IsRisky() bool

type SignGameExtraAward added in v1.1.0

type SignGameExtraAward struct {
	HasExtraAward  bool   `json:"has_extra_award"`
	StartTime      string `json:"start_time"`
	EndTime        string `json:"end_time"`
	List           []any  `json:"list"`
	StartTimestamp string `json:"start_timestamp"`
	EndTimestamp   string `json:"end_timestamp"`
}

type UserInfo

type UserInfo struct {
	Uid       string `json:"uid"`
	Nickname  string `json:"nickname"`
	Introduce string `json:"introduce"`
}

type VerifyVerificationData added in v1.0.4

type VerifyVerificationData struct {
	Challenge string `json:"challenge"`
}

func VerifyVerification added in v1.0.4

func VerifyVerification(challenge, validate string, account config.Account) (*VerifyVerificationData, error)

Jump to

Keyboard shortcuts

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