MalApi.V2 2.0.4

There is a newer version of this package available.
See the version list below for details.
dotnet add package MalApi.V2 --version 2.0.4                
NuGet\Install-Package MalApi.V2 -Version 2.0.4                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="MalApi.V2" Version="2.0.4" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add MalApi.V2 --version 2.0.4                
#r "nuget: MalApi.V2, 2.0.4"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install MalApi.V2 as a Cake Addin
#addin nuget:?package=MalApi.V2&version=2.0.4

// Install MalApi.V2 as a Cake Tool
#tool nuget:?package=MalApi.V2&version=2.0.4                

MyAnimeListApi V2

.NET wrapper for official MyAnimeList API v2

How to generate (official documentaiton)

MalApi provides a helper to generate token.

var url = MalAuthHelper.GetAuthUrl("<CLIENT_ID>");

will return an Auth url, you can paste this in your browser, you'll be prompted to authorize. after authorizing, it will redirected to <YOUR_REDIRECT_URI>?code=<AUTHORIZATION_CODE> copy the AUTHORIZATION_CODE and call

OAuthToken token = await MalAuthHelper.DoAuth("<CLIENT_ID>", "<AUTHORIZATION_CODE>")

this will contain both access and refresh tokens and is valid for 31 days

To refresh the token after expiry, do

OAuthToken token = await MalAuthHelper.RefreshToken("<CLIENT_ID>", "<REFRESH_TOKEN>")

Usage

create instance of MalClient

var client = new MalClient("yourAccessToken");

Get anime

Anime anime = await  client.Anime()
                           .WithId(420420)
                           .Find()

Search anime

PagedAnime anime = await  client.Anime()
                                .WithName("One piece")
                                .Find()

by default only Id,Title,and Image are returned by api to get addition details use WithFields().

Anime anime = await  client.Anime()
                           .WithId(1000)
                           .WithFields("my_list_status")
                           .Find()

Get user anime list

PagedAnime anime = await  client.Anime()
                                .OfUser("Mal_UserName") // if you don't give user name it return list of authenticated user.
                                .Find()

Update anime status

UserAnimeStatus status = await client.Anime()
                                     .WithId(696969) 
                                     .Update()
                                     .WithScore(7)
                                     .WithStatus(AnimeStatus.Watching)
                                     .WithIsRewatching(false)
                                     .WithEpisodesWatched(3)
                                     .WithPriority(1)
                                     .WithRewatchCount(0)
                                     .WithRewatchValue(1)
                                     .WithTags("tags")
                                     .WithComments("comment")
                                     .Publish()

all function between Update() and Publish() are option but you should atleast call one.

Remove from list

bool removed  = await client.Anime()
                            .WithId(12345)
                            .RemoveFromList()
Product Compatible and additional computed target framework versions.
.NET net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on MalApi.V2:

Repository Stars
insomniachi/Totoro
A Windows 10/11 only application that is a go to for all things anime.
Version Downloads Last updated
2.0.8 571 11/27/2022
2.0.7 454 9/25/2022
2.0.6 409 9/22/2022
2.0.5 410 9/22/2022
2.0.4 407 9/21/2022
2.0.3 411 9/10/2022
2.0.2 411 9/10/2022
2.0.1 444 8/14/2022
2.0.0 424 8/4/2022
1.1.4 439 8/3/2022
1.1.3 432 7/28/2022
1.1.2 433 7/28/2022
1.1.1 454 7/27/2022
1.1.0 420 7/24/2022
1.0.0 605 3/14/2021