debridlink

package
v0.0.0-...-2e152c4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 13, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SeedboxTorrentStructureTypeList = "list"
	SeedboxTorrentStructureTypeTree = "tree"
)
View Source
const LIST_SEEDBOX_TORRENTS_PER_PAGE_MAX = 100
View Source
const LIST_SEEDBOX_TORRENTS_PER_PAGE_MIN = 20

Variables

View Source
var DefaultHTTPClient = config.DefaultHTTPClient

Functions

func TranslateErrorCode

func TranslateErrorCode(errorCode ErrorCode) core.ErrorCode

func UpstreamErrorWithCause

func UpstreamErrorWithCause(cause error) *core.UpstreamError

Types

type APIClient

type APIClient struct {
	BaseURL    *url.URL
	HTTPClient *http.Client
	// contains filtered or unexported fields
}

func NewAPIClient

func NewAPIClient(conf *APIClientConfig) *APIClient

func (APIClient) AddSeedboxTorrent

func (c APIClient) AddSeedboxTorrent(params *AddSeedboxTorrentParams) (APIResponse[AddSeedboxTorrentData], error)

func (APIClient) CheckSeedboxTorrentsCached deprecated

Deprecated: Debrid-Link removed the endpoint

func (APIClient) GetAccountInfo

func (c APIClient) GetAccountInfo(params *GetAccountInfoParams) (APIResponse[GetAccountInfoData], error)

func (APIClient) ListSeedboxTorrents

func (APIClient) RemoveSeedboxTorrents

func (c APIClient) RemoveSeedboxTorrents(params *RemoveSeedboxTorrentParams) (APIResponse[RemoveSeedboxTorrentData], error)

func (APIClient) Request

func (c APIClient) Request(method, path string, params request.Context, v ResponseEnvelop) (*http.Response, error)

type APIClientConfig

type APIClientConfig struct {
	BaseURL    string // default https://debrid-link.com/api
	APIKey     string
	HTTPClient *http.Client
	UserAgent  string
}

type APIResponse

type APIResponse[T any] struct {
	Header     http.Header
	StatusCode int
	Data       T
}

type AddSeedboxTorrentBody

type AddSeedboxTorrentBody struct {
	Url           string                      `json:"rl"`    // torrent url, magnet or hash
	Wait          bool                        `json:"wait"`  // wait before starting the torrent to select files. default: false
	Async         bool                        `json:"async"` // If true, won't wait metadata before returning result, recommended. default: false
	StructureType SeedboxTorrentStructureType `json:"structureType,omitempty"`
}

type AddSeedboxTorrentData

type AddSeedboxTorrentData = SeedboxTorrent

type AddSeedboxTorrentParams

type AddSeedboxTorrentParams struct {
	Ctx
	Url           string                      `json:"url"`                     // torrent url, magnet or hash
	File          *multipart.FileHeader       `json:"-"`                       // File MUST use "multipart/form-data" content-type
	Wait          bool                        `json:"wait"`                    // wait before starting the torrent to select files. default: false
	StructureType SeedboxTorrentStructureType `json:"structureType,omitempty"` // Files structure type. list or tree. Default to list
	IP            string                      `json:"ip,omitempty"`
}

type CheckSeedboxTorrentsCachedData

type CheckSeedboxTorrentsCachedData = map[string]CheckSeedboxTorrentsCachedTorrent

type CheckSeedboxTorrentsCachedParams

type CheckSeedboxTorrentsCachedParams struct {
	Ctx
	Urls []string // torrent url, magnet or hash
}

type CheckSeedboxTorrentsCachedTorrent

type CheckSeedboxTorrentsCachedTorrent struct {
	Name       string                                  `json:"name"`
	HashString string                                  `json:"hashString"`
	Files      []CheckSeedboxTorrentsCachedTorrentFile `json:"files"`
}

type CheckSeedboxTorrentsCachedTorrentFile

type CheckSeedboxTorrentsCachedTorrentFile struct {
	Name string `json:"name"`
	Size int    `json:"size"`
}

type Ctx

type Ctx = request.Ctx

type ErrorCode

