kitsu

package module
v0.0.0-...-d9f79d2 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2017 License: GPL-3.0 Imports: 7 Imported by: 0

README

Go Report Card

kitsu-go

Interact with the kitsu.io api using Go

Install

go get github.com/KurozeroPB/kitsu-go

Usage

Simple example usage:

package main

import (
  "fmt"

  "github.com/KurozeroPB/kitsu-go"
)

func main() {
  // Example to search for an anime
  anime, e := kitsu.SearchAnime("fate/apocrypha", 0)
  if e != nil {
    fmt.Println(e)
    return
  }
  fmt.Println(anime.Attributes.PosterImage.Original)
}

Docs

SearchAnime(query, offset)
Parameter Type Description
query string The anime you want to search
offset int Page offset
SearchManga(query, offset)
Parameter Type Description
query string The manga you want to search
offset int Page offset
SearchCharacter(query)
Parameter Type Description
query string The name of the character you want to search for
SearchProducer(query)
Parameter Type Description
query string The name of the producer you want to search for
SearchUser(query)
Parameter Type Description
query string The name of the user you want to search for
SearchDrama(query)
Parameter Type Description
query string The drama you want to search

There are currently no dramas on kitsu so this will return an error until they add dramas to the website.

GetAnime(id)
Parameter Type Description
id int The id of the anime you want to get
GetManga(id)
Parameter Type Description
id int The id of the manga you want to get
GetUser(id)
Parameter Type Description
id int The id of the user you want to get
GetStats(id)
Parameter Type Description
id int The id of the user you want to get the stats from

TODO

  1. Manga search
  2. Character search
  3. Producers search
  4. Users search
  5. Drama search
  6. Get anime by id
  7. Get manga by id
  8. Get user by id
  9. Get user stats by id

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 `json:"id"`
	Type  string `json:"type"`
	Links struct {
		Self string `json:"self"`
	} `json:"links"`
	Attributes struct {
		TBA               string   `json:"tba"`
		AbbreviatedTitles []string `json:"abbreviatedTitles"`
		AverageRating     string   `json:"averageRating"`
		Status            string   `json:"status"`
		AgeRating         string   `json:"ageRating"`
		Subtype           string   `json:"subtype"`
		CanonicalTitle    string   `json:"canonicalTitle"`
		EpisodeLength     int      `json:"episodeLength"`
		CoverImage        struct {
			Original string `json:"original"`
			Tiny     string `json:"tiny"`
			Small    string `json:"small"`
			Large    string `json:"large"`
		} `json:"coverImage"`
		Slug   string `json:"slug"`
		Titles struct {
			EnJp string `json:"en_jp"`
			JaJp string `json:"ja_jp"`
		} `json:"titles"`
		AgeRatingGuide string `json:"ageRatingGuide"`
		StartDate      string `json:"startDate"`
		EpisodeCount   int    `json:"episodeCount"`
		FavoritesCount int    `json:"favoritesCount"`
		NSFW           bool   `json:"nsfw"`
		EndDate        string `json:"endDate"`
		RatingRank     int    `json:"ratingRank"`
		PosterImage    struct {
			Tiny     string `json:"tiny"`
			Small    string `json:"small"`
			Medium   string `json:"medium"`
			Large    string `json:"large"`
			Original string `json:"original"`
		} `json:"posterImage"`
		Synopsis       string `json:"synopsis"`
		ShowType       string `json:"showType"`
		UserCount      int    `json:"userCount"`
		PopularityRank int    `json:"popularityRank"`
	} `json:"attributes"`
	YoutubeVideoID string `json:"youtubeVideoId"`
}

Anime struct with all the anime data from kitsu

func SearchAnime

func SearchAnime(query string, offset int) (*Anime, error)

SearchAnime search for an anime on kitsu.io query being the anime to search for offset being the page offset

type AnimeByID

