pixivapi

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2020 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

Package pixivapi offers shared functionality for the public API and the mobile API

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIError

type APIError struct {
	ErrorOccurred bool   `json:"error"`
	ErrorMessage  string `json:"message"`
}

APIError contains error messages of the API

func (APIError) Error

func (e APIError) Error() string

Error returns the occurred API error message

type APIRequestError

type APIRequestError struct {
	ErrorMessage string `json:"error"`
}

APIRequestError is the error struct of invalid requests

func (APIRequestError) Error

func (e APIRequestError) Error() string

Error returns the occurred API error message

type IllustrationUnavailableError

type IllustrationUnavailableError struct {
	APIError
}

IllustrationUnavailableError will get returned from the illustration detail API request if the illustration got either deleted or made unavailable in general

type MobileAPIError

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

MobileAPIError is the error struct of the mobile API

func (MobileAPIError) Error

func (e MobileAPIError) Error() string

Error returns the occurred API error message

type PixivAPI

type PixivAPI struct {
	Session watcherHttp.SessionInterface

	OAuth2Config *oauth2.Config
	// contains filtered or unexported fields
}

PixivAPI is the struct offering shared functionality for the public API and the mobile API

func NewPixivAPI

func NewPixivAPI(moduleKey string, account *models.Account, referer string) *PixivAPI

NewPixivAPI returned a pixiv API struct with already configured round trips

func (*PixivAPI) AddRoundTrippers

func (a *PixivAPI) AddRoundTrippers() (err error)

AddRoundTrippers adds the required round trippers for the OAuth2 pixiv APIs

func (*PixivAPI) ApplyRateLimit

func (a *PixivAPI) ApplyRateLimit()

ApplyRateLimit waits until the leaky bucket can pass another request again

func (*PixivAPI) MapAPIResponse

func (a *PixivAPI) MapAPIResponse(res *http.Response, apiRes interface{}) (err error)

MapAPIResponse maps the API response into the passed APIResponse type

type UserUnavailableError

type UserUnavailableError struct {
	APIError
}

UserUnavailableError will get returned from the user information API request if the user got deleted or made unavailable in general

Directories

Path Synopsis
Package internal contains all the internal functions for the pixiv API token retrieval and refresh process
Package internal contains all the internal functions for the pixiv API token retrieval and refresh process

Jump to

Keyboard shortcuts

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