api

package
v0.1.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	DefaultAPIBase           = "https://app-api.pixiv.net"
	DefaultOAuthBase         = "https://oauth.secure.pixiv.net"
	DefaultOAuthClientID     = "MOBrBDS8blbauoSck0ZfDbtuzpyT"
	DefaultOAuthClientSecret = "lsACyCD94FhDUtGTXi3QzcFE2uU1hqtDaKeqrdwj"
	DefaultUserAgent         = "PixivAndroidApp/5.0.234 (Android 11; Pixel 5)"
	DefaultAppOS             = "android"
	DefaultAppOSVersion      = "11"
	DefaultAppVersion        = "5.0.234"
)
View Source
const DefaultOAuthRedirectURI = "https://app-api.pixiv.net/web/v1/users/auth/pixiv/callback"

Variables

This section is empty.

Functions

This section is empty.

Types

type APIError

type APIError struct {
	StatusCode int
	Body       string
}

func (APIError) Error

func (e APIError) Error() string

type AuthCodeToken

type AuthCodeToken struct {
	AccessToken  string
	RefreshToken string
	UserID       int64
	Username     string
}

type Client

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

func New

func New(refreshToken string, opts ...Option) *Client

func (*Client) Download

func (c *Client) Download(ctx context.Context, rawURL string, dst io.Writer) error

func (*Client) ExchangeAuthorizationCode

func (c *Client) ExchangeAuthorizationCode(ctx context.Context, code, codeVerifier string) (AuthCodeToken, error)

func (*Client) IllustDetail

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

func (*Client) IllustFollow

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

func (*Client) IllustRanking

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

func (*Client) IllustRecommended

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

func (*Client) IllustRelated

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

func (*Client) IsAuthenticated

func (c *Client) IsAuthenticated() bool

func (*Client) Refresh

func (c *Client) Refresh(ctx context.Context) error

func (*Client) RefreshTokenValue

func (c *Client) RefreshTokenValue() string

func (*Client) SearchIllust

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

func (*Client) SearchUser

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

func (*Client) SetRefreshToken

func (c *Client) SetRefreshToken(token string)

func (*Client) TrendingTagsIllust

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

func (*Client) UgoiraMetadata

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

func (*Client) UserBookmarks

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

func (*Client) UserDetail

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

func (*Client) UserFollowing

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

func (*Client) UserID

func (c *Client) UserID() int64

func (*Client) UserName

func (c *Client) UserName() string

type Illust

type Illust = model.Illust

type IllustDetail

type IllustDetail = model.IllustDetail

type IllustList

type IllustList = model.IllustList

type Option

type Option func(*Client)

func WithBaseURLs

func WithBaseURLs(apiBase, oauthBase string) Option

func WithHTTPClient

func WithHTTPClient(httpClient *http.Client) Option

type TrendTags

type TrendTags = model.TrendTags

type UgoiraMetadataResult

type UgoiraMetadataResult = model.UgoiraMetadataResult

type User

type User = model.User

type UserPreviewList

type UserPreviewList = model.UserPreviewList

Jump to

Keyboard shortcuts

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