Skip to content
This repository has been archived by the owner on Aug 17, 2024. It is now read-only.

QSCTech/box-sdk-go

Repository files navigation

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