/
user.go
36 lines (31 loc) · 912 Bytes
/
user.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package jengo_src
import (
"encoding/json"
"fmt"
)
type User struct {
Class string `yaml:"_class"`
AbsoluteURL string `yaml:"absoluteUrl"`
Description string `yaml:"description"`
FullName string `yaml:"fullName"`
ID string `yaml:"id"`
Property []Property `yaml:"property"`
}
type Property struct {
Class string `yaml:"_class"`
Address string `yaml:"address,omitempty"`
Triggers []interface{} `yaml:"triggers,omitempty"`
InsensitiveSearch bool `yaml:"insensitiveSearch,omitempty"`
}
func GetUser(username string) (obj User){
responseData, err := HandleRequest("GET", Kwargs{"name": "user", "user_name": username})
if err != nil {
ErrorLog(err)
}
fmt.Println(string(responseData))
if err := json.Unmarshal([]byte(responseData), &obj); err != nil {
ErrorLog(err)
}
fmt.Println(obj)
return
}