Documentation
¶
Index ¶
- Variables
- func UpstreamErrorWithCause(cause error) *core.UpstreamError
- type APIClient
- func (c APIClient) CheckLinkAvailability(params *CheckLinkAvailabilityParams) (APIResponse[CheckLinkAvailabilityData], error)
- func (c APIClient) CreateDownloadTask(params *CreateDownloadTaskParams) (APIResponse[Task], error)
- func (c APIClient) DeleteTask(params *DeleteTaskParams) (APIResponse[DeleteTaskData], error)
- func (c APIClient) GetAccount(params *GetAccountParams) (APIResponse[GetAccountData], error)
- func (c APIClient) GetTask(params *GetTaskParams) (APIResponse[Task], error)
- func (c APIClient) ListTask(params *ListTaskParams) (APIResponse[ListTaskData], error)
- func (c APIClient) Request(method, path string, params request.Context, v request.ResponseContainer) (*http.Response, error)
- type APIClientConfig
- type APIResponse
- type CheckLinkAvailabilityData
- type CheckLinkAvailabilityDataItem
- type CheckLinkAvailabilityDataItemFile
- type CheckLinkAvailabilityParams
- type CreateDownloadTaskData
- type CreateDownloadTaskParams
- type CreateDownloadTaskParamsData
- type Ctx
- type DeleteTaskData
- type DeleteTaskParams
- type DownloadTaskType
- type GetAccountData
- type GetAccountParams
- type GetTaskData
- type GetTaskParams
- type ListTaskData
- type ListTaskParams
- type LockedFileLink
- type ResponseContainer
- type StoreClient
- func (s *StoreClient) AddMagnet(params *store.AddMagnetParams) (*store.AddMagnetData, error)
- func (s *StoreClient) CheckMagnet(params *store.CheckMagnetParams) (*store.CheckMagnetData, error)
- func (s *StoreClient) GenerateLink(params *store.GenerateLinkParams) (*store.GenerateLinkData, error)
- func (s *StoreClient) GetMagnet(params *store.GetMagnetParams) (*store.GetMagnetData, error)
- func (s *StoreClient) GetName() store.StoreName
- func (s *StoreClient) GetUser(params *store.GetUserParams) (*store.User, error)
- func (s *StoreClient) ListMagnets(params *store.ListMagnetsParams) (*store.ListMagnetsData, error)
- func (s *StoreClient) RemoveMagnet(params *store.RemoveMagnetParams) (*store.RemoveMagnetData, error)
- type StoreClientConfig
- type Task
- type TaskFile
- type TaskStatus
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultHTTPClient = config.DefaultHTTPClient
Functions ¶
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) CheckLinkAvailability ¶
func (c APIClient) CheckLinkAvailability(params *CheckLinkAvailabilityParams) (APIResponse[CheckLinkAvailabilityData], error)
func (APIClient) CreateDownloadTask ¶
func (c APIClient) CreateDownloadTask(params *CreateDownloadTaskParams) (APIResponse[Task], error)
func (APIClient) DeleteTask ¶
func (c APIClient) DeleteTask(params *DeleteTaskParams) (APIResponse[DeleteTaskData], error)
func (APIClient) GetAccount ¶
func (c APIClient) GetAccount(params *GetAccountParams) (APIResponse[GetAccountData], error)
func (APIClient) GetTask ¶
func (c APIClient) GetTask(params *GetTaskParams) (APIResponse[Task], error)
func (APIClient) ListTask ¶
func (c APIClient) ListTask(params *ListTaskParams) (APIResponse[ListTaskData], error)
type APIClientConfig ¶
type CheckLinkAvailabilityData ¶
type CheckLinkAvailabilityData struct {
ResponseContainer
Result []CheckLinkAvailabilityDataItem `json:"result"`
}
type CheckLinkAvailabilityDataItem ¶
type CheckLinkAvailabilityDataItem struct {
Cached bool `json:"cached"`
Hash string `json:"hash"` // only when cached
Files []CheckLinkAvailabilityDataItemFile `json:"files"` // only when cached
}
type CheckLinkAvailabilityDataItemFile ¶
type CheckLinkAvailabilityDataItemFile struct {
Name string `json:"name"`
Size int64 `json:"size"`
DownloadLink string `json:"download_link"`
}
func (*CheckLinkAvailabilityDataItemFile) GetName ¶
func (f *CheckLinkAvailabilityDataItemFile) GetName() string
func (*CheckLinkAvailabilityDataItemFile) GetPath ¶
func (f *CheckLinkAvailabilityDataItemFile) GetPath() string
type CreateDownloadTaskData ¶
type CreateDownloadTaskData struct {
ResponseContainer
Data Task `json:"data"`
}
type CreateDownloadTaskParams ¶
type CreateDownloadTaskParams struct {
Ctx
Type DownloadTaskType `json:"type"`
Data CreateDownloadTaskParamsData `json:"data"`
}
type CreateDownloadTaskParamsData ¶
type CreateDownloadTaskParamsData struct {
FileContent *multipart.FileHeader // nzb / torrent
MagnetLink string // magnet
Url string // web
Password string // web
}
func (*CreateDownloadTaskParamsData) MarshalJSON ¶
func (d *CreateDownloadTaskParamsData) MarshalJSON() ([]byte, error)
type DeleteTaskData ¶
type DeleteTaskData struct {
ResponseContainer
}
type DeleteTaskParams ¶
type DownloadTaskType ¶
type DownloadTaskType string
const ( DownloadTaskTypeMagnet DownloadTaskType = "magnet" DownloadTaskTypeNzb DownloadTaskType = "nzb" DownloadTaskTypeTorrent DownloadTaskType = "torrent" DownloadTaskTypeWeb DownloadTaskType = "web" )
type GetAccountData ¶
type GetAccountData struct {
ResponseContainer
Id string `json:"id"`
Email string `json:"email"`
EmailConfirmedAt string `json:"email_confirmed_at"`
Role string `json:"role"` // user, admin
Subscription struct {
Id string `json:"id"`
UserId string `json:"user_id"`
PlanId string `json:"plan_id"`
Status string `json:"status"` // active, trialing, canceled
StartDate string `json:"start_date"`
EndDate string `json:"end_date,omitempty"`
CanceledAt string `json:"canceled_at,omitempty"`
CancelAtPeriodEnd bool `json:"cancel_at_period_end"`
TrialStart string `json:"trial_start,omitempty"`
TrialEnd string `json:"trial_end,omitempty"`
Metadata any `json:"metadata,omitempty"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
RazorpaySubscriptionId string `json:"razorpay_subscription_id,omitempty"`
ParadiseSubId string `json:"paradise_sub_id,omitempty"`
Plan struct {
Id string `json:"id"`
Url string `json:"url,omitempty"`
Name string `json:"name"`
Price float32 `json:"price"`
IsFree bool `json:"is_free"`
Currency string `json:"currency"` // USD
Interval string `json:"interval"` // year
Metadata struct {
ApiAccess bool `json:"api_access"`
ConcurrentSlots int `json:"concurrent_slots"`
DailyNzbDownloads int `json:"daily_nzb_downloads"` // -1
DownloadSpeedGbps int `json:"download_speed_gbps"`
UnlimitedDownloads bool `json:"unlimited_downloads"`
MaxDownloadSizeGb int `json:"max_download_size_gb"`
DailyHosterDownloads int `json:"daily_hoster_downloads"` // -1
DailyTorrentDownloads int `json:"daily_torrent_downloads"` // -1
DownloadRetentionDays int `json:"download_retention_days"`
UnlimitedHosterDownloads bool `json:"unlimited_hoster_downloads"`
} `json:"metadata"`
IsActive bool `json:"is_active"`
CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"`
Description string `json:"description"`
TotalCount int `json:"total_count"`
IntervalCount int `json:"interval_count"`
RazorpayPlanId string `json:"razorpay_plan_id,omitempty"`
} `json:"plan"`
} `json:"subscription"`
}
type GetAccountParams ¶
type GetAccountParams struct {
Ctx
}
type GetTaskData ¶
type GetTaskData struct {
ResponseContainer
Task
}
type GetTaskParams ¶
type ListTaskData ¶
type ListTaskData []Task
type ListTaskParams ¶
type ListTaskParams struct {
Ctx
}
type LockedFileLink ¶
type LockedFileLink string
func (LockedFileLink) Create ¶
func (l LockedFileLink) Create(taskId, fileName string) string
func (LockedFileLink) Parse ¶
func (l LockedFileLink) Parse() (taskId, fileName string, err error)
type ResponseContainer ¶
type ResponseContainer struct {
Message string `json:"message,omitempty"`
}
func (*ResponseContainer) Error ¶
func (e *ResponseContainer) Error() string
type StoreClient ¶
func NewStoreClient ¶
func NewStoreClient(config *StoreClientConfig) *StoreClient
func (*StoreClient) AddMagnet ¶
func (s *StoreClient) AddMagnet(params *store.AddMagnetParams) (*store.AddMagnetData, error)
func (*StoreClient) CheckMagnet ¶
func (s *StoreClient) CheckMagnet(params *store.CheckMagnetParams) (*store.CheckMagnetData, error)
func (*StoreClient) GenerateLink ¶
func (s *StoreClient) GenerateLink(params *store.GenerateLinkParams) (*store.GenerateLinkData, error)
func (*StoreClient) GetMagnet ¶
func (s *StoreClient) GetMagnet(params *store.GetMagnetParams) (*store.GetMagnetData, error)
func (*StoreClient) GetName ¶
func (s *StoreClient) GetName() store.StoreName
func (*StoreClient) GetUser ¶
func (s *StoreClient) GetUser(params *store.GetUserParams) (*store.User, error)
func (*StoreClient) ListMagnets ¶
func (s *StoreClient) ListMagnets(params *store.ListMagnetsParams) (*store.ListMagnetsData, error)
func (*StoreClient) RemoveMagnet ¶
func (s *StoreClient) RemoveMagnet(params *store.RemoveMagnetParams) (*store.RemoveMagnetData, error)
type StoreClientConfig ¶
type Task ¶
type Task struct {
Id string `json:"id"`
Hash string `json:"hash"`
Name string `json:"name"`
Size int64 `json:"size"`
Files []TaskFile `json:"files"`
Progress float64 `json:"progress"`
Status TaskStatus `json:"status"`
DownloadSpeed float64 `json:"downloadSpeed"` // in bytes per second
UploadSpeed float64 `json:"uploadSpeed"` // in bytes per second
ETA int64 `json:"eta"` // in seconds
AddedDate string `json:"addedDate"`
Type string `json:"type"` // torrent
}
func (*Task) GetAddedAt ¶
type TaskFile ¶
type TaskStatus ¶
type TaskStatus string
const ( TaskStatusError TaskStatus = "error" TaskStatusParsing TaskStatus = "parsing" TaskStatusDownloading TaskStatus = "downloading" TaskStatusCompleted TaskStatus = "completed" )
Click to show internal directories.
Click to hide internal directories.