service

package
v0.12.0-alpha.0 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2024 License: MIT Imports: 21 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                int64            `json:"id"`
	Title             string           `json:"title"`
	AlternativeTitles alternativeTitle `json:"alternative_titles"`
	Picture           string           `json:"picture"`
	StartDate         date             `json:"start_date"`
	EndDate           date             `json:"end_date"`
	Synopsis          string           `json:"synopsis"`
	Background        string           `json:"background"`
	NSFW              bool             `json:"nsfw"`
	Type              entity.Type      `json:"type" swaggertype:"string"`
	Status            entity.Status    `json:"status" swaggertype:"string"`
	Episode           episode          `json:"episode"`
	Season            *season          `json:"season"`
	Broadcast         *broadcast       `json:"broadcast"`
	Source            entity.Source    `json:"source" swaggertype:"string"`
	Rating            entity.Rating    `json:"rating" swaggertype:"string"`
	Mean              float64          `json:"mean"`
	Rank              int              `json:"rank"`
	Popularity        int              `json:"popularity"`
	Member            int              `json:"member"`
	Voter             int              `json:"voter"`
	Stats             stats            `json:"stats"`
	Genres            []genre          `json:"genres"`
	Pictures          []string         `json:"pictures"`
	Related           []related        `json:"related"`
	Studios           []studio         `json:"studios"`
	UpdatedAt         time.Time        `json:"updated_at"`
}

Anime is anime model.

type AnimeHistory added in v0.9.0

type AnimeHistory struct {
	Year          int     `json:"year"`
	Month         int     `json:"month"`
	Week          int     `json:"week"`
	Mean          float64 `json:"mean"`
	Rank          int     `json:"rank"`
	Popularity    int     `json:"popularity"`
	Member        int     `json:"member"`
	Voter         int     `json:"voter"`
	UserWatching  int     `json:"user_watching"`
	UserCompleted int     `json:"user_completed"`
	UserOnHold    int     `json:"user_on_hold"`
	UserDropped   int     `json:"user_dropped"`
	UserPlanned   int     `json:"user_planned"`
}

AnimeHistory is anime stats history.

type Genre added in v0.10.0

type Genre struct {
	ID     int64   `json:"id"`
	Name   string  `json:"name"`
	Count  int     `json:"count"`
	Mean   float64 `json:"mean"`
	Member int     `json:"member"`
}

Genre is genre model.

type GenreHistory added in v0.10.0

type GenreHistory struct {
	Year       int     `json:"year"`
	Month      int     `json:"month"`
	Mean       float64 `json:"mean"`
	Rank       int     `json:"rank"`
	Popularity int     `json:"popularity"`
	Member     int     `json:"member"`
	Voter      int     `json:"voter"`
	Count      int     `json:"count"`
}

GenreHistory is genre stats history.

type GetAnimeHistoriesRequest added in v0.9.0

type GetAnimeHistoriesRequest struct {
	ID        int64               `validate:"gt=0"`
	StartDate string              `validate:"omitempty,datetime=2006-01-02" mod:"trim"`
	EndDate   string              `validate:"omitempty,datetime=2006-01-02" mod:"trim"`
	Group     entity.HistoryGroup `validate:"oneof=WEEKLY MONTHLY YEARLY" mod:"trim,ucase,default=MONTHLY"`
}

GetAnimeHistoriesRequest is get anime history request model.

type GetAnimeRequest added in v0.9.0

type GetAnimeRequest struct {
	Title           string        `mod:"lcase,trim"`
	NSFW            *bool         ``
	Type            entity.Type   `validate:"omitempty,oneof=TV OVA ONA MOVIE SPECIAL MUSIC" mod:"ucase,no_space"`
	Status          entity.Status `validate:"omitempty,oneof=FINISHED RELEASING NOT_YET" mod:"ucase,no_space"`
	Season          entity.Season `validate:"omitempty,oneof=WINTER SPRING SUMMER FALL" mod:"ucase,no_space"`
	SeasonYear      int           `validate:"gte=0"`
	StartMean       float64       `validate:"gte=0,lte=10"`
	EndMean         float64       `validate:"gte=0,lte=10"`
	StartAiringYear int           `validate:"gte=0"`
	EndAiringYear   int           `validate:"gte=0"`
	GenreID         int64         `validate:"gte=0"`
	StudioID        int64         `validate:"gte=0"`
	Sort            entity.Sort   `` /* 166-byte string literal not displayed */
	Page            int           `validate:"required,gte=1" mod:"default=1"`
	Limit           int           `validate:"required,gte=-1" mod:"default=20"`
}

GetAnimeRequest is get anime list request model.

type GetGenreHistoriesRequest added in v0.10.0

type GetGenreHistoriesRequest struct {
	ID        int64               `validate:"gt=0"`
	StartYear int                 `validate:"gte=0"`
	EndYear   int                 `validate:"gte=0"`
	Group     entity.HistoryGroup `validate:"oneof=MONTHLY YEARLY" mod:"trim,ucase,default=MONTHLY"`
}

GetGenreHistoriesRequest is get genre history request model.

type GetGenresRequest added in v0.10.0

