kitsu

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: 28 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KitsuSubTypeOVA     = "OVA"
	KitsuSubTypeONA     = "ONA"
	KitsuSubTypeTV      = "TV"
	KitsuSubTypeMOVIE   = "MOVIE"
	KitsuSubTypeMUSIC   = "MUSIC"
	KitsuSubTypeSPECIAL = "SPECIAL"
)
View Source
const (
	KitsuStatusCURRENT  = "CURRENT"
	KitsuStatusFINISHED = "FINISHED"
	KitsuStatusUPCOMING = "UPCOMING"
	KitsuStatusTBA      = "TBA"
)
View Source
const (
	KitsuRelationTypeADAPTATION   = "ADAPTATION"
	KitsuRelationTypePREQUEL      = "PREQUEL"
	KitsuRelationTypeSEQUEL       = "SEQUEL"
	KitsuRelationTypePARENT_STORY = "PARENTSTORY"
	KitsuRelationTypeSIDE_STORY   = "SIDESTORY"
	KitsuRelationTypeSPINOFF      = "SPINOFF"
)
View Source
const (
	KitsuCharacterRoleMAIN       = "MAIN"
	KitsuCharacterRoleSUPPORTING = "SUPPORTING"
)
View Source
const (
	KitsuIncludeTypeAnime              string = "anime"
	KitsuIncludeTypeGenres             string = "genres"
	KitsuIncludeTypeCategories         string = "categories"
	KitsuIncludeTypeMediaRelationships string = "mediarelationships"
	KitsuIncludeTypeManga              string = "manga"
	KitsuIncludeTypeMediaCharacters    string = "mediacharacters"
	KitsuIncludeTypeAnimeProductions   string = "animeproductions"
	KitsuIncludeTypeProducers          string = "producers"
	KitsuIncludeTypeAnimeCharacters    string = "animecharacters"
	KitsuIncludeTypeCharacters         string = "characters"
)
View Source
const (
	KitsuTitleEnglish         string = "en"
	KitsuTitleEnglishJapanese string = "en_jp"
	KitsuTitleNativeJapanese  string = "ja_jp"
	KitsuTitleEnglishChinese  string = "en_cn"
	KitsuTitleNativeChinese   string = "zh_cn"
)

Variables

This section is empty.

Functions

func TransformCharacterRole

func TransformCharacterRole(characterRole string) *enum.CharacterRole

func TransformMedias

func TransformMedias(mediaList Response[[]*AnimeData]) (medias []*domain.AnimeMedia)

func TransformRelationType

func TransformRelationType(relationType string) *enum.AnimeRelationType

func TransformSubtype

func TransformSubtype(subType string) *enum.Format

Types

type AnimeAttributes

type AnimeAttributes struct {
	UpdatedAt           time.Time         `json:"updatedAt,omitempty"`
	CreatedAt           time.Time         `json:"createdAt,omitempty"`
	RatingFrequencies   map[string]string `json:"ratingFrequencies,omitempty"`
	CoverImage          *AnimeImage       `json:"coverImage,omitempty"`
	PosterImage         *AnimeImage       `json:"posterImage,omitempty"`
	TBA                 *string           `json:"tba,omitempty"`
	NextRelease         *string           `json:"nextRelease,omitempty"`
	Titles              map[string]string `json:"titles,omitempty"`
	EndDate             *string           `json:"endDate,omitempty"`
	AgeRatingGuide      string            `json:"ageRatingGuide,omitempty"`
	ShowType            string            `json:"showType,omitempty"`
	YoutubeVideoID      string            `json:"youtubeVideoId,omitempty"`
	Slug                string            `json:"slug,omitempty"`
	StartDate           *string           `json:"startDate,omitempty"`
	CanonicalTitle      string            `json:"canonicalTitle,omitempty"`
	Synopsis            string            `json:"synopsis,omitempty"`
	Description         string            `json:"description,omitempty"`
	Status              *string           `json:"status,omitempty"`
	AgeRating           string            `json:"ageRating,omitempty"`
	AverageRating       string            `json:"averageRating,omitempty"`
	Subtype             *string           `json:"subtype,omitempty"`
	AbbreviatedTitles   []string          `json:"abbreviatedTitles,omitempty"`
	RatingRank          int               `json:"ratingRank,omitempty"`
	PopularityRank      int               `json:"popularityRank,omitempty"`
	CoverImageTopOffset int               `json:"coverImageTopOffset,omitempty"`
	FavoritesCount      int               `json:"favoritesCount,omitempty"`
	EpisodeCount        int               `json:"episodeCount,omitempty"`
	EpisodeLength       int               `json:"episodeLength,omitempty"`
	TotalLength         int               `json:"totalLength,omitempty"`
	UserCount           int               `json:"userCount,omitempty"`
	NSFW                bool              `json:"nsfw,omitempty"`
}

