-
Notifications
You must be signed in to change notification settings - Fork 2
/
release.go
53 lines (41 loc) · 1.49 KB
/
release.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
package files_sdk
import (
"encoding/json"
lib "github.com/Files-com/files-sdk-go/v2/lib"
)
type Release struct {
Version string `json:"version,omitempty" path:"version,omitempty" url:"version,omitempty"`
Description string `json:"description,omitempty" path:"description,omitempty" url:"description,omitempty"`
NativeReleasePackages []string `json:"native_release_packages,omitempty" path:"native_release_packages,omitempty" url:"native_release_packages,omitempty"`
Title string `json:"title,omitempty" path:"title,omitempty" url:"title,omitempty"`
}
// Identifier no path or id
type ReleaseCollection []Release
type ReleaseGetLatestParams struct {
Platform string `url:"platform,omitempty" required:"false" json:"platform,omitempty" path:"platform"`
}
func (r *Release) UnmarshalJSON(data []byte) error {
type release Release
var v release
if err := json.Unmarshal(data, &v); err != nil {
return lib.ErrorWithOriginalResponse{}.ProcessError(data, err, map[string]interface{}{})
}
*r = Release(v)
return nil
}
func (r *ReleaseCollection) UnmarshalJSON(data []byte) error {
type releases ReleaseCollection
var v releases
if err := json.Unmarshal(data, &v); err != nil {
return lib.ErrorWithOriginalResponse{}.ProcessError(data, err, []map[string]interface{}{})
}
*r = ReleaseCollection(v)
return nil
}
func (r *ReleaseCollection) ToSlice() *[]interface{} {
ret := make([]interface{}, len(*r))
for i, v := range *r {
ret[i] = v
}
return &ret
}