Categorygithub.com/kaiserbh/anilistgo
modulepackage
0.1.4
Repository: https://github.com/kaiserbh/anilistgo.git
Documentation: pkg.go.dev

# README

anilistgo wrapper

Go Reference Go Report Card

Most of the functionality is good to go for querying media from Anilist and Mutation such as adding media to the list or removing it. However there are still some left such as Threads, Reviews.

Anilist is an online manga/anime database and social networking service More information on Anilist can be found here : anilist

INSTALLATION

go get github.com/kaiserbh/anilistgo

Examples

Query

Character Query

import "github.com/kaiserbh/anilistgo"
c := anilistgo.NewCharacterQuery()

ok, err := c.FilterCharacterByName("Nezuko")
if err != nil{
	panic(err)
}

// ok is optional basically a boolean for further use cases.
if ok{ 
	fmt.Printf("%+v\n", c)
}
	
// can do this as well without ok variable.
import "github.com/kaiserbh/anilistgo"
c := anilistgo.NewCharacterQuery()

_, err := c.FilterCharacterByName("Nezuko-channnnnn")
if err != nil{
	panic(err)
}

fmt.Printf("%+v\n", c)

User Query

import "github.com/kaiserbh/anilistgo"
u := anilistgo.NewUserQuery()

ok, err : = u.FilterUserByID(197690)
if err != nil{
	panic(err)
}

// ok is optional basically a boolean for further use cases.
if ok{
fmt.Printf("%+v\n", u)
}

// can do this as well without ok variable.
import "github.com/kaiserbh/anilistgo"
u := NewUserQuery

_, err : = u.FilterUserByID(197690)
if err != nil{
	panic(err)
}

fmt.Printf("%+v\n", u)

Media Query

import "github.com/kaiserbh/anilistgo"
m := NewMediaQuery()

ok, err := m.FilterByID(1)
if err != nil{
	panic(err)
}

// ok is optional basically a boolean for further use cases.
if ok{
fmt.Printf("%+v\n", m)
}

// can do this as well without ok variable.
import "github.com/kaiserbh/anilistgo"
m := NewMediaQuery()

_, err := m.FilterByID(1)
if err != nil{
	panic(err)
}

fmt.Printf("%+v\n", u)
  

Page Query

import "github.com/kaiserbh/anilistgo"
p := NewPageQuery()

ok, err := p.PaginationByTitle("Attack on Titan", 1, 10) // takes title, page number, and per page amount
if err != nil{
	panic(err)
}

// ok is optional basically a boolean for further use cases.
if ok{
fmt.Printf("%+v\n", p)
}

Mediatrend

import "github.com/kaiserbh/anilistgo"
mt := NewMediaTrendQuery()
ok,err := mt.SearchByMediaID(1)
if err != nil{
	panic(err)
}
if ok{
    fmt.Printf("%+v\n", mt)
}
  

Staff query

import "github.com/kaiserbh/anilistgo"
s := NewStaffQuery()

ok, err := s.FilterStaffByName("Hideaki Sorachi")
if err  != nil {
	panic(err)
}

if ok{
	fmt.Printf("%+v\n", s)
}

Mutation

UserMediaList requires Auth/Token

import  "github.com/kaiserbh/anilistgo"
authKey := "long ass string"
ok, err := anilistgo.SaveMediaListEntry(1, "CURRENT", 0, authKey)
if err != nil{
	panic(err)
}
if ok{
	log.Info("succesfully updated uwu")
}

updateUser requires Auth/Token

import "github.com/kaiserbh/anilistgo"
authKey := "long ass string"

ok, err := anilist.UpdateUserAbout("uwu I love anime", authKey)
if err != nil{
    panic(err)
}
if ok{
    log.Info("succesfully updated uwu")
}

Notes

You will need auth token for some of the methods to work to get your own token feel free to use https://anilist.co/api/v2/oauth/authorize?client_id=4684&response_type=token

Docs

Documentation

# Functions

