-
Notifications
You must be signed in to change notification settings - Fork 12
/
availabletopic.go
213 lines (138 loc) · 6.61 KB
/
availabletopic.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
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
package platformclientv2
import (
"github.com/leekchan/timeutil"
"encoding/json"
"strconv"
"strings"
)
// Availabletopic
type Availabletopic struct {
// Description
Description *string `json:"description,omitempty"`
// Id
Id *string `json:"id,omitempty"`
// PermissionDetails - Full detailed permissions required to subscribe to the topic
PermissionDetails *[]Permissiondetails `json:"permissionDetails,omitempty"`
// RequiresPermissions - Permissions required to subscribe to the topic
RequiresPermissions *[]string `json:"requiresPermissions,omitempty"`
// RequiresDivisionPermissions - True if the subscribing user must belong to the same division as the topic object ID
RequiresDivisionPermissions *bool `json:"requiresDivisionPermissions,omitempty"`
// RequiresAnyValidator - If multiple permissions are required for this topic, such as both requiresCurrentUser and requiresDivisionPermissions, then true here indicates that meeting any one condition will satisfy the requirements; false indicates all conditions must be met.
RequiresAnyValidator *bool `json:"requiresAnyValidator,omitempty"`
// Enforced - Whether or not the permissions on this topic are enforced
Enforced *bool `json:"enforced,omitempty"`
// Visibility - Visibility of this topic (Public or Preview)
Visibility *string `json:"visibility,omitempty"`
// Schema
Schema *map[string]interface{} `json:"schema,omitempty"`
// RequiresCurrentUser - True if the topic user ID is required to match the subscribing user ID
RequiresCurrentUser *bool `json:"requiresCurrentUser,omitempty"`
// RequiresCurrentUserOrPermission - True if permissions are only required when the topic user ID does not match the subscribing user ID
RequiresCurrentUserOrPermission *bool `json:"requiresCurrentUserOrPermission,omitempty"`
// Transports - Transports that support events for the topic
Transports *[]string `json:"transports,omitempty"`
// PublicApiTemplateUriPaths
PublicApiTemplateUriPaths *[]string `json:"publicApiTemplateUriPaths,omitempty"`
// TopicParameters - Parameters in the topic name that can be substituted, in the order they appear in the topic name
TopicParameters *[]string `json:"topicParameters,omitempty"`
}
func (o *Availabletopic) MarshalJSON() ([]byte, error) {
// Redundant initialization to avoid unused import errors for models with no Time values
_ = timeutil.Timedelta{}
type Alias Availabletopic
return json.Marshal(&struct {
Description *string `json:"description,omitempty"`
Id *string `json:"id,omitempty"`
PermissionDetails *[]Permissiondetails `json:"permissionDetails,omitempty"`
RequiresPermissions *[]string `json:"requiresPermissions,omitempty"`
RequiresDivisionPermissions *bool `json:"requiresDivisionPermissions,omitempty"`
RequiresAnyValidator *bool `json:"requiresAnyValidator,omitempty"`
Enforced *bool `json:"enforced,omitempty"`
Visibility *string `json:"visibility,omitempty"`
Schema *map[string]interface{} `json:"schema,omitempty"`
RequiresCurrentUser *bool `json:"requiresCurrentUser,omitempty"`
RequiresCurrentUserOrPermission *bool `json:"requiresCurrentUserOrPermission,omitempty"`
Transports *[]string `json:"transports,omitempty"`
PublicApiTemplateUriPaths *[]string `json:"publicApiTemplateUriPaths,omitempty"`
TopicParameters *[]string `json:"topicParameters,omitempty"`
*Alias
}{
Description: o.Description,
Id: o.Id,
PermissionDetails: o.PermissionDetails,
RequiresPermissions: o.RequiresPermissions,
RequiresDivisionPermissions: o.RequiresDivisionPermissions,
RequiresAnyValidator: o.RequiresAnyValidator,
Enforced: o.Enforced,
Visibility: o.Visibility,
Schema: o.Schema,
RequiresCurrentUser: o.RequiresCurrentUser,
RequiresCurrentUserOrPermission: o.RequiresCurrentUserOrPermission,
Transports: o.Transports,
PublicApiTemplateUriPaths: o.PublicApiTemplateUriPaths,
TopicParameters: o.TopicParameters,
Alias: (*Alias)(o),
})
}
func (o *Availabletopic) UnmarshalJSON(b []byte) error {
var AvailabletopicMap map[string]interface{}
err := json.Unmarshal(b, &AvailabletopicMap)
if err != nil {
return err
}
if Description, ok := AvailabletopicMap["description"].(string); ok {
o.Description = &Description
}
if Id, ok := AvailabletopicMap["id"].(string); ok {
o.Id = &Id
}
if PermissionDetails, ok := AvailabletopicMap["permissionDetails"].([]interface{}); ok {
PermissionDetailsString, _ := json.Marshal(PermissionDetails)
json.Unmarshal(PermissionDetailsString, &o.PermissionDetails)
}
if RequiresPermissions, ok := AvailabletopicMap["requiresPermissions"].([]interface{}); ok {
RequiresPermissionsString, _ := json.Marshal(RequiresPermissions)
json.Unmarshal(RequiresPermissionsString, &o.RequiresPermissions)
}
if RequiresDivisionPermissions, ok := AvailabletopicMap["requiresDivisionPermissions"].(bool); ok {
o.RequiresDivisionPermissions = &RequiresDivisionPermissions
}
if RequiresAnyValidator, ok := AvailabletopicMap["requiresAnyValidator"].(bool); ok {
o.RequiresAnyValidator = &RequiresAnyValidator
}
if Enforced, ok := AvailabletopicMap["enforced"].(bool); ok {
o.Enforced = &Enforced
}
if Visibility, ok := AvailabletopicMap["visibility"].(string); ok {
o.Visibility = &Visibility
}
if Schema, ok := AvailabletopicMap["schema"].(map[string]interface{}); ok {
SchemaString, _ := json.Marshal(Schema)
json.Unmarshal(SchemaString, &o.Schema)
}
if RequiresCurrentUser, ok := AvailabletopicMap["requiresCurrentUser"].(bool); ok {
o.RequiresCurrentUser = &RequiresCurrentUser
}
if RequiresCurrentUserOrPermission, ok := AvailabletopicMap["requiresCurrentUserOrPermission"].(bool); ok {
o.RequiresCurrentUserOrPermission = &RequiresCurrentUserOrPermission
}
if Transports, ok := AvailabletopicMap["transports"].([]interface{}); ok {
TransportsString, _ := json.Marshal(Transports)
json.Unmarshal(TransportsString, &o.Transports)
}
if PublicApiTemplateUriPaths, ok := AvailabletopicMap["publicApiTemplateUriPaths"].([]interface{}); ok {
PublicApiTemplateUriPathsString, _ := json.Marshal(PublicApiTemplateUriPaths)
json.Unmarshal(PublicApiTemplateUriPathsString, &o.PublicApiTemplateUriPaths)
}
if TopicParameters, ok := AvailabletopicMap["topicParameters"].([]interface{}); ok {
TopicParametersString, _ := json.Marshal(TopicParameters)
json.Unmarshal(TopicParametersString, &o.TopicParameters)
}
return nil
}
// String returns a JSON representation of the model
func (o *Availabletopic) String() string {
j, _ := json.Marshal(o)
str, _ := strconv.Unquote(strings.Replace(strconv.Quote(string(j)), `\\u`, `\u`, -1))
return str
}