pixiv

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2020 License: MIT Imports: 13 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEmptyNextURL = errors.New("pixiv: empty next_url field")
)

Functions

func IsInvalidCredentials added in v1.0.3

func IsInvalidCredentials(err error) bool

IsInvalidCredentials checks if the error is of invalid username/password/refresh_token

Types

type AddBookmarkOptions

type AddBookmarkOptions struct {
	Tags []string `url:"tags[],omitempty"`
}

AddBookmarkOptions defines form body in AddBookmark.

type AppAPI

type AppAPI struct {
	ClientID,
	ClientSecret,
	HashSecret,
	BaseURL,
	DeviceToken string
	BaseHeader http.Header

	AuthURL,
	Username,
	Password,
	RefreshToken,
	AccessToken string
	UserID           int
	TokenExpireAt    time.Time
	TokenExpiryDelta time.Duration

	// Contains details of login user.
	AuthResponse *RespAuth

	Client *http.Client // *http.Client with *Transport that can authorize requests automatically

	User    *UserService
	Illust  *IllustService
	Novel   *NovelService
	Comment *CommentService
	Search  *SearchService
	// contains filtered or unexported fields
}

AppAPI defines the Pixiv App-API client with config.

func New

func New() *AppAPI

New returns new PixivAppAPI with http.DefaultClient

func NewWithClient

func NewWithClient(client *http.Client) *AppAPI

NewWithClient returns new PixivAppAPI with the given http.Client.

func (*AppAPI) ForceAuth added in v0.1.1

func (api *AppAPI) ForceAuth() (*RespAuth, error)

ForceAuth gets new access_token with given username and password or refresh_token wether it expires.

func (*AppAPI) NewAuthorizedRequest added in v0.1.1

func (api *AppAPI) NewAuthorizedRequest(method, url string, body io.Reader) (*http.Request, error)

NewAuthorizedRequest sets auth and other headers and body of a new request with given method, url and form data.

func (*AppAPI) NewPximgRequest added in v1.1.1

func (api *AppAPI) NewPximgRequest(method, url string, body io.Reader) (*http.Request, error)

NewPximgRequest sets base headers and sets Referer to "https://app-api.pixiv.net/"

func (*AppAPI) SetHeaders added in v1.1.0

func (api *AppAPI) SetHeaders(req *http.Request)

SetHeaders sets the header of req with BaseHeader and adds X-Client-Time & X-Client-Hash headers.

func (*AppAPI) SetLanguage

func (api *AppAPI) SetLanguage(language string)

SetLanguage sets Accept-Language header to the given languages. This affects the language of tag translations and messages.

func (*AppAPI) SetRefreshToken

func (api *AppAPI) SetRefreshToken(token string)

SetRefreshToken sets the refresh_token for auth.

func (*AppAPI) SetUser

func (api *AppAPI) SetUser(username, password string)

SetUser sets the username and password for auth.

func (*AppAPI) TokenExpired added in v0.1.1

func (api *AppAPI) TokenExpired() bool

TokenExpired checks if the token has expired

type BookmarkQuery

type BookmarkQuery struct {
	Filter        string `url:"filter,omitempty"` //for_ios
	Offset        int    `url:"offset,omitempty"`
	MaxBookmarkID int    `url:"max_bookmark_id,omitempty"`
}

BookmarkQuery defines url query struct in fetching bookmark.

type Comment

type Comment struct {
	ID         int       `json:"id"`
	Comment    string    `json:"comment"`
	Date       time.Time `json:"date"`
	User       User      `json:"user"`
	HasReplies bool      `json:"has_replies"`
}

Comment is embedded in RespComments

type CommentService

type CommentService service

CommentService fetches comments.

func (*CommentService) AddToIllust added in v1.0.0

func (s *CommentService) AddToIllust(illustID int, comment string) (*RespComment, error)

AddToIllust adds comment to illust.

func (*CommentService) AddToNovel added in v1.0.0

func (s *CommentService) AddToNovel(novelID int, comment string) (*RespComment, error)

AddToNovel adds comment to novel.

func (*CommentService) DeleteFromIllust added in v1.0.0

func (s *CommentService) DeleteFromIllust(commentID int) error

DeleteFromIllust deletes illust comment by id.

func (*CommentService) DeleteFromNovel added in v1.0.0

func (s *CommentService) DeleteFromNovel(commentID int) error

DeleteFromNovel deletes novel comment by id.

