premiumize

package
v0.0.0-...-9649fc8 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2026 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const CachedMagnetIdPrefix = "premiumize:cached:magnet:"

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

func (c APIClient) CheckCache(params *CheckCacheParams) (APIResponse[CheckCacheData], error)

func (APIClient) CreateFolder

func (c APIClient) CreateFolder(params *CreateFolderParams) (APIResponse[CreateFolderData], error)

func (APIClient) CreateTransfer

func (c APIClient) CreateTransfer(params *CreateTransferParams) (APIResponse[CreateTransferData], error)

func (APIClient) DeleteFolder

func (c APIClient) DeleteFolder(params *DeleteFolderParams) (APIResponse[DeleteFolderData], error)

func (APIClient) DeleteTransfer

func (c APIClient) DeleteTransfer(params *DeleteTransferParams) (APIResponse[DeleteTransferData], error)

also deletes the folder

func (APIClient) GetAccountInfo

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

func (APIClient) GetItem

func (c APIClient) GetItem(params *GetItemParams) (APIResponse[GetItemData], error)

func (APIClient) ListFolders

func (c APIClient) ListFolders(params *ListFoldersParams) (APIResponse[ListFoldersData], error)

func (APIClient) ListItems

func (c APIClient) ListItems(params *ListItemsParams) (APIResponse[ListItemsData], error)

func (APIClient) ListTransfers

func (c APIClient) ListTransfers(params *ListTransfersParams) (APIResponse[ListTransfersData], error)

func (APIClient) Request

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

func (APIClient) SearchFolders

func (c APIClient) SearchFolders(params *SearchFoldersParams) (APIResponse[SearchFoldersData], error)

type APIClientConfig

type APIClientConfig struct {
	BaseURL    string // default: https://www.premiumize.me/api
	APIKey     string
	HTTPClient *http.Client
	UserAgent  string
}

type APIResponse

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

type CachedMagnetId

type CachedMagnetId string

type CheckCacheData

type CheckCacheData struct {
	Response   []bool        `json:"response"`
	Transcoded []bool        `json:"transcoded"`
	Filename   []string      `json:"filename"`
	Filesize   []json.Number `json:"filesize"`
}

type CheckCacheParams

type CheckCacheParams struct {
	Ctx
	Items []string
}

type CreateDirectDownloadLinkData

type CreateDirectDownloadLinkData struct {
	Location string                                `json:"location"`
	Filename string                                `json:"filename"`
	Filesize int                                   `json:"filesize"`
	Content  []CreateDirectDownloadLinkDataContent `json:"content"`
}

type CreateDirectDownloadLinkDataContent

type CreateDirectDownloadLinkDataContent struct {
	Path            string          `json:"path"`
	Size            int64           `json:"size"`
	Link            string          `json:"link"`
	StreamLink      string          `json:"stream_link"`
	TranscodeStatus TranscodeStatus `json:"transcode_status"`
}

func (CreateDirectDownloadLinkDataContent) GetName

func (CreateDirectDownloadLinkDataContent) GetPath

type CreateDirectDownloadLinkParams

type CreateDirectDownloadLinkParams struct {
	Ctx
	Src string
}

type CreateFolderData

type CreateFolderData struct {
	Id string `json:"id"`
}

type CreateFolderParams

type CreateFolderParams struct {
	Ctx
	Name     string
	ParentId string
}

type CreateTransferData

type CreateTransferData struct {
	Id   string `json:"id"`
	Name string `json:"name"`
	Type string `json:"type"`
}

type CreateTransferParams

type CreateTransferParams struct {
	Ctx
	Src      string
	File     *multipart.FileHeader
	FolderId string
}

type Ctx

type Ctx = request.Ctx

type DeleteFolderData

type DeleteFolderData struct {
}

type DeleteFolderParams

type DeleteFolderParams struct {
	Ctx
	Id string
}

type DeleteTransferData

type DeleteTransferData struct{}

type DeleteTransferParams

type DeleteTransferParams struct {
	Ctx
	Id string
}

type FolderItemType

type FolderItemType string
const (
	FolderItemTypeFolder FolderItemType = "folder"
	FolderItemTypeFile   FolderItemType = "file"
)

type GetAccountInfoData

type GetAccountInfoData struct {
	CustomerId   string  `json:"customer_id"`
	PremiumUntil int     `json:"premium_until"`
	LimitUsed    float32 `json:"limit_used"`
	SpaceUsed    int     `json:"space_used"`
}

type GetAccountInfoParams

type GetAccountInfoParams struct {
	Ctx
}

type GetItemData

type GetItemData struct {
	Id                string    `json:"id"`
	UserId            int       `json:"user_id"`
	CustomerId        int       `json:"customer_id"`
	Name              string    `json:"name"`
	Size              int64     `json:"size"`
	CreatedAt         int64     `json:"created_at"`
	TranscodeStatus   string    `json:"transcode_status"` // pending / good_as_is
	FolderId          string    `json:"folder_id"`
	ServerName        string    `json:"server_name"`
	ACodec            string    `json:"acodec"`
	VCodec            string    `json:"vcodec"`
	MimeType          string    `json:"mime_type"`
	OpensubtitlesHash string    `json:"opensubtitles_hash"`
	ResX              string    `json:"resx"`
	ResY              string    `json:"resy"`
	Duration          string    `json:"duration"`
	VirusScan         VirusScan `json:"virus_scan"`
	AudioTrackNames   []string  `json:"audio_track_names"`
	CRC32             string    `json:"crc32"`
	Type              string    `json:"type"`
	Link              string    `json:"link"`
	DirectLink        string    `json:"directlink"`
	StreamLink        string    `json:"streamlink,omitempty"`
	Unpackable        bool      `json:"unpackable"`
}

