forked from billtrust/looker-go-sdk
/
homepage_item.go
344 lines (247 loc) · 9.28 KB
/
homepage_item.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
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
// Code generated by go-swagger; DO NOT EDIT.
package models
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"github.com/go-openapi/errors"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/swag"
"github.com/go-openapi/validate"
)
// HomepageItem homepage item
//
// swagger:model HomepageItem
type HomepageItem struct {
// Operations the current user is able to perform on this object
// Read Only: true
Can map[string]bool `json:"can,omitempty"`
// Name of user who created the content this item is based on
// Read Only: true
ContentCreatedBy string `json:"content_created_by,omitempty"`
// Content favorite id associated with the item this content is based on
// Read Only: true
ContentFavoriteID int64 `json:"content_favorite_id,omitempty"`
// Content metadata id associated with the item this content is based on
// Read Only: true
ContentMetadataID int64 `json:"content_metadata_id,omitempty"`
// Last time the content that this item is based on was updated
// Read Only: true
ContentUpdatedAt string `json:"content_updated_at,omitempty"`
// Custom description entered by the user, if present
CustomDescription string `json:"custom_description,omitempty"`
// (Write-Only) base64 encoded image data
CustomImageDataBase64 string `json:"custom_image_data_base64,omitempty"`
// Custom image_url entered by the user, if present
// Read Only: true
CustomImageURL string `json:"custom_image_url,omitempty"`
// Custom title entered by the user, if present
CustomTitle string `json:"custom_title,omitempty"`
// Custom url entered by the user, if present
CustomURL string `json:"custom_url,omitempty"`
// Dashboard to base this item on
DashboardID int64 `json:"dashboard_id,omitempty"`
// The actual description for display
// Read Only: true
Description string `json:"description,omitempty"`
// Number of times content has been favorited, if present
// Read Only: true
FavoriteCount int64 `json:"favorite_count,omitempty"`
// Associated Homepage Section
HomepageSectionID string `json:"homepage_section_id,omitempty"`
// Unique Id
// Read Only: true
ID string `json:"id,omitempty"`
// The actual image_url for display
// Read Only: true
ImageURL string `json:"image_url,omitempty"`
// The container folder name of the content
// Read Only: true
Location string `json:"location,omitempty"`
// Look to base this item on
LookID int64 `json:"look_id,omitempty"`
// LookML Dashboard to base this item on
LookmlDashboardID string `json:"lookml_dashboard_id,omitempty"`
// An arbitrary integer representing the sort order within the section
Order int64 `json:"order,omitempty"`
// Number of seconds it took to fetch the section this item is in
// Read Only: true
SectionFetchTime float32 `json:"section_fetch_time,omitempty"`
// The actual title for display
// Read Only: true
Title string `json:"title,omitempty"`
// The actual url for display
// Read Only: true
URL string `json:"url,omitempty"`
// Whether the custom description should be used instead of the content description, if the item is associated with content
UseCustomDescription bool `json:"use_custom_description,omitempty"`
// Whether the custom image should be used instead of the content image, if the item is associated with content
UseCustomImage bool `json:"use_custom_image,omitempty"`
// Whether the custom title should be used instead of the content title, if the item is associated with content
UseCustomTitle bool `json:"use_custom_title,omitempty"`
// Whether the custom url should be used instead of the content url, if the item is associated with content
UseCustomURL bool `json:"use_custom_url,omitempty"`
// Number of times content has been viewed, if present
// Read Only: true
ViewCount int64 `json:"view_count,omitempty"`
}
// Validate validates this homepage item
func (m *HomepageItem) Validate(formats strfmt.Registry) error {
return nil
}
// ContextValidate validate this homepage item based on the context it is used
func (m *HomepageItem) ContextValidate(ctx context.Context, formats strfmt.Registry) error {
var res []error
if err := m.contextValidateCan(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateContentCreatedBy(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateContentFavoriteID(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateContentMetadataID(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateContentUpdatedAt(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateCustomImageURL(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateDescription(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateFavoriteCount(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateID(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateImageURL(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateLocation(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateSectionFetchTime(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateTitle(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateURL(ctx, formats); err != nil {
res = append(res, err)
}
if err := m.contextValidateViewCount(ctx, formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}
func (m *HomepageItem) contextValidateCan(ctx context.Context, formats strfmt.Registry) error {
return nil
}
func (m *HomepageItem) contextValidateContentCreatedBy(ctx context.Context, formats strfmt.Registry) error {
if err := validate.ReadOnly(ctx, "content_created_by", "body", string(m.ContentCreatedBy)); err != nil {
return err
}
return nil
}
func (m *HomepageItem) contextValidateContentFavoriteID(ctx context.Context, formats strfmt.Registry) error {
if err := validate.ReadOnly(ctx, "content_favorite_id", "body", int64(m.ContentFavoriteID)); err != nil {
return err
}
return nil
}
func (m *HomepageItem) contextValidateContentMetadataID(ctx context.Context, formats strfmt.Registry) error {
if err := validate.ReadOnly(ctx, "content_metadata_id", "body", int64(m.ContentMetadataID)); err != nil {
return err
}
return nil
}
func (m *HomepageItem) contextValidateContentUpdatedAt(ctx context.Context, formats strfmt.Registry) error {
if err := validate.ReadOnly(ctx, "content_updated_at", "body", string(m.ContentUpdatedAt)); err != nil {
return err
}
return nil
}
func (m *HomepageItem) contextValidateCustomImageURL(ctx context.Context, formats strfmt.Registry) error {
if err := validate.ReadOnly(ctx, "custom_image_url", "body", string(m.CustomImageURL)); err != nil {
return err
}
return nil
}
func (m *HomepageItem) contextValidateDescription(ctx context.Context, formats strfmt.Registry) error {
if err := validate.ReadOnly(ctx, "description", "body", string(m.Description)); err != nil {
return err
}
return nil
}
func (m *HomepageItem) contextValidateFavoriteCount(ctx context.Context, formats strfmt.Registry) error {
if err := validate.ReadOnly(ctx, "favorite_count", "body", int64(m.FavoriteCount)); err != nil {
return err
}
return nil
}
func (m *HomepageItem) contextValidateID(ctx context.Context, formats strfmt.Registry) error {
if err := validate.ReadOnly(ctx, "id", "body", string(m.ID)); err != nil {
return err
}
return nil
}
func (m *HomepageItem) contextValidateImageURL(ctx context.Context, formats strfmt.Registry) error {
if err := validate.ReadOnly(ctx, "image_url", "body", string(m.ImageURL)); err != nil {
return err
}
return nil
}
func (m *HomepageItem) contextValidateLocation(ctx context.Context, formats strfmt.Registry) error {
if err := validate.ReadOnly(ctx, "location", "body", string(m.Location)); err != nil {
return err
}
return nil
}
func (m *HomepageItem) contextValidateSectionFetchTime(ctx context.Context, formats strfmt.Registry) error {
if err := validate.ReadOnly(ctx, "section_fetch_time", "body", float32(m.SectionFetchTime)); err != nil {
return err
}
return nil
}
func (m *HomepageItem) contextValidateTitle(ctx context.Context, formats strfmt.Registry) error {
if err := validate.ReadOnly(ctx, "title", "body", string(m.Title)); err != nil {
return err
}
return nil
}
func (m *HomepageItem) contextValidateURL(ctx context.Context, formats strfmt.Registry) error {
if err := validate.ReadOnly(ctx, "url", "body", string(m.URL)); err != nil {
return err
}
return nil
}
func (m *HomepageItem) contextValidateViewCount(ctx context.Context, formats strfmt.Registry) error {
if err := validate.ReadOnly(ctx, "view_count", "body", int64(m.ViewCount)); err != nil {
return err
}
return nil
}
// MarshalBinary interface implementation
func (m *HomepageItem) MarshalBinary() ([]byte, error) {
if m == nil {
return nil, nil
}
return swag.WriteJSON(m)
}
// UnmarshalBinary interface implementation
func (m *HomepageItem) UnmarshalBinary(b []byte) error {
var res HomepageItem
if err := swag.ReadJSON(b, &res); err != nil {
return err
}
*m = res
return nil
}