forked from g8rswimmer/go-twitter
-
Notifications
You must be signed in to change notification settings - Fork 0
/
user_obj.go
69 lines (64 loc) · 3.13 KB
/
user_obj.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
package twitter
// UserField defines the twitter user account metadata fields
type UserField string
const (
// UserFieldCreatedAt is the UTC datetime that the user account was created on Twitter.
UserFieldCreatedAt UserField = "created_at"
// UserFieldDescription is the text of this user's profile description (also known as bio), if the user provided one.
UserFieldDescription UserField = "description"
// UserFieldEntities contains details about text that has a special meaning in the user's description.
UserFieldEntities UserField = "entities"
// UserFieldID is the unique identifier of this user.
UserFieldID UserField = "id"
// UserFieldLocation is the location specified in the user's profile, if the user provided one.
UserFieldLocation UserField = "location"
// UserFieldName is the name of the user, as they’ve defined it on their profile
UserFieldName UserField = "name"
// UserFieldPinnedTweetID is the unique identifier of this user's pinned Tweet.
UserFieldPinnedTweetID UserField = "pinned_tweet_id"
// UserFieldProfileImageURL is the URL to the profile image for this user, as shown on the user's profile.
UserFieldProfileImageURL UserField = "profile_image_url"
// UserFieldProtected indicates if this user has chosen to protect their Tweets (in other words, if this user's Tweets are private).
UserFieldProtected UserField = "protected"
// UserFieldPublicMetrics contains details about activity for this user.
UserFieldPublicMetrics UserField = "public_metrics"
// UserFieldURL is the URL specified in the user's profile, if present.
UserFieldURL UserField = "url"
// UserFieldUserName is the Twitter screen name, handle, or alias that this user identifies themselves with
UserFieldUserName UserField = "username"
// UserFieldVerified indicates if this user is a verified Twitter User.
UserFieldVerified UserField = "verified"
// UserFieldWithHeld contains withholding details
UserFieldWithHeld UserField = "withheld"
)
func userFieldStringArray(arr []UserField) []string {
strs := make([]string, len(arr))
for i, field := range arr {
strs[i] = string(field)
}
return strs
}
// UserObj contains Twitter user account metadata describing the referenced user
type UserObj struct {
ID string `json:"id"`
Name string `json:"name"`
UserName string `json:"username"`
CreatedAt string `json:"created_at"`
Description string `json:"description"`
Entities EntitiesObj `json:"entities"`
Location string `json:"location"`
PinnedTweetID string `json:"pinned_tweet_id"`
ProfileImageURL string `json:"profile_image_url"`
Protected bool `json:"protected"`
PublicMetrics UserMetricsObj `json:"public_metrics"`
URL string `json:"url"`
Verified bool `json:"verified"`
WithHeld WithHeldObj `json:"withheld"`
}
// UserMetricsObj contains details about activity for this user
type UserMetricsObj struct {
Followers int `json:"followers_count"`
Following int `json:"following_count"`
Tweets int `json:"tweet_count"`
Listed int `json:"listed_count"`
}