Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var EmptyBinder = Binder{}
EmptyBinder singleton
View Source
var EmptyBookBinder = BookBinder{}
EmptyBookBinder singleton
View Source
var EmptyMetadataBinder = MetadataBinder{}
EmptyMetadataBinder singleton
Functions ¶
func PatchMetadata ¶
PatchMetadata ensures that the nickname and username fields are not blank
Types ¶
type Binder ¶
type Binder struct {
MetadataBinder
BookBinder
}
Binder is a container for all the data fetched from a single source
type BookBinder ¶
type BookBinder struct {
Responses []JsonResponse
UpdateTime timestamp.Nano
}
BookBinder is a container for all the book data fetched from a single source
type ErrCode ¶
type ErrCode byte
ErrCode Error codes for fetcher
const ( InvalidCredentialsErr ErrCode = iota FetchMetadataErr MalformedMetadataErr FetchCardDataErr MalformedCardDataErr FetchBookDataErr MalformedBookDataErr FetchAvatarErr DecodeErr MissingCookieProviderErr None )
Error codes
func GetErrCode ¶
GetErrCode returns the error code from the given error
type Fetcher ¶
type Fetcher interface {
// Extends allows a fetcher to extend another fetcher
Extends(top Fetcher)
// SourceID returns the source ID of the fetcher
SourceID() source.ID
// SourceURL returns the source URL of the fetcher
SourceURL() string
// MainURL returns the main URL of the fetcher
MainURL() string
// BaseURLs returns the base URLs of the fetcher
BaseURLs() []BaseURL
// CharacterID returns the character ID from a URL
CharacterID(rawCharacterID string) string
// DirectURL returns the direct URL for a character
DirectURL(characterID string) string
// NormalizeURL returns the normalized URL for a character
NormalizeURL(characterID string) string
// FetchMetadataResponse fetches the metadata response from the source for the given characterID
FetchMetadataResponse(characterID string) (*req.Response, error)
// CreateBinder creates a MetadataBinder from the metadata response
CreateBinder(characterID string, response string) (*MetadataBinder, error)
// FetchCardInfo fetches the card info from the source
FetchCardInfo(metadataBinder *MetadataBinder) (*models.CardInfo, error)
// FetchCreatorInfo fetches the creator info from the source
FetchCreatorInfo(metadataBinder *MetadataBinder) (*models.CreatorInfo, error)
// FetchBookResponses fetches the book responses from the source
FetchBookResponses(metadataBinder *MetadataBinder) (*BookBinder, error)
// FetchCharacterCard fetches the character card from the source
FetchCharacterCard(binder *Binder) (*png.CharacterCard, error)
// Close closes the fetcher
Close()
// IsSourceUp checks if the source is up
IsSourceUp() error
}
Fetcher interface for all fetchers
type MetadataBinder ¶
type MetadataBinder struct {
CharacterID string
NormalizedURL string
DirectURL string
Document *goquery.Document
JsonResponse
}
MetadataBinder is a container for all the metadata fetched from a single source
Click to show internal directories.
Click to hide internal directories.