func (*CommentService) RepliesIllust

func (s *CommentService) RepliesIllust(commentID int) (*RespComments, error)

RepliesIllust fetches illust comment replies.

func (*CommentService) RepliesNovel

func (s *CommentService) RepliesNovel(commentID int) (*RespComments, error)

RepliesNovel fetches novel comment replies.

type Date added in v1.0.0

type Date string

Date defines the date format used in pixiv of format yyyy-mm-dd like 2000-04-01

func NewDate added in v1.0.0

func NewDate(year int, month int, day int) Date

NewDate returns new date with given year, month and day

func (Date) Day added in v1.0.0

func (d Date) Day() int

Day returns day in Date

func (Date) Month added in v1.0.0

func (d Date) Month() int

Month returns month in date

func (Date) Year added in v1.0.0

func (d Date) Year() int

Year returns year in date

type ErrAppAPI

type ErrAppAPI struct {
	Errors struct {
		UserMessage string `json:"user_message"`
		Message     string `json:"message"`
		Reason      string `json:"reason"`
	} `json:"error"`

	Response *http.Response
}

ErrAppAPI is the error from app-api.pixiv.net

func (*ErrAppAPI) Error

func (e *ErrAppAPI) Error() string

type ErrAuth

type ErrAuth struct {
	HasError bool `json:"has_error"`
	Errors   struct {
		System struct {
			Code    int    `json:"code"`
			Message string `json:"message"`
		} `json:"system"`
	} `json:"errors"`
	// contains filtered or unexported fields
}

ErrAuth is the error from POST https://oauth.secure.pixiv.net/auth/token

func (*ErrAuth) Error

func (e *ErrAuth) Error() string

type FollowingQuery

type FollowingQuery struct {
	Restrict Restrict `url:"restrict,omitempty"`
	Offset   int      `url:"offset,omitempty"`
}

FollowingQuery defines url query struct in fetching user's followings.

type Illust

type Illust struct {
	ID    int    `json:"id"`
	Title string `json:"title"`
	Type  string `json:"type"`

	// Deprecated: Only contains the image URLs of the first page.
	// Use MetaSinglePage or MetaPages instead.
	ImageURLs ImageURLs `json:"image_urls"`

	Caption        string    `json:"caption"`
	Restrict       int       `json:"restrict"`
	User           User      `json:"user"`
	Tags           []Tag     `json:"tags"`
	Tools          []string  `json:"tools"`
	CreateDate     time.Time `json:"create_date"`
	PageCount      int       `json:"page_count"`
	Width          int       `json:"width"`
	Height         int       `json:"height"`
	SanityLevel    int       `json:"sanity_level"`
	XRestrict      int       `json:"x_restrict"`
	Series         Series    `json:"series"`
	MetaSinglePage struct {
		OriginalImageURL string `json:"original_image_url,omitempty"`
	} `json:"meta_single_page"`
	MetaPages []struct {
		ImageURLs ImageURLs `json:"image_urls"`
	} `json:"meta_pages"`
	TotalView      int  `json:"total_view"`
	TotalBookmarks int  `json:"total_bookmarks"`
	IsBookmarked   bool `json:"is_bookmarked"`
	Visible        bool `json:"visible"`
	IsMuted        bool `json:"is_muted"`
}

Illust is embedded in RespIllusts

type IllustQuery

type IllustQuery struct {
	Filter string `url:"filter,omitempty"`
	Type   string `url:"type,omitempty"`
	Offset int    `url:"offset,omitempty"`
}

IllustQuery defines url query struct in fetching user's illusts.

type IllustService

type IllustService service

IllustService does ops with illust.

func (*IllustService) AddBookmark

func (s *IllustService) AddBookmark(illustID int, restrict Restrict, opts *AddBookmarkOptions) error

AddBookmark adds illust to public or private bookmark.

func (*IllustService) AddHistory

func (s *IllustService) AddHistory(illustIDs []int) error

AddHistory adds illust browsing history.

func (*IllustService) Comments

func (s *IllustService) Comments(illustID int) (*RespComments, error)

Comments fetches comments of the illust.

func (*IllustService) DeleteBookmark

func (s *IllustService) DeleteBookmark(illustID int) error

DeleteBookmark deletes illust from public and private bookmark

func (*IllustService) Detail

func (s *IllustService) Detail(illustID int) (*RespIllust, error)

Detail fetches illust's detail by it's id.

func (*IllustService) NewFromAll