type AnimeCharactersAttributes

type AnimeCharactersAttributes struct {
	CreatedAt *time.Time `json:"createdAt,omitempty"`
	UpdatedAt *time.Time `json:"updatedAt,omitempty"`
	Role      string     `json:"role,omitempty"`
}

type AnimeData

type AnimeData struct {
	Relationships Relationships         `json:"relationships,omitempty"`
	Links         RelationshipItemLinks `json:"links,omitempty"`
	ID            string                `json:"id,omitempty"`
	Type          string                `json:"type,omitempty"`
	Attributes    AnimeAttributes       `json:"attributes,omitempty"`
}

type AnimeImage

type AnimeImage struct {
	Meta     ImageMetadata `json:"meta,omitempty"`
	Tiny     string        `json:"tiny,omitempty"`
	Large    string        `json:"large,omitempty"`
	Small    string        `json:"small,omitempty"`
	Medium   string        `json:"medium,omitempty"`
	Original string        `json:"original,omitempty"`
}

type AnimeProductionAttributes

type AnimeProductionAttributes struct {
	CreatedAt *time.Time `json:"createdAt,omitempty"`
	UpdatedAt *time.Time `json:"updatedAt,omitempty"`
	Role      string     `json:"role,omitempty"`
}

type CategoryAttributes

type CategoryAttributes struct {
	CreatedAt       *time.Time `json:"createdAt,omitempty"`
	UpdatedAt       *time.Time `json:"updatedAt,omitempty"`
	Title           string     `json:"title,omitempty"`
	Description     *string    `json:"description,omitempty"`
	Slug            string     `json:"slug,omitempty"`
	TotalMediaCount int        `json:"totalMediaCount,omitempty"`
	ChildCount      int        `json:"childCount,omitempty"`
	NSFW            bool       `json:"nsfw,omitempty"`
}

type CharacterAttributes

type CharacterAttributes struct {
	Image         CharacterImage    `json:"image,omitempty"`
	CreatedAt     time.Time         `json:"createdAt,omitempty"`
	UpdatedAt     time.Time         `json:"updatedAt,omitempty"`
	Names         map[string]string `json:"names,omitempty"`
	Slug          string            `json:"slug,omitempty"`
	CanonicalName string            `json:"canonicalName,omitempty"`
	Name          string            `json:"name,omitempty"`
	Description   string            `json:"description,omitempty"`
	OtherNames    []string          `json:"otherNames,omitempty"`
	MalID         int               `json:"malId,omitempty"`
}

type CharacterImage

type CharacterImage struct {
	Tiny     string        `json:"tiny,omitempty"`
	Large    string        `json:"large,omitempty"`
	Small    string        `json:"small,omitempty"`
	Medium   string        `json:"medium,omitempty"`
	Original string        `json:"original,omitempty"`
	Meta     ImageMetadata `json:"meta,omitempty"`
}

type Dimensions

type Dimensions struct {
	Width  int `json:"width,omitempty"`
	Height int `json:"height,omitempty"`
}

type ErrorItem

type ErrorItem struct {
	Title  string `json:"title,omitempty"`
	Detail string `json:"detail,omitempty"`
	Code   string `json:"code,omitempty"`
	Status string `json:"status,omitempty"`
}

func (ErrorItem) Error

func (k ErrorItem) Error() string

type GenreAttributes

type GenreAttributes struct {
	CreatedAt   *time.Time `json:"createdAt,omitempty"`
	UpdatedAt   *time.Time `json:"updatedAt,omitempty"`
	Description *string    `json:"description,omitempty"`
	Slug        string     `json:"slug,omitempty"`
	Name        string     `json:"name,omitempty"`
}

type ImageDimensions

type ImageDimensions struct {
	Tiny   *Dimensions `json:"tiny,omitempty"`
	Large  *Dimensions `json:"large,omitempty"`
	Small  *Dimensions `json:"small,omitempty"`
	Medium *Dimensions `json:"medium,omitempty"`
}

type ImageMetadata