type AnimeByID struct {
	ID    string `json:"id"`
	Type  string `json:"type"`
	Links struct {
		Self string `json:"self"`
	} `json:"links"`
	Attributes struct {
		TBA               string   `json:"tba"`
		AbbreviatedTitles []string `json:"abbreviatedTitles"`
		AverageRating     string   `json:"averageRating"`
		Status            string   `json:"status"`
		AgeRating         string   `json:"ageRating"`
		Subtype           string   `json:"subtype"`
		CanonicalTitle    string   `json:"canonicalTitle"`
		EpisodeLength     int      `json:"episodeLength"`
		CoverImage        struct {
			Original string `json:"original"`
			Tiny     string `json:"tiny"`
			Small    string `json:"small"`
			Large    string `json:"large"`
		} `json:"coverImage"`
		Slug   string `json:"slug"`
		Titles struct {
			En   string `json:"en"`
			EnJp string `json:"en_jp"`
			JaJp string `json:"ja_jp"`
		} `json:"titles"`
		AgeRatingGuide string `json:"ageRatingGuide"`
		StartDate      string `json:"startDate"`
		EpisodeCount   int    `json:"episodeCount"`
		FavoritesCount int    `json:"favoritesCount"`
		NSFW           bool   `json:"nsfw"`
		EndDate        string `json:"endDate"`
		RatingRank     int    `json:"ratingRank"`
		PosterImage    struct {
			Tiny     string `json:"tiny"`
			Small    string `json:"small"`
			Medium   string `json:"medium"`
			Large    string `json:"large"`
			Original string `json:"original"`
		} `json:"posterImage"`
		Synopsis       string `json:"synopsis"`
		ShowType       string `json:"showType"`
		UserCount      int    `json:"userCount"`
		PopularityRank int    `json:"popularityRank"`
	} `json:"attributes"`
	YoutubeVideoID string `json:"youtubeVideoId"`
}

AnimeByID holds the data from searching an anime by the id

func GetAnime

func GetAnime(id int) (*AnimeByID, error)

GetAnime will fetch an anime with the given id from kitsu.io id of course being the id

type Character

type Character struct {
	ID    string `json:"id"`
	Type  string `json:"type"`
	Links struct {
		Self string `json:"self"`
	} `json:"links"`
	Attributes struct {
		CreatedAt   string `json:"createdAt"`
		UpdatedAt   string `json:"updatedAt"`
		Slug        string `json:"slug"`
		Name        string `json:"name"`
		MalID       int    `json:"malId"`
		Description string `json:"description"`
		Image       struct {
			Original string `json:"original"`
		}
	} `json:"attributes"`
}

Character struct with all the character data from kitsu

func SearchCharacter

func SearchCharacter(query string) (*Character, error)

SearchCharacter search for a character on kitsu.io query being the character to search for

type Drama

type Drama struct {
	ID    string `json:"id"`
	Type  string `json:"type"`
	Links struct {
		Self string `json:"self"`
	} `json:"links"`
	Attributes struct {
		CreatedAt string `json:"createdAt"`
		UpdatedAt string `json:"updatedAt"`
		Slug      string `json:"slug"`
		Synopsis  string `json:"synopsis"`
		Titles    struct {
			En   string `json:"en"`
			EnJp string `json:"en_jp"`
			JaJp string `json:"ja_jp"`
		} `json:"titles"`
		CanonicalTitle    string   `json:"canonicalTitle"`
		AbbreviatedTitles []string `json:"abbreviatedTitles"`
		AverageRating     string   `json:"averageRating"`
		UserCount         int      `json:"userCount"`
		FavoritesCount    int      `json:"favoritesCount"`
		StartDate         string   `json:"startDate"`
		EndDate           string   `json:"endDate"`
		PopularityRank    int      `json:"popularityRank"`
		RatingRank        int      `json:"ratingRank"`
		AgeRating         string   `json:"ageRating"`
		AgeRatingGuide    string   `json:"ageRatingGuide"`
		SubType           string   `json:"subType"`
		Status            string   `json:"status"`
		PosterImage       struct {
			Tiny     string `json:"tiny"`
			Small    string `json:"small"`
			Medium   string `json:"medium"`
			Large    string `json:"large"`
			Original string `json:"original"`
		} `json:"posterImage"`
		CoverImage struct {
			Tiny     string `json:"tiny"`
			Small    string `json:"small"`
			Large    string `json:"large"`
			Original string `json:"original"`
		} `json:"coverImage"`
		EpisodeCount   int    `json:"episodeCount"`
		EpisodeLength  int    `json:"episodeLength"`
		YoutubeVideoID string `json:"youtubeVideoId"`
		NSFW           bool   `json:"nsfw"`
	} `json:"attributes"`
	Relationships struct{} `json:"relationships"`
}