func (s *IllustService) NewFromAll(opts *NewIllustsQuery) (*RespIllusts, error)

NewFromAll fetches new illusts from everyone.

func (*IllustService) NewFromFollowings

func (s *IllustService) NewFromFollowings(restrict Restrict) (*RespIllusts, error)

NewFromFollowings fetches new illusts from followings.

func (*IllustService) NewFromMyPixiv

func (s *IllustService) NewFromMyPixiv() (*RespIllusts, error)

NewFromMyPixiv fetches new illusts from my-pixiv.

func (*IllustService) Ranking added in v1.0.0

func (s *IllustService) Ranking(opts *RankingQuery) (*RespIllusts, error)

Ranking fetches ranking illusts with filter.

func (*IllustService) RecommendedIllusts added in v1.0.0

func (s *IllustService) RecommendedIllusts(opts *RecommendedQuery) (*RespIllusts, error)

RecommendedIllusts fetches recommended illusts.

func (*IllustService) RecommendedManga added in v1.0.0

func (s *IllustService) RecommendedManga(opts *RecommendedQuery) (*RespIllusts, error)

RecommendedManga fetches recommended manga.

func (*IllustService) Related

func (s *IllustService) Related(illustID int, opts *RelatedQuery) (*RespIllusts, error)

Related fetches related illusts.

func (*IllustService) UgoiraMetadata

func (s *IllustService) UgoiraMetadata(illustID int) (*RespUgoiraMetadata, error)

UgoiraMetadata fetches ugoira metadata.

type ImageURLs

type ImageURLs struct {
	SquareMedium string `json:"square_medium"`
	Medium       string `json:"medium"`
	Large        string `json:"large"`
	Original     string `json:"original,omitempty"`
}

ImageURLs is embedded in Illust, MetaPage, Novel

type NewIllustsQuery

type NewIllustsQuery struct {
	ContentType string `url:"content_type,omitempty"`
	Filter      string `url:"filter,omitempty"`
	Offset      int    `url:"offset,omitempty"`
}

NewIllustsQuery defines url query of new illusts from everyone.

type Novel

type Novel struct {
	ID             int       `json:"id"`
	Title          string    `json:"title"`
	Caption        string    `json:"caption"`
	Restrict       int       `json:"restrict"`
	XRestrict      int       `json:"x_restrict"`
	ImageURLs      ImageURLs `json:"image_urls"`
	CreateDate     time.Time `json:"create_date"`
	Tags           []Tag     `json:"tags"`
	PageCount      int       `json:"page_count"`
	TextLength     int       `json:"text_length"`
	User           User      `json:"user"`
	Series         Series    `json:"series"`
	IsBookmarked   bool      `json:"is_bookmarked"`
	TotalBookmarks int       `json:"total_bookmarks"`
	TotalView      int       `json:"total_view"`
	Visible        bool      `json:"visible"`
	TotalComments  int       `json:"total_comments"`
	IsMuted        bool      `json:"is_muted"`
	IsMypixivOnly  bool      `json:"is_mypixiv_only"`
	IsXRestricted  bool      `json:"is_x_restricted"`
}

Novel is embedded in RespNovelText, RespNovels

type NovelMarker

type NovelMarker struct {
	Page int `json:"page"`
}

NovelMarker is embedded in RespNovelText

type NovelSeriesDetail added in v1.2.0

type NovelSeriesDetail struct {
	ID                  int    `json:"id"`
	Title               string `json:"title"`
	Caption             string `json:"caption"`
	IsOriginal          bool   `json:"is_original"`
	IsConcluded         bool   `json:"is_concluded"`
	ContentCount        int    `json:"content_count"`
	TotalCharacterCount int    `json:"total_character_count"`
	User                User   `json:"user"`
}

NovelSeriesDetail defines the detail of novel series

type NovelService

type NovelService service

NovelService does ops with novels.

func (*NovelService) AddBookmark

func (s *NovelService) AddBookmark(novelID int, restrict Restrict, opts *AddBookmarkOptions) error

AddBookmark adds novel to public or private bookmark.

func (*NovelService) AddHistory

func (s *NovelService) AddHistory(novelIDs []int) error

AddHistory adds novel browsing history.

func (*NovelService) Comments

func (s *NovelService) Comments(novelID int) (*RespComments, error)

Comments fetches comments of the novel.

func (*NovelService) DeleteBookmark

func (s *NovelService) DeleteBookmark(novelID int) error

