|
@@ -11,83 +11,6 @@ import (
|
|
|
"github.com/sirupsen/logrus"
|
|
|
)
|
|
|
|
|
|
-// UserResponse - Structure of a discourse user api response// UserResponse - Structure of a discourse user api response
|
|
|
-// type UserResponse struct {
|
|
|
-// User User `json:"user"`
|
|
|
-// Errors []string `json:"errors"`
|
|
|
-// ErrorType string `json:"error_type"`
|
|
|
-// }
|
|
|
-
|
|
|
-// User - A discoruse User
|
|
|
-// type User struct {
|
|
|
-// ID int `json:"id" schema:"external_id"`
|
|
|
-// Username string `json:"username"`
|
|
|
-// CanSendPM bool `json:"can_send_private_messages"`
|
|
|
-// Moderator bool `json:"moderator"`
|
|
|
-// Admin bool `json:"admin"`
|
|
|
-// TrustLevel int `json:"trust_level"`
|
|
|
-// Groups []Group `json:"groups"`
|
|
|
-// GroupStr string `schema:"groups"`
|
|
|
-// }
|
|
|
-
|
|
|
-// Generated by https://quicktype.io
|
|
|
-
|
|
|
-// type User struct {
|
|
|
-// ID int64 `json:"id"`
|
|
|
-// Username string `json:"username"`
|
|
|
-// Name interface{} `json:"name"`
|
|
|
-// AvatarTemplate string `json:"avatar_template"`
|
|
|
-// Email string `json:"email"`
|
|
|
-// SecondaryEmails []interface{} `json:"secondary_emails"`
|
|
|
-// Active bool `json:"active"`
|
|
|
-// Admin bool `json:"admin"`
|
|
|
-// Moderator bool `json:"moderator"`
|
|
|
-// LastSeenAt interface{} `json:"last_seen_at"`
|
|
|
-// LastEmailedAt interface{} `json:"last_emailed_at"`
|
|
|
-// CreatedAt string `json:"created_at"`
|
|
|
-// LastSeenAge interface{} `json:"last_seen_age"`
|
|
|
-// LastEmailedAge interface{} `json:"last_emailed_age"`
|
|
|
-// CreatedAtAge interface{} `json:"created_at_age"`
|
|
|
-// TrustLevel int64 `json:"trust_level"`
|
|
|
-// ManualLockedTrustLevel interface{} `json:"manual_locked_trust_level"`
|
|
|
-// FlagLevel int64 `json:"flag_level"`
|
|
|
-// Title interface{} `json:"title"`
|
|
|
-// TimeRead int64 `json:"time_read"`
|
|
|
-// Staged bool `json:"staged"`
|
|
|
-// DaysVisited int64 `json:"days_visited"`
|
|
|
-// PostsReadCount int64 `json:"posts_read_count"`
|
|
|
-// TopicsEntered int64 `json:"topics_entered"`
|
|
|
-// PostCount int64 `json:"post_count"`
|
|
|
-// }
|
|
|
-
|
|
|
-// Generated by https://quicktype.io
|
|
|
-
|
|
|
-// type GroupMembers struct {
|
|
|
-// Members []Member `json:"members"`
|
|
|
-// Owners []Member `json:"owners"`
|
|
|
-// Meta Meta `json:"meta"`
|
|
|
-// Errors []string `json:"errors"`
|
|
|
-// ErrorType string `json:"error_type"`
|
|
|
-// }
|
|
|
-
|
|
|
-// type Member struct {
|
|
|
-// ID int64 `json:"id"`
|
|
|
-// Username string `json:"username"`
|
|
|
-// Name interface{} `json:"name"`
|
|
|
-// AvatarTemplate string `json:"avatar_template"`
|
|
|
-// Title interface{} `json:"title"`
|
|
|
-// LastPostedAt string `json:"last_posted_at"`
|
|
|
-// LastSeenAt string `json:"last_seen_at"`
|
|
|
-// AddedAt string `json:"added_at"`
|
|
|
-// Timezone string `json:"timezone"`
|
|
|
-// }
|
|
|
-
|
|
|
-// type Meta struct {
|
|
|
-// Total int64 `json:"total"`
|
|
|
-// Limit int64 `json:"limit"`
|
|
|
-// Offset int64 `json:"offset"`
|
|
|
-// }
|
|
|
-
|
|
|
// GetUser - Get a discourse user
|
|
|
func GetUser(config APIConfig, username string) (User, error) {
|
|
|
url := fmt.Sprintf("%s/users/%s.json", config.Endpoint, username)
|