box SDK for go
Switch branches/tags
Nothing to show
Clone or download
Latest commit d252cc2 Oct 15, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
testAssets add download test Oct 7, 2018
v2 add V2 Oct 14, 2018
.gitignore add download test Oct 7, 2018
.travis.yml pass all tests Oct 8, 2018
LICENSE add LICENSE Oct 8, 2018
README.md add V2 Oct 14, 2018
Service.go Fix: replace OrdSrc with OldSec in changeParam Oct 9, 2018
avatar.jpg add download test Oct 7, 2018
exception_test.go pass all tests Oct 8, 2018
go.coverprofile update module in go.mod Oct 14, 2018
go.mod update module in go.mod Oct 14, 2018
go.sum Update gotton -> v1.2.2 Oct 8, 2018
init.go Update gotton -> v1.2.2 Oct 8, 2018
service_test.go update module in go.mod Oct 14, 2018

README.md

Coverage Status Go Report Card Build Status License: MIT Documentation

QSC BOX SDK

V1 is a demo project for gotten.

V2 is released.

Usage

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)	
}