This is a demo project for impler.
This package supports upload/download functions of single file.
/*
@Base https://box.zjuqsc.com/item
*/
type Service interface {
/*
@Desc upload a file by file path
@Post /add_item
@File(file) {path}
@Param(PHP_SESSION_UPLOAD_PROGRESS) qscbox
@Param(filecount) 1
@Param(callback) handleUploadCallback
@Param(is_ie9) 0
@Body multipart
*/
Upload(path string) (result *UploadResult, statusCode int, err error)
/*
@Desc change file status
@Post /change_item
@Param(new_token) {newToken}
@Param(old_token) {oldToken}
@Param(secure_id) {secureId}
@Param(token_sec) {tokenSec}
@Param(old_sec) {oldSec}
@Body form
*/
Change(newToken, jiami, oldToken, secureId, tokenSec, oldSec string, expiration int) (result *ChangeResult, statusCode int, err error)
/*
@Desc get file status
@Get issec/{token}
*/
Stat(token string) (*http.Response, error)
/*
@Desc verify secure token
@Get verify/{token}/{secToken}
*/
Verify(token, secToken string) (*http.Response, error)
/*
@Desc download a file
@Get get/{token}
*/
Download(token string) (*http.Response, error)
/*
@Desc download a secure file
@Get get/{token}/{secToken}
*/
DownloadSec(token, secToken string) (*http.Response, error)
}
service_impl.go
is generated by impler
Get service by NewService()
result, statusCode, err := box.NewService().Upload("testAssets/avatar.jpg")
if err == nil {
Deal(result)...
}