debrider

package
v0.0.0-...-2971d17 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

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 (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)

func (APIClient) Request

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

type APIClientConfig

type APIClientConfig struct {
	BaseURL    string // default: https://debrider.app/api
	APIKey     string
	HTTPClient *http.Client
	UserAgent  string
}

type APIResponse

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

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 (*CheckLinkAvailabilityDataItemFile) GetPath

type CheckLinkAvailabilityParams

type CheckLinkAvailabilityParams struct {
	Ctx
	Data []string `json:"data"` // links
}

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 Ctx

type Ctx = request.Ctx

type DeleteTaskData

type DeleteTaskData struct {
	ResponseContainer
}

type DeleteTaskParams

type DeleteTaskParams struct {
	Ctx
	Id string
}

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 GetTaskParams struct {
	Ctx
	Id string
}

type ListTaskData

type ListTaskData []Task

type ListTaskParams

type ListTaskParams struct {
	Ctx
}
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

func (*ResponseContainer) GetError

func (r *ResponseContainer) GetError(res *http.Response) error

func (*ResponseContainer) Unmarshal

func (r *ResponseContainer) Unmarshal(res *http.Response, body []byte, v any) error

type StoreClient

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

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 (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 StoreClientConfig struct {
	HTTPClient *http.Client
	UserAgent  string
}

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

func (li *Task) GetAddedAt() time.Time

type TaskFile

type TaskFile struct {
	Name         string `json:"name"`
	Size         int64  `json:"size"`
	DownloadLink string `json:"download_link,omitempty"`
}

func (*TaskFile) GetName

func (f *TaskFile) GetName() string

func (*TaskFile) GetPath

func (f *TaskFile) GetPath() string

type TaskStatus

type TaskStatus string
const (
	TaskStatusError       TaskStatus = "error"
	TaskStatusParsing     TaskStatus = "parsing"
	TaskStatusDownloading TaskStatus = "downloading"
	TaskStatusCompleted   TaskStatus = "completed"
)

Jump to

Keyboard shortcuts

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