thisnthat před 5 roky
rodič
revize
0ec1b32ba8
2 změnil soubory, kde provedl 14 přidání a 1 odebrání
  1. 2 0
      groups.go
  2. 12 1
      users.go

+ 2 - 0
groups.go

@@ -1,4 +1,6 @@
 package discourse
 
 type Group struct {
+	ID   int    `json:"id"`
+	name string `json:"name"`
 }

+ 12 - 1
users.go

@@ -1,6 +1,10 @@
 package discourse
 
-import "fmt"
+import (
+	"encoding/json"
+	"fmt"
+	"net/http"
+)
 
 type User struct {
 	ID        string  `json:"id"`
@@ -13,4 +17,11 @@ type User struct {
 func GetUser(config ApiConfig, username string) {
 	url := fmt.Sprintf("%s/users/%s.json?api_key=%s&api_username=%s", config.Endpoint, username, config.ApiKey, config.ApiUser)
 	fmt.Println(url)
+
+	response, _ := http.Get(url)
+
+	var result User
+	json.NewDecoder(response.Body).Decode(&result)
+
+	fmt.Println(result)
 }