public void GetAnimeListForNonexistentUserThrowsCorrectException() { using (MyAnimeListApi api = new MyAnimeListApi()) { Assert.Throws <MalUserNotFoundException>(() => api.GetAnimeListForUser("oijsfjisfdjfsdojpfsdp")); } }
static void Main(string[] args) { // No logging support for MalApi in .NET Core yet. // At this time there is no Common.Logging adapter for NLog that supports .NET core. using (MyAnimeListApi api = new MyAnimeListApi()) { api.UserAgent = "MalApiExample"; api.TimeoutInMs = 15000; MalUserLookupResults userLookup = api.GetAnimeListForUser("LordHighCaptain"); foreach (MyAnimeListEntry listEntry in userLookup.AnimeList) { Console.WriteLine("Rating for {0}: {1}", listEntry.AnimeInfo.Title, listEntry.Score); } Console.WriteLine(); Console.WriteLine(); RecentUsersResults recentUsersResults = api.GetRecentOnlineUsers(); foreach (string user in recentUsersResults.RecentUsers) { Console.WriteLine("Recent user: {0}", user); } Console.WriteLine(); Console.WriteLine(); int eurekaSevenID = 237; AnimeDetailsResults eurekaSeven = api.GetAnimeDetails(eurekaSevenID); Console.WriteLine("Eureka Seven genres: {0}", string.Join(", ", eurekaSeven.Genres)); } }
static void Main(string[] args) { // MalApi uses the Common.Logging logging abstraction. // You can hook it up to any logging library that has a Common.Logging adapter. // See App.config for an example of hooking up MalApi to NLog. // Note that you will also need the appropriate NLog and Common.Logging.NLogXX packages installed. // Hooking up logging is not necessary but can be useful. // With the configuration in this example and with this example program, you will see lines like: // Logged from MalApi: Getting anime list for MAL user LordHighCaptain using URI https://myanimelist.net/malappinfo.php?status=all&type=anime&u=LordHighCaptain // Logged from MalApi: Successfully retrieved anime list for user LordHighCaptain using (MyAnimeListApi api = new MyAnimeListApi()) { api.UserAgent = "MalApiExample"; api.TimeoutInMs = 15000; var animeUpdateInfo = new AnimeUpdate() { Episode = 26, Status = AnimeCompletionStatus.Completed, Score = 9, }; string userUpdateAnime = api.UpdateAnimeForUser(1, animeUpdateInfo, "user", "password"); var mangaUpdateInfo = new MangaUpdate() { Chapter = 20, Volume = 3, Score = 8, Status = MangaCompletionStatus.Completed }; string userUpdateManga = api.UpdateMangaForUser(952, mangaUpdateInfo, "user", "password"); MalUserLookupResults userLookup = api.GetAnimeListForUser("user"); foreach (MyAnimeListEntry listEntry in userLookup.AnimeList) { Console.WriteLine("Rating for {0}: {1}", listEntry.AnimeInfo.Title, listEntry.Score); } Console.WriteLine(); Console.WriteLine(); RecentUsersResults recentUsersResults = api.GetRecentOnlineUsers(); foreach (string user in recentUsersResults.RecentUsers) { Console.WriteLine("Recent user: {0}", user); } Console.WriteLine(); Console.WriteLine(); int eurekaSevenID = 237; AnimeDetailsResults eurekaSeven = api.GetAnimeDetails(eurekaSevenID); Console.WriteLine("Eureka Seven genres: {0}", string.Join(", ", eurekaSeven.Genres)); } }
public void GetAnimeListForUser() { string username = "******"; using (MyAnimeListApi api = new MyAnimeListApi()) { MalUserLookupResults userLookup = api.GetAnimeListForUser(username); // Just a smoke test that checks that getting an anime list returns something Assert.That(userLookup.AnimeList, Is.Not.Empty); } }
public void GetAnimeListForUser() { string username = "******"; using (MyAnimeListApi api = new MyAnimeListApi()) { MalUserLookupResults userLookup = api.GetAnimeListForUser(username); // Just a smoke test that checks that getting an anime list returns something Assert.NotEmpty(userLookup.AnimeList); } }
static void Main(string[] args) { using (MyAnimeListApi api = new MyAnimeListApi()) { api.TimeoutInMs = 15000; MalUserLookupResults userLookup = api.GetAnimeListForUser("LordHighCaptain"); foreach (MyAnimeListEntry listEntry in userLookup.AnimeList) { Console.WriteLine("Rating for {0}: {1}", listEntry.AnimeInfo.Title, listEntry.Score); } Console.WriteLine(); Console.WriteLine(); RecentUsersResults recentUsersResults = api.GetRecentOnlineUsers(); foreach (string user in recentUsersResults.RecentUsers) { Console.WriteLine("Recent user: {0}", user); } } }