Documentation
¶
Overview ¶
Package session 统一配置解析、SDK client 创建与 required/optional 认证生命周期。
Index ¶
- func WithOptionalAuth(options *Options, errOut io.Writer, fn func(*Client) error) error
- func WithRequiredAuth(options *Options, errOut io.Writer, fn func(*Client) error) error
- type Client
- func (c *Client) AllEntityMovies(ctx context.Context, kind, entityID string, opt javdb.EntityMoviesOptions, ...) ([]map[string]any, error)
- func (c *Client) Browse(ctx context.Context, opt javdb.BrowseOptions) (javdb.SearchResult, error)
- func (c *Client) Collected(ctx context.Context, kind string) ([]map[string]any, error)
- func (c *Client) EntityDetail(ctx context.Context, kind, id string) (map[string]any, error)
- func (c *Client) EntityMovies(ctx context.Context, kind, entityID string, opt javdb.EntityMoviesOptions) (javdb.SearchResult, error)
- func (c *Client) ListInfo(ctx context.Context, listID string) (map[string]any, error)
- func (c *Client) LoadOrRefreshTaxonomy(ctx context.Context, zone string, force bool) (*tags.Doc, string, error)
- func (c *Client) Mark(ctx context.Context, movieID, status string, score int, content string) (map[string]any, error)
- func (c *Client) MovieAssets(ctx context.Context, movieID string) ([]javdb.MovieAsset, error)
- func (c *Client) MovieComments(ctx context.Context, movieID string, page, limit int) ([]map[string]any, error)
- func (c *Client) MovieDetail(ctx context.Context, movieID string) (map[string]any, error)
- func (c *Client) MovieMagnets(ctx context.Context, movieID string) ([]map[string]any, error)
- func (c *Client) MyLists(ctx context.Context, page, limit int, sortBy string) (javdb.SearchResult, error)
- func (c *Client) RankingsActors(ctx context.Context, period string) (javdb.SearchResult, error)
- func (c *Client) RankingsMovies(ctx context.Context, type_, period string) (javdb.SearchResult, error)
- func (c *Client) RankingsPlayback(ctx context.Context, filterBy, period string) (javdb.SearchResult, error)
- func (c *Client) RecentViewed(ctx context.Context) ([]map[string]any, error)
- func (c *Client) RefreshTagTaxonomy(ctx context.Context, zone string) (*tags.Doc, error)
- func (c *Client) RelatedLists(ctx context.Context, movieID string, page, limit int) (javdb.SearchResult, error)
- func (c *Client) ResolveEntity(ctx context.Context, kind, ref, zone string) (string, error)
- func (c *Client) ResolveMovieID(ctx context.Context, number string) (string, error)
- func (c *Client) ResolveMovieIDExact(ctx context.Context, number string) (string, error)
- func (c *Client) ResolveTags(ctx context.Context, refs []string, zone string) ([]string, error)
- func (c *Client) Search(ctx context.Context, keyword string, opt javdb.SearchOptions) (javdb.SearchResult, error)
- func (c *Client) SearchByImage(ctx context.Context, request javdb.ReverseSearchRequest, ...) (javdb.ImageSearchResult, error)
- func (c *Client) Top250(ctx context.Context, zone, year string, startRank, page, limit int, ...) (javdb.SearchResult, error)
- func (c *Client) Unmark(ctx context.Context, movieID string) (bool, error)
- func (c *Client) WantMovies(ctx context.Context) ([]map[string]any, error)
- func (c *Client) WatchedMovies(ctx context.Context) ([]map[string]any, error)
- type LoginError
- type Options
- type ReverseSearchSetup
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithOptionalAuth ¶
WithOptionalAuth permits anonymous requests and honors explicit auto-relogin.
Types ¶
type Client ¶
Client adds the CLI authentication lifecycle to the public SDK client. Network operations still use the public SDK; each rejected operation is replayed once.
func New ¶
New 读取配置、校验命令行 host 与 proxy、解析运行时,并在 auto 时先完成线路选择,再构造 携带给定 token 的公开 SDK client。固定 host 完全绕过 route cache 与 selector。基线配置在 host/proxy 无副作用校验与 device UUID provision 之后创建;无效 host/proxy 不落盘,选线 失败也不回滚已创建的本机基线状态。
func NewRequired ¶
NewRequired checks local credentials before network route selection.
func NewWithDefaultToken ¶
NewWithDefaultToken builds a client using the default account of this invocation.
func (*Client) AllEntityMovies ¶
func (c *Client) AllEntityMovies(ctx context.Context, kind, entityID string, opt javdb.EntityMoviesOptions, maxPages int) ([]map[string]any, error)
AllEntityMovies executes the SDK operation under the CLI authentication policy.
func (*Client) Browse ¶
func (c *Client) Browse(ctx context.Context, opt javdb.BrowseOptions) (javdb.SearchResult, error)
Browse executes the SDK operation under the CLI authentication policy.
func (*Client) Collected ¶
Collected executes the SDK operation under the CLI authentication policy.
func (*Client) EntityDetail ¶
EntityDetail executes the SDK operation under the CLI authentication policy.
func (*Client) EntityMovies ¶
func (c *Client) EntityMovies(ctx context.Context, kind, entityID string, opt javdb.EntityMoviesOptions) (javdb.SearchResult, error)
EntityMovies executes the SDK operation under the CLI authentication policy.
func (*Client) LoadOrRefreshTaxonomy ¶
func (c *Client) LoadOrRefreshTaxonomy(ctx context.Context, zone string, force bool) (*tags.Doc, string, error)
LoadOrRefreshTaxonomy executes the SDK operation under the CLI authentication policy.
func (*Client) Mark ¶
func (c *Client) Mark(ctx context.Context, movieID, status string, score int, content string) (map[string]any, error)
Mark executes the SDK operation under the CLI authentication policy.
func (*Client) MovieAssets ¶
MovieAssets executes the SDK operation under the CLI authentication policy.
func (*Client) MovieComments ¶
func (c *Client) MovieComments(ctx context.Context, movieID string, page, limit int) ([]map[string]any, error)
MovieComments executes the SDK operation under the CLI authentication policy.
func (*Client) MovieDetail ¶
MovieDetail executes the SDK operation under the CLI authentication policy.
func (*Client) MovieMagnets ¶
MovieMagnets executes the SDK operation under the CLI authentication policy.
func (*Client) MyLists ¶
func (c *Client) MyLists(ctx context.Context, page, limit int, sortBy string) (javdb.SearchResult, error)
MyLists executes the SDK operation under the CLI authentication policy.
func (*Client) RankingsActors ¶
RankingsActors executes the SDK operation under the CLI authentication policy.
func (*Client) RankingsMovies ¶
func (c *Client) RankingsMovies(ctx context.Context, type_, period string) (javdb.SearchResult, error)
RankingsMovies executes the SDK operation under the CLI authentication policy.
func (*Client) RankingsPlayback ¶
func (c *Client) RankingsPlayback(ctx context.Context, filterBy, period string) (javdb.SearchResult, error)
RankingsPlayback executes the SDK operation under the CLI authentication policy.
func (*Client) RecentViewed ¶
RecentViewed executes the SDK operation under the CLI authentication policy.
func (*Client) RefreshTagTaxonomy ¶
RefreshTagTaxonomy executes the SDK operation under the CLI authentication policy.
func (*Client) RelatedLists ¶
func (c *Client) RelatedLists(ctx context.Context, movieID string, page, limit int) (javdb.SearchResult, error)
RelatedLists executes the SDK operation under the CLI authentication policy.
func (*Client) ResolveEntity ¶
ResolveEntity executes the SDK operation under the CLI authentication policy.
func (*Client) ResolveMovieID ¶
ResolveMovieID executes the SDK operation under the CLI authentication policy.
func (*Client) ResolveMovieIDExact ¶
ResolveMovieIDExact executes the SDK operation under the CLI authentication policy.
func (*Client) ResolveTags ¶
ResolveTags executes the SDK operation under the CLI authentication policy.
func (*Client) Search ¶
func (c *Client) Search(ctx context.Context, keyword string, opt javdb.SearchOptions) (javdb.SearchResult, error)
Search executes the SDK operation under the CLI authentication policy.
func (*Client) SearchByImage ¶
func (c *Client) SearchByImage(ctx context.Context, request javdb.ReverseSearchRequest, opts javdb.ImageSearchOptions) (javdb.ImageSearchResult, error)
SearchByImage uses the public SDK linker with authenticated lookups, so a rejected JavDB operation is replayed without uploading the image to the provider again.
func (*Client) Top250 ¶
func (c *Client) Top250(ctx context.Context, zone, year string, startRank, page, limit int, ignoreWatched bool) (javdb.SearchResult, error)
Top250 executes the SDK operation under the CLI authentication policy.
func (*Client) WantMovies ¶
WantMovies executes the SDK operation under the CLI authentication policy.
type LoginError ¶
LoginError keeps the user action separate from the complete upstream cause.
func (*LoginError) Error ¶
func (e *LoginError) Error() string
func (*LoginError) MessageKey ¶
func (e *LoginError) MessageKey() string
func (*LoginError) Unwrap ¶
func (e *LoginError) Unwrap() error
type Options ¶
type Options struct {
Logger *slog.Logger
Proxy string
Host string
// contains filtered or unexported fields
}
Options owns flags and the authentication state of one CLI invocation.
type ReverseSearchSetup ¶
type ReverseSearchSetup struct {
Client *Client
// Source 是本次调用选中的 source(已展开环境 header);builtin 时
// Name 为 "builtin"。
Source javdb.ReverseSearchSource
// CacheEnabled 反映配置与 --no-cache 之外的缓存开关。
CacheEnabled bool
// HTTPClient 是装配了最终代理配置的 HTTP client,供图片 URL 读取与
// provider 请求共用(图片 URL、provider、JavDB 共用同一代理契约)。
HTTPClient *http.Client
}
ReverseSearchSetup 是一次反搜调用所需的公开 SDK client 与已解析 source。
func NewReverseSearchClient ¶
func NewReverseSearchClient(options *Options, explicitSource string) (*ReverseSearchSetup, error)
NewReverseSearchClient 解析反搜配置(含环境 header 展开)、装配本机文件 缓存并构造携带反搜选项与默认账号 token 的公开 SDK client。explicitSource 非空时覆盖 default_source。配置损坏显式失败,绝不偷回 builtin。