models

package
v0.0.0-...-3c29c6b Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Anime

type Anime struct {
	ID       string
	MALID    uint16
	Name     string
	AltNames []string
	Year     uint16
}

Anime type

func (Anime) FormatEx

func (a Anime) FormatEx() AnimeEx

FormatEx formats the struct

func (Anime) MatchName

func (a Anime) MatchName(name string) bool

MatchName Checks if string matches any of the ANime title's name

func (Anime) MatchYear

func (a Anime) MatchYear(year string) bool

MatchYear Checks if the anime belongs to any of the input years' releases

type AnimeEx

type AnimeEx struct {
	ID          uint16         `json:"id"`
	Name        string         `json:"name"`
	AltNames    []string       `json:"altNames,omitempty"`
	Year        uint16         `json:"year"`
	Collections []CollectionEx `json:"collections,omitempty"`
}

AnimeEx export type

type Cache

type Cache struct {
	Anime       []Anime
	Themes      []Theme
	Collections []Collection
}

Cache type used to store cached anime titles

func (Cache) FilterAnime

func (c Cache) FilterAnime(name string, year string) []Anime

FilterAnime filters the Anime list

func (Cache) GetAnimeByID

func (c Cache) GetAnimeByID(id string) (int, *Anime)

GetAnimeByID gets an Anime by ID

func (Cache) GetAnimeByMALID

func (c Cache) GetAnimeByMALID(id int) *Anime

GetAnimeByMALID gets an Anime by MAL ID

func (Cache) GetAnimeThemes

func (c Cache) GetAnimeThemes(anime Anime) []Theme

GetAnimeThemes gets all themes associated with an Anime

func (Cache) GetCollections

func (c Cache) GetCollections(anime Anime) []Collection

GetCollections gets associated collections

type Collection

type Collection struct {
	ID         string
	AnimeMALID uint16
	Name       string
}

Collection type, contains a slice of themes

func (Collection) FormatEx

func (c Collection) FormatEx() CollectionEx

FormatEx formats the struct

type CollectionEx

type CollectionEx struct {
	Name   string    `json:"name,omitempty"`
	Themes []ThemeEx `json:"themes"`
}

CollectionEx type

type Error

type Error struct {
	Name        string `json:"name"`
	Description string `json:"description"`
}

Error type

func (Error) AnimeNotFound

func (e Error) AnimeNotFound(id int) *Error

AnimeNotFound returns a proper error message for when a passed ID does not match any scrapped Anime title

func (Error) InvalidAccessToken

func (e Error) InvalidAccessToken() *Error

InvalidAccessToken returns a proper error message for when the access token is incorrect

func (Error) LogNotFound

func (e Error) LogNotFound(id string) *Error

LogNotFound returns a proper error message for when a passed ID does not match any log file

type Response

type Response struct {
	Status   int         `json:"status"`
	HasError bool        `json:"hasError"`
	Error    *Error      `json:"error,omitempty"`
	Data     interface{} `json:"data,omitempty"`
}

Response type

type Source

type Source struct {
	Link         string
	Format       string
	Resolution   string
	HasLyrics    bool
	IsTransition bool
	IsOver       bool
	Tags         []string
}

Source type

func (Source) FormatEx

func (s Source) FormatEx() SourceEx

FormatEx formats the struct

type SourceEx

type SourceEx struct {
	Link         string   `json:"link"`
	Format       string   `json:"format"`
	Resolution   string   `json:"resolution"`
	HasLyrics    bool     `json:"hasLyrics"`
	IsTransition bool     `json:"isTransition"`
	IsOver       bool     `json:"isOver"`
	Tags         []string `json:"tags,omitempty"`
}

SourceEx export type

type Theme

type Theme struct {
	AnimeMALID   uint16
	CollectionID string
	Name         string
	ThemeType    uint8
	Order        uint8
	Version      uint8
	Episodes     []string
	IsNSFW       bool
	HasSpoilers  bool
	Sources      []Source
}

Theme song type

func (Theme) FormatEx

func (t Theme) FormatEx() ThemeEx

FormatEx formats the struct

type ThemeEx

type ThemeEx struct {
	Name        string     `json:"name"`
	ThemeType   uint8      `json:"type"`
	Order       uint8      `json:"order"`
	Variant     uint8      `json:"version"`
	Episodes    []string   `json:"episodes"`
	IsNSFW      bool       `json:"isNSFW"`
	HasSpoilers bool       `json:"hasSpoilers"`
	Sources     []SourceEx `json:"sources,omitempty"`
}

ThemeEx export type

Jump to

Keyboard shortcuts

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