-
Notifications
You must be signed in to change notification settings - Fork 0
/
uploads.go
38 lines (34 loc) · 867 Bytes
/
uploads.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
package connect
import "encoding/json"
// Upload management
// UploadsRemove - Remove uploaded file.
// Parameters
// id - identifier of uploaded file
func (s *ServerConnection) UploadsRemove(id string) error {
params := struct {
Id string `json:"id"`
}{id}
_, err := s.CallRaw("Uploads.remove", params)
return err
}
// UploadsRemoveList - Remove uploaded files.
// Parameters
// ids - identifiers of uploaded files
// Return
// errors - list of errors
func (s *ServerConnection) UploadsRemoveList(ids StringList) (ErrorList, error) {
params := struct {
Ids StringList `json:"ids"`
}{ids}
data, err := s.CallRaw("Uploads.removeList", params)
if err != nil {
return nil, err
}
errors := struct {
Result struct {
Errors ErrorList `json:"errors"`
} `json:"result"`
}{}
err = json.Unmarshal(data, &errors)
return errors.Result.Errors, err
}