Documentation
¶
Index ¶
- Variables
- func TranslateErr(err string) core.ErrorCode
- func UpstreamErrorWithCause(cause error) *core.UpstreamError
- type APIClient
- func (c APIClient) AddFile(params *AddFileParams) (APIResponse[AddFileData], error)
- func (c APIClient) DriveRequest(method, path string, params request.Context, v ResponseEnvelop) (*http.Response, error)
- func (c APIClient) GetFile(params *GetFileParams) (APIResponse[GetFileData], error)
- func (c APIClient) GetUser(params *GetUserParams) (APIResponse[GetUserData], error)
- func (c APIClient) GetVIPInfo(params *GetVIPInfoParams) (APIResponse[GetVIPInfoData], error)
- func (c APIClient) ListFiles(params *ListFilesParams) (APIResponse[ListFilesData], error)
- func (c APIClient) ListTasks(params *ListTasksParams) (APIResponse[ListTasksData], error)
- func (c APIClient) Trash(params *TrashParams) (APIResponse[TrashData], error)
- func (c APIClient) UserRequest(method, path string, params request.Context, v ResponseEnvelop) (*http.Response, error)
- type APIClientConfig
- type APIResponse
- type AddFileData
- type AddFileDataTask
- type AddFileDataURL
- type AddFileParams
- type AddFileParamsURL
- type AuthState
- type CaptchaToken
- type Context
- type Ctx
- type ErrorDetail
- type File
- type FileKind
- type FileMedia
- type FilePhase
- type GetFileData
- type GetFileParams
- type GetUserData
- type GetUserDataProvider
- type GetUserParams
- type GetVIPInfoData
- type GetVIPInfoDataVIPItem
- type GetVIPInfoParams
- type ListFilesData
- type ListFilesParams
- type ListTasksData
- type ListTasksParams
- type LockedFileLink
- type LoginParams
- type PikpakUser
- type ResponseContainer
- type ResponseEnvelop
- type StoreClient
- func (s *StoreClient) AddMagnet(params *store.AddMagnetParams) (*store.AddMagnetData, error)
- func (s *StoreClient) CheckMagnet(params *store.CheckMagnetParams) (*store.CheckMagnetData, error)
- func (s *StoreClient) GenerateLink(params *store.GenerateLinkParams) (*store.GenerateLinkData, error)
- func (s *StoreClient) GetMagnet(params *store.GetMagnetParams) (*store.GetMagnetData, error)
- func (s *StoreClient) GetName() store.StoreName
- func (s *StoreClient) GetUser(params *store.GetUserParams) (*store.User, error)
- func (s *StoreClient) GetWebz(params *store.GetWebzParams) (*store.GetWebzData, error)
- func (s *StoreClient) ListMagnets(params *store.ListMagnetsParams) (*store.ListMagnetsData, error)
- func (s *StoreClient) ListWebz(params *store.ListWebzParams) (*store.ListWebzData, error)
- func (s *StoreClient) RemoveMagnet(params *store.RemoveMagnetParams) (*store.RemoveMagnetData, error)
- type StoreClientConfig
- type Task
- type TrashData
- type TrashParams
- type VIPType
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaultHTTPClient = config.DefaultHTTPClient
View Source
var DriveAPIBaseURL = func() *url.URL { u, err := url.Parse("https://api-drive.mypikpak.com") if err != nil { panic(err) } return u }()
View Source
var ErrByCode = map[int]string{
3: "invalid_argument",
5: "not_found",
8: "file_space_not_enough",
9: "captcha_invalid",
16: "unauthenticated",
4002: "captcha_invalid",
4022: "invalid_account_or_password",
4126: "invalid_grant",
}
View Source
var UserAPIBaseURL = func() *url.URL { u, err := url.Parse("https://user.mypikpak.com") if err != nil { panic(err) } return u }()
View Source
var WebAlgorithms = []string{
"fyZ4+p77W1U4zcWBUwefAIFhFxvADWtT1wzolCxhg9q7etmGUjXr",
"uSUX02HYJ1IkyLdhINEFcCf7l2",
"iWt97bqD/qvjIaPXB2Ja5rsBWtQtBZZmaHH2rMR41",
"3binT1s/5a1pu3fGsN",
"8YCCU+AIr7pg+yd7CkQEY16lDMwi8Rh4WNp5",
"DYS3StqnAEKdGddRP8CJrxUSFh",
"crquW+4",
"ryKqvW9B9hly+JAymXCIfag5Z",
"Hr08T/NDTX1oSJfHk90c",
"i",
}
Functions ¶
func TranslateErr ¶
func UpstreamErrorWithCause ¶
func UpstreamErrorWithCause(cause error) *core.UpstreamError
Types ¶
type APIClient ¶
func NewAPIClient ¶
func NewAPIClient(conf *APIClientConfig) *APIClient
func (APIClient) AddFile ¶
func (c APIClient) AddFile(params *AddFileParams) (APIResponse[AddFileData], error)
func (APIClient) DriveRequest ¶
func (APIClient) GetFile ¶
func (c APIClient) GetFile(params *GetFileParams) (APIResponse[GetFileData], error)
func (APIClient) GetUser ¶
func (c APIClient) GetUser(params *GetUserParams) (APIResponse[GetUserData], error)
func (APIClient) GetVIPInfo ¶
func (c APIClient) GetVIPInfo(params *GetVIPInfoParams) (APIResponse[GetVIPInfoData], error)
func (APIClient) ListFiles ¶
func (c APIClient) ListFiles(params *ListFilesParams) (APIResponse[ListFilesData], error)
func (APIClient) ListTasks ¶
func (c APIClient) ListTasks(params *ListTasksParams) (APIResponse[ListTasksData], error)
func (APIClient) Trash ¶
func (c APIClient) Trash(params *TrashParams) (APIResponse[TrashData], error)
func (APIClient) UserRequest ¶
type APIClientConfig ¶
type AddFileData ¶
type AddFileData struct {
ResponseContainer
UploadType string `json:"upload_type"` // 'UPLOAD_TYPE_URL'
URL AddFileDataURL `json:"url"`
Task AddFileDataTask `json:"task"`
}
type AddFileDataTask ¶
type AddFileDataTask struct {
Kind string `json:"kind"` // 'drive#task'
Id string `json:"id"`
Name string `json:"name"`
Type string `json:"type"` // 'offline'
UserId string `json:"user_id"`
Statuses []any `json:"statuses"`
StatusSize int `json:"status_size"`
Params struct {
PredictSpeed string `json:"predict_speed"`
PredictType string `json:"predict_type"` // '3'
} `json:"params"`
FileId string `json:"file_id"`
FileName string `json:"file_name"`
FileSize string `json:"file_size"`
Message string `json:"message"`
CreatedTime string `json:"created_time"`
UpdatedTime string `json:"updated_time"`
ThirdTaskId string `json:"third_task_id"`
Phase FilePhase `json:"phase"`
Progress int `json:"progress"`
IconLink string `json:"icon_link"`
Callback string `json:"callback"`
Space string `json:"space"`
}
type AddFileDataURL ¶
type AddFileDataURL struct {
Kind string `json:"kind"` // 'upload#url'
}
type AddFileParams ¶
type AddFileParamsURL ¶
type AddFileParamsURL struct {
URL string `json:"url"`
}
type AuthState ¶
type AuthState struct {
AccessToken string `json:"atok"`
RefreshToken string `json:"rtok"`
UserId string `json:"uid"`
ExpiresAt int64 `json:"exp"`
CaptchaToken string `json:"-"`
}
func (AuthState) IsExpiring ¶
type CaptchaToken ¶
func (CaptchaToken) IsExpiring ¶
func (ct CaptchaToken) IsExpiring() bool
type Ctx ¶
func (Ctx) GetDeviceId ¶
func (Ctx) GetUser ¶
func (ctx Ctx) GetUser() *PikpakUser
func (Ctx) PreparePikpakHeader ¶
type ErrorDetail ¶
type File ¶
type File struct {
Apps []any `json:"apps"`
Audit struct {
Message string `json:"message"`
Status string `json:"status"` // 'STATUS_OK'
Title string `json:"title"`
} `json:"audit"`
CreatedTime string `json:"created_time"`
DeleteTime string `json:"delete_time"`
FileCategory string `json:"file_category"` // 'ARCHIVE' | 'OTHER'
FileExtension string `json:"file_extension"` // '.zip'
FolderType string `json:"folder_type"` // 'NORMAL' | 'DOWNLOAD'
Hash string `json:"hash"`
IconLink string `json:"icon_link"`
Id string `json:"id"`
Kind FileKind `json:"kind"`
Links struct{} `json:"links"`
MD5Checksum string `json:"md5_checksum"`
Medias []FileMedia `json:"medias"`
MimeType string `json:"mime_type"` // 'application/zip'
ModifiedTime string `json:"modified_time"`
Name string `json:"name"`
OriginalFileIndex int `json:"original_file_index"`
OriginalUrl string `json:"original_url"`
Params struct {
GlobalFileKind string `json:"global_file_kind,omitempty"` // '1'
GlobalFileRoot string `json:"global_file_root,omitempty"`
GlobalFileToken string `json:"global_file_token,omitempty"`
PlatformIcon string `json:"platform_icon"`
URL string `json:"url"`
} `json:"params"`
ParentId string `json:"parent_id"`
Phase FilePhase `json:"phase"`
ReferenceEvents []any `json:"reference_events"`
Revision string `json:"revision"` // '0'
Size string `json:"size"`
SortName string `json:"sort_name"`
Space string `json:"space"`
SpellName []any `json:"spell_name"`
Starred bool `json:"starred"`
Tags []any `json:"tags"`
ThumbnailLink string `json:"thumbnail_link"`
Trashed bool `json:"trashed"`
UserId string `json:"user_id"`
UserModifiedTime string `json:"user_modified_time"`
WebContentLink string `json:"web_content_link"`
Writable bool `json:"writable"`
}
type FileMedia ¶
type FileMedia struct {
MediaId string `json:"media_id"`
MediaName string `json:"media_name"`
Video struct {
Height int `json:"height"`
Width int `json:"width"`
Duration int `json:"duration"`
BitRate int `json:"bit_rate"`
FrameRate int `json:"frame_rate"`
VideoCodec string `json:"video_codec"`
AudioCodec string `json:"audio_codec"`
VideoType string `json:"video_type"`
HDRType string `json:"hdr_type"` // 'HDR10'
} `json:"video"`
Link struct {
URL string `json:"url"`
Token string `json:"token"`
Expire string `json:"expire"`
Type string `json:"type"`
} `json:"link"`
NeedMoreQuota bool `json:"need_more_quota"`
VIPTypes []any `json:"vip_types"`
RedirectLink string `json:"redirect_link"`
IconLink string `json:"icon_link"`
ExtIcon string `json:"ext_icon"`
IsDefault bool `json:"is_default"`
Priority int `json:"priority"`
IsOrigin bool `json:"is_origin"`
ResolutionName string `json:"resolution_name"` // '480P'
IsVisible bool `json:"is_visible"`
Category string `json:"category"` // 'category_origin' | 'category_transcode'
}
type GetFileData ¶
type GetFileData struct {
ResponseContainer
File
}
type GetFileParams ¶
type GetUserData ¶
type GetUserData struct {
ResponseContainer
CreatedAt time.Time `json:"created_at"`
Email string `json:"email"`
Name string `json:"name"`
PasswordUpdatedAt time.Time `json:"password_updated_at"`
Sub string `json:"sub"`
Providers []GetUserDataProvider `json:"providers"`
}
type GetUserDataProvider ¶
type GetUserParams ¶
type GetUserParams struct {
Ctx
}
type GetVIPInfoData ¶
type GetVIPInfoData struct {
Expire string `json:"expire"`
ExtType string `json:"ext_type"`
FeeRecord string `json:"fee_record"` // 'no_record'
Kind int `json:"kind"` // 1 / 0
Status string `json:"status"` // 'ok' / 'invalid'
Type VIPType `json:"type"` // 'platinum' / 'novip'
UserId string `json:"user_id"`
VIPItem []GetVIPInfoDataVIPItem `json:"vipItem"`
}
type GetVIPInfoDataVIPItem ¶
type GetVIPInfoParams ¶
type GetVIPInfoParams struct {
Ctx
}
type ListFilesData ¶
type ListFilesParams ¶
type ListTasksData ¶
type ListTasksData struct {
ResponseContainer
ExpiresIn int `json:"expires_in"`
NextPageToken string `json:"next_page_token"`
Tasks []Task `json:"tasks"`
}
type ListTasksParams ¶
type LockedFileLink ¶
type LockedFileLink string
type LoginParams ¶
type LoginParams struct {
Ctx
}
type PikpakUser ¶
func (PikpakUser) GetDeviceId ¶
func (u PikpakUser) GetDeviceId() string
type ResponseContainer ¶
type ResponseContainer struct {
Err string `json:"error"`
ErrCode int `json:"error_code"`
ErrDesc string `json:"error_description"`
ErrURL string `json:"error_url"`
ErrDetails []ErrorDetail `json:"error_details"`
}
func (*ResponseContainer) Error ¶
func (e *ResponseContainer) Error() string
func (*ResponseContainer) GetError ¶
func (r *ResponseContainer) GetError() *ResponseContainer
func (*ResponseContainer) HasError ¶
func (r *ResponseContainer) HasError() bool
type ResponseEnvelop ¶
type ResponseEnvelop interface {
HasError() bool
GetError() *ResponseContainer
}
type StoreClient ¶
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 (*StoreClient) GenerateLink ¶
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) GetWebz ¶
func (s *StoreClient) GetWebz(params *store.GetWebzParams) (*store.GetWebzData, error)
func (*StoreClient) ListMagnets ¶
func (s *StoreClient) ListMagnets(params *store.ListMagnetsParams) (*store.ListMagnetsData, error)
func (*StoreClient) ListWebz ¶
func (s *StoreClient) ListWebz(params *store.ListWebzParams) (*store.ListWebzData, error)
func (*StoreClient) RemoveMagnet ¶
func (s *StoreClient) RemoveMagnet(params *store.RemoveMagnetParams) (*store.RemoveMagnetData, error)
type StoreClientConfig ¶
type Task ¶
type Task struct {
Callback string `json:"callback"`
CreatedTime string `json:"created_time"`
FileId string `json:"file_id"`
FileName string `json:"file_name"`
FileSize string `json:"file_size"`
IconLink string `json:"icon_link"`
Id string `json:"id"`
Kind string `json:"kind"`
Message string `json:"message"`
Name string `json:"name"`
Params struct {
Age string `json:"age"`
MimeType string `json:"mime_type"`
PredictType string `json:"predict_type"` // '1'
URL string `json:"url"`
} `json:"params"`
Phase FilePhase `json:"phase"`
Progress int `json:"progress"`
ReferenceResource struct {
Type string `json:"@type"`
Audit struct {
Message string `json:"message"`
Status string `json:"status"` // 'STATUS_OK'
Title string `json:"title"`
} `json:"audit"`
Hash string `json:"hash"`
IconLink string `json:"icon_link"`
Id string `json:"id"`
Kind string `json:"kind"`
Medias []any `json:"medias"`
MimeType string `json:"mime_type"`
Name string `json:"name"`
Params struct {
PlatformIcon string `json:"platform_icon"`
URL string `json:"url"`
} `json:"params"`
ParentId string `json:"parent_id"`
Phase FilePhase `json:"phase"`
Size string `json:"size"`
Space string `json:"space"`
Starred bool `json:"starred"`
Tags []any `json:"tags"`
ThumbnailLink string `json:"thumbnail_link"`
}
Space string `json:"space"`
StatusSize int `json:"status_size"`
Statuses []any `json:"statuses"`
ThirdTaskId string `json:"third_task_id"`
Type string `json:"type"` // 'offline'
UpdatedTime string `json:"updated_time"`
UserId string `json:"user_id"`
}
type TrashData ¶
type TrashData struct {
ResponseContainer
TaskId string `json:"task_id"`
}
type TrashParams ¶
Click to show internal directories.
Click to hide internal directories.