jikan

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

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

Go to latest
Published: Jun 10, 2024 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	JikanStatusFINISHEDAIRING  = "FINISHEDAIRING"
	JikanStatusCURRENTLYAIRING = "CURRENTLYAIRING"
	JikanStatusNOTYETAIRED     = "NOTYETAIRED"
)
View Source
const (
	JikanTypeCM        = "CM"
	JikanTypeTV        = "TV"
	JikanTypeSPECIAL   = "SPECIAL"
	JikanTypeOVA       = "OVA"
	JikanTypeMOVIE     = "MOVIE"
	JikanTypeONA       = "ONA"
	JikanTypeMUSIC     = "MUSIC"
	JikanTypeTVSPECIAL = "TVSPECIAL"
	JikanTypePV        = "PV"
)
View Source
const (
	JikanSeasonSUMMER = "SUMMER"
	JikanSeasonWINTER = "WINTER"
	JikanSeasonSPRING = "SPRING"
	JikanSeasonFALL   = "FALL"
)
View Source
const (
	JikanTitlaTypeFRENCH   = "FRENCH"
	JikanTitlaTypeGERMAN   = "GERMAN"
	JikanTitlaTypeSPANISH  = "SPANISH"
	JikanTitlaTypeDEFAULT  = "DEFAULT"
	JikanTitlaTypeJAPANESE = "JAPANESE"
	JikanTitlaTypeENGLISH  = "ENGLISH"
	JikanTitlaTypeSYNONYM  = "SYNONYM"
)
View Source
const (
	JikanRelationTypeSIDESTORY          = "SIDESTORY"
	JikanRelationTypeALTERNATIVESETTING = "ALTERNATIVESETTING"
	JikanRelationTypeFULLSTORY          = "FULLSTORY"
	JikanRelationTypePARENTSTORY        = "PARENTSTORY"
	JikanRelationTypePREQUEL            = "PREQUEL"
	JikanRelationTypeADAPTATION         = "ADAPTATION"
	JikanRelationTypeSUMMARY            = "SUMMARY"
	JikanRelationTypeCHARACTER          = "CHARACTER"
	JikanRelationTypeSPINOFF            = "SPINOFF"
	JikanRelationTypeSEQUEL             = "SEQUEL"
	JikanRelationTypeALTERNATIVEVERSION = "ALTERNATIVEVERSION"
	JikanRelationTypeOTHER              = "OTHER"
)

Variables

This section is empty.

Functions

func TransformMedia

func TransformMedia(getAnimeResponse *GetAnimeResponse) *domain.AnimeMedia

func TransformRelationType

func TransformRelationType(relationType string) *enum.AnimeRelationType

Types

type ErrorResponse

type ErrorResponse struct {
	Type    string `json:"type"`
	Message string `json:"message"`
	Error   string `json:"error"`
}

type GetAnimeResponse

