Documentation
¶
Index ¶
- func IsAccountLimited(err error) bool
- func IsSpaceNotEnoughErr(err error) bool
- type API
- func (api *API) CreateFilesFromLink(ctx context.Context, master, worker, link string) (file *model.File, err error)
- func (api *API) CreateShare(ctx context.Context, master string, worker string, fileID string) (sharedLink string, err error)
- func (api *API) DeleteFilesByIDs(ctx context.Context, worker string, fileIDs []string) error
- func (api *API) DeleteShare(ctx context.Context, worker string, shareIDs []string) error
- func (api *API) DeleteShareByFileIDs(ctx context.Context, worker string, fileIDs []string) error
- func (api *API) GetFileByOriginalLinkHash(ctx context.Context, master string, worker string, originalLinkHash string) (*model.File, error)
- func (api *API) GetPremiumExpiration(ctx context.Context, worker string) (*time.Time, error)
- func (api *API) GetShareStatus(ctx context.Context, sharedLink string) (status share.State, worker string, err error)
- func (api *API) GetStatistics(ctx context.Context, sharedLink string) (*share.Statistics, error)
- func (api *API) GetStorageSize(ctx context.Context, worker string) (used, limit int64, err error)
- func (api *API) SignUp(ctx context.Context, email string, timeout time.Duration) (user *UserInfo, err error)
- func (api *API) UpdateFilesStatus(ctx context.Context, workerUserID string, files []*model.File, ...) (err error)
- func (api *API) UpdateWorkerPremium(ctx context.Context, worker *model.WorkerAccount) error
- func (api *API) UpdateWorkerStorage(ctx context.Context, worker string) error
- type JSON
- type RespErr
- type UserInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsAccountLimited ¶
IsAccountLimited returns whether the error is caused by space not enough.
func IsSpaceNotEnoughErr ¶
IsSpaceNotEnoughErr returns whether the error is caused by space not enough.
Types ¶
type API ¶
type API struct {
*hosts.Dependencies
// contains filtered or unexported fields
}
API PikPak server api.
func (*API) CreateFilesFromLink ¶
func (api *API) CreateFilesFromLink(ctx context.Context, master, worker, link string) (file *model.File, err error)
CreateFilesFromLink create files from link.
func (*API) CreateShare ¶
func (api *API) CreateShare(ctx context.Context, master string, worker string, fileID string) (sharedLink string, err error)
CreateShare create a sharing link by files.
func (*API) DeleteFilesByIDs ¶
func (*API) DeleteShare ¶
DeleteShare create a sharing link by files.
func (*API) DeleteShareByFileIDs ¶
DeleteShareByFileIDs deletes host shared links by original links.
func (*API) GetFileByOriginalLinkHash ¶
func (api *API) GetFileByOriginalLinkHash(ctx context.Context, master string, worker string, originalLinkHash string) (*model.File, error)
GetFileByOriginalLinkHash get file by original link. only one of master or worker is required.
func (*API) GetPremiumExpiration ¶
GetPremiumExpiration get the premium expiration for the worker account.
func (*API) GetShareStatus ¶
func (api *API) GetShareStatus(ctx context.Context, sharedLink string) (status share.State, worker string, err error)
GetShareStatus returns the statuses of the shared link.
func (*API) GetStatistics ¶
GetStatistics returns the statistics of each shared links.
func (*API) GetStorageSize ¶
GetStorageSize returns the used and limit size of the worker.
func (*API) SignUp ¶
func (api *API) SignUp(ctx context.Context, email string, timeout time.Duration) (user *UserInfo, err error)
SignUp sign up a new account by email.
func (*API) UpdateFilesStatus ¶
func (api *API) UpdateFilesStatus(ctx context.Context, workerUserID string, files []*model.File, updateRunningTasks ...bool) (err error)
UpdateFilesStatus update files status. All files must belong to the same worker.
func (*API) UpdateWorkerPremium ¶
UpdateWorkerPremium updates the worker's premium expiration and also storage info.