type ErrorCode = core.ErrorCode
const (
	ErrorCodeBadToken                ErrorCode = "badToken"
	ErrorCodeBadSign                 ErrorCode = "badSign"
	ErrorCodeHidedToken              ErrorCode = "hidedToken"
	ErrorCodeServerError             ErrorCode = "server_error"
	ErrorCodeAccessDenied            ErrorCode = "access_denied"
	ErrorCodeAuthorizationPending    ErrorCode = "authorization_pending"
	ErrorCodeUnsupportedGrantType    ErrorCode = "unsupported_grant_type"
	ErrorCodeUnsupportedResponseType ErrorCode = "unsupported_response_type"
	ErrorCodeInvalidRequest          ErrorCode = "invalid_request"
	ErrorCodeInvalidScope            ErrorCode = "invalid_scope"
	ErrorCodeExpiredToken            ErrorCode = "expired_token"
	ErrorCodeUnauthorizedClient      ErrorCode = "unauthorized_client"
	ErrorCodeInvalidClient           ErrorCode = "invalid_client"
	ErrorCodeUnknowR                 ErrorCode = "unknowR"
	ErrorCodeInternalError           ErrorCode = "internalError"
	ErrorCodeBadArguments            ErrorCode = "badArguments"
	ErrorCodeBadId                   ErrorCode = "badId"
	ErrorCodeFloodDetected           ErrorCode = "floodDetected"
	ErrorCodeServerNotAllowed        ErrorCode = "serverNotAllowed"
	ErrorCodeFreeServerOverload      ErrorCode = "freeServerOverload"
	ErrorCodeMaxAttempts             ErrorCode = "maxAttempts"
	ErrorCodeCaptchaRequired         ErrorCode = "captchaRequired"
	ErrorCodeAccountLocked           ErrorCode = "accountLocked"
	ErrorCodeNotDebrid               ErrorCode = "notDebrid"
	ErrorCodeHostNotValid            ErrorCode = "hostNotValid"
	ErrorCodeFileNotFound            ErrorCode = "fileNotFound"
	ErrorCodeFileNotAvailable        ErrorCode = "fileNotAvailable"
	ErrorCodeBadFileUrl              ErrorCode = "badFileUrl"
	ErrorCodeBadFilePassword         ErrorCode = "badFilePassword"
	ErrorCodeNotFreeHost             ErrorCode = "notFreeHost"
	ErrorCodeMaintenanceHost         ErrorCode = "maintenanceHost"
	ErrorCodeNoServerHost            ErrorCode = "noServerHost"
	ErrorCodeMaxLink                 ErrorCode = "maxLink"
	ErrorCodeMaxLinkHost             ErrorCode = "maxLinkHost"
	ErrorCodeMaxData                 ErrorCode = "maxData"
	ErrorCodeMaxDataHost             ErrorCode = "maxDataHost"
	ErrorCodeDisabledServerHost      ErrorCode = "disabledServerHost"
	ErrorCodeNotAddTorrent           ErrorCode = "notAddTorrent"
	ErrorCodeTorrentTooBig           ErrorCode = "torrentTooBig"
	ErrorCodeMaxTorrent              ErrorCode = "maxTorrent"
	ErrorCodeMaxTransfer             ErrorCode = "maxTransfer"
)

type GetAccountInfoData

type GetAccountInfoData struct {
	Email             string                     `json:"email"`
	EmailVerified     bool                       `json:"emailVerified"`
	AccountType       int                        `json:"accountType"`
	PremiumLeft       int                        `json:"premiumLeft"`
	Pts               int                        `json:"pts"`
	Trafficshare      int                        `json:"trafficshare"`
	VouchersUrl       string                     `json:"vouchersUrl"`
	EditPasswordUrl   string                     `json:"editPasswordUrl"`
	EditEmailUrl      string                     `json:"editEmailUrl"`
	ViewSessidUrl     string                     `json:"viewSessidUrl"`
	UpgradeAccountUrl string                     `json:"upgradeAccountUrl"`
	RegisterDate      string                     `json:"registerDate"`
	ServerDetected    bool                       `json:"serverDetected"`
	Settings          GetAccountInfoDataSettings `json:"settings"`
	AvatarUrl         string                     `json:"avatarUrl"`
	Username          string                     `json:"username"`
}

type GetAccountInfoDataSettings

type GetAccountInfoDataSettings struct {
	Https         bool   `json:"https"`
	ThemeDark     bool   `json:"themeDark"`
	HideOldLinks  bool   `json:"hideOldLinks"`
	Cdn           string `json:"cdn"`
	TwofaType     string `json:"twofaType"`
	EmailsNews    bool   `json:"emailsNews"`
	EmailsAccount bool   `json:"emailsAccount"`
	EmailsSupport bool   `json:"emailsSupport"`
}

type GetAccountInfoParams

type GetAccountInfoParams struct {
	Ctx
}

type ListSeedboxTorrentsData

type ListSeedboxTorrentsData struct {
	Value      []SeedboxTorrent
	Pagination ResponsePagination
}

type ListSeedboxTorrentsParams

type ListSeedboxTorrentsParams struct {
	Ctx
	Ids           []string
	StructureType SeedboxTorrentStructureType
	Page          int // start at 0
	PerPage       int // min 20, max 100
	IP            string
}

