Documentation
¶
Overview ¶
Package compose 编排需要多次调用上游才能完成的用例。
读取步骤经 engine.Execute 执行,使用 AuthOptional 接收调用方 Cookie,不借用会话池。 扫码登录经 RawDoWithCookieAndInput 取得 Set-Cookie,确认后按需补查账号资料。 gRPC service、CLI 与其它前端都调这里,不得各自再拼一遍。
Index ¶
- Constants
- func CheckQrcode(ctx context.Context, eng *engine.Engine, req *mmpb.CheckQrcodeRequest) (*mmpb.CheckQrcodeResponse, error)
- func PlaylistTracks(ctx context.Context, eng *engine.Engine, req *mmpb.AllTracksRequest) (*mmpb.AllTracksResponse, error)
- func UserPlaylists(ctx context.Context, eng *engine.Engine, req *mmpb.UserPlaylistRequest) (*mmpb.UserPlaylistResponse, error)
Constants ¶
const MaxPageSize = songendpoint.MaxDetails
MaxPageSize 是单页上限,超过时按上限返回。批量歌曲详情一次最多 1000 首, 用户歌单的上游单页也按这个数取。
Variables ¶
This section is empty.
Functions ¶
func CheckQrcode ¶ added in v0.5.3
func CheckQrcode(ctx context.Context, eng *engine.Engine, req *mmpb.CheckQrcodeRequest) (*mmpb.CheckQrcodeResponse, error)
CheckQrcode 轮询二维码状态;确认后返回新登录的凭据与账号,资料缺失时用新凭据补查。
func PlaylistTracks ¶
func PlaylistTracks(ctx context.Context, eng *engine.Engine, req *mmpb.AllTracksRequest) (*mmpb.AllTracksResponse, error)
PlaylistTracks 按歌单原顺序分页返回歌曲(对外的 AllTracks)。
歌单详情内嵌的 tracks 会被上游截断,只有 trackIds 完整:先取完整 trackIds, 切出这一页,再批量查这一页的歌曲详情。total 是歌单的歌曲总数; offset 超出总数时返回空页,不再请求歌曲详情。
func UserPlaylists ¶
func UserPlaylists(ctx context.Context, eng *engine.Engine, req *mmpb.UserPlaylistRequest) (*mmpb.UserPlaylistResponse, error)
UserPlaylists 返回用户歌单的一页(对外的 UserPlaylist)。
上游分页不能直接透传:第一页会在 limit 之外额外插入「喜欢的音乐」,不返回总数, 创建 / 收藏的筛选也只能在拿到数据后做(先分页再筛选会得到短页、漏项)。所以按上游 单页上限取全量,再筛选、分页;total 是筛选后的总数,不随 limit / offset 变化。 「喜欢的音乐」的创建者就是用户本人,计入 ALL 与 CREATED。
Types ¶
This section is empty.