file_browser_client

package
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 18 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BaseHeader

func BaseHeader() map[string]string

func FileMd5Bytes added in v0.4.0

func FileMd5Bytes(path string) ([]byte, error)

func FileMd5Hex added in v0.4.0

func FileMd5Hex(path string) (string, error)

func FileSha256Bytes added in v0.4.0

func FileSha256Bytes(path string) ([]byte, error)

func FileSha256Hex added in v0.4.0

func FileSha256Hex(path string) (string, error)

Types

type FileBrowserBasicFunc added in v0.7.0

type FileBrowserBasicFunc interface {
	Debug(isDebug bool)

	GetBaseUrl() string

	GetUsername() string

	SetRecaptcha(recaptcha string)

	GetRecaptcha() string

	IsLogin() bool

	Login() error
}

type FileBrowserClient

type FileBrowserClient struct {
	FileBrowserBasicFunc FileBrowserBasicFunc `json:"-"`

	FileBrowserResourceFunc FileBrowserResourceFunc `json:"-"`

	FileBrowserDirectoryFunc FileBrowserDirectoryFunc `json:"-"`

	FileBrowserShareFunc FileBrowserShareFunc `json:"-"`
	// contains filtered or unexported fields
}

func NewClient

func NewClient(
	username, password, baseUrl string,
	timeoutSecond, timeoutFileSecond uint,
) (FileBrowserClient, error)

NewClient new client for filebrowser

func (*FileBrowserClient) Debug

func (f *FileBrowserClient) Debug(isDebug bool)

Debug open FileBrowserClient debug or close

func (*FileBrowserClient) GetBaseUrl added in v0.7.0

func (f *FileBrowserClient) GetBaseUrl() string

func (*FileBrowserClient) GetRecaptcha added in v0.7.0

func (f *FileBrowserClient) GetRecaptcha() string

func (*FileBrowserClient) GetUsername added in v0.7.0

func (f *FileBrowserClient) GetUsername() string

func (*FileBrowserClient) IsLogin

func (f *FileBrowserClient) IsLogin() bool

IsLogin check FileBrowserClient has login

func (*FileBrowserClient) Login

func (f *FileBrowserClient) Login() error

Login do login in by FileBrowserClient

func (*FileBrowserClient) ResourceDownload

func (f *FileBrowserClient) ResourceDownload(remotePath string, localPath string, override bool) error

ResourceDownload remotePath must exist and not empty; override is true, will not check localPath and will mkdir by parent folder override is false, will check localPath and not mkdir by parent folder

func (*FileBrowserClient) ResourcesDeletePath

func (f *FileBrowserClient) ResourcesDeletePath(remotePath string) (bool, error)

ResourcesDeletePath remotePath just use remote path

func (*FileBrowserClient) ResourcesGet

func (f *FileBrowserClient) ResourcesGet(pathResource string) (web_api.Resources, error)

ResourcesGet pathResource path resource at remote

func (*FileBrowserClient) ResourcesGetCheckSum

func (f *FileBrowserClient) ResourcesGetCheckSum(pathResource string, checksum string) (web_api.Resources, error)

ResourcesGetCheckSum pathResource path resource at remote checksum will be [ md5 sha1 sha256 sha512 ] or empty

func (*FileBrowserClient) ResourcesPostDirectoryFiles

func (f *FileBrowserClient) ResourcesPostDirectoryFiles(resourceDirectory ResourcePostDirectory, override bool) (ResourcesPostDirectoryResult, error)

ResourcesPostDirectoryFiles post directory full files by ResourcePostDirectory settings ResourcePostDirectory.LocalDirectoryPath must exist override will want override remote path, but success must enable the permission at filebrowser to modify files

func (*FileBrowserClient) ResourcesPostFile

func (f *FileBrowserClient) ResourcesPostFile(resourceFile ResourcePostFile, override bool) error

ResourcesPostFile param post file by ResourcePostFile, ResourcePostFile.LocalFilePath must exist; override will want override remote path, but success must enable the permission at filebrowser to modify files

func (*FileBrowserClient) SetRecaptcha added in v0.7.0

func (f *FileBrowserClient) SetRecaptcha(recaptcha string)

func (*FileBrowserClient) ShareDelete

func (f *FileBrowserClient) ShareDelete(hash string) (bool, error)

ShareDelete delete share by share hash warning: For security purposes, this api always returns correct if the permission is passed

func (*FileBrowserClient) ShareGetByRemotePath

func (f *FileBrowserClient) ShareGetByRemotePath(remotePath string) ([]web_api.ShareLink, error)

ShareGetByRemotePath get share by remote path return shareLink will be list

func (*FileBrowserClient) SharePost

func (f *FileBrowserClient) SharePost(shareResource ShareResource) (ShareContent, error)

SharePost post share by ShareResource settings ShareResource.RemotePath must exist

func (*FileBrowserClient) SharesGet

func (f *FileBrowserClient) SharesGet() ([]web_api.ShareLink, error)

SharesGet get full shares by user. warning: do not use this api at production environment

type FileBrowserDirectoryFunc added in v0.7.0

type FileBrowserDirectoryFunc interface {
	ResourcesPostDirectoryFiles(resourceDirectory ResourcePostDirectory, override bool) (ResourcesPostDirectoryResult, error)
}

type FileBrowserResourceFunc added in v0.7.0

type FileBrowserResourceFunc interface {
	ResourcesGet(pathResource string) (web_api.Resources, error)

	ResourcesGetCheckSum(pathResource string, checksum string) (web_api.Resources, error)

	ResourcesDeletePath(remotePath string) (bool, error)

	ResourcesPostFile(resourceFile ResourcePostFile, override bool) error

	ResourceDownload(remotePath string, localPath string, override bool) error
}

type FileBrowserShareFunc added in v0.7.0

type FileBrowserShareFunc interface {
	SharePost(shareResource ShareResource) (ShareContent, error)

	ShareGetByRemotePath(remotePath string) ([]web_api.ShareLink, error)

	SharesGet() ([]web_api.ShareLink, error)

	ShareDelete(hash string) (bool, error)
}

type ResourcePostDirectory

type ResourcePostDirectory struct {
	RemoteDirectoryPath string
	LocalDirectoryPath  string
}

type ResourcePostFile

type ResourcePostFile struct {
	RemoteFilePath string
	LocalFilePath  string
}

type ResourcesPostDirectoryResult

type ResourcesPostDirectoryResult struct {
	FullSuccess  bool               `json:"full_success"`
	SuccessFiles []ResourcePostFile `json:"post_success_files,omitempty"`
	FailFiles    []ResourcePostFile `json:"fail_files,omitempty"`
}

type ShareContent

type ShareContent struct {
	ShareLink      web_api.ShareLink `json:"share_link"`
	RemotePath     string            `json:"remote_path"`
	DownloadUrl    string            `json:"download_url"`
	DownloadPage   string            `json:"download_page"`
	DownloadPasswd string            `json:"page_passwd,omitempty"`
}

type ShareResource

type ShareResource struct {
	RemotePath  string
	ShareConfig web_api.ShareConfig
}

Jump to

Keyboard shortcuts

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