_123

package
v4.2.8 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2026 License: AGPL-3.0 Imports: 33 Imported by: 2

Documentation

Index

Constants

View Source
const (
	Api              = "https://yun.123pan.com/api"
	AApi             = "https://yun.123pan.com/a/api"
	BApi             = "https://yun.123pan.com/b/api"
	LoginApi         = "https://login.123pan.com/api"
	MainApi          = BApi
	SignIn           = LoginApi + "/user/sign_in"
	Logout           = MainApi + "/user/logout"
	UserInfo         = MainApi + "/user/info"
	FileList         = MainApi + "/file/list/new"
	DownloadInfo     = MainApi + "/file/download_info"
	Mkdir            = MainApi + "/file/upload_request"
	Move             = MainApi + "/file/mod_pid"
	Rename           = MainApi + "/file/rename"
	Trash            = MainApi + "/file/trash"
	UploadRequest    = MainApi + "/file/upload_request"
	UploadComplete   = MainApi + "/file/upload_complete"
	S3PreSignedUrls  = MainApi + "/file/s3_repare_upload_parts_batch"
	S3Auth           = MainApi + "/file/s3_upload_object/auth"
	UploadCompleteV2 = MainApi + "/file/upload_complete/v2"
	S3Complete       = MainApi + "/file/s3_complete_multipart_upload"

	OfflineResolve    = MainApi + "/v2/offline_download/task/resolve"
	OfflineSubmit     = MainApi + "/v2/offline_download/task/submit"
	OfflineTaskList   = MainApi + "/offline_download/task/list"
	OfflineTaskDelete = MainApi + "/offline_download/task/delete"
)

Variables

View Source
var ErrOfflineTaskNotFound = errors.New("offline task not found")

Functions

func GetApi

func GetApi(rawUrl string) string

Types

type Addition

type Addition struct {
	Username string `json:"username" required:"true"`
	Password string `json:"password" required:"true"`
	driver.RootID
	//OrderBy        string `json:"order_by" type:"select" options:"file_id,file_name,size,update_at" default:"file_name"`
	//OrderDirection string `json:"order_direction" type:"select" options:"asc,desc" default:"asc"`
	AccessToken  string
	UploadThread int    `json:"UploadThread" type:"number" default:"3" help:"the threads of upload"`
	Platform     string `json:"platform" type:"string" default:"web" help:"the platform header value, sent with API requests"`
}

type File

type File struct {
	FileName    string    `json:"FileName"`
	Size        int64     `json:"Size"`
	UpdateAt    time.Time `json:"UpdateAt"`
	FileId      int64     `json:"FileId"`
	Type        int       `json:"Type"`
	Etag        string    `json:"Etag"`
	S3KeyFlag   string    `json:"S3KeyFlag"`
	DownloadUrl string    `json:"DownloadUrl"`
}

func (File) CreateTime

func (f File) CreateTime() time.Time

func (File) GetHash

func (f File) GetHash() utils.HashInfo

func (File) GetID

func (f File) GetID() string

func (File) GetName

func (f File) GetName() string

func (File) GetPath

func (f File) GetPath() string

func (File) GetSize

func (f File) GetSize() int64

func (File) IsDir

func (f File) IsDir() bool

func (File) ModTime

func (f File) ModTime() time.Time

func (File) Thumb

func (f File) Thumb() string

type Files

type Files struct {
	//BaseResp
	Data struct {
		Next     string `json:"Next"`
		Total    int    `json:"Total"`
		InfoList []File `json:"InfoList"`
	} `json:"data"`
}

type Pan123

type Pan123 struct {
	model.Storage
	Addition
	// contains filtered or unexported fields
}

func (*Pan123) APIRateLimit

func (d *Pan123) APIRateLimit(ctx context.Context, api string) error

func (*Pan123) Config

func (d *Pan123) Config() driver.Config

func (*Pan123) Copy

func (d *Pan123) Copy(ctx context.Context, srcObj, dstDir model.Obj) error

func (*Pan123) DeleteOfflineTasks added in v4.1.10

