-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathapi.go
88 lines (54 loc) · 1.45 KB
/
api.go
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
package pkg
import (
"net/http"
"os"
"time"
)
type Space struct {
Available uint64 `json:"available,omitempty"`
Capacity uint64 `json:"capacity,omitempty"`
}
type File interface {
Id() string
PId() string
os.FileInfo
}
type FileExt struct {
FileCount int64
CreateTime time.Time
DownloadUrl string
}
type Api interface {
Sign() error
Space() (Space, error)
Login(name, password string) error
Find(id, name string) (File, error)
FindDir(id, name string) (File, error)
FindFile(id, name string) (File, error)
ListFile(id string) ([]File, error)
Mkdir(parentId, path string, parents bool) error
Mkdirs(parentId string, path ...string) (map[string]interface{}, error)
Copy(taget string, src ...File) error
Move(taget string, src ...File) error
Delete(src ...File) error
Rename(file File, newName string) error
Download(file File, start int64) (*http.Response, error)
ReadWriter
}
type App interface {
Uploader() ReadWriter
Login(name, password string) error
Sign() error
Space() (Space, error)
Stat(path string) (File, error)
List(file File) ([]File, error)
ListBy(name string) ([]File, error)
Mkdir(path string, parents bool) error
Mkdirs(path ...string) error
Copy(target string, from ...string) error
Move(target string, from ...string) error
Remove(paths ...string) error
Download(local string, paths ...string) error
DownloadFile(local string, file File) error
Upload(cloud string, locals ...string) error
}