Documentation
¶
Index ¶
- func IsAccountLimited(err error) bool
- func IsSpaceNotEnoughErr(err error) bool
- func IsTaskDailyCreateLimitErr(err error) bool
- func IsTaskRunNumsLimitErr(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) GetCommissions(ctx context.Context, userID string) (*GetCommissionsResponse, 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) InviteSubAccount(ctx context.Context, masterUserID string, workerEmail string) error
- func (api *API) JoinReferral(ctx context.Context, userID string) error
- func (api *API) SignUp(ctx context.Context, email string, timeout time.Duration) (user *UserInfo, err error)
- func (api *API) TriggerRunningFile(file *model.File)
- 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
- func (api *API) VerifyInviteSubAccountToken(ctx context.Context, token string) error
- type GetCommissionsResponse
- 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 or rate limit...
func IsSpaceNotEnoughErr ¶
IsSpaceNotEnoughErr returns whether the error is caused by space not enough.
func IsTaskDailyCreateLimitErr ¶ added in v0.1.4
IsTaskDailyCreateLimitErr returns whether the error is caused by task daily create limit.
func IsTaskRunNumsLimitErr ¶ added in v0.1.4
IsTaskRunNumsLimitErr returns whether the error is caused by task run nums limit.
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) GetCommissions ¶ added in v0.1.3
GetCommissions get commissions from server.
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) InviteSubAccount ¶ added in v0.1.2
func (api *API) InviteSubAccount(ctx context.Context, masterUserID string, workerEmail string) error
InviteSubAccount invite sub-account by email.
func (*API) JoinReferral ¶ added in v0.1.2
JoinReferral join https://mypikpak.com/referral/
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) TriggerRunningFile ¶ added in v0.1.5
TriggerRunningFile try to update the status of the running or pending files.
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.
func (*API) UpdateWorkerStorage ¶
UpdateWorkerStorage updates the worker's storage info from server.
type GetCommissionsResponse ¶ added in v0.1.3
type GetCommissionsResponse struct { Total float64 `json:"total"` Pending float64 `json:"pending"` Available float64 `json:"available"` }
GetCommissionsResponse is the response of the GetCommissions API.