https://github.com/torbox-app/torbox-sdk-go
The official TorBox SDK in Golang
https://github.com/torbox-app/torbox-sdk-go
go golang sdk sdk-go sdk-golang torbox
Last synced: about 1 year ago
JSON representation
The official TorBox SDK in Golang
- Host: GitHub
- URL: https://github.com/torbox-app/torbox-sdk-go
- Owner: TorBox-App
- License: mit
- Created: 2024-11-24T18:48:31.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-04-26T09:14:10.000Z (about 1 year ago)
- Last Synced: 2025-04-30T21:43:01.384Z (about 1 year ago)
- Topics: go, golang, sdk, sdk-go, sdk-golang, torbox
- Language: Go
- Homepage: https://api-docs.torbox.app
- Size: 604 KB
- Stars: 3
- Watchers: 0
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

## Table of Contents
- [Setup \& Configuration](#setup--configuration)
- [Supported Language Versions](#supported-language-versions)
- [Authentication](#authentication)
- [Access Token Authentication](#access-token-authentication)
- [Setting the Access Token](#setting-the-access-token)
- [Services](#services)
- [Response Wrappers](#response-wrappers)
- [`TorboxApiResponse[T]`](#torboxapiresponset)
- [`TorboxApiError`](#torboxapierror)
- [`TorboxApiResponseMetadata`](#torboxapiresponsemetadata)
- [Models](#models)
- [License](#license)
# 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:
```go
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:
```go
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](documentation/services/torrents_service.md) |
| [UsenetService](documentation/services/usenet_service.md) |
| [WebDownloadsDebridService](documentation/services/web_downloads_debrid_service.md) |
| [GeneralService](documentation/services/general_service.md) |
| [NotificationsService](documentation/services/notifications_service.md) |
| [UserService](documentation/services/user_service.md) |
| [RssFeedsService](documentation/services/rss_feeds_service.md) |
| [IntegrationsService](documentation/services/integrations_service.md) |
| [QueuedService](documentation/services/queued_service.md) |
### 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](documentation/models/create_torrent_request.md) | |
| [CreateTorrentOkResponse](documentation/models/create_torrent_ok_response.md) | |
| [ControlTorrentOkResponse](documentation/models/control_torrent_ok_response.md) | |
| [RequestDownloadLinkOkResponse](documentation/models/request_download_link_ok_response.md) | |
| [GetTorrentListOkResponse](documentation/models/get_torrent_list_ok_response.md) | |
| [GetTorrentCachedAvailabilityOkResponse](documentation/models/get_torrent_cached_availability_ok_response.md) | |
| [ExportTorrentDataOkResponse](documentation/models/export_torrent_data_ok_response.md) | |
| [GetTorrentInfoOkResponse](documentation/models/get_torrent_info_ok_response.md) | |
| [CreateUsenetDownloadRequest](documentation/models/create_usenet_download_request.md) | |
| [CreateUsenetDownloadOkResponse](documentation/models/create_usenet_download_ok_response.md) | |
| [GetUsenetListOkResponse](documentation/models/get_usenet_list_ok_response.md) | |
| [CreateWebDownloadRequest](documentation/models/create_web_download_request.md) | |
| [CreateWebDownloadOkResponse](documentation/models/create_web_download_ok_response.md) | |
| [GetWebDownloadListOkResponse](documentation/models/get_web_download_list_ok_response.md) | |
| [GetHosterListOkResponse](documentation/models/get_hoster_list_ok_response.md) | |
| [GetUpStatusOkResponse](documentation/models/get_up_status_ok_response.md) | |
| [GetStatsOkResponse](documentation/models/get_stats_ok_response.md) | |
| [GetNotificationFeedOkResponse](documentation/models/get_notification_feed_ok_response.md) | |
| [GetUserDataOkResponse](documentation/models/get_user_data_ok_response.md) | |
| [AddReferralToAccountOkResponse](documentation/models/add_referral_to_account_ok_response.md) | |
| [GetAllJobsOkResponse](documentation/models/get_all_jobs_ok_response.md) | |
| [GetAllJobsByHashOkResponse](documentation/models/get_all_jobs_by_hash_ok_response.md) | |
## License
This SDK is licensed under the MIT License.
See the [LICENSE](LICENSE) file for more details.