Table of Contents

Running the Examples Project

This page shows how to execute the examples project and how the menu-driven runner maps to the source files.

Prerequisites

  • .NET SDK installed
  • a TorBox API key in the TORBOX_API_KEY environment variable
  • the repository checked out locally

Run the examples

From the repository root:

dotnet run --project src/TorBoxSDK.Examples

The console application displays a numbered menu implemented in Program.cs. Each menu entry executes one example class through its RunAsync() method.

Shared infrastructure

The shared helper in ExampleHelper.cs provides the common setup used across most examples:

  • creates a DI-based ITorBoxClient
  • reads TORBOX_API_KEY
  • centralizes a default 30-second timeout
  • keeps a shared ServiceProvider alive for the runner lifetime

That helper is useful for examples, but it is not part of the public SDK API.

The runner groups examples into these categories:

  • Getting Started
  • Main API
  • Search Client
  • Relay Client
  • Error Handling

Source map

Category Representative source files
Getting Started BasicSetupExample.cs, ConfigurationExample.cs, StandaloneSetupExample.cs
Main API CreateTorrentExample.cs, AuthenticationExample.cs, OAuthExample.cs
Search Client SearchTorrentsExample.cs, DownloadSearchResultsExample.cs
Relay Client RelayExample.cs
Error Handling ErrorHandlingExample.cs

Good first examples

If you are new to TorBoxSDK, start in this order:

  1. BasicSetupExample.cs
  2. StandaloneSetupExample.cs
  3. ListTorrentsExample.cs
  4. SearchTorrentsExample.cs
  5. ErrorHandlingExample.cs