types.go 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. package discourse
  2. // UserResponse - Structure of a discourse user api response// UserResponse - Structure of a discourse user api response
  3. type UserResponse struct {
  4. User User `json:"user"`
  5. Errors []string `json:"errors"`
  6. ErrorType string `json:"error_type"`
  7. }
  8. type UserClass struct {
  9. UserBadges []interface{} `json:"user_badges"`
  10. User User `json:"user"`
  11. }
  12. // User - A discoruse User
  13. type User struct {
  14. ID int `json:"id" schema:"external_id"`
  15. Username string `json:"username"`
  16. CanSendPM bool `json:"can_send_private_messages"`
  17. Moderator bool `json:"moderator"`
  18. Admin bool `json:"admin"`
  19. TrustLevel int64 `json:"trust_level"`
  20. Groups []Group `json:"groups"`
  21. GroupStr string `schema:"groups"`
  22. Staged bool `json:"staged"`
  23. }
  24. type Group struct {
  25. ID int64 `json:"id"`
  26. Automatic bool `json:"automatic"`
  27. Name string `json:"name"`
  28. DisplayName string `json:"display_name"`
  29. UserCount int64 `json:"user_count"`
  30. MentionableLevel int64 `json:"mentionable_level"`
  31. MessageableLevel int64 `json:"messageable_level"`
  32. VisibilityLevel int64 `json:"visibility_level"`
  33. PrimaryGroup bool `json:"primary_group"`
  34. Title string `json:"title"`
  35. GrantTrustLevel int64 `json:"grant_trust_level"`
  36. IncomingEmail string `json:"incoming_email"`
  37. HasMessages bool `json:"has_messages"`
  38. FlairURL string `json:"flair_url"`
  39. FlairBgColor string `json:"flair_bg_color"`
  40. FlairColor string `json:"flair_color"`
  41. BioRaw string `json:"bio_raw"`
  42. BioCooked string `json:"bio_cooked"`
  43. BioExcerpt string `json:"bio_excerpt"`
  44. PublicAdmission bool `json:"public_admission"`
  45. PublicExit bool `json:"public_exit"`
  46. AllowMembershipRequests bool `json:"allow_membership_requests"`
  47. FullName string `json:"full_name"`
  48. DefaultNotificationLevel int64 `json:"default_notification_level"`
  49. MembershipRequestTemplate string `json:"membership_request_template"`
  50. MembersVisibilityLevel int64 `json:"members_visibility_level"`
  51. CanSeeMembers bool `json:"can_see_members"`
  52. CanAdminGroup bool `json:"can_admin_group"`
  53. PublishReadState bool `json:"publish_read_state"`
  54. }
  55. type SSOResponse struct {
  56. ID int
  57. Username string
  58. Groups []string
  59. Admin bool
  60. Moderator bool
  61. Nonce string
  62. }