Skip to content

TorBox-App/torbox-sdk-java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Logo

Table of Contents

Setup & Configuration

Supported Language Versions

This SDK is compatible with the following versions: Java >= 1.8

Installation

If you use Maven, place the following within the dependency tag in your pom.xml file:

<dependency>
    <groupId>app.torbox</groupId>
    <artifactId>torbox</artifactId>
    <version>1.0.1</version>
</dependency>

If you use Gradle, paste the next line inside the dependencies block of your build.gradle file:

implementation group: app.torbox, name: torbox, version: 1.0.1

If you use JAR files, package the SDK by running the following command:

mvn compile assembly:single

Then, add the JAR file to your project's classpath.

Authentication

Access Token Authentication

The TorboxApi API uses an Access Token for authentication.

This token must be provided to authenticate your requests to the API.

Setting the Access Token

When you initialize the SDK, you can set the access token as follows:

import app.torbox.torbox.TorboxApi;
import app.torbox.torbox.config.TorboxApiConfig;

public class Main {

  public static void main(String[] args) {
    TorboxApiConfig config = TorboxApiConfig.builder().accessToken("YOUR_ACCESS_TOKEN").build();

    TorboxApi torboxApi = new TorboxApi(config);
  }
}

If you need to set or update the access token after initializing the SDK, you can use:

torboxApi.setAccessToken('YOUR_ACCESS_TOKEN');

Setting a Custom Timeout

You can set a custom timeout for the SDK's HTTP requests as follows:

import app.torbox.torbox.TorboxApi;
import app.torbox.torbox.config.TorboxApiConfig;

public class Main {

  public static void main(String[] args) {
    TorboxApiConfig config = TorboxApiConfig.builder().timeout(10000).build();
    TorboxApi torboxApi = new TorboxApi(config);
  }
}

Sample Usage

Below is a comprehensive example demonstrating how to authenticate and call a simple endpoint:

import app.torbox.torbox.TorboxApi;
import app.torbox.torbox.config.TorboxApiConfig;
import app.torbox.torbox.exceptions.ApiException;
import app.torbox.torbox.models.GetUpStatusOkResponse;

public class Main {

  public static void main(String[] args) {
    TorboxApiConfig config = TorboxApiConfig.builder().accessToken("YOUR_ACCESS_TOKEN").build();

    TorboxApi torboxApi = new TorboxApi(config);

    try {
      GetUpStatusOkResponse response = torboxApi.general.getUpStatus();

      System.out.println(response);
    } catch (ApiException e) {
      e.printStackTrace();
    }

    System.exit(0);
  }
}

Services

The SDK provides various services to interact with the API.

Below is a list of all available services with links to their detailed documentation:
Name
TorrentsService
UsenetService
WebDownloadsDebridService
GeneralService
NotificationsService
UserService
RssFeedsService
IntegrationsService
QueuedService

Models

The SDK includes several models that represent the data structures used in API requests and responses. These models help in organizing and managing the data efficiently.

Below is a list of all available models with links to their detailed documentation:
Name Description
CreateTorrentRequest
CreateTorrentOkResponse
ControlTorrentOkResponse
RequestDownloadLinkOkResponse
GetTorrentListOkResponse
GetTorrentCachedAvailabilityOkResponse
ExportTorrentDataOkResponse
GetTorrentInfoOkResponse
GetTorrentInfo1Request
GetTorrentInfo1OkResponse
CreateUsenetDownloadRequest
CreateUsenetDownloadOkResponse
GetUsenetListOkResponse
CreateWebDownloadRequest
CreateWebDownloadOkResponse
GetWebDownloadListOkResponse
GetHosterListOkResponse
GetUpStatusOkResponse
GetStatsOkResponse
GetChangelogsJsonOkResponse
GetNotificationFeedOkResponse
GetUserDataOkResponse
AddReferralToAccountOkResponse
GetAllJobsOkResponse
GetAllJobsByHashOkResponse
RequestDownloadLinkParameters
GetTorrentListParameters
GetTorrentCachedAvailabilityParameters
ExportTorrentDataParameters
GetTorrentInfoParameters
RequestDownloadLink1Parameters
GetUsenetListParameters
GetUsenetCachedAvailabilityParameters
ControlWebDownloadParameters
RequestDownloadLink2Parameters
GetWebDownloadListParameters
GetWebDownloadCachedAvailabilityParameters
GetSpeedtestFilesParameters
GetRssNotificationFeedParameters
GetUserDataParameters
AddReferralToAccountParameters
GetUserRssFeedsParameters
GetRssFeedItemsParameters
GetQueuedDownloadsParameters

License

This SDK is licensed under the MIT License.

See the LICENSE file for more details.