V1 is a demo project for gotten.
V2 is released.
This package supports upload/download functions of single file.
type (
Service struct {
Upload func(param *UploadParam) (gotten.Response, error) `method:"POST" path:"add_item"`
Change func(param *ChangeParam) (gotten.Response, error) `method:"POST" path:"change_item"`
Stat func(param *TokenParam) (gotten.Response, error) `path:"issec/{token}"` // resp: YES / NO<SP>
Verify func(param *SecParam) (gotten.Response, error) `path:"verify/{token}/{sec_token}"` // resp: Y / N
Download func(param *TokenParam) (gotten.Response, error) `path:"get/{token}"`
DownloadSec func(param *SecParam) (gotten.Response, error) `path:"get/{token}/{sec_token}"` // fail: html, no Content-Disposition
}
)
Get service singleton by GetService()
resp, err := box.GetService().Upload(&box.UploadParam{File: gotten.FilePath("testAssets/avatar.jpg")})
if err == nil {
var result box.UploadResult
err = resp.Unmarshal(&result)
}