-
Notifications
You must be signed in to change notification settings - Fork 1
/
users.go
34 lines (29 loc) · 820 Bytes
/
users.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
package flumewater
import (
"fmt"
"log"
)
type FlumeWaterFetchUserResponse struct {
*ResponseBase
Data []FlumeWaterUser `json:"data"`
}
type FlumeWaterUser struct {
ID int `json:"id"`
EmailAddress string `json:"email_address"`
FirstName string `json:"first_name"`
LastName string `json:"last_name"`
Phone string `json:"phone"`
Status string `json:"status"`
Type string `json:"type"`
SignupDatetime string `json:"signup_datetime,omitempty"`
}
func (fw *Client) FetchUser() (flumeUser FlumeWaterUser, err error) {
fetchURL := baseURL + "/users/" + fmt.Sprint(fw.UserID())
var flumeResp FlumeWaterFetchUserResponse
err = fw.FlumeGet(fetchURL, &flumeResp)
if err != nil {
log.Fatal(err)
}
flumeUser = flumeResp.Data[0]
return flumeUser, nil
}