原文:http://coderbee.net/index.php/open-source/20130820/414
把最近用Go写的 Dropbox SDK 发布到了 gihub上,有兴趣的可以参与、反馈。
地址: https://github.com/wen866595/godropbox
大多数接口都已实现,除了获取delta数据的,因为这个接口返回的JSON结构数据没法映射到Go的数据结构上。
一些示例:
oauth2 := &oauth2.OAuth2{AccessToken: "you ouath2 access_token"} dropboxApi := &dropbox.DropboxApi{Signer: oauth2, Root: "dropbox", Locale: "CN"} accountInfo, err := dropboxApi.GetAccountInfo() if err != nil { fmt.Printf("error msg: %s\n", err) } else { fmt.Printf("account info: %v\n", accountInfo) } metadata, err := dropboxApi.GetFileMetadata("/") if err != nil { fmt.Printf("error msg: %s\n", err) } else { fmt.Printf("metadata: %v\n", metadata) } put, err := dropboxApi.PutFileByName("main.go", "dropbox", "/main.go") if err != nil { fmt.Printf("error msg: %s\n", err) } else { fmt.Printf("put: %v\n", put) } copyRef, err := dropboxApi.CopyRef("/main.go") if err != nil { fmt.Printf("error msg: %s\n", err) } else { fmt.Printf("copyRef : %v\n", copyRef) } revisions, err := dropboxApi.Revisions("/main.go") if err != nil { fmt.Printf("error msg: %s\n", err) } else { fmt.Printf("revisions : %v\n", revisions) } shares, err := dropboxApi.Shares("/main.go") if err != nil { fmt.Printf("error msg: %s\n", err) } else { fmt.Printf("shares : %v\n", shares) } media, err := dropboxApi.Media("/main.go") if err != nil { fmt.Printf("error msg: %s\n", err) } else { fmt.Printf("media : %v\n", media) } thumbnails, err := dropboxApi.Thumbnails("/IMG_20130613_121901.jpg") if err != nil { fmt.Printf("get thumbnails error msg: %s\n", err) } else { ioerr := ioutil.WriteFile("IMG_20130613_121901.jpg", thumbnails.DataByte, 666) if ioerr == nil { fmt.Printf("write image ok .\n") } else { fmt.Printf("write image error : %v\n", ioerr) } } copym, err := dropboxApi.Copy("/testcopy.txt", "/abctest/testcopy.txt") if err != nil { fmt.Printf("error msg: %s\n", err) } else { fmt.Printf("copym : %v\n", copym) } copym, err := dropboxApi.Copy("/testcopy.txt", "/abctest/testcopy.txt") if err != nil { fmt.Printf("error msg: %s\n", err) } else { fmt.Printf("copym : %v\n", copym) } move, err := dropboxApi.Move("/abctest/testcopy.txt", "/testcopy-moved.txt") if err != nil { fmt.Printf("error msg: %s\n", err) } else { fmt.Printf("move : %v\n", move) } createFolder, err := dropboxApi.CreateFolder("createFolder") if err != nil { fmt.Printf("error msg: %s\n", err) } else { fmt.Printf("createFolder: %v\n", createFolder) } deleted, err := dropboxApi.Delete("createFolder") if err != nil { fmt.Printf("error msg: %s\n", err) } else { fmt.Printf("deleted: %v\n", deleted) }
相关推荐
dropbox-sdk-go-unofficial, Go的非官方 Dropbox SDK 面向 [UNOFFICIAL] 的 Dropbox 用于与Dropbox集成的非官方 go 。 使用 go 1.5 测试这菊花什么意思这里没有正式的Dropbox支持Bug 可能也可能无法修复并非所有的...
DropBlocks概述DropBlocks是Dropbox iOS SDK的包装,可让您使用块而不是委托回调。用法而不是像这样拨打电话: [restClient loadFile:path intoPath:destinationPath]; 然后实现这些回调: - (void)restClient:...
标题 "Go-Servefilesfromdropboxoverhttp(s)" 暗示了这是一个使用Go语言构建的服务,它能够通过HTTP(S)协议从Dropbox云存储服务上提供文件下载。描述 "Serve files from dropbox over http(s)" 进一步确认了这个功能...
dbxcli :Dropbox用户和团队管理员的命令行工具 产品特点 支持基本文件操作,例如ls,cp,mkdir,mv(通过Files API) 支持搜索 支持文件修订和文件还原 大文件分块上传,大目录分页列出 支持不断增长的团队运营 ...
Go 语言,又称 Golang,是由 Google 推出的一种静态类型的、编译型的、并发型且具有垃圾回收功能的编程语言。Go 语言的设计理念是简洁、高效和可移植性,这使得它成为构建分布式系统和网络服务的理想选择。GoBox ...
But really all they had go do was target marshmallow's SDK level and they get the auto backup and restore for free, automatically. Automatically restored when you restore your device. So