type PaginatedResponse

type PaginatedResponse[T any] struct {
	Response[[]T]
	Pagination ResponsePagination `json:"pagination"`
}

type RemoveSeedboxTorrentData

type RemoveSeedboxTorrentData = []string

type RemoveSeedboxTorrentParams

type RemoveSeedboxTorrentParams struct {
	Ctx
	Ids []string
}

type RequestContext

type RequestContext interface {
	GetContext() context.Context
	PrepareBody(method string, query *url.Values) (body io.Reader, contentType string, err error)
}

type Response

type Response[T any] struct {
	*ResponseError
	Success bool `json:"success"`
	Value   T    `json:"value,omitempty"`
}

func (Response[any]) GetError

func (r Response[any]) GetError() *ResponseError

func (Response[any]) IsSuccess

func (r Response[any]) IsSuccess() bool

type ResponseEnvelop

type ResponseEnvelop interface {
	IsSuccess() bool
	GetError() *ResponseError
}

type ResponseError

type ResponseError struct {
	Err     ErrorCode `json:"error,omitempty"`
	ErrId   string    `json:"error_id,omitempty"`
	ErrDesc string    `json:"error_description,omitempty"`
}

func (*ResponseError) Error

func (e *ResponseError) Error() string

type ResponsePagination

type ResponsePagination struct {
	Page     int `json:"page"`
	Pages    int `json:"pages"`
	Next     int `json:"next"`
	Previous int `json:"previous"`
}

type SeedboxTorrent

type SeedboxTorrent struct {
	Id              string                  `json:"id"`
	Name            string                  `json:"name"`
	Error           int                     `json:"error"`
	ErrorString     string                  `json:"errorString"`
	HashString      string                  `json:"hashString"`
	UploadRatio     float64                 `json:"uploadRatio"`
	ServerId        string                  `json:"serverId"`
	Wait            bool                    `json:"wait"`
	Downloaded      bool                    `json:"downloaded"`
	PeersConnected  int                     `json:"peersConnected"`
	Status          int                     `json:"status"`
	ActProgress     bool                    `json:"act_progress"`
	TotalSize       int64                   `json:"totalSize"`
	Files           []SeedboxTorrentFile    `json:"files"`
	Trackers        []SeedboxTorrentTracker `json:"trackers"`
	IsZip           bool                    `json:"isZip"`
	Created         int64                   `json:"created"`
	DownloadPercent int                     `json:"downloadPercent"`
	DownloadSpeed   int                     `json:"downloadSpeed"`
	UploadSpeed     int                     `json:"uploadSpeed"`
}

func (SeedboxTorrent) GetAddedAt

func (t SeedboxTorrent) GetAddedAt() time.Time

type SeedboxTorrentFile

type SeedboxTorrentFile struct {
	Id              string `json:"id"`
	Name            string `json:"name"`
	DownloadUrl     string `json:"downloadUrl"`
	Downloaded      bool   `json:"downloaded"`
	Size            int64  `json:"size"`
	DownloadPercent int    `json:"downloadPercent"`
}

type SeedboxTorrentStructureType

type SeedboxTorrentStructureType string

type SeedboxTorrentTracker

type SeedboxTorrentTracker struct {
	Announce string `json:"announce"`
}

type StoreClient

type StoreClient struct {
	Name store.StoreName
	// contains filtered or unexported fields
}

func NewStoreClient

func NewStoreClient(config *StoreClientConfig) *StoreClient

func (*StoreClient) AddMagnet

func (c *StoreClient) AddMagnet(params *store.AddMagnetParams) (*store.AddMagnetData, error)

func (*StoreClient) CheckMagnet

func (c *StoreClient) CheckMagnet(params *store.CheckMagnetParams) (*store.CheckMagnetData, error)
func (c *StoreClient) GenerateLink(params *store.GenerateLinkParams) (*store.GenerateLinkData, error)

func (*StoreClient) GetMagnet

func (c *StoreClient) GetMagnet(params *store.GetMagnetParams) (*store.GetMagnetData, error)

func (*StoreClient) GetName

func (c *StoreClient) GetName() store.StoreName

func (*StoreClient) GetUser

func (c *StoreClient) GetUser(params *store.GetUserParams) (*store.User, error)

func (*StoreClient) ListMagnets

func (c *StoreClient) ListMagnets(params *store.ListMagnetsParams) (*store.ListMagnetsData, error)

func (*StoreClient) RemoveMagnet

func (c *StoreClient) RemoveMagnet(params *store.RemoveMagnetParams) (*store.RemoveMagnetData, error)

type StoreClientConfig

type StoreClientConfig struct {
	HTTPClient *http.Client
	UserAgent  string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL