|
@@ -6,7 +6,7 @@ import (
|
|
"net/http"
|
|
"net/http"
|
|
)
|
|
)
|
|
|
|
|
|
-// UserResponse - Structure of a discourse user api response
|
|
|
|
|
|
+// UserResponse - Structure of a discourse user api response// UserResponse - Structure of a discourse user api response
|
|
type UserResponse struct {
|
|
type UserResponse struct {
|
|
User User `json:"user"`
|
|
User User `json:"user"`
|
|
Errors []string `json:"errors"`
|
|
Errors []string `json:"errors"`
|
|
@@ -15,17 +15,18 @@ type UserResponse struct {
|
|
|
|
|
|
// User - A discoruse User
|
|
// User - A discoruse User
|
|
type User struct {
|
|
type User struct {
|
|
- ID int `json:"id"`
|
|
|
|
|
|
+ ID int `json:"id" schema:"external_id"`
|
|
Username string `json:"username"`
|
|
Username string `json:"username"`
|
|
CanSendPM bool `json:"can_send_private_messages"`
|
|
CanSendPM bool `json:"can_send_private_messages"`
|
|
Moderator bool `json:"moderator"`
|
|
Moderator bool `json:"moderator"`
|
|
Admin bool `json:"admin"`
|
|
Admin bool `json:"admin"`
|
|
Groups []Group `json:"groups"`
|
|
Groups []Group `json:"groups"`
|
|
|
|
+ GroupStr string `schema:"groups"`
|
|
}
|
|
}
|
|
|
|
|
|
// GetUser - Get a discourse user
|
|
// GetUser - Get a discourse user
|
|
-func GetUser(config ApiConfig, username string) User {
|
|
|
|
- url := fmt.Sprintf("%s/users/%s.json?api_key=%s&api_username=%s", config.Endpoint, username, config.ApiKey, config.ApiUser)
|
|
|
|
|
|
+func GetUser(config APIConfig, username string) User {
|
|
|
|
+ url := fmt.Sprintf("%s/users/%s.json?api_key=%s&api_username=%s", config.Endpoint, username, config.APIKey, config.APIUsername)
|
|
|
|
|
|
response, _ := http.Get(url)
|
|
response, _ := http.Get(url)
|
|
|
|
|