DeleteBookmark deletes novel from public and private bookmark

func (*NovelService) Detail

func (s *NovelService) Detail(novelID int) (*RespNovel, error)

Detail fetches novel's detail by it's id.

func (*NovelService) Ranking added in v1.0.0

func (s *NovelService) Ranking(opts *RankingQuery) (*RespNovels, error)

Ranking fetches ranking novel with filter.

func (*NovelService) Recommended added in v1.0.0

func (s *NovelService) Recommended(opts *RecommendedQuery) (*RespNovels, error)

Recommended fetches recommended novels.

func (*NovelService) Text

func (s *NovelService) Text(novelID int) (*RespNovelText, error)

Text fetches text of the novel.

type Profile

type Profile struct {
	Webpage string `json:"webpage"`
	Gender  string `json:"gender"`

	// Format: 1999-04-10
	Birth Date `json:"birth"`

	Region                     string `json:"region"`
	AddressID                  int    `json:"address_id"`
	CountryCode                string `json:"country_code"`
	Job                        string `json:"job"`
	JobID                      int    `json:"job_id"`
	TotalFollowUsers           int    `json:"total_follow_users"`
	TotalMypixivUsers          int    `json:"total_mypixiv_users"`
	TotalIllusts               int    `json:"total_illusts"`
	TotalManga                 int    `json:"total_manga"`
	TotalNovels                int    `json:"total_novels"`
	TotalIllustBookmarksPublic int    `json:"total_illust_bookmarks_public"`
	TotalIllustSeries          int    `json:"total_illust_series"`
	TotalNovelSeries           int    `json:"total_novel_series"`
	BackgroundImageURL         string `json:"background_image_url"`
	TwitterAccount             string `json:"twitter_account"`
	TwitterURL                 string `json:"twitter_url"`
	PawooURL                   string `json:"pawoo_url"`
	IsPremium                  bool   `json:"is_premium"`
	IsUsingCustomProfileImage  bool   `json:"is_using_custom_profile_image"`
}

Profile is embedded in RespUserDetail

type RankingMode added in v1.0.0

type RankingMode string

RankingMode defines mode field in RankingQuery.

const (
	RMDay          RankingMode = "day"
	RMDayMale      RankingMode = "day_male"
	RMDayFemale    RankingMode = "day_female"
	RMWeek         RankingMode = "week"
	RMWeekOriginal RankingMode = "week_original"
	RMWeekRookie   RankingMode = "week_rookie"
	RMMonth        RankingMode = "month"

	RMDayManga        RankingMode = "day_manga"
	RMWeekRookieManga RankingMode = "week_rookie_manga"
	RMWeekManga       RankingMode = "week_manga"
	RMMonthManga      RankingMode = "month_manga"
)

ranking query modes

type RankingQuery added in v1.0.0

type RankingQuery struct {
	Filter string      `url:"filter,omitempty"`
	Mode   RankingMode `url:"mode,omitempty"`
	Date   string      `url:"date,omitempty"`
	Offset int         `url:"offset,omitempty"`
}

RankingQuery defines url query of ranking illusts and novels.

type RecommendedQuery added in v1.0.0

type RecommendedQuery struct {
	IncludeRankingIllusts bool   `url:"include_ranking_illusts,omitempty"`
	IncludePrivacyPolicy  bool   `url:"include_privacy_policy,omitempty"`
	Filter                string `url:"filter,omitempty"`
	Offset                int    `url:"offset,omitempty"`
}

RecommendedQuery defines url query of recommended illusts.

type RecommendedUsersQuery added in v1.0.0

type RecommendedUsersQuery struct {
	Filter string `url:"filter,omitempty"` //for_ios
	Offset int    `url:"offset,omitempty"`
}

RecommendedUsersQuery defines url query struct in fetching recommend users.

type RelatedQuery

type RelatedQuery struct {
	Filter string `url:"filter,omitempty"`
}

RelatedQuery defines url query of related illusts.

type RespAuth

