pikpak

package
v0.0.0-...-2c443e8 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2024 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Concurrent int64 = 1 << 4
View Source
var ErrNotFoundFolder = errors.New("not found pikpak folder")

Functions

This section is empty.

Types

type CompleteMultipartUpload

type CompleteMultipartUpload struct {
	Part []Part `xml:"Part"`
}

type File

type File struct {
	FileStat
	Revision       string `json:"revision"`
	Starred        bool   `json:"starred"`
	WebContentLink string `json:"web_content_link"`
	Links          struct {
		ApplicationOctetStream struct {
			URL    string    `json:"url"`
			Token  string    `json:"token"`
			Expire time.Time `json:"expire"`
		} `json:"application/octet-stream"`
	} `json:"links"`
	Audit struct {
		Status  string `json:"status"`
		Message string `json:"message"`
		Title   string `json:"title"`
	} `json:"audit"`
	Medias []struct {
		MediaID   string      `json:"media_id"`
		MediaName string      `json:"media_name"`
		Video     interface{} `json:"video"`
		Link      struct {
			URL    string    `json:"url"`
			Token  string    `json:"token"`
			Expire time.Time `json:"expire"`
		} `json:"link"`
		NeedMoreQuota  bool          `json:"need_more_quota"`
		VipTypes       []interface{} `json:"vip_types"`
		RedirectLink   string        `json:"redirect_link"`
		IconLink       string        `json:"icon_link"`
		IsDefault      bool          `json:"is_default"`
		Priority       int           `json:"priority"`
		IsOrigin       bool          `json:"is_origin"`
		ResolutionName string        `json:"resolution_name"`
		IsVisible      bool          `json:"is_visible"`
		Category       string        `json:"category"`
	} `json:"medias"`
	Trashed     bool   `json:"trashed"`
	DeleteTime  string `json:"delete_time"`
	OriginalURL string `json:"original_url"`
	Params      struct {
		Platform     string `json:"platform"`
		PlatformIcon string `json:"platform_icon"`
	} `json:"params"`
	OriginalFileIndex int           `json:"original_file_index"`
	Space             string        `json:"space"`
	Apps              []interface{} `json:"apps"`
	Writable          bool          `json:"writable"`
	FolderType        string        `json:"folder_type"`
	Collection        interface{}   `json:"collection"`
}

func (*File) Download

func (f *File) Download(path string, bar *mpb.Bar) error

Download file

type FileStat

type FileStat struct {
	Kind          string    `json:"kind"`
	ID            string    `json:"id"`
	ParentID      string    `json:"parent_id"`
	Name          string    `json:"name"`
	UserID        string    `json:"user_id"`
	Size          string    `json:"size"`
	FileExtension string    `json:"file_extension"`
	MimeType      string    `json:"mime_type"`
	CreatedTime   time.Time `json:"created_time"`
	ModifiedTime  time.Time `json:"modified_time"`
	IconLink      string    `json:"icon_link"`
	ThumbnailLink string    `json:"thumbnail_link"`
	Md5Checksum   string    `json:"md5_checksum"`
	Hash          string    `json:"hash"`
	Phase         string    `json:"phase"`
}

type OssArgs

type OssArgs struct {
	Bucket          string `json:"bucket"`
	AccessKeyId     string `json:"access_key_id"`
	AccessKeySecret string `json:"access_key_secret"`
	EndPoint        string `json:"endpoint"`
	Key             string `json:"key"`
	SecurityToken   string `json:"security_token"`
}

type Part

type Part struct {
	PartNumber string `xml:"PartNumber"`
	ETag       string `xml:"ETag"`
}

type PikPak

type PikPak struct {
	Account  string `json:"account"`
	Password string `json:"password"`
	JwtToken string `json:"token"`

	CaptchaToken  string `json:"captchaToken"`
	Sub           string `json:"userId"`
	DeviceId      string `json:"deviceId"`
	RefreshSecond int64  `json:"refreshSecond"`
	// contains filtered or unexported fields
}

func NewPikPak

func NewPikPak(account, password string) PikPak

func (*PikPak) AuthCaptchaToken

func (p *PikPak) AuthCaptchaToken(action string) error

func (*PikPak) CreateFolder

func (p *PikPak) CreateFolder(parentId, dir string) (string, error)

Create new folder in parent folder parentId is parent folder id

func (*PikPak) CreateShaFile

func (p *PikPak) CreateShaFile(parentId, fileName, size, sha string) error

func (*PikPak) CreateUrlFile

func (p *PikPak) CreateUrlFile(parentId, url string) error

func (*PikPak) GetDeepFolderId

func (p *PikPak) GetDeepFolderId(parentId string, dirPath string) (string, error)

获取文件夹 id dir 可以包括 /. 若以 / 开头,函数会去除 /, 且会从 parent 目录开始查找

func (*PikPak) GetDeepFolderOrCreateId

func (p *PikPak) GetDeepFolderOrCreateId(parentId string, dirPath string) (string, error)

func (*PikPak) GetFile

func (p *PikPak) GetFile(fileId string) (File, error)

func (*PikPak) GetFileStat

func (p *PikPak) GetFileStat(parentId string, name string) (FileStat, error)

Find FileState similar to name in the parentId directory

func (*PikPak) GetFolderFileStatList

func (p *PikPak) GetFolderFileStatList(parentId string) ([]FileStat, error)

func (*PikPak) GetFolderId

func (p *PikPak) GetFolderId(parentId string, dir string) (string, error)

获取文件夹 id dir 不能包括 /

func (*PikPak) GetPathFolderId

func (p *PikPak) GetPathFolderId(dirPath string) (string, error)

func (*PikPak) GetQuota

func (p *PikPak) GetQuota() (Quota, error)

get cloud quota

func (*PikPak) Login

func (p *PikPak) Login() error

func (*PikPak) RefreshToken

func (p *PikPak) RefreshToken() error

func (*PikPak) UploadFile

func (p *PikPak) UploadFile(parentId, path string) error

type Quota

type Quota struct {
	Kind           string `json:"kind"`
	Limit          string `json:"limit"`
	Usage          string `json:"usage"`
	UsageInTrash   string `json:"usage_in_trash"`
	PlayTimesLimit string `json:"play_times_limit"`
	PlayTimesUsage string `json:"play_times_usage"`
}

type Quotas

type Quotas struct {
}

Jump to

Keyboard shortcuts

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