ColinFL / ShikimoriSharp

shikimori.one API wrapper for C#

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Shikimori API .NET

Nuget .NET Core

API Documentation

https://shikimori.one/api/doc/1.0

OAUTH stuff

https://shikimori.one/oauth

Examples

ShikimoriClient

var client = new ShikimoriSharp(logger, new ClientSettings("ClientName", "ClientID", "ClientSecret"));
var token = client.Client.AuthorizationManager.GetAccessToken("authorizationCode"); //If you need to convert authorization code to access token

Subscribe on token updates, you will probably need to store this somewhere

client.Client.OnNewToken += token => Console.WriteLine($"{token.Access_Token}:{token.RefreshToken}");

Use Shikimori API v1

Example of getting related titles by name

var search = await client.Animes.GetAnime(new AnimeRequestSettings
                                        {
                                            search = "Detective Conan"
                                        });
var id = search.First().Id;
var conan = await client.Animes.GetAnimeById(id);
Console.WriteLine($"Anime {conan.Name}: {conan.Score}");
var related = await client.Animes.GetRelated(id);
Console.WriteLine($"\Related titles");
foreach (var rel in related)
{
      Console.Write(rel.RelationRussian);
      if(!(rel.Anime is null)) Console.WriteLine($" | Anime: {rel.Anime.Name}");
      if (!(rel.Manga is null)) Console.WriteLine($" | Manga: {rel.Manga.Name}");
      Console.WriteLine();
}

About

shikimori.one API wrapper for C#

License:MIT License


Languages

Language:C# 100.0%