CleanCharacterJSON cleans the html body.
CleanMediaTrendPageJSON cleans the html.
CleanPageJSON cleans the html body.
CleanStaffJSON cleans the html body.
CleanStudioJSON cleans the html body.
CleanUserJSON cleans the html body.
CleanUserListJSON clean the body for the usermedialist.
DeleteCustomLisAnime Delete a custom list and remove the list entries from it.
DeleteCustomListManga Delete a custom list and remove the list entries from it.
DeleteMediaListEntry Delete a media list entry just provide media ID it will then be converted to the mediaList ID id: Int The id of the media list entry to delete */.
NewCharacterQuery creates Character objects.
NewMediaQuery creates Media objects.
NewMediaTrendQuery Create new NewMediaTrend Object.
NewPageQuery Create new NewMediaTrend Object.
NewStaffQuery Create new Staff Object.
NewStudioQuery Create new Studio Object.
NewUserMediaListQuery Create new MediaListEntry Object.
NewUserQuery Create new User Object.
PostRequest sends POST request that takes []byte as parameter then returns back html Body as []byte.
PostRequestAuth Request with token and auth token can be retrieved from anilist.
ResetTheme will reset theme to default values which is "list" if encounter anime list that can't be shown even when the list is not big try using this.
SaveMediaListEntry create or update a media list SaveMediaListEntry mediaId: Int The id of the media the entry is of status: MediaListStatus The watching/reading status CURRENT Currently watching/reading PLANNING Planning to watch/read COMPLETED Finished watching/reading DROPPED Stopped watching/reading before completing PAUSED Paused watching/reading REPEATING Re-watching/reading progress: Int The amount of episodes/chapters consumed by the user */.
SaveMediaListEntryAddNotes Create or update a media list entry notes: String Text notes add notes to the media */.
SaveMediaListEntryPrivate Create or update a media list entry private: Boolean If the entry should only be visible to authenticated user */.
SaveMediaListEntryProgressVolume Create or update a media list entry progressVolumes: Int The amount of volumes read by the user */.
SaveMediaListEntryWithRepeat Create or update a media list entry repeat: Int The amount of times the user has rewatched/read the media */.
SaveMediaListEntryWithScore Create or update a media list entry score: Float The score of the media in the user's chosen scoring method */.
SaveMediaListEntryWithScoreRaw Create or update a media list entry scoreRaw: Int The score of the media in 100 point */.
UpdateUserAbout User's about/bio text.
UpdateUserAdultContent If the user should see media marked as adult-only boolean.
UpdateUserAdvancedScoring The names of the user's advanced scoring sections.
UpdateUserAdvancedScoringEnabled If advanced scoring is enabled.
UpdateUserAiringNotification If the user should get notifications when a show they are watching aires.
UpdateUserAnimeListOptionsCustomLists The names of the user's custom lists.
UpdateUserAnimeListOptionSectionOrder A user's list options for anime or manga lists.
UpdateUserAnimeListOptionSplitCompletedSectionByFormat If the completed sections of the list should be separated by format.
UpdateUserMangaListOptionsCustomLists The names of the user's custom lists.
UpdateUserMangaListOptionSplitCompletedSectionByFormat If the completed sections of the list should be separated by format.
UpdateUserMangaListOptionsSectionOrder A user's list options for anime or manga lists.
UpdateUserNotificationOption The user's Notification options ACTIVITY_MESSAGEA user has sent you message ACTIVITY_REPLYA user has replied to your activity FOLLOWINGA user has followed you ACTIVITY_MENTIONA user has mentioned you in their activity THREAD_COMMENT_MENTIONA user has mentioned you in a forum comment THREAD_SUBSCRIBEDA user has commented in one of your subscribed forum threads THREAD_COMMENT_REPLYA user has replied to your forum comment AIRINGAn anime you are currently watching has aired ACTIVITY_LIKEA user has liked your activity ACTIVITY_REPLY_LIKEA user has liked your activity reply THREAD_LIKEA user has liked your forum thread THREAD_COMMENT_LIKEA user has liked your forum comment ACTIVITY_REPLY_SUBSCRIBEDA user has replied to activity you have also replied to RELATED_MEDIA_ADDITIONA new anime or manga has been added to the site where its related media is on the user's list.
UpdateUserProfileColor The user's Profile highlight color: blue, purple, green, orange, red, pink.
UpdateUserRowOrder The user's default list order such as Score, title, last updated, last added.
UpdateUserScoreFormat The user's list scoring system/Media list scoring type such as POINT_100, POINT_10_DECIMAL, POINT_10, POINT_5, POINT_3.
UpdateUserTitleLanguage User's title language; The language the user wants to see media titles in such asROMAJI, ENGLISH, NATIVE, ROMAJI_STYLISED, ENGLISH_STYLISED, NATIVE_STYLISED.

# Constants

