-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathexample_test.go
More file actions
40 lines (31 loc) · 776 Bytes
/
example_test.go
File metadata and controls
40 lines (31 loc) · 776 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package dropbox_test
import (
"fmt"
"io"
"os"
"github.com/tj/go-dropbox"
)
// Example using the Client, which provides both User and File clients.
func Example() {
d := dropbox.New(dropbox.NewConfig("<token>"))
file, _ := os.Open("Readme.md")
d.Files.Upload(&dropbox.UploadInput{
Path: "Readme.md",
Reader: file,
Mute: true,
})
}
// Example using the Files client directly.
func Example_files() {
files := dropbox.NewFiles(dropbox.NewConfig("<token>"))
out, _ := files.Download(&dropbox.DownloadInput{
Path: "Readme.md",
})
io.Copy(os.Stdout, out.Body)
}
// Example using the Users client directly.
func Example_users() {
users := dropbox.NewUsers(dropbox.NewConfig("<token>"))
out, _ := users.GetCurrentAccount()
fmt.Printf("%v\n", out)
}