An open API service indexing awesome lists of open source software.

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

Awesome Lists containing this project

README

          

[![Coverage Status](https://coveralls.io/repos/github/QSCTech/box-sdk-go/badge.svg)](https://coveralls.io/github/QSCTech/box-sdk-go)
[![Go Report Card](https://goreportcard.com/badge/github.com/QSCTech/box-sdk-go)](https://goreportcard.com/report/github.com/QSCTech/box-sdk-go)
[![Build Status](https://travis-ci.org/QSCTech/box-sdk-go.svg?branch=master)](https://travis-ci.org/QSCTech/box-sdk-go)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/QSCTech/box-sdk-go/blob/master/LICENSE)
[![Documentation](https://godoc.org/github.com/QSCTech/box-sdk-go?status.svg)](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)
}
```