Drama struct with all the drama data from kitsu

func SearchDrama

func SearchDrama(query string) (*Drama, error)

SearchDrama search for a drama on kitsu.io query being the producer to search for

type Manga

type Manga struct {
	ID    string `json:"id"`
	Type  string `json:"type"`
	Links struct {
		Self string `json:"self"`
	} `json:"links"`
	Attributes struct {
		CreatedAt string `json:"createdAt"`
		UpdatedAt string `json:"updatedAt"`
		Slug      string `json:"slug"`
		Synopsis  string `json:"synopsis"`
		Titles    struct {
			En   string `json:"en"`
			EnJp string `json:"en_jp"`
			JaJp string `json:"ja_jp"`
		} `json:"titles"`
		CanonicalTitle    string   `json:"canonicalTitle"`
		AbbreviatedTitles []string `json:"abbreviatedTitles"`
		AverageRating     string   `json:"averageRating"`
		UserCount         int      `json:"userCount"`
		FavoritesCount    int      `json:"favoritesCount"`
		StartDate         string   `json:"startDate"`
		EndDate           string   `json:"endDate"`
		PopularityRank    int      `json:"popularityRank"`
		RatingRank        int      `json:"ratingRank"`
		AgeRating         string   `json:"ageRating"`
		AgeRatingGuide    string   `json:"ageRatingGuide"`
		Subtype           string   `json:"subtype"`
		Status            string   `json:"status"`
		TBA               string   `json:"tba"`
		PosterImage       struct {
			Tiny     string `json:"tiny"`
			Small    string `json:"small"`
			Medium   string `json:"medium"`
			Large    string `json:"large"`
			Original string `json:"original"`
		} `json:"posterImage"`
		CoverImage struct {
			Tiny     string `json:"tiny"`
			Small    string `json:"small"`
			Large    string `json:"large"`
			Original string `json:"original"`
		} `json:"coverImage"`

		ChapterCount  int    `json:"chapterCount"`
		VolumeCount   int    `json:"volumeCount"`
		Serialization string `json:"serialization"`
		MangaType     string `json:"mangaType"`
	} `json:"attributes"`
}

Manga struct with all the manga data from kitsu

func SearchManga

func SearchManga(query string, offset int) (*Manga, error)

SearchManga search for a manga on kitsu.io query being the manga to search for offset being the page offset

type MangaByID

type MangaByID struct {
	ID    string `json:"id"`
	Type  string `json:"type"`
	Links struct {
		Self string `json:"self"`
	} `json:"links"`
	Attributes struct {
		CreatedAt string `json:"createdAt"`
		UpdatedAt string `json:"updatedAt"`
		Slug      string `json:"slug"`
		Synopsis  string `json:"synopsis"`
		Titles    struct {
			En   string `json:"en"`
			EnJp string `json:"en_jp"`
			JaJp string `json:"ja_jp"`
		} `json:"titles"`
		CanonicalTitle    string   `json:"canonicalTitle"`
		AbbreviatedTitles []string `json:"abbreviatedTitles"`
		AverageRating     string   `json:"averageRating"`
		UserCount         int      `json:"userCount"`
		FavoritesCount    int      `json:"favoritesCount"`
		StartDate         string   `json:"startDate"`
		EndDate           string   `json:"endDate"`
		PopularityRank    int      `json:"popularityRank"`
		RatingRank        int      `json:"ratingRank"`
		AgeRating         string   `json:"ageRating"`
		AgeRatingGuide    string   `json:"ageRatingGuide"`
		Subtype           string   `json:"subtype"`
		Status            string   `json:"status"`
		TBA               string   `json:"tba"`
		PosterImage       struct {
			Tiny     string `json:"tiny"`
			Small    string `json:"small"`
			Medium   string `json:"medium"`
			Large    string `json:"large"`
			Original string `json:"original"`
		} `json:"posterImage"`
		CoverImage struct {
			Tiny     string `json:"tiny"`
			Small    string `json:"small"`
			Large    string `json:"large"`
			Original string `json:"original"`
		} `json:"coverImage"`

		ChapterCount  int    `json:"chapterCount"`
		VolumeCount   int    `json:"volumeCount"`
		Serialization string `json:"serialization"`
		MangaType     string `json:"mangaType"`
	} `json:"attributes"`
}

