-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathmember.go
More file actions
40 lines (33 loc) · 747 Bytes
/
member.go
File metadata and controls
40 lines (33 loc) · 747 Bytes
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
37
38
39
40
package trello
import (
"encoding/json"
"net/url"
)
const memberurl = "members"
// Trello Member.
type Member struct {
Id string
Username string
FullName string
Url string
Bio string
IdOrganizations []string
IdBoards []string
c *Client `json:"-"`
}
// Member retrieves a trello member's (user) info
func (c *Client) Member(username string) (*Member, error) {
extra := url.Values{"fields": {"username,fullName,url,bio,idBoards,idOrganizations"}}
b, err := c.Request("GET", memberurl+"/"+username, nil, extra)
if err != nil {
return nil, err
}
m := Member{
c: c,
}
err = json.Unmarshal(b, &m)
if err != nil {
return nil, err
}
return &m, nil
}