IsThereAnyDealApi 1.0.2
dotnet add package IsThereAnyDealApi --version 1.0.2
NuGet\Install-Package IsThereAnyDealApi -Version 1.0.2
<PackageReference Include="IsThereAnyDealApi" Version="1.0.2" />
<PackageVersion Include="IsThereAnyDealApi" Version="1.0.2" />
<PackageReference Include="IsThereAnyDealApi" />
paket add IsThereAnyDealApi --version 1.0.2
#r "nuget: IsThereAnyDealApi, 1.0.2"
#addin nuget:?package=IsThereAnyDealApi&version=1.0.2
#tool nuget:?package=IsThereAnyDealApi&version=1.0.2
IsThereAnyDeal .NET Client Library
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:
- Handling the interactive OAuth flow (generating PKCE, redirecting the user, receiving the callback, exchanging the code for tokens).
- Obtaining the
access_token
. - 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
- Clone the repository.
- Create Secrets File: For running the
ManualTester
project or potential future integration tests, create a file namedtestsettings.json
in theIsThereAnyDealApi.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:
(Note: This file is included in{ "ITAD_CLIENT_ID": "YOUR_ITAD_APP_CLIENT_ID", "ITAD_CLIENT_SECRET": "YOUR_ITAD_APP_CLIENT_SECRET", "ITAD_API_KEY": "YOUR_ITAD_API_KEY" }
.gitignore
and should NOT be committed). - Define Redirect URI: In
IsThereAnyDealApi.ManualTester/Program.cs
, update theYourRedirectUri
constant to match the URI you registered with ITAD (e.g.,http://localhost:1234/callback
). - Build the solution:
dotnet build IsThereAnyDeal.sln
- Run the Manual Tester (optional):
(Or use the launch configuration provided indotnet run --project IsThereAnyDealApi.ManualTester
.vscode/launch.json
)
Contributions are welcome! Please feel free to open an issue or submit a pull request.
Product | Versions 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. |
-
.NETStandard 2.0
- Newtonsoft.Json (>= 13.0.3)
- RestEase (>= 1.6.4)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.