-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathuser.go
40 lines (34 loc) · 810 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
37
38
39
40
package srv
import (
"io"
"net/http"
)
type (
// User represents the user
User struct {
Email string `json:"email"`
Country string `json:"country"`
}
// HTTPClient is the http wrapper for the application
HTTPClient interface {
HTTPGetter
HTTPPoster
}
// HTTPPoster holds fields and dependencies for executing an http POST request
HTTPPoster interface {
// Post executes a POST http request
Post(url, contentType string, body io.Reader) (*http.Response, error)
}
// HTTPGetter holds fields and dependencies for executing an http GET request
HTTPGetter interface {
// Get executes a GET http request
Get(url string) (*http.Response, error)
}
)
// NewUser returns new user
func NewUser(email, country string) *User {
return &User{
Email: email,
Country: country,
}
}