forked from TrueCloudLab/rclone
filefabric: fix listing after change of from field from "int" to int.
This commit is contained in:
parent
054b467f32
commit
1b44035e45
1 changed files with 19 additions and 1 deletions
|
@ -5,6 +5,7 @@ package api
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"reflect"
|
"reflect"
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -51,6 +52,23 @@ func (t Time) String() string {
|
||||||
return time.Time(t).UTC().Format(timeFormatParameters)
|
return time.Time(t).UTC().Format(timeFormatParameters)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Int represents an integer which can be represented in JSON as a
|
||||||
|
// quoted integer or an integer.
|
||||||
|
type Int int
|
||||||
|
|
||||||
|
// MarshalJSON turns a Int into JSON
|
||||||
|
func (i *Int) MarshalJSON() (out []byte, err error) {
|
||||||
|
return json.Marshal((*int)(i))
|
||||||
|
}
|
||||||
|
|
||||||
|
// UnmarshalJSON turns JSON into a Int
|
||||||
|
func (i *Int) UnmarshalJSON(data []byte) error {
|
||||||
|
if len(data) >= 2 && data[0] == '"' && data[len(data)-1] == '"' {
|
||||||
|
data = data[1 : len(data)-1]
|
||||||
|
}
|
||||||
|
return json.Unmarshal(data, (*int)(i))
|
||||||
|
}
|
||||||
|
|
||||||
// Status return returned in all status responses
|
// Status return returned in all status responses
|
||||||
type Status struct {
|
type Status struct {
|
||||||
Code string `json:"status"`
|
Code string `json:"status"`
|
||||||
|
@ -115,7 +133,7 @@ type GetFolderContentsResponse struct {
|
||||||
Total int `json:"total,string"`
|
Total int `json:"total,string"`
|
||||||
Items []Item `json:"filelist"`
|
Items []Item `json:"filelist"`
|
||||||
Folder Item `json:"folder"`
|
Folder Item `json:"folder"`
|
||||||
From int `json:"from,string"`
|
From Int `json:"from"`
|
||||||
//Count int `json:"count"`
|
//Count int `json:"count"`
|
||||||
Pid string `json:"pid"`
|
Pid string `json:"pid"`
|
||||||
RefreshResult Status `json:"refreshresult"`
|
RefreshResult Status `json:"refreshresult"`
|
||||||
|
|
Loading…
Reference in a new issue