type GetAnimeResponse struct {
	Data struct {
		MalID   int                               `json:"mal_id"`
		URL     string                            `json:"url"`
		Images  map[string]*GetAnimeResponseImage `json:"images"`
		Trailer struct {
			YoutubeID string `json:"youtube_id"`
			URL       string `json:"url"`
			EmbedURL  string `json:"embed_url"`
			Images    struct {
				ImageURL        string `json:"image_url"`
				SmallImageURL   string `json:"small_image_url"`
				MediumImageURL  string `json:"medium_image_url"`
				LargeImageURL   string `json:"large_image_url"`
				MaximumImageURL string `json:"maximum_image_url"`
			} `json:"images"`
		} `json:"trailer"`
		Approved bool `json:"approved"`
		Titles   []struct {
			Type  string `json:"type"`
			Title string `json:"title"`
		} `json:"titles"`
		Title         string   `json:"title"`
		TitleEnglish  string   `json:"title_english"`
		TitleJapanese string   `json:"title_japanese"`
		TitleSynonyms []string `json:"title_synonyms"`
		Type          string   `json:"type"`
		Source        string   `json:"source"`
		Episodes      any      `json:"episodes"`
		Status        string   `json:"status"`
		Airing        bool     `json:"airing"`
		Aired         *struct {
			From time.Time `json:"from"`
			To   time.Time `json:"to"`
			Prop struct {
				From struct {
					Day   int `json:"day"`
					Month int `json:"month"`
					Year  int `json:"year"`
				} `json:"from"`
				To struct {
					Day   any `json:"day"`
					Month any `json:"month"`
					Year  any `json:"year"`
				} `json:"to"`
			} `json:"prop"`
			String string `json:"string"`
		} `json:"aired"`
		Duration   string   `json:"duration"`
		Rating     string   `json:"rating"`
		Score      *float64 `json:"score"`
		ScoredBy   int      `json:"scored_by"`
		Rank       int      `json:"rank"`
		Popularity int      `json:"popularity"`
		Members    int      `json:"members"`
		Favorites  int      `json:"favorites"`
		Synopsis   string   `json:"synopsis"`
		Background string   `json:"background"`
		Season     string   `json:"season"`
		Year       int      `json:"year"`
		Broadcast  struct {
			Day      string `json:"day"`
			Time     string `json:"time"`
			Timezone string `json:"timezone"`
			String   string `json:"string"`
		} `json:"broadcast"`
		Producers []struct {
			MalID int    `json:"mal_id"`
			Type  string `json:"type"`
			Name  string `json:"name"`
			URL   string `json:"url"`
		} `json:"producers"`
		Licensors []struct {
			MalID int    `json:"mal_id"`
			Type  string `json:"type"`
			Name  string `json:"name"`
			URL   string `json:"url"`
		} `json:"licensors"`
		Studios []struct {
			MalID int    `json:"mal_id"`
			Type  string `json:"type"`
			Name  string `json:"name"`
			URL   string `json:"url"`
		} `json:"studios"`
		Genres []struct {
			MalID int    `json:"mal_id"`
			Type  string `json:"type"`
			Name  string `json:"name"`
			URL   string `json:"url"`
		} `json:"genres"`
		ExplicitGenres []struct {
			MalID int    `json:"mal_id"`
			Type  string `json:"type"`
			Name  string `json:"name"`
			URL   string `json:"url"`
		} `json:"explicit_genres"`
		Themes []struct {
			MalID int    `json:"mal_id"`
			Type  string `json:"type"`
			Name  string `json:"name"`
			URL   string `json:"url"`
		} `json:"themes"`
		Demographics []struct {
			MalID int    `json:"mal_id"`
			Type  string `json:"type"`
			Name  string `json:"name"`
			URL   string `json:"url"`
		} `json:"demographics"`
		Relations []struct {
			Relation string `json:"relation"`
			Entry    []struct {
				MalID int    `json:"mal_id"`
				Type  string `json:"type"`
				Name  string `json:"name"`
				URL   string `json:"url"`
			} `json:"entry"`
		} `json:"relations"`
		Theme struct {
			Openings []string `json:"openings"`
			Endings  []string `json:"endings"`
		} `json:"theme"`
		External []struct {
			Name string `json:"name"`
			URL  string `json:"url"`
		} `json:"external"`
		Streaming []struct {
			Name string `json:"name"`
			URL  string `json:"url"`
		} `json:"streaming"`
	} `json:"data"`
}

type GetAnimeResponseImage

type GetAnimeResponseImage struct {
	ImageURL      string `json:"image_url"`
	SmallImageURL string `json:"small_image_url"`
	LargeImageURL string `json:"large_image_url"`
}

type Service

type Service interface {
	GetMedia(ctx context.Context, ids ...string) ([]*domain.AnimeMedia, error)
}

func NewService

func NewService(
	redisClient redis.UniversalClient,
	cacher cacher.Cacher,
	redisTTL configmodels.RedisKeyTTL,
	provider configmodels.ProviderConfig,
) (Service, error)

Jump to

Keyboard shortcuts

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