PokeApi.V2 0.2.0

dotnet add package PokeApi.V2 --version 0.2.0
                    
NuGet\Install-Package PokeApi.V2 -Version 0.2.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="PokeApi.V2" Version="0.2.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="PokeApi.V2" Version="0.2.0" />
                    
Directory.Packages.props
<PackageReference Include="PokeApi.V2" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add PokeApi.V2 --version 0.2.0
                    
#r "nuget: PokeApi.V2, 0.2.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package PokeApi.V2@0.2.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=PokeApi.V2&version=0.2.0
                    
Install as a Cake Addin
#tool nuget:?package=PokeApi.V2&version=0.2.0
                    
Install as a Cake Tool

PokeApi.V2

Version Nuget downloads

PokeApi.V2 is a .NET client library for accessing PokéAPI API v2.

Supports in-memory caching and distributed caching (e.g. Redis).

Installation

dotnet add package PokeApi.V2

How to use

Get Pokémon resource by ID or name

using PokeApi.V2;

PokeApiClient client = new();

var pokemonById = await client.GetApiResourceAsync<Pokemon>(1); // Get Pokémon with ID 1 (Bulbasaur)
var pokemonByName = await client.GetApiResourceAsync<Pokemon>("bulbasaur"); // Get Pokémon with name "bulbasaur"

Get Pokemon Location Areas by ID, name, or resource reference

using PokeApi.V2;
PokeApiClient client = new();

var locationAreaById = await client.GetApiResourcePropertyAsync<LocationAreaEncounter>(1); // Get Pokemon Location Area of Pokémon with ID 1 (Bulbasaur)
var locationAreaByName = await client.GetApiResourcePropertyAsync<LocationAreaEncounter>("bulbasaur"); // Get Pokemon Location Area of Pokémon with name "bulbasaur"

var pokemonList = await client.GetApiResourceListAsync<Pokemon>(offset: 0, limit: 1);
var pokemonRef = pokemonList.Results.First();
var locationAreaByRef = await client.GetApiResourcePropertyAsync<Pokemon, LocationAreaEncounter>(pokemonRef); // Get Pokemon Location Area using resource reference

Get a list of Pokémon resources with pagination

using PokeApi.V2;

PokeApiClient client = new();

var pokemonList = await client.GetApiResourceListAsync<Pokemon>(offset: 0, limit: 20); // Get first 20 Pokémon

foreach (var pokemonRef in pokemonList.Results)
{
    var pokemon = await client.GetApiResourceAsync<Pokemon>(pokemonRef); // Fetch each Pokémon resource using its reference
}

Enumerate all Pokémon resources

using PokeApi.V2;
PokeApiClient client = new();
await foreach (var pokemonRef in client.EnumerateApiResourcesAsync<Pokemon>())
{
    Console.WriteLine($"{pokemonRef.Id}: {pokemonRef.Name}");
}

Create client with in-memory caching

using Microsoft.Extensions.Caching.Memory;
using PokeApi.V2;

MemoryCache memoryCache = new(new MemoryCacheOptions());
PokeApiClient client = new(memoryCache);

var pokemon = await client.GetApiResourceAsync<Pokemon>(25); // Get Pokémon with ID 25 (Pikachu) with caching

Register client with Redis caching with Aspire

using PokeApi.V2;

var builder = Host.CreateApplicationBuilder(args);

builder.AddServiceDefaults();

builder.AddRedisDistributedCache("distributed-cache");

builder.Services.AddSingleton<PokeApiClient>();

Difference between PokeApi.V2 and PokeApiNet

PokeApiNet

  • Targets .NET Standard 2.0
  • Some of nullable annotations are missing
  • Does not support distributed caching

PokeApi.V2

  • Targets .NET 10+
  • Fully annotated with nullable reference types
  • Supports distributed caching (e.g. Redis)
Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.2.0 117 2/13/2026
0.1.1 118 2/8/2026
0.1.0 118 2/8/2026