Documentation
¶
Index ¶
- Constants
- Variables
- func TranslateErrorCode(errorCode ErrorCode) core.ErrorCode
- func UpstreamErrorWithCause(cause error) *core.UpstreamError
- type APIClient
- func (c APIClient) CheckTorrentsCached(params *CheckTorrentsCachedParams) (APIResponse[CheckTorrentsCachedData], error)
- func (c APIClient) ControlTorrent(params *ControlTorrentParams) (APIResponse[ControlTorrentData], error)
- func (c APIClient) CreateTorrent(params *CreateTorrentParams) (APIResponse[CreateTorrentData], error)
- func (c APIClient) GetTorrent(params *GetTorrentParams) (APIResponse[GetTorrentData], error)
- func (c APIClient) GetTorrentInfo(params *GetTorrentInfoParams) (APIResponse[GetTorrentInfoData], error)
- func (c APIClient) GetUser(params *GetUserParams) (APIResponse[GetUserData], error)
- func (c APIClient) ListTorrents(params *ListTorrentsParams) (APIResponse[ListTorrentsData], error)
- func (c APIClient) Request(method, path string, params request.Context, v ResponseEnvelop) (*http.Response, error)
- func (c APIClient) RequestDownloadLink(params *RequestDownloadLinkParams) (APIResponse[RequestDownloadLinkData], error)
- type APIClientConfig
- type APIResponse
- type CheckTorrentsCachedData
- type CheckTorrentsCachedDataItem
- type CheckTorrentsCachedDataItemFile
- type CheckTorrentsCachedParams
- type ControlTorrentData
- type ControlTorrentOperation
- type ControlTorrentParams
- type CreateTorrentData
- type CreateTorrentParams
- type CreateTorrentParamsSeed
- type Ctx
- type ErrorCode
- type GetTorrentData
- type GetTorrentInfoData
- type GetTorrentInfoParams
- type GetTorrentParams
- type GetUserData
- type GetUserParams
- type ListTorrentsData
- type ListTorrentsParams
- type LockedFileLink
- type Plan
- type RequestDownloadLinkData
- type RequestDownloadLinkParams
- type Response
- type ResponseEnvelop
- type ResponseError
- type ResponseStatus
- type StoreClient
- func (c *StoreClient) AddMagnet(params *store.AddMagnetParams) (*store.AddMagnetData, error)
- func (c *StoreClient) CheckMagnet(params *store.CheckMagnetParams) (*store.CheckMagnetData, error)
- func (c *StoreClient) GenerateLink(params *store.GenerateLinkParams) (*store.GenerateLinkData, error)
- func (c *StoreClient) GetMagnet(params *store.GetMagnetParams) (*store.GetMagnetData, error)
- func (c *StoreClient) GetName() store.StoreName
- func (c *StoreClient) GetUser(params *store.GetUserParams) (*store.User, error)
- func (c *StoreClient) ListMagnets(params *store.ListMagnetsParams) (*store.ListMagnetsData, error)
- func (c *StoreClient) RemoveMagnet(params *store.RemoveMagnetParams) (*store.RemoveMagnetData, error)
- type StoreClientConfig
- type Torrent
- type TorrentDownloadState
- type TorrentFile
Constants ¶
View Source
const ( PlanFree = iota PlanEssential PlanPro PlanStandard )
Variables ¶
View Source
var DefaultHTTPClient = request.DefaultHTTPClient
View Source
var DefaultHTTPTransport = request.DefaultHTTPTransport
Functions ¶
func TranslateErrorCode ¶
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) CheckTorrentsCached ¶
func (c APIClient) CheckTorrentsCached(params *CheckTorrentsCachedParams) (APIResponse[CheckTorrentsCachedData], error)
func (APIClient) ControlTorrent ¶
func (c APIClient) ControlTorrent(params *ControlTorrentParams) (APIResponse[ControlTorrentData], error)
func (APIClient) CreateTorrent ¶
func (c APIClient) CreateTorrent(params *CreateTorrentParams) (APIResponse[CreateTorrentData], error)
Possible Detail values:
- Found Cached Torrent. Using Cached Torrent.
func (APIClient) GetTorrent ¶
func (c APIClient) GetTorrent(params *GetTorrentParams) (APIResponse[GetTorrentData], error)
func (APIClient) GetTorrentInfo ¶
func (c APIClient) GetTorrentInfo(params *GetTorrentInfoParams) (APIResponse[GetTorrentInfoData], error)
func (APIClient) GetUser ¶
func (c APIClient) GetUser(params *GetUserParams) (APIResponse[GetUserData], error)
func (APIClient) ListTorrents ¶
func (c APIClient) ListTorrents(params *ListTorrentsParams) (APIResponse[ListTorrentsData], error)
func (APIClient) RequestDownloadLink ¶
func (c APIClient) RequestDownloadLink(params *RequestDownloadLinkParams) (APIResponse[RequestDownloadLinkData], error)
type APIClientConfig ¶
type APIResponse ¶
type CheckTorrentsCachedData ¶
type CheckTorrentsCachedData []CheckTorrentsCachedDataItem
type CheckTorrentsCachedDataItem ¶
type CheckTorrentsCachedDataItem struct { Name string `json:"name"` Size int `json:"size"` Hash string `json:"hash"` Files []CheckTorrentsCachedDataItemFile `json:"files"` }
type ControlTorrentData ¶
type ControlTorrentData struct { }
type ControlTorrentOperation ¶
type ControlTorrentOperation string
const ( ControlTorrentOperationReannounce ControlTorrentOperation = "reannounce" ControlTorrentOperationDelete ControlTorrentOperation = "delete" ControlTorrentOperationResume ControlTorrentOperation = "resume" ControlTorrentOperationPause ControlTorrentOperation = "pause" )
type ControlTorrentParams ¶
type ControlTorrentParams struct { Ctx TorrentId int `json:"torrent_id"` Operation ControlTorrentOperation `json:"operation"` All bool `json:"all"` }
type CreateTorrentData ¶
type CreateTorrentParams ¶
type CreateTorrentParamsSeed ¶
type CreateTorrentParamsSeed int
const ( CreateTorrentParamsSeedAuto CreateTorrentParamsSeed = 1 CreateTorrentParamsSeedYes CreateTorrentParamsSeed = 2 CreateTorrentParamsSeedNo CreateTorrentParamsSeed = 3 )
type ErrorCode ¶
type ErrorCode string
const ( ErrorCodeDatabaseError ErrorCode = "DATABASE_ERROR" ErrorCodeUnknownError ErrorCode = "UNKNOWN_ERROR" ErrorCodeNoAuth ErrorCode = "NO_AUTH" ErrorCodeBadToken ErrorCode = "BAD_TOKEN" ErrorCodeAuthError ErrorCode = "AUTH_ERROR" ErrorCodeInvalidOption ErrorCode = "INVALID_OPTION" ErrorCodeRedirectError ErrorCode = "REDIRECT_ERROR" ErrorCodeOAuthVerificationError ErrorCode = "OAUTH_VERIFICATION_ERROR" ErrorCodeEndpointNotFound ErrorCode = "ENDPOINT_NOT_FOUND" ErrorCodeItemNotFound ErrorCode = "ITEM_NOT_FOUND" ErrorCodePlanRestrictedFeature ErrorCode = "PLAN_RESTRICTED_FEATURE" ErrorCodeDuplicateItem ErrorCode = "DUPLICATE_ITEM" ErrorCodeBozoRssFeed ErrorCode = "BOZO_RSS_FEED" ErrorCodeSellixError ErrorCode = "SELLIX_ERROR" ErrorCodeTooMuchData ErrorCode = "TOO_MUCH_DATA" ErrorCodeDownloadTooLarge ErrorCode = "DOWNLOAD_TOO_LARGE" ErrorCodeMissingRequiredOption ErrorCode = "MISSING_REQUIRED_OPTION" ErrorCodeTooManyOptions ErrorCode = "TOO_MANY_OPTIONS" ErrorCodeBozoTorrent ErrorCode = "BOZO_TORRENT" ErrorCodeNoServersAvailableError ErrorCode = "NO_SERVERS_AVAILABLE_ERROR" ErrorCodeMonthlyLimit ErrorCode = "MONTHLY_LIMIT" ErrorCodeCooldownLimit ErrorCode = "COOLDOWN_LIMIT" ErrorCodeActiveLimit ErrorCode = "ACTIVE_LIMIT" ErrorCodeDownloadServerError ErrorCode = "DOWNLOAD_SERVER_ERROR" ErrorCodeBozoNzb ErrorCode = "BOZO_NZB" ErrorCodeSearchError ErrorCode = "SEARCH_ERROR" ErrorCodeInvalidDevice ErrorCode = "INVALID_DEVICE" ErrorCodeDiffIssue ErrorCode = "DIFF_ISSUE" ErrorCodeLinkOffline ErrorCode = "LINK_OFFLINE" ErrorCodeVendorDisabled ErrorCode = "VENDOR_DISABLED" )
type GetTorrentData ¶
type GetTorrentData = Torrent
type GetTorrentInfoData ¶
type GetTorrentInfoData = CheckTorrentsCachedDataItem
type GetTorrentInfoParams ¶
type GetTorrentParams ¶
type GetUserData ¶
type GetUserData struct { Id int `json:"id"` CreatedAt string `json:"created_at"` UpdatedAt string `json:"updated_at"` Email string `json:"email"` Plan Plan `json:"plan"` TotalDownloaded int `json:"total_downloaded"` Customer string `json:"customer"` Server int `json:"server"` IsSubscribed bool `json:"is_subscribed"` PremiumExpiresAt string `json:"premium_expires_at"` CooldownUntil string `json:"cooldown_until"` AuthId string `json:"auth_id"` UserReferral string `json:"user_referral"` BaseEmail string `json:"base_email"` Settings *map[string]any `json:"settings,omitempty"` }
type GetUserParams ¶
type ListTorrentsData ¶
type ListTorrentsData []Torrent
type ListTorrentsParams ¶
type LockedFileLink ¶
type LockedFileLink string
type RequestDownloadLinkData ¶
type RequestDownloadLinkData struct {
Link string
}
type Response ¶
type Response[T any] struct { Success bool `json:"success"` Data T `json:"data,omitempty"` Detail string `json:"detail"` Error ErrorCode `json:"error,omitempty"` }
func (Response[any]) GetError ¶
func (r Response[any]) GetError() *ResponseError
type ResponseEnvelop ¶
type ResponseEnvelop interface { IsSuccess() bool GetError() *ResponseError }
type ResponseError ¶
func (*ResponseError) Error ¶
func (e *ResponseError) Error() string
type ResponseStatus ¶
type ResponseStatus string
const ( ResponseStatusSuccess ResponseStatus = "success" ResponseStatusError ResponseStatus = "error" )
type StoreClient ¶
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 (*StoreClient) GenerateLink ¶
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 Torrent ¶
type Torrent struct { Id int `json:"id"` Hash string `json:"hash"` CreatedAt string `json:"created_at"` UpdatedAt string `json:"updated_at"` Magnet string `json:"magnet"` Size int `json:"size"` Active bool `json:"active"` AuthId string `json:"auth_id"` DownloadState TorrentDownloadState `json:"download_state"` Seeds int `json:"seeds"` Peers int `json:"peers"` Ratio float32 `json:"ratio"` Progress int `json:"progress"` DownloadSpeed int `json:"download_speed"` UploadSpeed int `json:"upload_speed"` Name string `json:"name"` ETA int `json:"eta"` Server int `json:"server"` TorrentFile bool `json:"torrent_file"` ExpiresAt string `json:"expires_at"` DownloadPresent bool `json:"download_present"` DownloadFinished bool `json:"download_finished"` Files []TorrentFile `json:"files"` InactiveCheck int `json:"inactive_check"` Availability int `json:"availability"` }
func (Torrent) GetAddedAt ¶
type TorrentDownloadState ¶
type TorrentDownloadState string
const ( TorrentDownloadStateDownloading TorrentDownloadState = "downloading" // The torrent is currently downloading TorrentDownloadStateUploading TorrentDownloadState = "uploading" // The torrent is currently seeding TorrentDownloadStatePaused TorrentDownloadState = "paused" // The torrent is paused TorrentDownloadStateCompleted TorrentDownloadState = "completed" // The torrent is completely downloaded. Do not use this for download completion status TorrentDownloadStateCached TorrentDownloadState = "cached" // The torrent is cached from the server TorrentDownloadStateMetaDL TorrentDownloadState = "metaDL" // The torrent is downloading metadata from the hoard TorrentDownloadStateCheckingResumeData TorrentDownloadState = "checkingResumeData" // The torrent is checking resumable data )
Click to show internal directories.
Click to hide internal directories.