Documentation
¶
Overview ¶
Package client provides FileBrowser API clients.
Index ¶
- type AuthClient
- type LoginRequest
- type Resource
- type ResourceClient
- func (r *ResourceClient) Copy(ctx context.Context, src, dst string) error
- func (r *ResourceClient) Download(ctx context.Context, remotePath, localPath string) error
- func (r *ResourceClient) Info(ctx context.Context, path string) (*Resource, error)
- func (r *ResourceClient) List(ctx context.Context, path string) (*Resource, error)
- func (r *ResourceClient) Mkdir(ctx context.Context, path string) error
- func (r *ResourceClient) Move(ctx context.Context, src, dst string) error
- func (r *ResourceClient) Preview(ctx context.Context, path, size string) ([]byte, error)
- func (r *ResourceClient) Remove(ctx context.Context, path string) error
- func (r *ResourceClient) Upload(ctx context.Context, localPath, remotePath string, override bool) error
- type SearchClient
- type SearchResult
- type Share
- type ShareClient
- func (s *ShareClient) Create(ctx context.Context, path, expires, unit, password string) (*Share, error)
- func (s *ShareClient) Delete(ctx context.Context, hash string) error
- func (s *ShareClient) Info(ctx context.Context, path string) ([]Share, error)
- func (s *ShareClient) List(ctx context.Context) ([]Share, error)
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthClient ¶
type AuthClient struct {
C *httpclient.Client
}
AuthClient handles authentication operations.
func (*AuthClient) Login ¶
Login authenticates with FileBrowser and returns the token. The token is also stored on a.C.Token for subsequent requests.
type LoginRequest ¶
LoginRequest is the request body for login.
type Resource ¶
type Resource struct {
Path string `json:"path"`
Name string `json:"name"`
IsDir bool `json:"isDir"`
Size int64 `json:"size"`
Modified string `json:"modified"`
Created string `json:"created"`
Type string `json:"type"`
Extension string `json:"extension"`
Items []Resource `json:"items"`
NumDirs int `json:"numDirs"`
NumFiles int `json:"numFiles"`
Content string `json:"content,omitempty"`
Checksum string `json:"checksum,omitempty"`
}
Resource represents a FileBrowser file or directory.
type ResourceClient ¶
type ResourceClient struct {
C *httpclient.Client
}
ResourceClient handles resource operations.
func (*ResourceClient) Copy ¶
func (r *ResourceClient) Copy(ctx context.Context, src, dst string) error
Copy copies a resource.
func (*ResourceClient) Download ¶
func (r *ResourceClient) Download(ctx context.Context, remotePath, localPath string) error
Download downloads a remote file to a local path.
func (*ResourceClient) Mkdir ¶
func (r *ResourceClient) Mkdir(ctx context.Context, path string) error
Mkdir creates a directory at the remote path.
func (*ResourceClient) Move ¶
func (r *ResourceClient) Move(ctx context.Context, src, dst string) error
Move moves or renames a resource.
func (*ResourceClient) Preview ¶
Preview returns an image preview of a resource. size must be "thumb" (256x256) or "big" (1080x1080).
type SearchClient ¶
type SearchClient struct {
C *httpclient.Client
}
SearchClient handles search operations.
func (*SearchClient) Search ¶
func (s *SearchClient) Search(ctx context.Context, path, query string, limit int) ([]SearchResult, error)
Search searches for files matching the query. path is the directory to search in, query is the search term. limit is the maximum number of results (0 = no limit).
type SearchResult ¶
SearchResult represents a single search result.
type ShareClient ¶
type ShareClient struct {
}
ShareClient handles share operations.
func (*ShareClient) Create ¶
func (s *ShareClient) Create(ctx context.Context, path, expires, unit, password string) (*Share, error)
Create creates a new share for the given path.
func (*ShareClient) Delete ¶
func (s *ShareClient) Delete(ctx context.Context, hash string) error
Delete removes a share by hash.