type RespAuth struct {
	Response struct {
		AccessToken  string `json:"access_token"`
		ExpiresIn    int    `json:"expires_in"`
		TokenType    string `json:"token_type"`
		Scope        string `json:"scope"`
		RefreshToken string `json:"refresh_token"`
		User         struct {
			ProfileImageURLs struct {
				PX16X16   string `json:"px_16x16"`
				PX50X50   string `json:"px_50x50"`
				PX170X170 string `json:"px_170x170"`
			} `json:"profile_image_urls"`

			// The ID in original response is of the type string
			ID string `json:"id"`

			Name                   string `json:"name"`
			Account                string `json:"account"`
			MailAddress            string `json:"mail_address"`
			IsPremium              bool   `json:"is_premium"`
			XRestrict              int    `json:"x_restrict"`
			IsMailAuthorized       bool   `json:"is_mail_authorized"`
			RequirePolicyAgreement bool   `json:"require_policy_agreement"`
		} `json:"user"`
		DeviceToken string `json:"device_token"`
	} `json:"response"`
}

RespAuth is the response from POST https://oauth.secure.pixiv.net/auth/token

type RespBookmarkTags

type RespBookmarkTags struct {
	BookmarkTags []struct {
		Count int    `json:"count"`
		Name  string `json:"name"`
	} `json:"bookmark_tags"`
	NextURL string
	// contains filtered or unexported fields
}

RespBookmarkTags is the response from:

/v1/user/bookmark-tags/illust

type RespComment added in v1.0.0

type RespComment struct {
	Comment Comment `json:"comment"`
}

RespComment is the response from:

POST /v1/illust/comment/add

type RespComments

type RespComments struct {
	Comments []*Comment `json:"comments"`
	NextURL  string     `json:"next_url"`
	// contains filtered or unexported fields
}

RespComments is the response from:

/v2/illust/comments?illust_id=...
/v2/novel/comments?novel_id=...
/v1/illust/comment/replies?comment_id=...

func (*RespComments) NextComments

func (r *RespComments) NextComments() (*RespComments, error)

NextComments fetches NextURL with API.

type RespIllust

type RespIllust struct {
	Illust Illust `json:"illust"`
}

RespIllust is the response from:

/v1/illust/detail?illust_id=...

type RespIllusts

type RespIllusts struct {
	Illusts []*Illust `json:"illusts"`
	NextURL string    `json:"next_url"`

	// For queries of recommended illusts and manga, RankingIllusts contains ranking illusts.
	RankingIllusts []*Illust `json:"ranking_illusts"`

	SearchSpanLimit int `json:"search_span_limit"`
	// contains filtered or unexported fields
}

RespIllusts is the response from:

/v2/illust/mypixiv
/v1/illust/new?content_type=...
/v1/user/illusts?user_id=...&type=...

func (*RespIllusts) NextIllusts

func (r *RespIllusts) NextIllusts() (*RespIllusts, error)

NextIllusts fetches NextURL with API.

type RespNovel

type RespNovel struct {
	Novel Novel `json:"novel"`
}

RespNovel is the response from:

/v2/novel/detail?novel_id=...

type RespNovelSeries added in v1.2.0

type RespNovelSeries struct {
	NovelSeriesDetail      NovelSeriesDetail `json:"novel_series_detail"`
	NovelSeriesFirstNovel  Novel             `json:"novel_series_first_novel"`
	NovelSeriesLatestNovel Novel             `json:"novel_series_latest_novel"`
	Novels                 []*Novel          `json:"novels"`
	NextURL                string            `json:"next_url"`
}

RespNovelSeries is the response from:

GET /v2/novel/series?series_id=...

type RespNovelText

type RespNovelText struct {
	NovelMarker NovelMarker `json:"novel_marker"`

	NovelText  string `json:"novel_text"`
	SeriesPrev Novel  `json:"series_prev"`
	SeriesNext Novel  `json:"series_next"`
}

RespNovelText is the response from:

/v1/novel/text?novel_id=...

type RespNovels

type RespNovels struct {
	Novels  []*Novel `json:"novels"`
	NextURL string   `json:"next_url"`

	RankingNovels []*Novel `json:"ranking_novels"`

	SearchSpanLimit int `json:"search_span_limit"`
	// contains filtered or unexported fields
}

RespNovels is the response from:

/v1/user/novels?user_id=...
/v1/user/bookmarks/novel?user_id=...&restrict=...

func (*RespNovels) NextNovels

func (r *RespNovels) NextNovels() (*RespNovels, error)

NextNovels fetches NextURL with API.

type RespTags added in v1.0.0

type RespTags struct {
	Tags []Tag `json:"tags"`
}

RespTags is the response from:

/v2/search/autocomplete?word=...

type RespTrendingTags added in v1.0.0