type GetGenresRequest struct {
	Name  string      `mod:"lcase,trim"`
	Sort  entity.Sort `validate:"oneof=NAME -NAME COUNT -COUNT MEAN -MEAN MEMBER -MEMBER" mod:"no_space,ucase,default=NAME"`
	Page  int         `validate:"required,gte=1" mod:"default=1"`
	Limit int         `validate:"required,gte=-1" mod:"default=20"`
}

GetGenresRequest is get genre list request model.

type GetStudioHistoriesRequest added in v0.10.0

type GetStudioHistoriesRequest struct {
	ID        int64               `validate:"gt=0"`
	StartYear int                 `validate:"gte=0"`
	EndYear   int                 `validate:"gte=0"`
	Group     entity.HistoryGroup `validate:"oneof=MONTHLY YEARLY" mod:"trim,ucase,default=MONTHLY"`
}

GetStudioHistoriesRequest is get studio history request model.

type GetStudiosRequest added in v0.10.0

type GetStudiosRequest struct {
	Name  string      `mod:"lcase,trim"`
	Sort  entity.Sort `validate:"oneof=NAME -NAME COUNT -COUNT MEAN -MEAN MEMBER -MEMBER" mod:"no_space,ucase,default=NAME"`
	Page  int         `validate:"required,gte=1" mod:"default=1"`
	Limit int         `validate:"required,gte=-1" mod:"default=20"`
}

GetStudiosRequest is get studio list request model.

type GetUserAnimeRequest added in v0.2.0

type GetUserAnimeRequest struct {
	Username string `validate:"required" mod:"trim,lcase"`
	Page     int    `validate:"required,gte=1" mod:"default=1"`
	Limit    int    `validate:"required,gte=-1" mod:"default=20"`
}

GetUserAnimeRequest is get user anime request model.

type Pagination added in v0.2.0

type Pagination struct {
	Page  int `json:"page"`
	Limit int `json:"limit"`
	Total int `json:"total"`
}

Pagination is pagination model.

type Service

type Service interface {
	GetAnime(ctx context.Context, data GetAnimeRequest) ([]Anime, *Pagination, int, error)
	GetAnimeByID(ctx context.Context, id int64) (*Anime, int, error)
	GetAnimeHistoriesByID(ctx context.Context, data GetAnimeHistoriesRequest) ([]AnimeHistory, int, error)
	UpdateAnimeByID(ctx context.Context, id int64) (int, error)

	GetGenres(ctx context.Context, data GetGenresRequest) ([]Genre, *Pagination, int, error)
	GetGenreByID(ctx context.Context, id int64) (*Genre, int, error)
	GetGenreHistoriesByID(ctx context.Context, data GetGenreHistoriesRequest) ([]GenreHistory, int, error)

	GetStudios(ctx context.Context, data GetStudiosRequest) ([]Studio, *Pagination, int, error)
	GetStudioByID(ctx context.Context, id int64) (*Studio, int, error)
	GetStudioHistoriesByID(ctx context.Context, data GetStudioHistoriesRequest) ([]StudioHistory, int, error)

	GetUserAnime(ctx context.Context, data GetUserAnimeRequest) ([]UserAnime, *Pagination, int, error)
	GetUserAnimeRelations(ctx context.Context, username string) (*UserAnimeRelation, int, error)
	UpdateUserAnime(ctx context.Context, username string) (int, error)

	ConsumeMessage(ctx context.Context, msg entity.Message) error

	QueueOldReleasingAnime(ctx context.Context, limit int) (int, int, error)
	QueueOldFinishedAnime(ctx context.Context, limit int) (int, int, error)
	QueueOldNotYetAnime(ctx context.Context, limit int) (int, int, error)
	QueueMissingAnime(ctx context.Context, limit int) (int, int, error)
	QueueOldUserAnime(ctx context.Context, limit int) (int, int, error)
}

Service contains functions for service.

type Studio added in v0.10.0

type Studio struct {
	ID     int64   `json:"id"`
	Name   string  `json:"name"`
	Count  int     `json:"count"`
	Mean   float64 `json:"mean"`
	Member int     `json:"member"`
}

Studio is studio model.

type StudioHistory added in v0.10.0

type StudioHistory struct {
	Year       int     `json:"year"`
	Month      int     `json:"month"`
	Mean       float64 `json:"mean"`
	Rank       int     `json:"rank"`
	Popularity int     `json:"popularity"`
	Member     int     `json:"member"`
	Voter      int     `json:"voter"`
	Count      int     `json:"count"`
}

StudioHistory is studio stats history.

type UserAnime added in v0.2.0

type UserAnime struct {
	AnimeID   int64         `json:"anime_id"`
	Status    entity.Status `json:"status" swaggertype:"string"`
	Score     int           `json:"score"`
	Episode   int           `json:"episode"`
	Tags      []string      `json:"tags"`
	Comment   string        `json:"comment"`
	UpdatedAt time.Time     `json:"updated_at"`
}

UserAnime is user anime model.

type UserAnimeRelation added in v0.3.0

type UserAnimeRelation struct {
	Nodes []userAnimeRelationNode `json:"nodes"`
	Links []userAnimeRelationLink `json:"links"`
}

UserAnimeRelation is user anime relation model.

Jump to

Keyboard shortcuts

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