Documentation
¶
Index ¶
- Constants
- func LocalBookID(storeURL string, remoteBookID string) string
- func LocalCoverURL(localBookID string, remoteStoreKey string, _ string) string
- func LocalFileURL(localBookID string, remoteStoreKey string, page model.PageInfo) string
- func LocalizeBook(storeURL string, remoteBook *model.Book) *model.Book
- func LocalizeBookInShelf(storeURL string, remoteBook *model.Book, shelfKey string, shelfName string) *model.Book
- func MatchStoreByKey(storeURLs []string, key string) (string, error)
- func PublicBaseURL(storeURL string) (string, error)
- func ResolveBook(storeURLs []string, remoteStoreKey string, localBookID string, sortBy string, ...) (*model.Book, bool, error)
- func ShelfKey(storeURL string, shelf model.StoreBookInfo, index int) string
- func StoreKey(storeURL string) (string, error)
- type Client
- func (c *Client) Delete(apiPath string, query url.Values) ([]byte, string, error)
- func (c *Client) GetAllBookmarks() ([]model.BookinfoWithBookMark, error)
- func (c *Client) GetBook(remoteBookID string, sortBy string) (*model.Book, error)
- func (c *Client) GetBytes(apiPath string, query url.Values) ([]byte, string, error)
- func (c *Client) GetResponse(apiPath string, query url.Values, headers http.Header) (*http.Response, error)
- func (c *Client) GetServerVersion() (string, error)
- func (c *Client) GetTopShelf(sortBy string) ([]model.StoreBookInfo, error)
- func (c *Client) PostJSON(apiPath string, payload []byte) ([]byte, string, error)
Constants ¶
View Source
const RemoteStoreQuery = "remote_store"
Variables ¶
This section is empty.
Functions ¶
func LocalBookID ¶
LocalBookID 根据远端书库和远端 BookID 生成本机 BookID,避免跨书库冲突。
func LocalCoverURL ¶
LocalCoverURL 生成本机封面代理 URL。
func LocalFileURL ¶
LocalFileURL 生成本机图片代理 URL。
func LocalizeBook ¶
LocalizeBook 把远端书籍元数据转换成本机书库中的远程书籍元数据。
func LocalizeBookInShelf ¶
func LocalizeBookInShelf(storeURL string, remoteBook *model.Book, shelfKey string, shelfName string) *model.Book
LocalizeBookInShelf 把远端书籍放进指定的远端顶级书库分组。
func MatchStoreByKey ¶
MatchStoreByKey 从当前配置的书库列表中找到 remote_store 对应的远端 Comigo URL。
func PublicBaseURL ¶
PublicBaseURL 返回不含账号密码的远端 Comigo 主页 URL。
func ResolveBook ¶
func ResolveBook(storeURLs []string, remoteStoreKey string, localBookID string, sortBy string, timeoutSeconds int) (*model.Book, bool, error)
ResolveBook 根据本机 BookID 和 remote_store 参数实时获取远端书籍详情。
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client 访问另一个 Comigo 服务,负责登录态和 BasePath 拼接。
func (*Client) GetAllBookmarks ¶
func (c *Client) GetAllBookmarks() ([]model.BookinfoWithBookMark, error)
GetAllBookmarks 获取远端所有书签。
func (*Client) GetResponse ¶
func (c *Client) GetResponse(apiPath string, query url.Values, headers http.Header) (*http.Response, error)
GetResponse 流式代理远端 GET 响应,供音视频等需要 Range 的原始资源使用。
func (*Client) GetServerVersion ¶
GetServerVersion 获取远端 Comigo 版本;兼容旧服务只在 ServerName 中带版本号的响应。
func (*Client) GetTopShelf ¶
func (c *Client) GetTopShelf(sortBy string) ([]model.StoreBookInfo, error)
GetTopShelf 获取远端顶层书架。
Click to show internal directories.
Click to hide internal directories.