type ImageMetadata struct {
	Dimensions ImageDimensions `json:"dimensions,omitempty"`
}

type IncludedItem

type IncludedItem struct {
	Attributes    interface{}        `json:"attributes,omitempty"`
	Links         *IncludedItemLinks `json:"links,omitempty"`
	Relationships *Relationships     `json:"relationships,omitempty"`
	ID            string             `json:"id,omitempty"`
	Type          string             `json:"type,omitempty"`
}

func (*IncludedItem) UnmarshalJSON

func (h *IncludedItem) UnmarshalJSON(b []byte) error
type IncludedItemLinks struct {
	Self string `json:"self"`
}

type MediaCharacterAttributes

type MediaCharacterAttributes struct {
	CreatedAt *time.Time `json:"createdAt,omitempty"`
	UpdatedAt *time.Time `json:"updatedAt,omitempty"`
	Role      string     `json:"role,omitempty"`
}

type MediaRelationshipAttributes

type MediaRelationshipAttributes struct {
	CreatedAt *time.Time `json:"createdAt,omitempty"`
	UpdatedAt *time.Time `json:"updatedAt,omitempty"`
	Role      string     `json:"role,omitempty"`
}

type ProducerAttributes

type ProducerAttributes struct {
	CreatedAt *time.Time `json:"createdAt,omitempty"`
	UpdatedAt *time.Time `json:"updatedAt,omitempty"`
	Slug      string     `json:"slug,omitempty"`
	Name      string     `json:"name,omitempty"`
}

type RelationshipItem

type RelationshipItem[Data any] struct {
	Links *RelationshipItemLinks `json:"links,omitempty"`
	Data  Data                   `json:"data,omitempty"`
}

type RelationshipItemData

type RelationshipItemData struct {
	Type string `json:"type,omitempty"`
	ID   string `json:"id,omitempty"`
}
type RelationshipItemLinks struct {
	Self    *string `json:"self,omitempty"`
	Related *string `json:"related,omitempty"`
}

type Relationships

type Relationships struct {
	Genres             *RelationshipItem[[]*RelationshipItemData] `json:"genres,omitempty"`
	Categories         *RelationshipItem[[]*RelationshipItemData] `json:"categories,omitempty"`
	Castings           *RelationshipItem[[]*RelationshipItemData] `json:"castings,omitempty"`
	Installments       *RelationshipItem[[]*RelationshipItemData] `json:"installments,omitempty"`
	Mappings           *RelationshipItem[[]*RelationshipItemData] `json:"mappings,omitempty"`
	Reviews            *RelationshipItem[[]*RelationshipItemData] `json:"reviews,omitempty"`
	MediaRelationships *RelationshipItem[[]*RelationshipItemData] `json:"mediaRelationships,omitempty"`
	Staff              *RelationshipItem[[]*RelationshipItemData] `json:"staff,omitempty"`
	Productions        *RelationshipItem[[]*RelationshipItemData] `json:"productions,omitempty"`
	Quotes             *RelationshipItem[[]*RelationshipItemData] `json:"quotes,omitempty"`
	Episodes           *RelationshipItem[[]*RelationshipItemData] `json:"episodes,omitempty"`
	StreamingLinks     *RelationshipItem[[]*RelationshipItemData] `json:"streamingLinks,omitempty"`
	AnimeProductions   *RelationshipItem[[]*RelationshipItemData] `json:"animeProductions,omitempty"`
	AnimeCharacters    *RelationshipItem[[]*RelationshipItemData] `json:"animeCharacters,omitempty"`
	AnimeStaff         *RelationshipItem[[]*RelationshipItemData] `json:"animeStaff,omitempty"`
	Source             *RelationshipItem[[]*RelationshipItemData] `json:"source,omitempty"`
	Character          *RelationshipItem[*RelationshipItemData]   `json:"character,omitempty"`
	Destination        *RelationshipItem[*RelationshipItemData]   `json:"destination,omitempty"`
	Producer           *RelationshipItem[*RelationshipItemData]   `json:"producer,omitempty"`
}

type Response

type Response[Data any] struct {
	Data     Data            `json:"data,omitempty"`
	Included []*IncludedItem `json:"included,omitempty"`
	Errors   []*ErrorItem    `json:"error,omitempty"`
}

type Service

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

func NewService

func NewService(
	cacher cacher.Cacher,
	redisTTL configmodels.RedisKeyTTL,
	provider configmodels.ProviderConfig,
) Service

Jump to

Keyboard shortcuts

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