type RespTrendingTags struct {
	TrendTags []struct {
		Name           string `json:"tag"`
		TranslatedName string `json:"translated_name"`
		Illust         Illust `json:"illust"`
	} `json:"trend_tags"`
}

RespTrendingTags is the response from:

/v1/trending-tags/illust

type RespUgoiraMetadata

type RespUgoiraMetadata struct {
	UgoiraMetadata struct {
		ZipURLs struct {
			Medium string `json:"medium"`
		} `json:"zip_urls"`
		Frames []struct {
			File  string `json:"file"`
			Delay int    `json:"delay"`
		} `json:"frames"`
	} `json:"ugoira_metadata"`
}

RespUgoiraMetadata is the response from:

/v1/ugoira/metadata?illust_id=...

type RespUserDetail

type RespUserDetail struct {
	User    User    `json:"user"`
	Profile Profile `json:"profile"`

	// All fields here except Pawoo are all "private" or "public"
	ProfilePublicity struct {
		Gender    string `json:"gender"`
		Region    string `json:"region"`
		BirthDay  string `json:"birth_day"`
		BirthYear string `json:"birth_year"`
		Job       string `json:"job"`
		Pawoo     bool   `json:"pawoo"`
	} `json:"profile_publicity"`
	Workspace map[string]string `json:"workspace"`
}

RespUserDetail is the response from:

/v1/user/detail?user_id=...

type RespUserPreviews

type RespUserPreviews struct {
	UserPreviews []*UserPreview `json:"user_previews"`
	NextURL      string         `json:"next_url"`
	// contains filtered or unexported fields
}

RespUserPreviews is the response from:

/v1/user/following?restrict=...&user_id=...

func (*RespUserPreviews) NextFollowing

func (r *RespUserPreviews) NextFollowing() (*RespUserPreviews, error)

NextFollowing fetches NextURL with API.

type Restrict

type Restrict string

Restrict defines the restrict query field in fetching bookmark. It can be "public" or "private".

const (
	RPublic  Restrict = "public"
	RPrivate Restrict = "private"
	RAll     Restrict = "all"
)

Restrict can be "public" or "private".

type SearchQuery added in v1.0.0

type SearchQuery struct {
	SearchTarget SearchTarget `url:"search_target,omitempty"`
	Sort         Sort         `url:"sort,omitempty"`
	// MergePlainKeywordResults bool         `url:"merge_plain_keyword_results,omitempty"`
	Filter string `url:"filter,omitempty"`

	StartDate Date `url:"start_date,omitempty"`
	EndDate   Date `url:"end_date,omitempty"`
	Offset    int  `url:"offset,omitempty"`
}

SearchQuery defines url query in illust and novel searching

type SearchService added in v1.0.0

type SearchService service

SearchService searches pixiv content.

func (*SearchService) IllustTrendingTags added in v1.0.0

func (s *SearchService) IllustTrendingTags(opts *TrendingTagsQuery) (*RespTrendingTags, error)

IllustTrendingTags fetches trending tags of illusts and manga.

func (*SearchService) Illusts added in v1.0.0

func (s *SearchService) Illusts(word string, opts *SearchQuery) (*RespIllusts, error)

Illusts searches illusts with options.

func (*SearchService) NovelTrendingTags added in v1.0.0

func (s *SearchService) NovelTrendingTags(opts *TrendingTagsQuery) (*RespTrendingTags, error)

NovelTrendingTags fetches trending tags of novels.

func (*SearchService) Novels added in v1.0.0

func (s *SearchService) Novels(word string, opts *SearchQuery) (*RespNovels, error)

Novels searches novels with options.

func (*SearchService) PopularIllustsPreview added in v1.0.0

func (s *SearchService) PopularIllustsPreview(word string, opts *SearchQuery) (*RespIllusts, error)

PopularIllustsPreview searches 30 illusts sort by popularity

func (*SearchService) PopularNovelsPreview added in v1.0.0

func (s *SearchService) PopularNovelsPreview(word string, opts *SearchQuery) (*RespNovels, error)

PopularNovelsPreview searches 30 novels sort by popularity

func (*SearchService) TagsStartWith added in v1.0.0

func (s *SearchService) TagsStartWith(word string) (*RespTags, error)

TagsStartWith fetches tags start with word.

func (*SearchService) Users added in v1.0.0

func (s *SearchService) Users(word string, opts *SearchUserQuery) (*RespUserPreviews, error)

Users searches user previews by options.

type SearchTarget added in v1.0.0

