client

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2026 License: MIT Imports: 17 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is the high-level SDK wrapper. httpClient and creds are optional; when nil the global SDK client / global types.* values are used. When non-nil they enable per-account isolation so multiple Client instances can operate concurrently without racing on global state.

func New

func New(env ...*auth.AuthEnv) *Client

func NewWithClient added in v0.1.6

func NewWithClient(httpClient phttp.Client, env ...*auth.AuthEnv) *Client

NewWithClient creates a Client that uses the given HTTP client for all SDK calls. Pass nil to fall back to the global SDK client.

func (*Client) ComplateMultiPartUpload

func (c *Client) ComplateMultiPartUpload(path string, size types.SizeB, uploadId string, blockMd5List []string) (*file.CreateRes, error)

func (*Client) CompleteMultipartUpload added in v0.1.1

func (c *Client) CompleteMultipartUpload(state *MultipartUploadState) (*file.CreateRes, error)

func (*Client) CopyObject

func (c *Client) CopyObject(srcFilePath string, destDir string, newName ...string) (*file.FilemanagerItem, error)

func (*Client) Credentials added in v0.1.6

func (c *Client) Credentials() *types.Credentials

Credentials returns the per-client credentials, or nil to use global types.* values.

func (*Client) DeleteObject added in v0.0.3

func (c *Client) DeleteObject(srcFilePath string) (*file.FilemanagerItem, error)

func (*Client) GetAuthCodeURL

func (c *Client) GetAuthCodeURL(req ...*auth.AuthCodeReq) string

func (*Client) GetObject

func (c *Client) GetObject(path string) (io.ReadCloser, error)

func (*Client) GetObjectRange added in v0.0.2

func (c *Client) GetObjectRange(path string, start, end types.SizeB) (io.ReadCloser, error)

func (*Client) GetPathFsid

func (c *Client) GetPathFsid(filePath string) (uint64, error)

func (*Client) GetToken

func (c *Client) GetToken(code string, redirectUrl ...string) (*auth.GetTokenRes, error)

func (*Client) GetUploadHost

func (c *Client) GetUploadHost(path string, uploadId ...string) (*file.LocateUploadRes, error)

func (*Client) HTTPClient added in v0.1.6

func (c *Client) HTTPClient() phttp.Client

HTTPClient returns the per-client HTTP client, or nil to use the global SDK client.

func (*Client) InitMultiPartUpload

func (c *Client) InitMultiPartUpload(path string, size types.SizeB, blockList ...string) (*file.PreCreateRes, error)

func (*Client) ListObjects

func (c *Client) ListObjects(dir string, opt ...*file.ListAllReq) (*file.ListRes, error)

func (*Client) ListObjectsStream

func (c *Client) ListObjectsStream(dir string, opt ...*file.ListAllReq) <-chan *file.ListItem

func (*Client) Mkdir

func (c *Client) Mkdir(path string) (*file.CreateRes, error)

func (*Client) MoveObject

func (c *Client) MoveObject(srcFilePath string, destDir string, newName ...string) (*file.FilemanagerItem, error)

func (*Client) PutObject

func (c *Client) PutObject(path string, data io.Reader, ondup ...types.OndupMode) (*file.UploadRes, error)

func (*Client) Quota

func (c *Client) Quota(req ...*user.QuotaReq) (*user.QuotaRes, error)

func (*Client) RefreshToken

func (c *Client) RefreshToken() (*auth.GetTokenRes, error)

func (*Client) RenameObject

func (c *Client) RenameObject(srcFilePath string, newName string) (*file.FilemanagerItem, error)

func (*Client) SetAuth

func (c *Client) SetAuth(req *auth.AuthEnv)

SetAuth stores credentials into the Client (per-instance) AND writes the global types.* vars for backward compatibility with code paths that have not been migrated to per-Client usage.

func (*Client) StartMultipartUpload added in v0.1.1

func (c *Client) StartMultipartUpload(
	path string,
	size types.SizeB,
	blockMd5List []string,
	ondup ...types.OndupMode,
) (*MultipartUploadState, error)

func (*Client) StatObject

func (c *Client) StatObject(path string) (*file.FilemetasItem, error)

func (*Client) StatObjectUseFsId

func (c *Client) StatObjectUseFsId(fsId uint64) (*file.FilemetasItem, error)

func (*Client) StatObjects

func (c *Client) StatObjects(fsIds ...uint64) (*file.FilemetasRes, error)

func (*Client) StatObjectsPro

func (c *Client) StatObjectsPro(req *file.FilemetasReq) (*file.FilemetasRes, error)

func (*Client) UploadMultipartPart added in v0.1.1

func (c *Client) UploadMultipartPart(
	state *MultipartUploadState,
	partSeq int,
	data io.Reader,
) (*file.UploadChunkRes, error)

func (*Client) UploadPart

func (c *Client) UploadPart(path string, uploadId string, partSeq int, data io.Reader) (*file.UploadChunkRes, error)

func (*Client) UserInfo

func (c *Client) UserInfo(v2 ...bool) (*user.UserInfoRes, error)

type FileReader

type FileReader struct {
	// contains filtered or unexported fields
}

func (*FileReader) Close

func (d *FileReader) Close() error

func (*FileReader) Read

func (d *FileReader) Read(p []byte) (n int, err error)

func (*FileReader) Seek added in v0.0.2

func (d *FileReader) Seek(offset int64, whence int) (int64, error)

type MultipartUploadState added in v0.1.1

type MultipartUploadState struct {
	Path             string                `json:"path"`
	Size             types.SizeB           `json:"size"`
	UploadId         string                `json:"uploadid"`
	BlockMd5List     []string              `json:"block_md5_list"`
	PendingPartSeqs  []int                 `json:"pending_partseqs"`
	CompletedPartSeq []int                 `json:"completed_partseqs,omitempty"`
	RType            types.FileCreateRType `json:"rtype,omitempty"`
}

MultipartUploadState contains the resumable state callers can persist.

func (*MultipartUploadState) IsPartCompleted added in v0.1.1

func (s *MultipartUploadState) IsPartCompleted(partSeq int) bool

func (*MultipartUploadState) MarkPartCompleted added in v0.1.1

func (s *MultipartUploadState) MarkPartCompleted(partSeq int)

Jump to

Keyboard shortcuts

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