func (d *Pan123) DeleteOfflineTasks(ctx context.Context, taskIDs []int64) error

func (*Pan123) Drop

func (d *Pan123) Drop(ctx context.Context) error

func (*Pan123) GetAddition

func (d *Pan123) GetAddition() driver.Additional

func (*Pan123) GetDetails added in v4.1.4

func (d *Pan123) GetDetails(ctx context.Context) (*model.StorageDetails, error)

func (*Pan123) GetOfflineTask added in v4.1.10

func (d *Pan123) GetOfflineTask(ctx context.Context, taskID int64) (*offlineTask, error)

func (*Pan123) Init

func (d *Pan123) Init(ctx context.Context) error
func (d *Pan123) Link(ctx context.Context, file model.Obj, args model.LinkArgs) (*model.Link, error)

func (*Pan123) List

func (d *Pan123) List(ctx context.Context, dir model.Obj, args model.ListArgs) ([]model.Obj, error)

func (*Pan123) MakeDir

func (d *Pan123) MakeDir(ctx context.Context, parentDir model.Obj, dirName string) error

func (*Pan123) Move

func (d *Pan123) Move(ctx context.Context, srcObj, dstDir model.Obj) error

func (*Pan123) OfflineDownload added in v4.1.10

func (d *Pan123) OfflineDownload(ctx context.Context, uri string, dstDir model.Obj) (int64, error)

func (*Pan123) Put

func (d *Pan123) Put(ctx context.Context, dstDir model.Obj, file model.FileStreamer, up driver.UpdateProgress) error

func (*Pan123) RapidHashAlgos added in v4.2.8

func (d *Pan123) RapidHashAlgos() []utils.HashType

RapidHashAlgos 返回 123 云盘支持的秒传哈希算法(MD5)

func (*Pan123) RapidHashNeedsPieces added in v4.2.8

func (d *Pan123) RapidHashNeedsPieces() bool

RapidHashNeedsPieces 123 云盘不需要分片哈希

func (*Pan123) RapidUploadByHashes added in v4.2.8

func (d *Pan123) RapidUploadByHashes(ctx context.Context, dstDir model.Obj, req *driver.SeedRapidUploadRequest, overwrite bool) (model.Obj, error)

RapidUploadByHashes 使用种子中的 MD5(Etag)哈希尝试秒传。

123 的秒传即「上传请求返回 reuse=true」,无需真正传输内容。

func (*Pan123) Remove

func (d *Pan123) Remove(ctx context.Context, obj model.Obj) error

func (*Pan123) Rename

func (d *Pan123) Rename(ctx context.Context, srcObj model.Obj, newName string) error

func (*Pan123) Request

func (d *Pan123) Request(url string, method string, callback base.ReqCallback, resp interface{}) ([]byte, error)

type S3PreSignedURLs

type S3PreSignedURLs struct {
	Data struct {
		PreSignedUrls map[string]string `json:"presignedUrls"`
	} `json:"data"`
}

type UploadResp

type UploadResp struct {
	//BaseResp
	Data struct {
		AccessKeyId     string `json:"AccessKeyId"`
		Bucket          string `json:"Bucket"`
		Key             string `json:"Key"`
		SecretAccessKey string `json:"SecretAccessKey"`
		SessionToken    string `json:"SessionToken"`
		FileId          int64  `json:"FileId"`
		Reuse           bool   `json:"Reuse"`
		EndPoint        string `json:"EndPoint"`
		StorageNode     string `json:"StorageNode"`
		UploadId        string `json:"UploadId"`
	} `json:"data"`
}

type UserInfoResp added in v4.1.4

type UserInfoResp struct {
	Data struct {
		Uid            int64  `json:"UID"`
		Nickname       string `json:"Nickname"`
		SpaceUsed      int64  `json:"SpaceUsed"`
		SpacePermanent int64  `json:"SpacePermanent"`
		SpaceTemp      int64  `json:"SpaceTemp"`
		FileCount      int    `json:"FileCount"`
	} `json:"data"`
}

Jump to

Keyboard shortcuts

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