Interface IStreamClient
Defines operations for streaming content through the TorBox Main API.
public interface IStreamClient
Methods
CreateStreamAsync(long, long, string, CreateStreamOptions?, CancellationToken)
Creates a stream for a download item.
Task<TorBoxResponse<string>> CreateStreamAsync(long id, long fileId, string type, CreateStreamOptions? options = null, CancellationToken cancellationToken = default)
Parameters
idlongThe identifier of the download.
fileIdlongThe identifier of the file within the download.
typestringThe type of download (e.g., torrent, usenet).
optionsCreateStreamOptionsOptional stream creation options for track indices.
cancellationTokenCancellationTokenCancellation token.
Returns
- Task<TorBoxResponse<string>>
The stream URL or data as a string.
Exceptions
- ArgumentNullException
Thrown when
typeis null.- ArgumentException
Thrown when
typeis empty.- TorBoxException
Thrown when the API returns an error.
GetStreamDataAsync(string, string, GetStreamDataOptions?, CancellationToken)
Gets stream data for a download item.
Task<TorBoxResponse<StreamData>> GetStreamDataAsync(string presignedToken, string token, GetStreamDataOptions? options = null, CancellationToken cancellationToken = default)
Parameters
presignedTokenstringThe presigned token for stream authentication.
tokenstringThe authentication token.
optionsGetStreamDataOptionsOptional stream data options for track indices.
cancellationTokenCancellationTokenCancellation token.
Returns
- Task<TorBoxResponse<StreamData>>
The stream data.
Exceptions
- ArgumentNullException
Thrown when
presignedTokenortokenis null.- ArgumentException
Thrown when
presignedTokenortokenis empty.- TorBoxException
Thrown when the API returns an error.