MangaByID holds the data from searching a manga by the id

func GetManga

func GetManga(id int) (*MangaByID, error)

GetManga will fetch a manga with the given id from kitsu.io id of course being the id

type Producers

type Producers struct {
	ID    string `json:"id"`
	Type  string `json:"type"`
	Links struct {
		Self string `json:"self"`
	} `json:"links"`
	Attributes struct {
		CreatedAt string `json:"createdAt"`
		UpdatedAt string `json:"updatedAt"`
		Slug      string `json:"slug"`
		Name      string `json:"name"`
	} `json:"attributes"`
	Relationships struct {
		AnimeProductions struct {
			Links struct {
				Self    string `json:"self"`
				Related string `json:"related"`
			} `json:"links"`
		} `json:"animeProductions"`
	} `json:"relationships"`
}

Producers struct with all the producers data from kitsu

func SearchProducer

func SearchProducer(query string) (*Producers, error)

SearchProducer search for a producer on kitsu.io query being the producer to search for

type Stats

type Stats struct {
	ID    string `json:"id"`
	Type  string `json:"type"`
	Links struct {
		Self string `json:"self"`
	} `json:"links"`
	Attributes struct {
		CreatedAt string `json:"createdAt"`
		UpdatedAt string `json:"updatedAt"`
		Kind      string `json:"kind"`
		StatsData struct {
			Total         int      `json:"total"`
			TotalMedia    int      `json:"total_media"`
			Activity      []string `json:"activity"`
			AllCategories struct {
				War   int `json:"war"`
				Asia  int `json:"asia"`
				Cops  int `json:"cops"`
				Idol  int `json:"idol"`
				Mars  int `json:"mars"`
				Navy  int `json:"navy"`
				Past  int `json:"past"`
				Alien int `json:"alien"`
				Angel int `json:"angel"`
				Angst int `json:"angst"`
				China int `json:"china"`
				Crime int `json:"crime"`
				Deity int `json:"deity"`
				Demon int `json:"demon"`
			} `json:"all_categories"`
			AllTime struct {
				TotalTime     int `json:"total_time"`
				TotalMedia    int `json:"total_media"`
				TotalProgress int `json:"total_progress"`
			} `json:"all_time"`
			AllYears struct{} `json:"all_years"`
		} `json:"statsData"`
	} `json:"attributes"`
	Relationships struct{} `json:"relationships"`
}

Stats struct with all the stats from the user

func GetStats

func GetStats(id int) (*Stats, error)

GetStats get the stats of a user by his/her id from kitsu.io id of course being the id

type User

