Interface ISearchApiClient
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
idstringThe unique identifier of the usenet article.
guidstringThe GUID of the NZB file to download.
cancellationTokenCancellationTokenCancellation token.
Returns
- Task<TorBoxResponse<string>>
The NZB download data as a string.
Exceptions
- ArgumentNullException
Thrown when
idorguidis null.- ArgumentException
Thrown when
idorguidis 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
idstringThe unique identifier of the metadata entry.
cancellationTokenCancellationTokenCancellation token.
Returns
- Task<TorBoxResponse<MetaSearchResult>>
The metadata search result.
Exceptions
- ArgumentNullException
Thrown when
idis null.- ArgumentException
Thrown when
idis 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
cancellationTokenCancellationTokenCancellation 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
idstringThe unique identifier of the torrent.
optionsTorrentSearchOptionsOptional search options to filter and customize results.
cancellationTokenCancellationTokenCancellation token.
Returns
- Task<TorBoxResponse<TorrentSearchResult>>
The torrent search result.
Exceptions
- ArgumentNullException
Thrown when
idis null.- ArgumentException
Thrown when
idis 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
cancellationTokenCancellationTokenCancellation 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
idstringThe unique identifier of the usenet article.
optionsUsenetSearchOptionsOptional search options to filter and customize results.
cancellationTokenCancellationTokenCancellation token.
Returns
- Task<TorBoxResponse<UsenetSearchResult>>
The usenet search result.
Exceptions
- ArgumentNullException
Thrown when
idis null.- ArgumentException
Thrown when
idis 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
cancellationTokenCancellationTokenCancellation 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
querystringThe search query string.
optionsMetaSearchOptionsOptional search options to filter and customize results.
cancellationTokenCancellationTokenCancellation token.
Returns
- Task<TorBoxResponse<IReadOnlyList<MetaSearchResult>>>
A list of matching metadata search results.
Exceptions
- ArgumentNullException
Thrown when
queryis null.- ArgumentException
Thrown when
queryis 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
querystringThe search query string.
apiKeystringOptional API key override for the Newznab endpoint, or null to use the default key.
cancellationTokenCancellationTokenCancellation token.
Returns
- Task<TorBoxResponse<string>>
The search results as an XML string.
Exceptions
- ArgumentNullException
Thrown when
queryis null.- ArgumentException
Thrown when
queryis 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
querystringThe search query string.
optionsTorrentSearchOptionsOptional search options to filter and customize results.
cancellationTokenCancellationTokenCancellation token.
Returns
- Task<TorBoxResponse<TorrentSearchResponse>>
A torrent search response containing metadata and matching torrent results.
Exceptions
- ArgumentNullException
Thrown when
queryis null.- ArgumentException
Thrown when
queryis 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
querystringThe search query string.
apiKeystringOptional API key override for the Torznab endpoint, or null to use the default key.
cancellationTokenCancellationTokenCancellation token.
Returns
- Task<TorBoxResponse<string>>
The search results as an XML string.
Exceptions
- ArgumentNullException
Thrown when
queryis null.- ArgumentException
Thrown when
queryis 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
querystringThe search query string.
optionsUsenetSearchOptionsOptional search options to filter and customize results.
cancellationTokenCancellationTokenCancellation token.
Returns
- Task<TorBoxResponse<UsenetSearchResponse>>
A usenet search response containing metadata and matching NZB results.
Exceptions
- ArgumentNullException
Thrown when
queryis null.- ArgumentException
Thrown when
queryis empty.- TorBoxException
Thrown when the API returns an error.