-
Notifications
You must be signed in to change notification settings - Fork 2
/
clickwrap.go
123 lines (98 loc) · 4.52 KB
/
clickwrap.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
package files_sdk
import (
"encoding/json"
lib "github.com/Files-com/files-sdk-go/v2/lib"
)
type Clickwrap struct {
Id int64 `json:"id,omitempty" path:"id,omitempty" url:"id,omitempty"`
Name string `json:"name,omitempty" path:"name,omitempty" url:"name,omitempty"`
Body string `json:"body,omitempty" path:"body,omitempty" url:"body,omitempty"`
UseWithUsers string `json:"use_with_users,omitempty" path:"use_with_users,omitempty" url:"use_with_users,omitempty"`
UseWithBundles string `json:"use_with_bundles,omitempty" path:"use_with_bundles,omitempty" url:"use_with_bundles,omitempty"`
UseWithInboxes string `json:"use_with_inboxes,omitempty" path:"use_with_inboxes,omitempty" url:"use_with_inboxes,omitempty"`
}
func (c Clickwrap) Identifier() interface{} {
return c.Id
}
type ClickwrapCollection []Clickwrap
type ClickwrapUseWithBundlesEnum string
func (u ClickwrapUseWithBundlesEnum) String() string {
return string(u)
}
func (u ClickwrapUseWithBundlesEnum) Enum() map[string]ClickwrapUseWithBundlesEnum {
return map[string]ClickwrapUseWithBundlesEnum{
"none": ClickwrapUseWithBundlesEnum("none"),
"available": ClickwrapUseWithBundlesEnum("available"),
"require": ClickwrapUseWithBundlesEnum("require"),
}
}
type ClickwrapUseWithInboxesEnum string
func (u ClickwrapUseWithInboxesEnum) String() string {
return string(u)
}
func (u ClickwrapUseWithInboxesEnum) Enum() map[string]ClickwrapUseWithInboxesEnum {
return map[string]ClickwrapUseWithInboxesEnum{
"none": ClickwrapUseWithInboxesEnum("none"),
"available": ClickwrapUseWithInboxesEnum("available"),
"require": ClickwrapUseWithInboxesEnum("require"),
}
}
type ClickwrapUseWithUsersEnum string
func (u ClickwrapUseWithUsersEnum) String() string {
return string(u)
}
func (u ClickwrapUseWithUsersEnum) Enum() map[string]ClickwrapUseWithUsersEnum {
return map[string]ClickwrapUseWithUsersEnum{
"none": ClickwrapUseWithUsersEnum("none"),
"require": ClickwrapUseWithUsersEnum("require"),
}
}
type ClickwrapListParams struct {
ListParams
}
type ClickwrapFindParams struct {
Id int64 `url:"-,omitempty" required:"false" json:"-,omitempty" path:"id"`
}
type ClickwrapCreateParams struct {
Name string `url:"name,omitempty" required:"false" json:"name,omitempty" path:"name"`
Body string `url:"body,omitempty" required:"false" json:"body,omitempty" path:"body"`
UseWithBundles ClickwrapUseWithBundlesEnum `url:"use_with_bundles,omitempty" required:"false" json:"use_with_bundles,omitempty" path:"use_with_bundles"`
UseWithInboxes ClickwrapUseWithInboxesEnum `url:"use_with_inboxes,omitempty" required:"false" json:"use_with_inboxes,omitempty" path:"use_with_inboxes"`
UseWithUsers ClickwrapUseWithUsersEnum `url:"use_with_users,omitempty" required:"false" json:"use_with_users,omitempty" path:"use_with_users"`
}
type ClickwrapUpdateParams struct {
Id int64 `url:"-,omitempty" required:"false" json:"-,omitempty" path:"id"`
Name string `url:"name,omitempty" required:"false" json:"name,omitempty" path:"name"`
Body string `url:"body,omitempty" required:"false" json:"body,omitempty" path:"body"`
UseWithBundles ClickwrapUseWithBundlesEnum `url:"use_with_bundles,omitempty" required:"false" json:"use_with_bundles,omitempty" path:"use_with_bundles"`
UseWithInboxes ClickwrapUseWithInboxesEnum `url:"use_with_inboxes,omitempty" required:"false" json:"use_with_inboxes,omitempty" path:"use_with_inboxes"`
UseWithUsers ClickwrapUseWithUsersEnum `url:"use_with_users,omitempty" required:"false" json:"use_with_users,omitempty" path:"use_with_users"`
}
type ClickwrapDeleteParams struct {
Id int64 `url:"-,omitempty" required:"false" json:"-,omitempty" path:"id"`
}
func (c *Clickwrap) UnmarshalJSON(data []byte) error {
type clickwrap Clickwrap
var v clickwrap
if err := json.Unmarshal(data, &v); err != nil {
return lib.ErrorWithOriginalResponse{}.ProcessError(data, err, map[string]interface{}{})
}
*c = Clickwrap(v)
return nil
}
func (c *ClickwrapCollection) UnmarshalJSON(data []byte) error {
type clickwraps ClickwrapCollection
var v clickwraps
if err := json.Unmarshal(data, &v); err != nil {
return lib.ErrorWithOriginalResponse{}.ProcessError(data, err, []map[string]interface{}{})
}
*c = ClickwrapCollection(v)
return nil
}
func (c *ClickwrapCollection) ToSlice() *[]interface{} {
ret := make([]interface{}, len(*c))
for i, v := range *c {
ret[i] = v
}
return &ret
}