Skip to content
box SDK for go
Go AMPL
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
testAssets
v2
.gitignore
.travis.yml
LICENSE
README.md
Service.go
avatar.jpg
exception_test.go
go.coverprofile
go.mod
go.sum
init.go
service_test.go

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)	
}
You can’t perform that action at this time.