Table of Contents

Interface ISearchApiClient

Namespace
TorBoxSDK.Search
Assembly
TorBoxSDK.dll

Defines the Search API client for querying torrent and usenet indexers and metadata through the TorBox Search API.

public interface ISearchApiClient

Methods

DownloadUsenetAsync(string, string, CancellationToken)

Downloads an NZB file for a usenet article.

Task<TorBoxResponse<string>> DownloadUsenetAsync(string id, string guid, CancellationToken cancellationToken = default)

Parameters

id string

The unique identifier of the usenet article.

guid string

The GUID of the NZB file to download.

cancellationToken CancellationToken

Cancellation token.

Returns

Task<TorBoxResponse<string>>

The NZB download data as a string.

Exceptions

ArgumentNullException

Thrown when id or guid is null.

ArgumentException

Thrown when id or guid is empty.

TorBoxException

Thrown when the API returns an error.

GetMetaByIdAsync(string, CancellationToken)

Retrieves a specific metadata entry by its unique identifier.

Task<TorBoxResponse<MetaSearchResult>> GetMetaByIdAsync(string id, CancellationToken cancellationToken = default)

Parameters

id string

The unique identifier of the metadata entry.

cancellationToken CancellationToken

Cancellation token.

Returns

Task<TorBoxResponse<MetaSearchResult>>

The metadata search result.

Exceptions

ArgumentNullException

Thrown when id is null.

ArgumentException

Thrown when id is empty.

TorBoxException

Thrown when the API returns an error.

GetMetaSearchTutorialAsync(CancellationToken)

Retrieves the meta search tutorial and information page.

Task<TorBoxResponse<string>> GetMetaSearchTutorialAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Cancellation token.

Returns

Task<TorBoxResponse<string>>

The tutorial content as a string.

Exceptions

TorBoxException

Thrown when the API returns an error.

GetTorrentByIdAsync(string, TorrentSearchOptions?, CancellationToken)

Retrieves a specific torrent by its unique identifier.

Task<TorBoxResponse<TorrentSearchResult>> GetTorrentByIdAsync(string id, TorrentSearchOptions? options = null, CancellationToken cancellationToken = default)

Parameters

id string

The unique identifier of the torrent.

options TorrentSearchOptions

Optional search options to filter and customize results.

cancellationToken CancellationToken

Cancellation token.

Returns

Task<TorBoxResponse<TorrentSearchResult>>

The torrent search result.

Exceptions

ArgumentNullException

Thrown when id is null.

ArgumentException

Thrown when id is empty.

TorBoxException

Thrown when the API returns an error.

GetTorrentSearchTutorialAsync(CancellationToken)

Retrieves the torrent search tutorial and information page.

Task<TorBoxResponse<string>> GetTorrentSearchTutorialAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Cancellation token.

Returns

Task<TorBoxResponse<string>>

The tutorial content as a string.

Exceptions

TorBoxException

Thrown when the API returns an error.

GetUsenetByIdAsync(string, UsenetSearchOptions?, CancellationToken)

Retrieves a specific usenet article by its unique identifier.

Task<TorBoxResponse<UsenetSearchResult>> GetUsenetByIdAsync(string id, UsenetSearchOptions? options = null, CancellationToken cancellationToken = default)

Parameters

id string

The unique identifier of the usenet article.

options UsenetSearchOptions

Optional search options to filter and customize results.

cancellationToken CancellationToken

Cancellation token.

Returns

Task<TorBoxResponse<UsenetSearchResult>>

The usenet search result.

Exceptions

ArgumentNullException

Thrown when id is null.

ArgumentException

Thrown when id is empty.

TorBoxException

Thrown when the API returns an error.

GetUsenetSearchTutorialAsync(CancellationToken)

Retrieves the usenet search tutorial and information page.

Task<TorBoxResponse<string>> GetUsenetSearchTutorialAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Cancellation token.

Returns

Task<TorBoxResponse<string>>

The tutorial content as a string.

Exceptions

TorBoxException

Thrown when the API returns an error.

SearchMetaAsync(string, MetaSearchOptions?, CancellationToken)

Searches for metadata entries matching the specified query.

Task<TorBoxResponse<IReadOnlyList<MetaSearchResult>>> SearchMetaAsync(string query, MetaSearchOptions? options = null, CancellationToken cancellationToken = default)

Parameters

query string

The search query string.

options MetaSearchOptions

Optional search options to filter and customize results.

cancellationToken CancellationToken

Cancellation token.

Returns

Task<TorBoxResponse<IReadOnlyList<MetaSearchResult>>>

A list of matching metadata search results.

Exceptions

ArgumentNullException

Thrown when query is null.

ArgumentException

Thrown when query is empty.

TorBoxException

Thrown when the API returns an error.

SearchNewznabAsync(string, string?, CancellationToken)

Searches the Newznab API for usenet articles matching the specified query.

Task<TorBoxResponse<string>> SearchNewznabAsync(string query, string? apiKey = null, CancellationToken cancellationToken = default)

Parameters

query string

The search query string.

apiKey string

Optional API key override for the Newznab endpoint, or null to use the default key.

cancellationToken CancellationToken

Cancellation token.

Returns

Task<TorBoxResponse<string>>

The search results as an XML string.

Exceptions

ArgumentNullException

Thrown when query is null.

ArgumentException

Thrown when query is empty.

TorBoxException

Thrown when the API returns an error.

SearchTorrentsAsync(string, TorrentSearchOptions?, CancellationToken)

Searches for torrents matching the specified query.

Task<TorBoxResponse<TorrentSearchResponse>> SearchTorrentsAsync(string query, TorrentSearchOptions? options = null, CancellationToken cancellationToken = default)

Parameters

query string

The search query string.

options TorrentSearchOptions

Optional search options to filter and customize results.

cancellationToken CancellationToken

Cancellation token.

Returns

Task<TorBoxResponse<TorrentSearchResponse>>

A torrent search response containing metadata and matching torrent results.

Exceptions

ArgumentNullException

Thrown when query is null.

ArgumentException

Thrown when query is empty.

TorBoxException

Thrown when the API returns an error.

SearchTorznabAsync(string, string?, CancellationToken)

Searches the Torznab API for torrents matching the specified query.

Task<TorBoxResponse<string>> SearchTorznabAsync(string query, string? apiKey = null, CancellationToken cancellationToken = default)

Parameters

query string

The search query string.

apiKey string

Optional API key override for the Torznab endpoint, or null to use the default key.

cancellationToken CancellationToken

Cancellation token.

Returns

Task<TorBoxResponse<string>>

The search results as an XML string.

Exceptions

ArgumentNullException

Thrown when query is null.

ArgumentException

Thrown when query is empty.

TorBoxException

Thrown when the API returns an error.

SearchUsenetAsync(string, UsenetSearchOptions?, CancellationToken)

Searches for usenet articles matching the specified query.

Task<TorBoxResponse<UsenetSearchResponse>> SearchUsenetAsync(string query, UsenetSearchOptions? options = null, CancellationToken cancellationToken = default)

Parameters

query string

The search query string.

options UsenetSearchOptions

Optional search options to filter and customize results.

cancellationToken CancellationToken

Cancellation token.

Returns

Task<TorBoxResponse<UsenetSearchResponse>>

A usenet search response containing metadata and matching NZB results.

Exceptions

ArgumentNullException

Thrown when query is null.

ArgumentException

Thrown when query is empty.

TorBoxException

Thrown when the API returns an error.