appapi

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultAPIBase      = protocol.AppAPIBase
	DefaultUserAgent    = protocol.AppUserAgent
	DefaultAppOS        = protocol.AppOS
	DefaultAppOSVersion = protocol.AppOSVersion
	DefaultAppVersion   = protocol.AppVersion
)

Variables

View Source
var ErrMalformedResponse = protocol.ErrMalformedResponse

ErrMalformedResponse 标识成功 HTTP 响应无法构成约定 JSON,不包含原始响应体。

Functions

This section is empty.

Types

type APIError

type APIError = protocol.Failure

APIError 保留内部兼容名称;实际失败统一由 protocol.Failure 脱敏表示。

type Client

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

func New

func New(opts ...Option) *Client

func (*Client) AddBookmark

func (c *Client) AddBookmark(ctx context.Context, illustID int64, restrict string, tags []string) error

AddBookmark 收藏作品。成功响应可为空,因此不走 JSON 解码路径。

func (*Client) FollowUser

func (c *Client) FollowUser(ctx context.Context, userID int64, restrict string) error

FollowUser 关注用户。

func (*Client) IllustDetail

func (c *Client) IllustDetail(ctx context.Context, id int64) (*model.IllustDetail, error)

func (*Client) IllustFollow

func (c *Client) IllustFollow(ctx context.Context, restrict string, offset int) (*model.IllustList, error)

func (*Client) IllustRanking

func (c *Client) IllustRanking(ctx context.Context, mode, date string, offset int) (*model.IllustList, error)

func (*Client) IllustRecommended

func (c *Client) IllustRecommended(ctx context.Context, offset int, continuationExists bool) (*model.IllustList, error)

func (*Client) IllustRelated

func (c *Client) IllustRelated(ctx context.Context, id int64, offset int) (*model.IllustList, error)

func (*Client) MangaRecommended added in v0.3.0

func (c *Client) MangaRecommended(ctx context.Context, offset int, continuationExists bool) (*model.IllustList, error)

MangaRecommended 使用插画推荐 catalog 的漫画筛选;Pixiv 没有独立 manga 推荐 endpoint。

func (*Client) NovelRecommended added in v0.3.0

func (c *Client) NovelRecommended(ctx context.Context, offset int, continuationExists bool) (*model.NovelList, error)

NovelRecommended 返回小说推荐的单个 App API 批次。

func (*Client) RemoveBookmark

func (c *Client) RemoveBookmark(ctx context.Context, illustID int64) error

RemoveBookmark 取消收藏作品。

func (*Client) SearchIllust

func (c *Client) SearchIllust(ctx context.Context, word, target, sort, duration string, offset int, filterOptions ...model.SearchIllustFilters) (*model.IllustList, error)

func (*Client) SearchIllustOptions added in v0.4.0

func (c *Client) SearchIllustOptions(ctx context.Context, word string) (*model.SearchIllustOptions, error)

func (*Client) SearchUser

func (c *Client) SearchUser(ctx context.Context, word string, offset int) (*model.UserPreviewList, error)

func (*Client) TrendingTagsIllust

func (c *Client) TrendingTagsIllust(ctx context.Context) (*model.TrendTags, error)

func (*Client) UgoiraMetadata

func (c *Client) UgoiraMetadata(ctx context.Context, id int64) (*model.UgoiraMetadataResult, error)

func (*Client) UnfollowUser

func (c *Client) UnfollowUser(ctx context.Context, userID int64) error

UnfollowUser 取消关注用户。

func (*Client) UserArtworks

func (c *Client) UserArtworks(ctx context.Context, userID int64, illustType string, offset int) (*model.IllustList, error)

UserArtworks 返回用户作品的单个 App API 批次。

func (*Client) UserBookmarks

func (c *Client) UserBookmarks(ctx context.Context, userID int64, restrict, tag string, maxBookmarkID int64) (*model.IllustList, error)

func (*Client) UserDetail

func (c *Client) UserDetail(ctx context.Context, userID int64) (*model.UserDetail, error)

func (*Client) UserFollowing

func (c *Client) UserFollowing(ctx context.Context, userID int64, restrict string, offset int) (*model.UserPreviewList, error)

func (*Client) UserRecommended added in v0.3.0

func (c *Client) UserRecommended(ctx context.Context, offset int, continuationExists bool) (*model.RecommendedUserList, error)

UserRecommended 返回作者推荐及其可用作品预览的单个 App API 批次。

type Option

type Option func(*Client)

func WithAccessToken

func WithAccessToken(token string) Option

WithAccessToken 注入已取得的 access token,供无需刷新流程的 SDK 调用复用 App API。

func WithBaseURL

func WithBaseURL(apiBase string) Option

func WithHTTPClient

func WithHTTPClient(httpClient *http.Client) Option

func WithSession

func WithSession(session Session) Option

type Session

type Session interface {
	AccessToken() string
	Refresh(context.Context) error
}

Session 是 App 内容 API 仅需知道的最小认证边界。

Jump to

Keyboard shortcuts

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