publicapi

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: 5 Imported by: 0

Documentation

Overview

Package publicapi handles the default API functionality reverse engineered from the public API

Index

Constants

View Source
const (
	// order of the search results
	SearchOrderAscending  = "asc"
	SearchOrderDescending = "desc"

	// search modes
	SearchModePartialTagMatch = "tag"
	SearchModeExactTagMatch   = "exact_tag"
	SearchModeText            = "text"
	SearchModeTitleAndCaption = "caption"
)

noinspection GoUnusedConst

Variables

This section is empty.

Functions

This section is empty.

Types

type PublicAPI

type PublicAPI struct {
	pixivapi.PixivAPI
}

PublicAPI is the implementation of the public API

func NewPublicAPI

func NewPublicAPI(moduleKey string, account *models.Account) *PublicAPI

NewPublicAPI initializes the public API and handles the whole OAuth2 and round tripper procedures

func (*PublicAPI) GetSearchIllust

func (a *PublicAPI) GetSearchIllust(
	word string, searchMode string, searchOrder string, page int,
) (*SearchIllust, error)

GetSearchIllust returns the illustration search results from the API

type PublicIllustration

type PublicIllustration struct {
	ID        int    `json:"id"`
	Title     string `json:"title"`
	Type      string `json:"type"`
	ImageURLs struct {
		Large string `json:"large"`
	} `json:"image_urls"`
	PageCount int `json:"page_count"`
}

PublicIllustration is the illustration response from the public API search

type SearchIllust

type SearchIllust struct {
	Illustrations []PublicIllustration `json:"response"`
	Status        string               `json:"status"`
	Count         json.Number          `json:"count"`
	Pagination    struct {
		Previous *int `json:"previous"`
		Current  *int `json:"current"`
		Next     *int `json:"next"`
		Total    *int `json:"total"`
	} `json:"pagination"`
}

SearchIllust contains all relevant information regarding the illustration search

Jump to

Keyboard shortcuts

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