Skip to content

BIGDummyHead/Rick.Net

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 

Repository files navigation

Rick.Net

A simple wrapper for the Rick and Morty API.

This wrapper was built to be simple and allow you to get information on the fly about your favorite characters and such.

All Snippets below are presumed to be in an Async Task. All Methods in Search.cs have their own CounterPart for Async and Synchronous

Character

Snippet Resources:

Beth's Mytholog - Json | ID : 40

//there are many ways to gather a character.
Character x = await Search.GetCharacterAsync(40);
Multiple<Character> y = await Search.GetCharacterAsync(page:1, name:"Beth", status: Status.dead, gender: Gender.female);
//each page has 20 characters on them. 
Multiple<Character> characters = await Search.GetAllCharactersAsync(2);
Character z = characters.Results[19];

Episode

Snippet Resources:

The ABC's of Beth - Json | ID : 30

//there are also many ways to gather an Episode.
Episode x = await Search.GetEpisodeAsync(30);
Multiple<Episode> y = await Search.GetEpisodeAsync(page:1, episodeName: null, episodeCode:"S03E09");
Multiple<Episode> episodes = await Search.GetAllEpisodesAsync(2);
Episode z = episodes.Results[9];

Location

Snippet Resources:

Post-Apocalyptic Earth - Json | ID : 8

//there are also many ways to gather an Location.
Location x = await Search.GetLocationAsync(8);
Multiple<Location> y = await Search.GetLocationAsync(page:1, name:"post-apocalyptic", type:null, dimension:null);
Multiple<Location> locations = await Search.GetAllLocationsAsync(1);
Location z = locations.Results[7];

Error

You may be wondering. "What if my request fails or there is no Character, Location, or Episode for this ID/Criteria?"

Each API request model comes with the CanError class inherited.

You can check if your request has an error like so

var x = await Search.GetEpisodeAsync(20);

if(x.DidError)
  return;
  
//do code

API Info

Website

About

Docs

Api

Buy them a coffee

Dependencies

NewtonSoft.Json

About

An unofficial better wrapper for the Rick and Morty API

Resources

Stars

Watchers

Forks

Languages