-
Notifications
You must be signed in to change notification settings - Fork 2
/
auto.go
46 lines (35 loc) · 967 Bytes
/
auto.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
package files_sdk
import (
"encoding/json"
lib "github.com/Files-com/files-sdk-go/v2/lib"
)
type Auto struct {
Dynamic map[string]interface{} `json:"dynamic,omitempty" path:"dynamic,omitempty" url:"dynamic,omitempty"`
}
// Identifier no path or id
type AutoCollection []Auto
func (a *Auto) UnmarshalJSON(data []byte) error {
type auto Auto
var v auto
if err := json.Unmarshal(data, &v); err != nil {
return lib.ErrorWithOriginalResponse{}.ProcessError(data, err, map[string]interface{}{})
}
*a = Auto(v)
return nil
}
func (a *AutoCollection) UnmarshalJSON(data []byte) error {
type autos AutoCollection
var v autos
if err := json.Unmarshal(data, &v); err != nil {
return lib.ErrorWithOriginalResponse{}.ProcessError(data, err, []map[string]interface{}{})
}
*a = AutoCollection(v)
return nil
}
func (a *AutoCollection) ToSlice() *[]interface{} {
ret := make([]interface{}, len(*a))
for i, v := range *a {
ret[i] = v
}
return &ret
}