type SearchTarget string

SearchTarget defines search_target field in SearchQuery

const (
	STPartialMatchTags SearchTarget = "partial_match_for_tags"
	STExactMatchTags   SearchTarget = "exact_match_for_tags"

	// For novel search only.
	STText SearchTarget = "text"

	// For illust search only.
	STTitleCaption SearchTarget = "title_and_caption"
)

SearchTarget values

type SearchUserQuery added in v1.0.0

type SearchUserQuery struct {
	Filter string `url:"filter,omitempty"`
	Offset int    `url:"offset,omitempty"`
}

SearchUserQuery defines url query struct used in user searching

type Series

type Series struct {
	ID    int    `json:"id"`
	Title string `json:"title"`
}

Series is embedded in Illust(where Type="manga"), Novel

type Sort added in v1.0.0

type Sort string

Sort defines sort field in SearchQuery

const (
	SDateAsc     Sort = "date_asc"
	SDateDesc    Sort = "date_desc"
	SPopularDesc Sort = "popular_desc"
)

Sort values

type Tag

type Tag struct {
	Name                string `json:"name"`
	TranslatedName      string `json:"translated_name"`
	AddedByUploadedUser *bool  `json:"added_by_uploaded_user"`
}

Tag is embedded in Illust, Novel

type TrendingTagsQuery added in v1.0.0

type TrendingTagsQuery struct {
	Filter string `url:"filter,omitempty"`
}

TrendingTagsQuery defines url query for IllustTrendingTags.

type Type

type Type string

Type defines the type field of pixiv works.

const (
	TIllust Type = "illust"
	TManga  Type = "manga"
	TUgoira Type = "ugoira"
	TNovel  Type = "novel"
)

Type of pixiv works.

type User

type User struct {
	ID               int    `json:"id"`
	Name             string `json:"name"`
	Account          string `json:"account"`
	ProfileImageURLs struct {
		Medium string `json:"medium"`
	} `json:"profile_image_urls"`
	Comment    string `json:"comment"`
	IsFollowed bool   `json:"is_followed"`
}

User may be embedded in Illust, Novel, Comment

type UserDetailQuery

type UserDetailQuery struct {
	Filter string `url:"filter,omitempty"` //for_ios
}

UserDetailQuery defines url query struct in fetching user's detail.

type UserPreview

type UserPreview struct {
	User    User      `json:"user"`
	Illusts []*Illust `json:"illusts"`
	Novels  []*Novel  `json:"novels"`
	IsMuted bool      `json:"is_muted"`
}

UserPreview contains last 3 illusts and novels of a user.

type UserService

type UserService service

UserService does the fetching with user.

func (*UserService) BookmarkedIllusts

func (s *UserService) BookmarkedIllusts(userID int, restrict Restrict, opts *BookmarkQuery) (*RespIllusts, error)

BookmarkedIllusts fetches user's bookmarked illusts.

func (*UserService) BookmarkedNovels

func (s *UserService) BookmarkedNovels(userID int, restrict Restrict, opts *BookmarkQuery) (*RespNovels, error)

BookmarkedNovels fetches user's bookmarked novels.

func (*UserService) Detail

func (s *UserService) Detail(userID int, opts *UserDetailQuery) (*RespUserDetail, error)

Detail fetches user profile from /v1/user/detail

func (*UserService) Followings

func (s *UserService) Followings(userID int, opts *FollowingQuery) (*RespUserPreviews, error)

Followings fetches user's followings.

func (*UserService) IllustBookmarkTags

func (s *UserService) IllustBookmarkTags(restrict Restrict) (*RespBookmarkTags, error)

IllustBookmarkTags fetches user's illust bookmark tags.

func (*UserService) Illusts

func (s *UserService) Illusts(userID int, opts *IllustQuery) (*RespIllusts, error)

Illusts fetches user's illusts.

func (*UserService) NovelBookmarkTags

func (s *UserService) NovelBookmarkTags(restrict Restrict) (*RespBookmarkTags, error)

NovelBookmarkTags fetches user's novel bookmark tags.

func (*UserService) Novels

func (s *UserService) Novels(userID int) (*RespNovels, error)

Novels fetches user's novels.

func (*UserService) Recommended added in v1.0.0

func (s *UserService) Recommended(opts *RecommendedUsersQuery) (*RespUserPreviews, error)

Recommended fetches recommend users.

Jump to

Keyboard shortcuts

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