-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtrash.go
60 lines (47 loc) · 1.47 KB
/
trash.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
package disk
// TODO
/*
func (c *Client) Delete(ctx context.Context, path string, params *QueryParams) (*Link, *ErrorResponse) {
resp, err := c.delete(ctx, s.client.apiURL+"trash/resources?path="+path, nil, params)
if err != nil {
return nil, handleResponseCode(resp.StatusCode)
}
defer resp.Body.Close()
var link *Link
if resp.StatusCode == http.StatusOK {
err = json.NewDecoder(resp.Body).Decode(&link)
if err != nil {
return nil, jsonDecodeError(err)
}
}
return nil, nil
}
// RestoreFromTrash -
func (s *TrashService) Restore(ctx context.Context, path string, params *QueryParams) (*Link, *Operation, *ErrorResponse) {
var link *Link
resp, err := s.client.put(ctx, s.client.apiURL+"trash/resources/restore?path="+path, nil, nil, params)
if haveError(err) {
return nil, nil, handleResponseCode(resp.StatusCode)
}
defer resp.Body.Close()
err = json.NewDecoder(resp.Body).Decode(&link)
if haveError(err) {
return nil, nil, jsonDecodeError(err)
}
return link, nil, nil
}
// ListTrashResources -
func (s *TrashService) List(ctx context.Context, path string, params *QueryParams) (*TrashResource, *ErrorResponse) {
var resource *TrashResource
resp, err := s.client.get(ctx, s.client.apiURL+"trash/resources?path="+path, params)
if haveError(err) {
return nil, handleResponseCode(resp.StatusCode)
}
defer resp.Body.Close()
err = json.NewDecoder(resp.Body).Decode(&resource)
if haveError(err) {
return nil, jsonDecodeError(err)
}
return resource, nil
}
*/