RickNMorty.Common
1.0.3
dotnet add package RickNMorty.Common --version 1.0.3
NuGet\Install-Package RickNMorty.Common -Version 1.0.3
<PackageReference Include="RickNMorty.Common" Version="1.0.3" />
paket add RickNMorty.Common --version 1.0.3
#r "nuget: RickNMorty.Common, 1.0.3"
// Install RickNMorty.Common as a Cake Addin
#addin nuget:?package=RickNMorty.Common&version=1.0.3
// Install RickNMorty.Common as a Cake Tool
#tool nuget:?package=RickNMorty.Common&version=1.0.3
RickNMorty API NuGet Package
A .NET library for easy integration with the Rick and Morty API. This library provides services to interact with characters, locations, and episodes from the "Rick and Morty" universe.
Wrapper API around the following API
Installation
You can install the package via NuGet Package Manager or by using the .NET CLI.
nuget install RickNMorty.API
or
dotnet add package RickNMorty.API
Usage
Installation
First, install the NuGet package in your project.
Register Services
In your application's startup or configuration class, register the services provided by the RickNMorty.API library.
using Microsoft.Extensions.DependencyInjection;
using RickNMorty.Common; // Replace with actual namespace
public void ConfigureServices(IServiceCollection services)
{
services.AddTransient<RegistrationContainer>();
}
Using Services
Now you can inject and use the services in your application components.
Character Service
Getting All Characters
Retrieve a list of all characters from the "Rick and Morty" universe.
using RickNMorty.Common; // Replace with actual namespace
public class MyService
{
private readonly ICharacterService _characterService;
public MyService(ICharacterService characterService)
{
_characterService = characterService;
}
public void FetchAllCharacters()
{
var allCharacters = _characterService.GetAllCharacters(1);
// Process the characters
}
}
Getting a Character by ID
Retrieve a specific character using their ID.
using RickNMorty.API; // Replace with actual namespace
public class MyService
{
private readonly ICharacterService _characterService;
public MyService(ICharacterService characterService)
{
_characterService = characterService;
}
public void FetchCharacterById(int characterId)
{
var character = _characterService.GetCharacter(characterId);
// Process the character
}
}
Getting a List of Characters by ID
Retrieve a specific list of characters using their ID.
using RickNMorty.API; // Replace with actual namespace
public class MyService
{
private readonly ICharacterService _characterService;
public MyService(ICharacterService characterService)
{
_characterService = characterService;
}
public void FetchCharacterById(int characterId)
{
var characterList = new List<int>(){1,2,3}
var character = _characterService.GetCharacters(characterList);
// Process the character
}
}
Location Service
Getting All Locations
Retrieve a list of all locations from the "Rick and Morty" universe.
using RickNMorty.Common; // Replace with actual namespace
public class MyService
{
private readonly ILocationService _locationService;
public MyService(ILocationService locationService)
{
_locationService = locationService;
}
public void FetchAllLocations()
{
var allLocations = _locationService.GetLocations(1);
// Process the locations
}
}
Getting a Location by ID
Retrieve a specific location using its ID.
using RickNMorty.Common; // Replace with actual namespace
public class MyService
{
private readonly ILocationService _locationService;
public MyService(ILocationService locationService)
{
_locationService = locationService;
}
public void FetchLocationById(int locationId)
{
var location = _locationService.GetLocation(locationId);
// Process the location
}
}
Getting a Location by ID
Retrieve a specific location using its ID.
using RickNMorty.Common; // Replace with actual namespace
public class MyService
{
private readonly ILocationService _locationService;
public MyService(ILocationService locationService)
{
_locationService = locationService;
}
public void FetchLocationsById()
{
var locationList = new List<int>(){1,2,3}
var locations = _locationService.GetLocations(locationList);
// Process the location
}
}
Episode Service
Getting All Episodes
Retrieve a list of all episodes from the "Rick and Morty" universe.
using RickNMorty.Common; // Replace with actual namespace
public class MyService
{
private readonly IEpisodeService _episodeService;
public MyService(IEpisodeService episodeService)
{
_episodeService = episodeService;
}
public void FetchAllEpisodes()
{
var allEpisodes = _episodeService.GetAllEpisodes();
// Process the episodes
}
}
Getting an Episode by ID
Retrieve a specific episode using its ID.
using RickNMorty.API; // Replace with actual namespace
public class MyService
{
private readonly IEpisodeService _episodeService;
public MyService(IEpisodeService episodeService)
{
_episodeService = episodeService;
}
public void FetchEpisodeById(int episodeId)
{
var episode = _episodeService.GetEpisode(episodeId);
// Process the episode
}
}
Getting a List Of Episodes by ID
Retrieve a specific list of episodes using their ID.
using RickNMorty.Common; // Replace with actual namespace
public class MyService
{
private readonly IEpisodeService _episodeService;
public MyService(IEpisodeService episodeService)
{
_episodeService = episodeService;
}
public void GetEpisodesById()
{
var episodesList = new List<int>(){1,2,3}
var episodes = _episodeService.GetEpisodes(locationList);
// Process the location
}
}
Contributing
If you find any issues or want to contribute, please open an issue or create a pull request on the GitHub repository.
License
This project is licensed under the MIT License.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. 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. |
-
net8.0
- ApiUtilities.Common (>= 1.0.4)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.