mobileapi

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2020 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package mobileapi handles the default API functionality reverse engineered from the mobile application since the API is not documented or intended to be used outside of the mobile application

Index

Constants

View Source
const (
	// order of the search results
	SearchOrderDateAscending        = "date_asc"
	SearchOrderDateDescending       = "date_desc"
	SearchOrderPopularityAscending  = "popular_asc"
	SearchOrderPopularityDescending = "popular_desc"

	// search modes
	SearchModePartialTagMatch = "partial_match_for_tags"
	SearchModeExactTagMatch   = "exact_match_for_tags"
	SearchModeTitleAndCaption = "title_and_caption"
)

noinspection GoUnusedConst

Variables

This section is empty.

Functions

This section is empty.

Types

type IllustDetail

type IllustDetail struct {
	Illustration Illustration `json:"illust"`
}

IllustDetail contains all relevant information regarding an illustration detail API request

type Illustration

type Illustration struct {
	ID             int    `json:"id"`
	Title          string `json:"title"`
	Type           string `json:"type"`
	MetaSinglePage struct {
		OriginalImageURL *string `json:"original_image_url"`
	} `json:"meta_single_page"`
	MetaPages []*struct {
		ImageURLs struct {
			Original string `json:"original"`
		} `json:"image_urls"`
	} `json:"meta_pages"`
	User UserInfo `json:"user"`
}

Illustration contains all relevant information of an illustration

type MobileAPI

type MobileAPI struct {
	pixivapi.PixivAPI
}

MobileAPI is the implementation of the API used in the mobile applications

func NewMobileAPI

func NewMobileAPI(moduleKey string, account *models.Account) *MobileAPI

NewMobileAPI initializes the mobile API and handles the whole OAuth2 and round tripper procedures

func (*MobileAPI) GetIllustDetail

func (a *MobileAPI) GetIllustDetail(illustID int) (*IllustDetail, error)

GetIllustDetail returns the illustration details from the API

func (*MobileAPI) GetSearchIllust

func (a *MobileAPI) GetSearchIllust(
	word string, searchMode string, searchOrder string, offset int,
) (*SearchIllust, error)

GetSearchIllust returns the illustration search results from the API

func (*MobileAPI) GetSearchIllustByURL

func (a *MobileAPI) GetSearchIllustByURL(url string) (*SearchIllust, error)

GetSearchIllustByURL returns the illustration search results from the API by passed URL

func (*MobileAPI) GetUgoiraMetadata

func (a *MobileAPI) GetUgoiraMetadata(illustID int) (*UgoiraMetadata, error)

GetUgoiraMetadata returns the animation details from the API

func (*MobileAPI) GetUserDetail

func (a *MobileAPI) GetUserDetail(userID int) (*UserDetail, error)

GetUserDetail returns the user details from the API

func (*MobileAPI) GetUserIllusts

func (a *MobileAPI) GetUserIllusts(userID int, filter string, offset int) (*UserIllusts, error)

GetUserIllusts returns the user illustration results from the API

func (*MobileAPI) GetUserIllustsByURL

func (a *MobileAPI) GetUserIllustsByURL(url string) (*UserIllusts, error)

GetUserIllustsByURL returns the user illustration results from the API by passed URL

type SearchIllust

type SearchIllust struct {
	Illustrations []Illustration `json:"illusts"`
	NextURL       string         `json:"next_url"`
}

SearchIllust contains all relevant information regarding the illustration search

type UgoiraFrame

type UgoiraFrame struct {
	File  string      `json:"file"`
	Delay json.Number `json:"delay"`
}

UgoiraFrame contains all available information of the animation frames

type UgoiraMetadata

type UgoiraMetadata struct {
	Metadata struct {
		ZipURLs struct {
			Medium string `json:"medium"`
		} `json:"zip_urls"`
		Frames []*UgoiraFrame `json:"frames"`
	} `json:"ugoira_metadata"`
}

UgoiraMetadata contains all relevant information regarding the animation details (ugoira)

func (*UgoiraMetadata) GetUgoiraFrame

func (m *UgoiraMetadata) GetUgoiraFrame(fileName string) (*UgoiraFrame, error)

GetUgoiraFrame returns the associated UgoiraFrame information if existent

type UserDetail

type UserDetail struct {
	User    UserInfo `json:"user"`
	Profile struct {
		Website            string `json:"webpage"`
		TotalIllustrations int    `json:"total_illusts"`
		TotalManga         int    `json:"total_manga"`
		TotalNovels        int    `json:"total_novels"`
	} `json:"profile"`
}

UserDetail contains all relevant information regarding the user details

type UserIllusts

type UserIllusts struct {
	Illustrations []Illustration `json:"illusts"`
	NextURL       string         `json:"next_url"`
}

UserIllusts contains all relevant information regarding the user illustrations and navigation

type UserInfo

type UserInfo struct {
	ID         int    `json:"id"`
	Name       string `json:"name"`
	IsFollowed bool   `json:"is_followed"`
}

UserInfo contains the ID, displayed name and the follow status

func (*UserInfo) GetUserTag

func (u *UserInfo) GetUserTag() string

GetUserTag returns the default download tag for illustrations of the user context

Jump to

Keyboard shortcuts

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