IsThereAnyDealApi 1.0.2

dotnet add package IsThereAnyDealApi --version 1.0.2
                    
NuGet\Install-Package IsThereAnyDealApi -Version 1.0.2
                    
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="IsThereAnyDealApi" Version="1.0.2" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="IsThereAnyDealApi" Version="1.0.2" />
                    
Directory.Packages.props
<PackageReference Include="IsThereAnyDealApi" />
                    
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 IsThereAnyDealApi --version 1.0.2
                    
#r "nuget: IsThereAnyDealApi, 1.0.2"
                    
#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.
#addin nuget:?package=IsThereAnyDealApi&version=1.0.2
                    
Install IsThereAnyDealApi as a Cake Addin
#tool nuget:?package=IsThereAnyDealApi&version=1.0.2
                    
Install IsThereAnyDealApi as a Cake Tool

IsThereAnyDeal .NET Client Library

NuGet Version NuGet Downloads

A .NET client library for interacting with the IsThereAnyDeal API (v2). This library uses RestEase and is compatible with .NET Standard 2.0+.

It provides easy access to ITAD features including:

  • Game lookups (by title, Steam AppID, ITAD ID, etc.)
  • Current game prices and deals across various stores
  • Historical price information (overall lows, store lows, price history)
  • Bundle information
  • User waitlists, collections, notes, and notifications (via OAuth)
  • Store information

Installation

Install via NuGet:

# .NET CLI
dotnet add package IsThereAnyDealApi

# Package Manager Console
Install-Package IsThereAnyDealApi

Usage

Quickstart

The library uses RestEase to provide a typed client for the ITAD API.

Most public endpoints require an API Key, while user-specific endpoints (Waitlist, Collection, etc.) require OAuth 2.0.

Using an API Key

You obtain an API key by registering your app on the ITAD website.

using IsThereAnyDeal.Api;
using IsThereAnyDeal.Api.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

// Get your API Key from ITAD registration (e.g., load from config)
string? apiKey = Environment.GetEnvironmentVariable("ITAD_API_KEY"); // Or load from elsewhere

if (string.IsNullOrEmpty(apiKey))
{
    Console.WriteLine("API Key is required!");
    return;
}

var client = new IsThereAnyDealApiClient(apiKey);

// --- Example 1: Lookup a game by Steam AppID ---
int steamAppId = 570; // Dota 2
GameLookupResult? lookupResult = await client.LookupGameAsync(appid: steamAppId);

if (lookupResult != null && lookupResult.Found && lookupResult.Game != null)
{
    Console.WriteLine($"Found Game: {lookupResult.Game.Title} (ITAD ID: {lookupResult.Game.Id})");
    string gameId = lookupResult.Game.Id; // Use this ID for other calls

    // --- Example 2: Get current prices for the found game ---
    List<GamePrices>? pricesResult = await client.GetGamePricesAsync(new List<string> { gameId }, country: "US");
    GamePrices? gamePrices = pricesResult?.FirstOrDefault();

    if (gamePrices != null && gamePrices.Deals.Any())
    {
        Deal? bestDeal = gamePrices.Deals.OrderBy(d => d.Price.Amount).First();
        Console.WriteLine($"Current Best Deal: {bestDeal.Price.Amount} {bestDeal.Price.Currency} at {bestDeal.Shop.Name} ({bestDeal.Cut}% off)");
        Console.WriteLine($"Link: {bestDeal.Url}");
    }
    else
    {
        Console.WriteLine("No current deals found for this game.");
    }
}
else
{
    Console.WriteLine($"Game with AppID {steamAppId} not found.");
}
Using OAuth 2.0 (for User Data)

This library supports accessing user-specific endpoints (like Waitlist, Collection) via OAuth. ITAD uses the Authorization Code flow with PKCE extension.

This flow requires user interaction (browser redirect for login and authorization). Therefore, the consuming application (your app using this library) is responsible for:

  1. Handling the interactive OAuth flow (generating PKCE, redirecting the user, receiving the callback, exchanging the code for tokens).
  2. Obtaining the access_token.
  3. Providing the token to this library instance.
// Assume 'myAccessToken' was obtained via the OAuth flow handled by your application
string myAccessToken = "USER_ACCESS_TOKEN_OBTAINED_VIA_OAUTH_FLOW";

// Initialize client (can be done with or without API key depending on needs)
var userClient = new IsThereAnyDealApiClient(apiKey); // API key might still be needed for other calls

// Set the user's token
userClient.SetUserAccessToken(myAccessToken);

// Now you can call OAuth-protected methods
try
{
    UserInfo userInfo = await userClient.GetUserInfoAsync();
    Console.WriteLine($"Authenticated as user: {userInfo.Username}");

    List<WaitlistGame> waitlist = await userClient.GetWaitlistGamesAsync();
    Console.WriteLine($"User has {waitlist.Count} games on their waitlist.");
    // ... call other methods like GetCollectionGamesAsync, etc.
}
catch (RestEase.ApiException apiEx)
{
    // Handle potential 401 Unauthorized or other API errors
    Console.WriteLine($"API Error: {apiEx.StatusCode} - {apiEx.ReasonPhrase}");
    // If 401, the access token might be expired or invalid - trigger refresh token flow
}

(See the IsThereAnyDealApi.ManualTester project in this repository for an example of how to handle the OAuth flow semi-manually for testing purposes).

API Documentation

Refer to the official IsThereAnyDeal API Documentation for details on all available endpoints, parameters, and response models. The models in this library (IsThereAnyDeal.Api.Models) correspond directly to the schemas defined there.

Versioning Policy

This project aims to follow Semantic Versioning (SemVer).

  • MAJOR version bumps for incompatible API changes.
  • MINOR version bumps for adding functionality in a backward-compatible manner.
  • PATCH version bumps for backward-compatible bug fixes.

Contributing / Local Development

Prerequisites

  • .NET 6 SDK or later (Runtime supports .NET Standard 2.0+)
  • VS Code, Visual Studio, or JetBrains Rider

Setup

  1. Clone the repository.
  2. Create Secrets File: For running the ManualTester project or potential future integration tests, create a file named testsettings.json in the IsThereAnyDealApi.ManualTester project directory (ensure it's set to "Copy to Output Directory: Copy if newer"). Populate it with your credentials obtained from the ITAD App Registration:
    {
      "ITAD_CLIENT_ID": "YOUR_ITAD_APP_CLIENT_ID",
      "ITAD_CLIENT_SECRET": "YOUR_ITAD_APP_CLIENT_SECRET",
      "ITAD_API_KEY": "YOUR_ITAD_API_KEY"
    }
    
    (Note: This file is included in .gitignore and should NOT be committed).
  3. Define Redirect URI: In IsThereAnyDealApi.ManualTester/Program.cs, update the YourRedirectUri constant to match the URI you registered with ITAD (e.g., http://localhost:1234/callback).
  4. Build the solution:
    dotnet build IsThereAnyDeal.sln
    
  5. Run the Manual Tester (optional):
    dotnet run --project IsThereAnyDealApi.ManualTester
    
    (Or use the launch configuration provided in .vscode/launch.json)

Contributions are welcome! Please feel free to open an issue or submit a pull request.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos 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
1.0.2 146 4/29/2025
1.0.1 147 4/29/2025
1.0.0 139 4/29/2025