_123Open

package
v3.53.0 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2025 License: AGPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// baseurl
	ApiBaseURL = "https://open-api.123pan.com"

	// auth
	ApiToken = "/api/v1/access_token"

	// file list
	ApiFileList = "/api/v2/file/list"

	// direct link
	ApiGetDirectLink = "/api/v1/direct-link/url"

	// mkdir
	ApiMakeDir = "/upload/v1/file/mkdir"

	// remove
	ApiRemove = "/api/v1/file/trash"

	// upload
	ApiUploadDomainURL   = "/upload/v2/file/domain"
	ApiSingleUploadURL   = "/upload/v2/file/single/create"
	ApiCreateUploadURL   = "/upload/v2/file/create"
	ApiUploadSliceURL    = "/upload/v2/file/slice"
	ApiUploadCompleteURL = "/upload/v2/file/upload_complete"

	// move
	ApiMove = "/api/v1/file/move"

	// rename
	ApiRename = "/api/v1/file/name"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Addition

type Addition struct {
	driver.RootID

	ClientID     string `json:"client_id" required:"true" label:"Client ID"`
	ClientSecret string `json:"client_secret" required:"true" label:"Client Secret"`
}

type DirectLinkData

type DirectLinkData struct {
	URL string `json:"url"`
}

type DirectLinkResp

type DirectLinkResp struct {
	Code    int            `json:"code"`
	Message string         `json:"message"`
	Data    DirectLinkData `json:"data"`
}

type File

type File struct {
	FileName     string `json:"filename"`
	Size         int64  `json:"size"`
	CreateAt     string `json:"createAt"`
	UpdateAt     string `json:"updateAt"`
	FileId       int64  `json:"fileId"`
	Type         int    `json:"type"`
	Etag         string `json:"etag"`
	S3KeyFlag    string `json:"s3KeyFlag"`
	ParentFileId int    `json:"parentFileId"`
	Category     int    `json:"category"`
	Status       int    `json:"status"`
	Trashed      int    `json:"trashed"`
}

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) GetModified

func (f File) GetModified() 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) GetThumb

func (f File) GetThumb() string

func (File) IsDir

func (f File) IsDir() bool

func (File) ModTime

func (f File) ModTime() time.Time

type FileListData

type FileListData struct {
	LastFileId int64  `json:"lastFileId"`
	FileList   []File `json:"fileList"`
}

type FileListResp

type FileListResp struct {
	Code    int          `json:"code"`
	Message string       `json:"message"`
	Data    FileListData `json:"data"`
}

type MakeDirData

type MakeDirData struct {
	DirID int64 `json:"dirID"`
}

type MakeDirRequest

type MakeDirRequest struct {
	Name     string `json:"name"`
	ParentID int64  `json:"parentID"`
}

type MakeDirResp

type MakeDirResp struct {
	Code    int         `json:"code"`
	Message string      `json:"message"`
	Data    MakeDirData `json:"data"`
}

type Open123

type Open123 struct {
	model.Storage
	Addition

	UploadThread int
	// contains filtered or unexported fields
}

func (*Open123) ArchiveDecompress

func (d *Open123) ArchiveDecompress(ctx context.Context, srcObj, dstDir model.Obj, args model.ArchiveDecompressArgs) ([]model.Obj, error)

func (*Open123) Config

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

func (*Open123) Copy

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

func (*Open123) Drop

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

func (*Open123) Extract

func (d *Open123) Extract(ctx context.Context, obj model.Obj, args model.ArchiveInnerArgs) (*model.Link, error)

func (*Open123) GetAddition

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

func (*Open123) GetArchiveMeta

func (d *Open123) GetArchiveMeta(ctx context.Context, obj model.Obj, args model.ArchiveArgs) (model.ArchiveMeta, error)

func (*Open123) GetUploadDomains

func (d *Open123) GetUploadDomains() ([]string, error)

func (*Open123) Init

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

func (*Open123) List

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

func (*Open123) ListArchive

func (d *Open123) ListArchive(ctx context.Context, obj model.Obj, args model.ArchiveInnerArgs) ([]model.Obj, error)

func (*Open123) MakeDir

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

func (*Open123) Move

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

func (*Open123) Put

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

func (*Open123) Remove

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

func (*Open123) Rename

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

func (*Open123) Request

func (d *Open123) Request(endpoint string, method string, setup func(*resty.Request), result any) (*resty.Response, error)

func (*Open123) RequestTo

func (d *Open123) RequestTo(fullURL string, method string, setup func(*resty.Request), result any) (*resty.Response, error)

func (*Open123) Upload

func (d *Open123) Upload(ctx context.Context, file model.FileStreamer, parentID int64, createResp *UploadCreateResp, up driver.UpdateProgress) error

func (*Open123) UploadSingle

func (d *Open123) UploadSingle(ctx context.Context, createResp *UploadCreateResp, file model.FileStreamer, parentID int64) error

type RemoveRequest

type RemoveRequest struct {
	FileIDs []int64 `json:"fileIDs"`
}

type Response

type Response[T any] struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Data    T      `json:"data"`
}

type TokenData

type TokenData struct {
	AccessToken string `json:"accessToken"`
	ExpiredAt   string `json:"expiredAt"`
}

type TokenResp

type TokenResp struct {
	Code    int       `json:"code"`
	Message string    `json:"message"`
	Data    TokenData `json:"data"`
}

type UploadCompleteData

type UploadCompleteData struct {
	FileID    int  `json:"fileID"`
	Completed bool `json:"completed"`
}

type UploadCompleteResp

type UploadCompleteResp struct {
	Code    int                `json:"code"`
	Message string             `json:"message"`
	Data    UploadCompleteData `json:"data"`
}

type UploadCreateData

type UploadCreateData struct {
	FileID      int64    `json:"fileId"`
	Reuse       bool     `json:"reuse"`
	PreuploadID string   `json:"preuploadId"`
	SliceSize   int64    `json:"sliceSize"`
	Servers     []string `json:"servers"`
}

type UploadCreateResp

type UploadCreateResp struct {
	Code    int              `json:"code"`
	Message string           `json:"message"`
	Data    UploadCreateData `json:"data"`
}

type UploadUrlData

type UploadUrlData struct {
	PresignedURL string `json:"presignedUrl"`
}

type UploadUrlResp

type UploadUrlResp struct {
	Code    int           `json:"code"`
	Message string        `json:"message"`
	Data    UploadUrlData `json:"data"`
}

Jump to

Keyboard shortcuts

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