https://github.com/qsctech/box-sdk-go
box SDK for go
https://github.com/qsctech/box-sdk-go
Last synced: about 1 year ago
JSON representation
box SDK for go
- Host: GitHub
- URL: https://github.com/qsctech/box-sdk-go
- Owner: QSCTech
- License: mit
- Archived: true
- Created: 2018-10-07T09:53:47.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-10-14T16:24:11.000Z (over 7 years ago)
- Last Synced: 2025-03-23T07:17:56.367Z (about 1 year ago)
- Language: Go
- Size: 44.9 KB
- Stars: 3
- Watchers: 12
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://coveralls.io/github/QSCTech/box-sdk-go)
[](https://goreportcard.com/report/github.com/QSCTech/box-sdk-go)
[](https://travis-ci.org/QSCTech/box-sdk-go)
[](https://github.com/QSCTech/box-sdk-go/blob/master/LICENSE)
[](https://godoc.org/github.com/QSCTech/box-sdk-go)
### QSC BOX SDK
V1 is a demo project for [gotten](https://github.com/Hexilee/gotten).
[V2](https://github.com/QSCTech/box-sdk-go/blob/master/v2) is released.
### Usage
This package supports upload/download functions of single file.
```go
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
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()
```go
resp, err := box.GetService().Upload(&box.UploadParam{File: gotten.FilePath("testAssets/avatar.jpg")})
if err == nil {
var result box.UploadResult
err = resp.Unmarshal(&result)
}
```