A C# helper library for SWAPI - the Star Wars API
Basic Usage
Register SharpTrooperCore to your services for Dependency Injection.
| using var scope = host.Services.CreateScope(); | |
| var sharpTrooperService = scope.ServiceProvider.GetService<SharpTrooperCore>() | |
| ?? throw new NullReferenceException("service is null"); | |
| Console.WriteLine("SWAPI:"); | |
| Console.WriteLine("..."); | |
| var films = await sharpTrooperService.GetAllFilmsAsync(); | |
| foreach (var item in films.results) | |
| { | |
| Console.WriteLine(item.title); | |
| } |
Methods
var films = await sharpTrooperService.GetAllFilmsAsync(); var people = await sharpTrooperService.GetAllPeopleAsync(); var vehicles = await sharpTrooperService.GetAllVehiclesAsync(); var species = await sharpTrooperService.GetAllSpeciesAsync(); var planets = await sharpTrooperService.GetAllPlanetsAsync();
For more info, visit the documentation of SWAPI: SWAPI/Documentation
or my personal blog post: The Star Wars API