-
Notifications
You must be signed in to change notification settings - Fork 3
/
user.go
48 lines (43 loc) · 1.69 KB
/
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
41
42
43
44
45
46
47
48
package patreon
var (
// UserDefaultIncludes specifies default includes for User.
UserDefaultIncludes = []string{"campaign", "memberships"}
// UserFields is all fields in the User Attributes struct
UserFields = getObjectFields(UserAttributes{})
)
// User is the Patreon user, which can be both patron and creator.
type User struct {
Type string `json:"type"`
ID string `json:"id"`
Attributes UserAttributes `json:"attributes"`
Relationships struct {
Campaign *CampaignRelationship `json:"campaign,omitempty"`
Memberships *MembershipsRelationship `json:"memberships,omitempty"`
} `json:"relationships"`
}
// UserAttributes is the attributes struct for User
type UserAttributes struct {
About string `json:"about"`
CanSeeNSFW bool `json:"can_see_nsfw"`
Created NullTime `json:"created"`
Email string `json:"email"`
FirstName string `json:"first_name"`
FullName string `json:"full_name"`
HidePledges bool `json:"hide_pledges"`
ImageURL string `json:"image_url"`
IsEmailVerified bool `json:"is_email_verified"`
LastName string `json:"last_name"`
LikeCount int `json:"like_count"`
SocialConnections interface{} `json:"social_connections"`
ThumbURL string `json:"thumb_url"`
URL string `json:"url"`
Vanity string `json:"vanity"`
}
// UserResponse wraps Patreon's fetch user API response
type UserResponse struct {
Data User `json:"data"`
Included Includes `json:"included"`
Links struct {
Self string `json:"self"`
} `json:"links"`
}