Skip to content

TorBox-App/torbox-sdk-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Logo

Table of Contents

Setup & Configuration

Supported Language Versions

This SDK is compatible with the following versions: Go >= 1.19.0

Authentication

Access Token Authentication

The torbox-api 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 (
    "torbox-sdk-go/pkg/torboxapi"
    "torbox-sdk-go/pkg/torboxapiconfig"
  )

config := torboxapiconfig.NewConfig()
config.SetBearerToken("YOUR-TOKEN")

sdk := torboxapi.NewTorboxApi(config)

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

import (
    "torbox-sdk-go/pkg/torboxapi"
    "torbox-sdk-go/pkg/torboxapiconfig"
  )

config := torboxapiconfig.NewConfig()

sdk := torboxapi.NewTorboxApi(config)
sdk.SetBearerToken("YOUR-TOKEN")

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

Response Wrappers

All services use response wrappers to provide a consistent interface to return the responses from the API.

The response wrapper itself is a generic struct that contains the response data and metadata.

Below are the response wrappers used in the SDK:

TorboxApiResponse[T]

This response wrapper is used to return the response data from the API. It contains the following fields:

Name Type Description
Data T The body of the API response
Metadata TorboxApiResponseMetadata Status code and headers returned by the API

TorboxApiError

This response wrapper is used to return an error. It contains the following fields:

Name Type Description
Err error The error that occurred
Body T The body of the API response
Metadata TorboxApiResponseMetadata Status code and headers returned by the API

TorboxApiResponseMetadata

This struct is shared by both response wrappers and contains the following fields:

Name Type Description
Headers map[string]string A map containing the headers returned by the API
StatusCode int The status code returned by the API

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
ControlQueuedTorrentOkResponse
RequestDownloadLinkOkResponse
GetTorrentListOkResponse
GetTorrentCachedAvailabilityOkResponse
SearchAllTorrentsFromScraperOkResponse
ExportTorrentDataOkResponse
GetTorrentInfoOkResponse
CreateUsenetDownloadRequest
CreateUsenetDownloadOkResponse
GetUsenetListOkResponse
CreateWebDownloadRequest
CreateWebDownloadOkResponse
GetWebDownloadListOkResponse
GetUpStatusOkResponse
GetStatsOkResponse
GetNotificationFeedOkResponse
GetUserDataOkResponse
AddReferralToAccountOkResponse
GetAllJobsOkResponse
GetAllJobsByHashOkResponse

License

This SDK is licensed under the MIT License.

See the LICENSE file for more details.