CharacterQuery graphql constant for CharacterQuery.
MediaQuery Query Constant what will be posted to the api and send as post request.
MediaTrendQuery graphql constant for MediaTrendQuery.
StaffQuery graphql constant for StaffQuery.
StudioQuery constant of data we are querying against anilist apu.

# Structs

AiringSchedule Media Airing Schedule.
AiringScheduleConnection connection for AiringSchedule.
AiringScheduleEdge AiringSchedule connection edge.
Character A character that features in an anime or manga.
CharacterConnection connection for Character.
CharacterEdge Character connection edge.
CharacterImage of the characters Large or Medium.
CharacterName The names of the character.
CoverImage of the anime ExtraLarge, Large, Medium, and Color for some reason.
Favourites User's favourite anime, manga, characters, staff & studios.
FuzzyDate date type that's being used widely.
Media Anime or Manga.
MediaConnection stores edges, nodes, and pageInfo for MediaConnection.
MediaEdge Media connection edge.
MediaExternalLinks An external link to another site related to the media.
MediaListEntry The authenticated user's media list entry for the media.
MediaListOptions options for MediaList.
MediaListTypeOptions A user's list options for anime or manga lists.
MediaRank The ranking of a media in a particular time span and format compared to other media.
MediaStats of the current anime array of Score such as 10, 20, 30, 100 tells you how many people scored it such and Status such as PLANNING, WATCHING, DROPPED.
MediaStreamingEpisode Data and links to legal streaming episodes on external sites.
MediaTag A tag that describes a theme or element of the media.
MediaTrend Daily Media Statistics.
MediaTrendConnection holds Edges, Nodes, and PageInfo.
MediaTrendEdge trend connection edge.
NotificationOption Notification option.
Page Page of data.
PageInfo represents the information regarding the Page of Anilist query.
Recommendation Media recommendation.
RecommendationConnection holds Edges, Nodes, and PageInfo.
RecommendationEdge Recommendation connection edge.
Review A Review that features in an anime or manga.
ReviewConnection holds Edges, Nodes, and PageInfo of ReviewConnection.
ReviewEdge Review connection edge.
ScoreDistribution A user's list score distribution.
Staff Voice actors or production staff.
StaffConnection holds Edges, Nodes and PageInfo of StaffConnection.
StaffEdge Staff connection edge.
StaffImage of the staff Large or Medium.
StaffName The names of the staff member.
StaffRoleType Voice actor role for a character.
StatusDistribution The distribution of the watching/reading status of media or a user's list.
Studio Animation or production company.
StudioConnection holds Edges, Nodes, and PageInfo of StudioConnection.
StudioEdge Studio connection edge.
Title object that has Romaji, English, Native and UserPreffered if they are given.
Trailer contains YouTube Unique code to the video.
User query for Anilist.
UserAvatar Images Large and medium size.
UserCountryStatistic holds the stats of Country which country the anime/manga user watched from contains: "JP" == Japan, "CN" == China and etc.
UserFormatStatistic holds the stats of type format such as : TV, MOVIE, OVA, ONA etc.
UserGenreStatistic holds the stats of Genre such as : Action, Comedy, Fantasy, Adventure etc.
UserLengthStatistic holds the stats of type Length such as : 7-16 minutes, 101+, 1, 29-55.
UserOptions A user's general options.
UserReleaseYearStatistic holds the stats of type ReleaseYear such as : 2020, 2019, 2018 returns the score and MediaIds.
UserScoreStatistic holds the stats of type Score such as : 70, 80, 75 basically any scores made and it will return the count meanScore and mediaIds.
UserStaffStatistic holds the stats of Staff such as the count or how many anime they have worked on etc.
UserStartYearStatistic holds the stats of StartYear such as : 2020, 2019, 2018 returns the score and MediaIds.
UserStatistics holds information about user stats what they watched or read and scores etc.
UserStatisticTypes holds user statistics anime|manga.
UserStatusStatistic holds the stats of type Status such as : COMPLETED, PLANNING, CURRENT, and PAUSED.
UserStudioStatistic holds the stats of Studio such as the count or how many anime the user watched of this particular studio and what are their ratings for the anime etc.
UserTagStatistic holds the stats of Tag users tags such as; Male Protagonist, Shounen, Super Power etc.
UserVoiceActorStatistic holds the stats of VoiceActor such as the count or how many anime they have voiced in the user anime stats.