- 授权协议: GPL
- 开发语言: Google Go
- 操作系统: 跨平台
- 软件首页: https://github.com/ohohco/taobao
- 软件文档: https://github.com/ohohco/taobao
软件介绍
淘宝开放平台的go版的SDK. 内置sdk生成工具.
可由淘宝提供的ApiMetadata.xml,自动生成sdk. 主要有两种生成方式:
分结构生成
一键生成所有
示例代码:
package main
import (
"github.com/ohohco/taobao/autosdk"
"log"
"os"
"path"
)
var (
//生成文件所在路径.
root = "github.com/ohohco/taobao/api"
//ApiMetadata.xml文件
filename = "./ApiMetadata.xml"
//api文档的调用方法
apiMethod = "taobao.item.get"
//生成文件所在路径(绝对路径).
dest = path.Join(os.Getenv("GOPATH"), "src/github.com/ohohco/taobao/api")
)
func main() {
log.SetFlags(log.Lshortfile | log.LstdFlags)
//文件读取
var metadata *autosdk.Metadata
metadata, err := metadata.UnmarshalFile(filename)
if err != nil {
panic(err)
}
//文件生成
///////////////
////方式1//////
///////////////
if err = metadata.GenerateByApiMethod(apiMethod, dest); err != nil {
panic(err)
}
///////////////
////其他方式///
///////////////
if err = metadata.Generate(dest); err != nil {
panic(err)
}
//代码格式化:
if err = autosdk.Format(dest); err != nil {
panic(err)
}
//代码install:
if err = autosdk.Install(path.Join(root, "domain"),
path.Join(root, "request"),
path.Join(root, "response")); err != nil {
panic(err)
}
}
///////////////
////方式2//////
///////////////
if err = metadata.Generate(dest); err != nil {
panic(err)
}
Beginning XML with DOM and Ajax
Sas Jacobs / Apress / 2006-06-05 / USD 39.99
Don't waste time on 1,000-page tomes full of syntax; this book is all you need to get ahead in XML development. Renowned web developer Sas Jacobs presents an essential guide to XML. Beginning XML with......一起来看看 《Beginning XML with DOM and Ajax》 这本书的介绍吧!