type User struct {
	ID    string `json:"id"`
	Type  string `json:"type"`
	Links struct {
		Self string `json:"self"`
	} `json:"links"`
	Attributes struct {
		CreatedAt           string   `json:"createdAt"`
		UpdatedAt           string   `json:"updatedAt"`
		Name                string   `json:"name"`
		PastNames           []string `json:"pastNames"`
		Slug                string   `json:"slug"`
		About               string   `json:"about"`
		Location            string   `json:"location"`
		WaifuOrHusbando     string   `json:"waifuOrHusbando"`
		FollowersCount      int      `json:"followersCount"`
		FollowingCount      int      `json:"followingCount"`
		LifeSpentOnAnime    int      `json:"lifeSpentOnAnime"`
		Birthday            string   `json:"birthday"`
		Gender              string   `json:"gender"`
		CommentsCount       int      `json:"commentsCount"`
		FavoritesCount      int      `json:"favoritesCount"`
		LikesGivenCount     int      `json:"likesGivenCount"`
		ReviewsCount        int      `json:"reviewsCount"`
		LikesReceivedCount  int      `json:"likesReceivedCount"`
		PostsCount          int      `json:"postsCount"`
		RatingsCount        int      `json:"ratingsCount"`
		MediaReactionsCount int      `json:"mediaReactionsCount"`
		ProExpiresAt        string   `json:"proExpiresAt"`
		Title               string   `json:"title"`
		ProfileCompleted    bool     `json:"profileCompleted"`
		FeedCompleted       bool     `json:"feedCompleted"`
		Website             string   `json:"website"`
		Avatar              struct {
			Tiny     string `json:"tiny"`
			Small    string `json:"small"`
			Medium   string `json:"medium"`
			Large    string `json:"large"`
			Original string `json:"original"`
		} `json:"avatar"`
		CoverImage struct {
			Tiny     string `json:"tiny"`
			Small    string `json:"small"`
			Large    string `json:"large"`
			Original string `json:"original"`
		} `json:"coverImage"`
		RatingSystem string `json:"ratingSystem"`
		Theme        string `json:"theme"`
		FacebookID   string `json:"facebookId"`
	} `json:"attributes"`
	Relationships struct{} `json:"relationships"` // Relationships can contain different stuff for everyone
}

User struct with all the user's data from kitsu

func SearchUser

func SearchUser(query string) (*User, error)

SearchUser search for a user on kitsu.io query being the user to search for

type UserByID

type UserByID struct {
	ID    string `json:"id"`
	Type  string `json:"type"`
	Links struct {
		Self string `json:"self"`
	} `json:"links"`
	Attributes struct {
		CreatedAt           string   `json:"createdAt"`
		UpdatedAt           string   `json:"updatedAt"`
		Name                string   `json:"name"`
		PastNames           []string `json:"pastNames"`
		Slug                string   `json:"slug"`
		About               string   `json:"about"`
		Location            string   `json:"location"`
		WaifuOrHusbando     string   `json:"waifuOrHusbando"`
		FollowersCount      int      `json:"followersCount"`
		FollowingCount      int      `json:"followingCount"`
		LifeSpentOnAnime    int      `json:"lifeSpentOnAnime"`
		Birthday            string   `json:"birthday"`
		Gender              string   `json:"gender"`
		CommentsCount       int      `json:"commentsCount"`
		FavoritesCount      int      `json:"favoritesCount"`
		LikesGivenCount     int      `json:"likesGivenCount"`
		ReviewsCount        int      `json:"reviewsCount"`
		LikesReceivedCount  int      `json:"likesReceivedCount"`
		PostsCount          int      `json:"postsCount"`
		RatingsCount        int      `json:"ratingsCount"`
		MediaReactionsCount int      `json:"mediaReactionsCount"`
		ProExpiresAt        string   `json:"proExpiresAt"`
		Title               string   `json:"title"`
		ProfileCompleted    bool     `json:"profileCompleted"`
		FeedCompleted       bool     `json:"feedCompleted"`
		Website             string   `json:"website"`
		Avatar              struct {
			Tiny     string `json:"tiny"`
			Small    string `json:"small"`
			Medium   string `json:"medium"`
			Large    string `json:"large"`
			Original string `json:"original"`
		} `json:"avatar"`
		CoverImage struct {
			Tiny     string `json:"tiny"`
			Small    string `json:"small"`
			Large    string `json:"large"`
			Original string `json:"original"`
		} `json:"coverImage"`
		RatingSystem string `json:"ratingSystem"`
		Theme        string `json:"theme"`
		FacebookID   string `json:"facebookId"`
	} `json:"attributes"`
	Relationships struct{} `json:"relationships"`
}

UserByID struct with all the user's data from kitsu

func GetUser

func GetUser(id int) (*UserByID, error)

GetUser get a user by his/her id from kitsu.io id of course being the id

Jump to

Keyboard shortcuts

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