func (GetItemData) GetCreatedAt

func (d GetItemData) GetCreatedAt() time.Time

type GetItemParams

type GetItemParams struct {
	Ctx
	Id string
}

type ListFolderDataBreadcrumbItem

type ListFolderDataBreadcrumbItem struct {
	Id       string `json:"id"`
	Name     string `json:"name"`
	ParentId string `json:"parent_id"`
}

type ListFolderDataContentItem

type ListFolderDataContentItem struct {
	Id              string          `json:"id"`
	Name            string          `json:"name"`
	Type            FolderItemType  `json:"type"`
	Size            int64           `json:"size"`
	CreatedAt       int64           `json:"created_at"`
	MimeType        string          `json:"mime_type"`
	TranscodeStatus TranscodeStatus `json:"transcode_status"`
	Link            string          `json:"link"`
	StreamLink      string          `json:"stream_link"`
	VirusScan       VirusScan       `json:"virus_scan"`
}

func (ListFolderDataContentItem) GetAddedAt

func (c ListFolderDataContentItem) GetAddedAt() time.Time

type ListFoldersData

type ListFoldersData struct {
	Content     []ListFolderDataContentItem    `json:"content"`
	Breadcrumbs []ListFolderDataBreadcrumbItem `json:"breadcrumbs"`
	Name        string                         `json:"name"`
	ParentId    string                         `json:"parent_id"`
	FolderId    string                         `json:"folder_id"`
}

type ListFoldersParams

type ListFoldersParams struct {
	Ctx
	Id                 string
	IncludeBreadcrumbs bool
}

type ListItemsData

type ListItemsData struct {
	Files []ListItemsDataFile
}

type ListItemsDataFile

type ListItemsDataFile struct {
	Id        string `json:"id"`
	Name      string `json:"name"`
	CreatedAt int64  `json:"created_at"`
	Size      int64  `json:"size"`
	MimeType  string `json:"mime_type"`
	VirusScan VirusScan
	Path      string
}

func (ListItemsDataFile) GetCreatedAt

func (c ListItemsDataFile) GetCreatedAt() time.Time

type ListItemsParams

type ListItemsParams struct {
	Ctx
}

type ListTransfersData

type ListTransfersData struct {
	Transfers []ListTransfersDataItem `json:"transfers"`
}

type ListTransfersDataItem

type ListTransfersDataItem struct {
	Id       string         `json:"id"`
	Name     string         `json:"name"`
	Message  string         `json:"message"`
	Status   TransferStatus `json:"status"`
	Progress float32        `json:"progress"`
	Src      string         `json:"src"`
	FolderId string         `json:"folder_id"`
	FileId   string         `json:"file_id"`
}

func (ListTransfersDataItem) GetAddedAt

func (t ListTransfersDataItem) GetAddedAt() time.Time

type ListTransfersParams

type ListTransfersParams struct {
	Ctx
}

type ResponseContainer

type ResponseContainer struct {
	Status  ResponseStatus `json:"status"`
	Message string         `json:"message,omitempty"`
}

func (*ResponseContainer) Error

func (e *ResponseContainer) Error() string

func (*ResponseContainer) GetError

func (r *ResponseContainer) GetError() *ResponseContainer

func (*ResponseContainer) GetStatus

func (r *ResponseContainer) GetStatus() ResponseStatus

type ResponseEnvelop

type ResponseEnvelop interface {
	GetStatus() ResponseStatus
	GetError() *ResponseContainer
}

type ResponseStatus

type ResponseStatus string
const (
	ResponseStatusSuccess ResponseStatus = "success"
	ResponseStatusError   ResponseStatus = "error"
)

type SearchFoldersData

type SearchFoldersData struct {
	Content []ListFolderDataContentItem `json:"content"`
}

type SearchFoldersParams

type SearchFoldersParams struct {
	Ctx
	Query string
}

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
	ParentFolderName string
}

type TranscodeStatus

type TranscodeStatus string
const (
	TranscodeStatusError         TranscodeStatus = "error"
	TranscodeStatusFetchPending  TranscodeStatus = "fetch_pending"
	TranscodeStatusFinished      TranscodeStatus = "finished"
	TranscodeStatusGoodAsIs      TranscodeStatus = "good_as_is"
	TranscodeStatusNotApplicable TranscodeStatus = "not_applicable"
	TranscodeStatusPending       TranscodeStatus = "pending"
	TranscodeStatusRunning       TranscodeStatus = "running"
)

type TransferStatus

type TransferStatus string
const (
	TransferStatusBanned   TransferStatus = "banned"
	TransferStatusDeleted  TransferStatus = "deleted"
	TransferStatusError    TransferStatus = "error"
	TransferStatusFinished TransferStatus = "finished"
	TransferStatusQueued   TransferStatus = "queued"
	TransferStatusRunning  TransferStatus = "running"
	TransferStatusSeeding  TransferStatus = "seeding"
	TransferStatusTimeout  TransferStatus = "timeout"
	TransferStatusWaiting  TransferStatus = "waiting"
)

type VirusScan

type VirusScan string
const (
	VirusScanError    VirusScan = "error"
	VirusScanInfected VirusScan = "infected"
	VirusScanOk       VirusScan = "ok"
)

Jump to

Keyboard shortcuts

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