PageRenderTime 38ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 0ms

/MalApi.Example/Program.cs

https://bitbucket.org/LHCGreg/mal-api
C# | 34 lines | 30 code | 4 blank | 0 comment | 0 complexity | 8a988dd1220192406d34f07c44db487a MD5 | raw file
Possible License(s): Apache-2.0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. namespace MalApi.Example
  6. {
  7. class Program
  8. {
  9. static void Main(string[] args)
  10. {
  11. using (MyAnimeListApi api = new MyAnimeListApi())
  12. {
  13. api.UserAgent = "MalApiExample";
  14. api.TimeoutInMs = 15000;
  15. MalUserLookupResults userLookup = api.GetAnimeListForUser("LordHighCaptain");
  16. foreach (MyAnimeListEntry listEntry in userLookup.AnimeList)
  17. {
  18. Console.WriteLine("Rating for {0}: {1}", listEntry.AnimeInfo.Title, listEntry.Score);
  19. }
  20. Console.WriteLine();
  21. Console.WriteLine();
  22. RecentUsersResults recentUsersResults = api.GetRecentOnlineUsers();
  23. foreach (string user in recentUsersResults.RecentUsers)
  24. {
  25. Console.WriteLine("Recent user: {0}", user);
  26. }
  27. }
  28. }
  29. }
  30. }