github.com/ActiveState/cli@v0.0.0-20240508170324-6801f60cd051/pkg/platform/api/mono/mono_models/user.go (about) 1 // Code generated by go-swagger; DO NOT EDIT. 2 3 package mono_models 4 5 // This file was generated by the swagger tool. 6 // Editing this file might prove futile when you re-run the swagger generate command 7 8 import ( 9 "context" 10 "strconv" 11 12 "github.com/go-openapi/errors" 13 "github.com/go-openapi/strfmt" 14 "github.com/go-openapi/swag" 15 "github.com/go-openapi/validate" 16 ) 17 18 // User user 19 // 20 // swagger:model User 21 type User struct { 22 23 // e u l a accepted 24 // Format: date-time 25 EULAAccepted *strfmt.DateTime `json:"EULAAccepted,omitempty"` 26 27 // t o t p enabled 28 TOTPEnabled *bool `json:"TOTPEnabled,omitempty"` 29 30 // acl 31 ACL map[string]bool `json:"acl,omitempty"` 32 33 // added 34 // Format: date-time 35 Added strfmt.DateTime `json:"added,omitempty"` 36 37 // can unlink account 38 CanUnlinkAccount bool `json:"canUnlinkAccount,omitempty"` 39 40 // datetime format 41 DatetimeFormat string `json:"datetimeFormat,omitempty"` 42 43 // email 44 Email string `json:"email,omitempty"` 45 46 // expires 47 // Format: date-time 48 Expires *strfmt.DateTime `json:"expires,omitempty"` 49 50 // is paid user 51 IsPaidUser *bool `json:"isPaidUser,omitempty"` 52 53 // last login 54 // Format: date-time 55 LastLogin *strfmt.DateTime `json:"lastLogin,omitempty"` 56 57 // linked accounts 58 LinkedAccounts []string `json:"linkedAccounts"` 59 60 // name 61 Name string `json:"name,omitempty"` 62 63 // noncompliance status 64 NoncomplianceStatus *UserNoncomplianceStatus `json:"noncomplianceStatus,omitempty"` 65 66 // organizations 67 Organizations []*UserOrganizationsItems0 `json:"organizations"` 68 69 // send marketing email 70 SendMarketingEmail bool `json:"sendMarketingEmail,omitempty"` 71 72 // timezone 73 Timezone string `json:"timezone,omitempty"` 74 75 // user ID 76 // Format: uuid 77 UserID strfmt.UUID `json:"userID,omitempty"` 78 79 // username 80 Username string `json:"username,omitempty"` 81 82 // verified email 83 VerifiedEmail bool `json:"verifiedEmail,omitempty"` 84 } 85 86 // Validate validates this user 87 func (m *User) Validate(formats strfmt.Registry) error { 88 var res []error 89 90 if err := m.validateEULAAccepted(formats); err != nil { 91 res = append(res, err) 92 } 93 94 if err := m.validateAdded(formats); err != nil { 95 res = append(res, err) 96 } 97 98 if err := m.validateExpires(formats); err != nil { 99 res = append(res, err) 100 } 101 102 if err := m.validateLastLogin(formats); err != nil { 103 res = append(res, err) 104 } 105 106 if err := m.validateNoncomplianceStatus(formats); err != nil { 107 res = append(res, err) 108 } 109 110 if err := m.validateOrganizations(formats); err != nil { 111 res = append(res, err) 112 } 113 114 if err := m.validateUserID(formats); err != nil { 115 res = append(res, err) 116 } 117 118 if len(res) > 0 { 119 return errors.CompositeValidationError(res...) 120 } 121 return nil 122 } 123 124 func (m *User) validateEULAAccepted(formats strfmt.Registry) error { 125 if swag.IsZero(m.EULAAccepted) { // not required 126 return nil 127 } 128 129 if err := validate.FormatOf("EULAAccepted", "body", "date-time", m.EULAAccepted.String(), formats); err != nil { 130 return err 131 } 132 133 return nil 134 } 135 136 func (m *User) validateAdded(formats strfmt.Registry) error { 137 if swag.IsZero(m.Added) { // not required 138 return nil 139 } 140 141 if err := validate.FormatOf("added", "body", "date-time", m.Added.String(), formats); err != nil { 142 return err 143 } 144 145 return nil 146 } 147 148 func (m *User) validateExpires(formats strfmt.Registry) error { 149 if swag.IsZero(m.Expires) { // not required 150 return nil 151 } 152 153 if err := validate.FormatOf("expires", "body", "date-time", m.Expires.String(), formats); err != nil { 154 return err 155 } 156 157 return nil 158 } 159 160 func (m *User) validateLastLogin(formats strfmt.Registry) error { 161 if swag.IsZero(m.LastLogin) { // not required 162 return nil 163 } 164 165 if err := validate.FormatOf("lastLogin", "body", "date-time", m.LastLogin.String(), formats); err != nil { 166 return err 167 } 168 169 return nil 170 } 171 172 func (m *User) validateNoncomplianceStatus(formats strfmt.Registry) error { 173 if swag.IsZero(m.NoncomplianceStatus) { // not required 174 return nil 175 } 176 177 if m.NoncomplianceStatus != nil { 178 if err := m.NoncomplianceStatus.Validate(formats); err != nil { 179 if ve, ok := err.(*errors.Validation); ok { 180 return ve.ValidateName("noncomplianceStatus") 181 } 182 return err 183 } 184 } 185 186 return nil 187 } 188 189 func (m *User) validateOrganizations(formats strfmt.Registry) error { 190 if swag.IsZero(m.Organizations) { // not required 191 return nil 192 } 193 194 for i := 0; i < len(m.Organizations); i++ { 195 if swag.IsZero(m.Organizations[i]) { // not required 196 continue 197 } 198 199 if m.Organizations[i] != nil { 200 if err := m.Organizations[i].Validate(formats); err != nil { 201 if ve, ok := err.(*errors.Validation); ok { 202 return ve.ValidateName("organizations" + "." + strconv.Itoa(i)) 203 } 204 return err 205 } 206 } 207 208 } 209 210 return nil 211 } 212 213 func (m *User) validateUserID(formats strfmt.Registry) error { 214 if swag.IsZero(m.UserID) { // not required 215 return nil 216 } 217 218 if err := validate.FormatOf("userID", "body", "uuid", m.UserID.String(), formats); err != nil { 219 return err 220 } 221 222 return nil 223 } 224 225 // ContextValidate validate this user based on the context it is used 226 func (m *User) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 227 var res []error 228 229 if err := m.contextValidateNoncomplianceStatus(ctx, formats); err != nil { 230 res = append(res, err) 231 } 232 233 if err := m.contextValidateOrganizations(ctx, formats); err != nil { 234 res = append(res, err) 235 } 236 237 if len(res) > 0 { 238 return errors.CompositeValidationError(res...) 239 } 240 return nil 241 } 242 243 func (m *User) contextValidateNoncomplianceStatus(ctx context.Context, formats strfmt.Registry) error { 244 245 if m.NoncomplianceStatus != nil { 246 if err := m.NoncomplianceStatus.ContextValidate(ctx, formats); err != nil { 247 if ve, ok := err.(*errors.Validation); ok { 248 return ve.ValidateName("noncomplianceStatus") 249 } 250 return err 251 } 252 } 253 254 return nil 255 } 256 257 func (m *User) contextValidateOrganizations(ctx context.Context, formats strfmt.Registry) error { 258 259 for i := 0; i < len(m.Organizations); i++ { 260 261 if m.Organizations[i] != nil { 262 if err := m.Organizations[i].ContextValidate(ctx, formats); err != nil { 263 if ve, ok := err.(*errors.Validation); ok { 264 return ve.ValidateName("organizations" + "." + strconv.Itoa(i)) 265 } 266 return err 267 } 268 } 269 270 } 271 272 return nil 273 } 274 275 // MarshalBinary interface implementation 276 func (m *User) MarshalBinary() ([]byte, error) { 277 if m == nil { 278 return nil, nil 279 } 280 return swag.WriteJSON(m) 281 } 282 283 // UnmarshalBinary interface implementation 284 func (m *User) UnmarshalBinary(b []byte) error { 285 var res User 286 if err := swag.ReadJSON(b, &res); err != nil { 287 return err 288 } 289 *m = res 290 return nil 291 } 292 293 // UserNoncomplianceStatus user noncompliance status 294 // 295 // swagger:model UserNoncomplianceStatus 296 type UserNoncomplianceStatus struct { 297 298 // company name 299 CompanyName string `json:"companyName,omitempty"` 300 301 // type 302 Type int32 `json:"type"` 303 } 304 305 // Validate validates this user noncompliance status 306 func (m *UserNoncomplianceStatus) Validate(formats strfmt.Registry) error { 307 return nil 308 } 309 310 // ContextValidate validates this user noncompliance status based on context it is used 311 func (m *UserNoncomplianceStatus) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 312 return nil 313 } 314 315 // MarshalBinary interface implementation 316 func (m *UserNoncomplianceStatus) MarshalBinary() ([]byte, error) { 317 if m == nil { 318 return nil, nil 319 } 320 return swag.WriteJSON(m) 321 } 322 323 // UnmarshalBinary interface implementation 324 func (m *UserNoncomplianceStatus) UnmarshalBinary(b []byte) error { 325 var res UserNoncomplianceStatus 326 if err := swag.ReadJSON(b, &res); err != nil { 327 return err 328 } 329 *m = res 330 return nil 331 } 332 333 // UserOrganizationsItems0 user organizations items0 334 // 335 // swagger:model UserOrganizationsItems0 336 type UserOrganizationsItems0 struct { 337 338 // u r lname 339 URLname string `json:"URLname,omitempty"` 340 341 // created 342 // Format: date-time 343 Created strfmt.DateTime `json:"created,omitempty"` 344 345 // organization ID 346 // Format: uuid 347 OrganizationID strfmt.UUID `json:"organizationID,omitempty"` 348 349 // personal 350 Personal bool `json:"personal,omitempty"` 351 352 // role 353 Role string `json:"role,omitempty"` 354 355 // tier 356 Tier string `json:"tier,omitempty"` 357 } 358 359 // Validate validates this user organizations items0 360 func (m *UserOrganizationsItems0) Validate(formats strfmt.Registry) error { 361 var res []error 362 363 if err := m.validateCreated(formats); err != nil { 364 res = append(res, err) 365 } 366 367 if err := m.validateOrganizationID(formats); err != nil { 368 res = append(res, err) 369 } 370 371 if len(res) > 0 { 372 return errors.CompositeValidationError(res...) 373 } 374 return nil 375 } 376 377 func (m *UserOrganizationsItems0) validateCreated(formats strfmt.Registry) error { 378 if swag.IsZero(m.Created) { // not required 379 return nil 380 } 381 382 if err := validate.FormatOf("created", "body", "date-time", m.Created.String(), formats); err != nil { 383 return err 384 } 385 386 return nil 387 } 388 389 func (m *UserOrganizationsItems0) validateOrganizationID(formats strfmt.Registry) error { 390 if swag.IsZero(m.OrganizationID) { // not required 391 return nil 392 } 393 394 if err := validate.FormatOf("organizationID", "body", "uuid", m.OrganizationID.String(), formats); err != nil { 395 return err 396 } 397 398 return nil 399 } 400 401 // ContextValidate validates this user organizations items0 based on context it is used 402 func (m *UserOrganizationsItems0) ContextValidate(ctx context.Context, formats strfmt.Registry) error { 403 return nil 404 } 405 406 // MarshalBinary interface implementation 407 func (m *UserOrganizationsItems0) MarshalBinary() ([]byte, error) { 408 if m == nil { 409 return nil, nil 410 } 411 return swag.WriteJSON(m) 412 } 413 414 // UnmarshalBinary interface implementation 415 func (m *UserOrganizationsItems0) UnmarshalBinary(b []byte) error { 416 var res UserOrganizationsItems0 417 if err := swag.ReadJSON(b, &res); err != nil { 418 return err 419 } 420 *m = res 421 return nil 422 }