Documentation
¶
Index ¶
- Constants
- func NewSite(name string, siteConfig *config.SiteConfigStruct, config *config.ConfigStruct) (site.Site, error)
- type DownloadTokenResponse
- type Float64String
- type Int64
- type Int64String
- type Profile
- type ProfileResponse
- type ResponseCode
- type Site
- func (m *Site) DownloadTorrent(url string) (content []byte, filename string, id string, err error)
- func (m *Site) DownloadTorrentById(id string) (content []byte, filename string, err error)
- func (m *Site) GetAllTorrents(sort string, desc bool, pageMarker string, baseUrl string) (torrents []*site.Torrent, nextPageMarker string, err error)
- func (m *Site) GetDefaultHttpHeaders() [][]string
- func (m *Site) GetLatestTorrents(full bool) ([]*site.Torrent, error)
- func (m *Site) GetName() string
- func (m *Site) GetSiteConfig() *config.SiteConfigStruct
- func (m *Site) GetStatus() (*site.Status, error)
- func (m *Site) PublishTorrent(contents []byte, metadata neturl.Values) (id string, err error)
- func (m *Site) PurgeCache()
- func (m *Site) SearchTorrents(keyword string, baseUrl string) (torrents []*site.Torrent, err error)
- type Time
- type Torrent
- type TorrentList
- type TorrentSearchRequest
- type TorrentSearchRequestOption
- type TorrentSearchResponse
- type TorrentStatus
Constants ¶
View Source
const ( APIPath_GenerateDownloadToken = "/api/torrent/genDlToken" APIPath_TorrentSearch = "/api/torrent/search" APIPath_Profile = "/api/member/profile" )
View Source
const ( TorrentSearchMode_Normal = "normal" TorrentSearchMode_Adult = "adult" TorrentSearchDirection_Asc = "ASC" TorrentSearchDirection_Desc = "DESC" // Torrent discount TorrentDiscount_Normal = "NORMAL" TorrentDiscount_50Percent = "PERCENT_50" // 50% TorrentDiscount_70Percent = "PERCENT_70" // 30% TorrentDiscount_Free = "FREE" // Free )
Variables ¶
This section is empty.
Functions ¶
func NewSite ¶
func NewSite(name string, siteConfig *config.SiteConfigStruct, config *config.ConfigStruct) (site.Site, error)
Types ¶
type DownloadTokenResponse ¶
type DownloadTokenResponse struct { ResponseCode Data string `json:"data"` }
type Float64String ¶
type Float64String string
func (Float64String) Value ¶
func (ci Float64String) Value() float64
type Int64String ¶
type Int64String string
func (Int64String) Value ¶
func (ci Int64String) Value() int64
type Profile ¶
type Profile struct { Id string `json:"id"` CreateDate Time `json:"createdDate"` LastModifiedDate Time `json:"lastModifiedDate"` UserName string `json:"username"` MemberCount struct { Bonus Int64String `json:"bonus"` Uploaded Int64String `json:"uploaded"` Downloaded Int64String `json:"downloaded"` ShareRate Float64String `json:"shareRate"` } `json:"memberCount"` }
type ProfileResponse ¶
type ProfileResponse struct { ResponseCode Data Profile `json:"data"` }
type ResponseCode ¶
func (ResponseCode) GetError ¶
func (r ResponseCode) GetError() error
type Site ¶
type Site struct { Name string SiteConfig *config.SiteConfigStruct HttpClient *azuretls.Session HttpHeaders [][]string }
func (*Site) DownloadTorrent ¶
DownloadTorrent download torrent by url like `https://kp.m-team.cc/api/rss/dl?credential=xxx` if url is id, find real url by this id then call DownloadTorrentById
func (*Site) DownloadTorrentById ¶
DownloadTorrentById download torrent by id
func (*Site) GetAllTorrents ¶
func (*Site) GetDefaultHttpHeaders ¶
func (*Site) GetLatestTorrents ¶
func (*Site) GetSiteConfig ¶
func (m *Site) GetSiteConfig() *config.SiteConfigStruct
func (*Site) PublishTorrent ¶
PublishTorrent implements site.Site.
func (*Site) PurgeCache ¶
func (m *Site) PurgeCache()
type TorrentList ¶
type TorrentSearchRequest ¶
type TorrentSearchRequest struct { Mode string `json:"mode"` Categories []string `json:"categories"` Visible int `json:"visible"` Keyword string `json:"keyword,omitempty"` PageNumber int64 `json:"pageNumber"` PageSize int `json:"pageSize"` SortDirection string `json:"sortDirection,omitempty"` SortField string `json:"sortField,omitempty"` }
func NewTorrentSearchRequest ¶
func NewTorrentSearchRequest(opts ...TorrentSearchRequestOption) TorrentSearchRequest
type TorrentSearchRequestOption ¶
type TorrentSearchRequestOption func(*TorrentSearchRequest)
func WithKeyword ¶
func WithKeyword(keyword string) TorrentSearchRequestOption
func WithMode ¶
func WithMode(mode string) TorrentSearchRequestOption
func WithPageNumber ¶
func WithPageNumber(pageNumber int64) TorrentSearchRequestOption
func WithSortDirection ¶
func WithSortDirection(desc bool) TorrentSearchRequestOption
func WithSortField ¶
func WithSortField(field string) TorrentSearchRequestOption
type TorrentSearchResponse ¶
type TorrentSearchResponse struct { ResponseCode Data TorrentList `json:"data"` }
Click to show internal directories.
Click to hide internal directories.