Documentation ¶
Overview ¶
Copyright (c) 2020 tickstep.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- func DeleteLocalFile(localFilePath string) bool
- func HttpGet(header map[string]string, url string) string
- func HttpPost(header map[string]string, url string, data interface{}) string
- type Context
- type DownloadFileFinishParams
- type DownloadFilePrepareParams
- type DownloadFilePrepareResult
- type IdlePlugin
- func (p *IdlePlugin) DownloadFileFinishCallback(context *Context, params *DownloadFileFinishParams) error
- func (p *IdlePlugin) DownloadFilePrepareCallback(context *Context, params *DownloadFilePrepareParams) (*DownloadFilePrepareResult, error)
- func (p *IdlePlugin) Start() error
- func (p *IdlePlugin) Stop() error
- func (p *IdlePlugin) UploadFileFinishCallback(context *Context, params *UploadFileFinishParams) error
- func (p *IdlePlugin) UploadFilePrepareCallback(context *Context, params *UploadFilePrepareParams) (*UploadFilePrepareResult, error)
- type JsPlugin
- func (js *JsPlugin) DownloadFileFinishCallback(context *Context, params *DownloadFileFinishParams) error
- func (js *JsPlugin) DownloadFilePrepareCallback(context *Context, params *DownloadFilePrepareParams) (*DownloadFilePrepareResult, error)
- func (js *JsPlugin) LoadScript(script string) error
- func (js *JsPlugin) Start() error
- func (js *JsPlugin) Stop() error
- func (js *JsPlugin) UploadFileFinishCallback(context *Context, params *UploadFileFinishParams) error
- func (js *JsPlugin) UploadFilePrepareCallback(context *Context, params *UploadFilePrepareParams) (*UploadFilePrepareResult, error)
- type Plugin
- type PluginManager
- type UploadFileFinishParams
- type UploadFilePrepareParams
- type UploadFilePrepareResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeleteLocalFile ¶
DeleteLocalFile 删除本地文件,不支持文件夹
Types ¶
type Context ¶
type Context struct { AppName string `json:"appName"` Version string `json:"version"` UserId string `json:"userId"` Nickname string `json:"nickname"` FileDriveId string `json:"fileDriveId"` AlbumDriveId string `json:"albumDriveId"` }
Context 插件回调函数上下文信息
func GetContext ¶
type DownloadFileFinishParams ¶
type DownloadFileFinishParams struct { DriveId string `json:"driveId"` DriveFileName string `json:"driveFileName"` DriveFilePath string `json:"driveFilePath"` DriveFileSha1 string `json:"driveFileSha1"` DriveFileSize int64 `json:"driveFileSize"` DriveFileType string `json:"driveFileType"` DriveFileUpdatedAt string `json:"driveFileUpdatedAt"` DownloadResult string `json:"downloadResult"` LocalFilePath string `json:"localFilePath"` }
DownloadFileFinishParams 下载文件结束的回调函数-参数
type DownloadFilePrepareParams ¶
type DownloadFilePrepareParams struct { DriveId string `json:"driveId"` DriveFileName string `json:"driveFileName"` DriveFilePath string `json:"driveFilePath"` DriveFileSha1 string `json:"driveFileSha1"` DriveFileSize int64 `json:"driveFileSize"` DriveFileType string `json:"driveFileType"` DriveFileUpdatedAt string `json:"driveFileUpdatedAt"` LocalFilePath string `json:"localFilePath"` }
DownloadFilePrepareParams 下载文件前的回调函数-参数
type DownloadFilePrepareResult ¶
type DownloadFilePrepareResult struct { // DownloadApproved 确认该文件是否下载。yes-下载 no-不下载 DownloadApproved string `json:"downloadApproved"` // LocalFilePath 保存本地的修改后的路径。注意该路径是相对路径 LocalFilePath string `json:"localFilePath"` }
DownloadFilePrepareResult 上传文件前的回调函数-返回结果
type IdlePlugin ¶
type IdlePlugin struct {
Name string
}
func NewIdlePlugin ¶
func NewIdlePlugin() *IdlePlugin
func (*IdlePlugin) DownloadFileFinishCallback ¶
func (p *IdlePlugin) DownloadFileFinishCallback(context *Context, params *DownloadFileFinishParams) error
func (*IdlePlugin) DownloadFilePrepareCallback ¶
func (p *IdlePlugin) DownloadFilePrepareCallback(context *Context, params *DownloadFilePrepareParams) (*DownloadFilePrepareResult, error)
func (*IdlePlugin) Start ¶
func (p *IdlePlugin) Start() error
func (*IdlePlugin) Stop ¶
func (p *IdlePlugin) Stop() error
func (*IdlePlugin) UploadFileFinishCallback ¶
func (p *IdlePlugin) UploadFileFinishCallback(context *Context, params *UploadFileFinishParams) error
func (*IdlePlugin) UploadFilePrepareCallback ¶
func (p *IdlePlugin) UploadFilePrepareCallback(context *Context, params *UploadFilePrepareParams) (*UploadFilePrepareResult, error)
type JsPlugin ¶
type JsPlugin struct { Name string // contains filtered or unexported fields }
func NewJsPlugin ¶
func NewJsPlugin() *JsPlugin
func (*JsPlugin) DownloadFileFinishCallback ¶
func (js *JsPlugin) DownloadFileFinishCallback(context *Context, params *DownloadFileFinishParams) error
DownloadFileFinishCallback 下载文件结束的回调函数
func (*JsPlugin) DownloadFilePrepareCallback ¶
func (js *JsPlugin) DownloadFilePrepareCallback(context *Context, params *DownloadFilePrepareParams) (*DownloadFilePrepareResult, error)
DownloadFilePrepareCallback 下载文件前的回调函数
func (*JsPlugin) UploadFileFinishCallback ¶
func (js *JsPlugin) UploadFileFinishCallback(context *Context, params *UploadFileFinishParams) error
UploadFileFinishCallback 上传文件结束的回调函数
func (*JsPlugin) UploadFilePrepareCallback ¶
func (js *JsPlugin) UploadFilePrepareCallback(context *Context, params *UploadFilePrepareParams) (*UploadFilePrepareResult, error)
UploadFilePrepareCallback 上传文件前的回调函数
type Plugin ¶
type Plugin interface { // Start 启动 Start() error // UploadFilePrepareCallback 上传文件前的回调函数 UploadFilePrepareCallback(context *Context, params *UploadFilePrepareParams) (*UploadFilePrepareResult, error) // UploadFileFinishCallback 上传文件结束的回调函数 UploadFileFinishCallback(context *Context, params *UploadFileFinishParams) error // DownloadFilePrepareCallback 下载文件前的回调函数 DownloadFilePrepareCallback(context *Context, params *DownloadFilePrepareParams) (*DownloadFilePrepareResult, error) // DownloadFileFinishCallback 下载文件结束的回调函数 DownloadFileFinishCallback(context *Context, params *DownloadFileFinishParams) error // Stop 停止 Stop() error }
Plugin 插件接口
type PluginManager ¶
type PluginManager struct {
PluginPath string
}
func NewPluginManager ¶
func NewPluginManager(pluginDir string) *PluginManager
func (*PluginManager) GetPlugin ¶
func (p *PluginManager) GetPlugin() (Plugin, error)
func (*PluginManager) SetPluginPath ¶
func (p *PluginManager) SetPluginPath(pluginPath string) error
type UploadFileFinishParams ¶
type UploadFileFinishParams struct { LocalFilePath string `json:"localFilePath"` LocalFileName string `json:"localFileName"` LocalFileSize int64 `json:"localFileSize"` LocalFileType string `json:"localFileType"` LocalFileUpdatedAt string `json:"localFileUpdatedAt"` LocalFileSha1 string `json:"localFileSha1"` UploadResult string `json:"uploadResult"` DriveId string `json:"driveId"` DriveFilePath string `json:"driveFilePath"` }
UploadFileFinishParams 上传文件结束的回调函数-参数
type UploadFilePrepareParams ¶
type UploadFilePrepareParams struct { LocalFilePath string `json:"localFilePath"` LocalFileName string `json:"localFileName"` LocalFileSize int64 `json:"localFileSize"` LocalFileType string `json:"localFileType"` LocalFileUpdatedAt string `json:"localFileUpdatedAt"` DriveId string `json:"driveId"` DriveFilePath string `json:"driveFilePath"` }
UploadFilePrepareParams 上传文件前的回调函数-参数
type UploadFilePrepareResult ¶
type UploadFilePrepareResult struct { // UploadApproved 确认该文件是否上传。yes-上传 no-不上传 UploadApproved string `json:"uploadApproved"` // DriveFilePath 保存网盘的修改后的路径。注意该路径是相对路径 DriveFilePath string `json:"driveFilePath"` }
UploadFilePrepareResult 上传文件前的回调函数-返回结果