Skip to content

Commit df7caaf

Browse files
authored
Merge pull request #1120 from paultyng/status_emoji_display_info
Add support for status_emoji_display_info
2 parents f1c8f0a + 048adff commit df7caaf

File tree

2 files changed

+58
-38
lines changed

2 files changed

+58
-38
lines changed

users.go

Lines changed: 32 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -17,30 +17,38 @@ const (
1717

1818
// UserProfile contains all the information details of a given user
1919
type UserProfile struct {
20-
FirstName string `json:"first_name"`
21-
LastName string `json:"last_name"`
22-
RealName string `json:"real_name"`
23-
RealNameNormalized string `json:"real_name_normalized"`
24-
DisplayName string `json:"display_name"`
25-
DisplayNameNormalized string `json:"display_name_normalized"`
26-
Email string `json:"email"`
27-
Skype string `json:"skype"`
28-
Phone string `json:"phone"`
29-
Image24 string `json:"image_24"`
30-
Image32 string `json:"image_32"`
31-
Image48 string `json:"image_48"`
32-
Image72 string `json:"image_72"`
33-
Image192 string `json:"image_192"`
34-
Image512 string `json:"image_512"`
35-
ImageOriginal string `json:"image_original"`
36-
Title string `json:"title"`
37-
BotID string `json:"bot_id,omitempty"`
38-
ApiAppID string `json:"api_app_id,omitempty"`
39-
StatusText string `json:"status_text,omitempty"`
40-
StatusEmoji string `json:"status_emoji,omitempty"`
41-
StatusExpiration int `json:"status_expiration"`
42-
Team string `json:"team"`
43-
Fields UserProfileCustomFields `json:"fields"`
20+
FirstName string `json:"first_name"`
21+
LastName string `json:"last_name"`
22+
RealName string `json:"real_name"`
23+
RealNameNormalized string `json:"real_name_normalized"`
24+
DisplayName string `json:"display_name"`
25+
DisplayNameNormalized string `json:"display_name_normalized"`
26+
Email string `json:"email"`
27+
Skype string `json:"skype"`
28+
Phone string `json:"phone"`
29+
Image24 string `json:"image_24"`
30+
Image32 string `json:"image_32"`
31+
Image48 string `json:"image_48"`
32+
Image72 string `json:"image_72"`
33+
Image192 string `json:"image_192"`
34+
Image512 string `json:"image_512"`
35+
ImageOriginal string `json:"image_original"`
36+
Title string `json:"title"`
37+
BotID string `json:"bot_id,omitempty"`
38+
ApiAppID string `json:"api_app_id,omitempty"`
39+
StatusText string `json:"status_text,omitempty"`
40+
StatusEmoji string `json:"status_emoji,omitempty"`
41+
StatusEmojiDisplayInfo []UserProfileStatusEmojiDisplayInfo `json:"status_emoji_display_info,omitempty"`
42+
StatusExpiration int `json:"status_expiration"`
43+
Team string `json:"team"`
44+
Fields UserProfileCustomFields `json:"fields"`
45+
}
46+
47+
type UserProfileStatusEmojiDisplayInfo struct {
48+
EmojiName string `json:"emoji_name"`
49+
DisplayAlias string `json:"display_alias,omitempty"`
50+
DisplayURL string `json:"display_url,omitempty"`
51+
Unicode string `json:"unicode,omitempty"`
4452
}
4553

4654
// UserProfileCustomFields represents user profile's custom fields.

users_test.go

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -33,22 +33,31 @@ func getTestUserProfileCustomFields() UserProfileCustomFields {
3333
}}
3434
}
3535

36+
func getTestUserProfileStatusEmojiDisplayInfo() []UserProfileStatusEmojiDisplayInfo {
37+
return []UserProfileStatusEmojiDisplayInfo{{
38+
EmojiName: "construction",
39+
Unicode: "1f6a7",
40+
DisplayURL: "https://a.slack-edge.com/production-standard-emoji-assets/14.0/apple-large/1f6a7.png",
41+
}}
42+
}
43+
3644
func getTestUserProfile() UserProfile {
3745
return UserProfile{
38-
StatusText: "testStatus",
39-
StatusEmoji: ":construction:",
40-
RealName: "Test Real Name",
41-
RealNameNormalized: "Test Real Name Normalized",
42-
DisplayName: "Test Display Name",
43-
DisplayNameNormalized: "Test Display Name Normalized",
44-
45-
Image24: "https://s3-us-west-2.amazonaws.com/slack-files2/avatars/2016-10-18/92962080834_ef14c1469fc0741caea1_24.jpg",
46-
Image32: "https://s3-us-west-2.amazonaws.com/slack-files2/avatars/2016-10-18/92962080834_ef14c1469fc0741caea1_32.jpg",
47-
Image48: "https://s3-us-west-2.amazonaws.com/slack-files2/avatars/2016-10-18/92962080834_ef14c1469fc0741caea1_48.jpg",
48-
Image72: "https://s3-us-west-2.amazonaws.com/slack-files2/avatars/2016-10-18/92962080834_ef14c1469fc0741caea1_72.jpg",
49-
Image192: "https://s3-us-west-2.amazonaws.com/slack-files2/avatars/2016-10-18/92962080834_ef14c1469fc0741caea1_192.jpg",
50-
Image512: "https://s3-us-west-2.amazonaws.com/slack-files2/avatars/2016-10-18/92962080834_ef14c1469fc0741caea1_512.jpg",
51-
Fields: getTestUserProfileCustomFields(),
46+
StatusText: "testStatus",
47+
StatusEmoji: ":construction:",
48+
StatusEmojiDisplayInfo: getTestUserProfileStatusEmojiDisplayInfo(),
49+
RealName: "Test Real Name",
50+
RealNameNormalized: "Test Real Name Normalized",
51+
DisplayName: "Test Display Name",
52+
DisplayNameNormalized: "Test Display Name Normalized",
53+
54+
Image24: "https://s3-us-west-2.amazonaws.com/slack-files2/avatars/2016-10-18/92962080834_ef14c1469fc0741caea1_24.jpg",
55+
Image32: "https://s3-us-west-2.amazonaws.com/slack-files2/avatars/2016-10-18/92962080834_ef14c1469fc0741caea1_32.jpg",
56+
Image48: "https://s3-us-west-2.amazonaws.com/slack-files2/avatars/2016-10-18/92962080834_ef14c1469fc0741caea1_48.jpg",
57+
Image72: "https://s3-us-west-2.amazonaws.com/slack-files2/avatars/2016-10-18/92962080834_ef14c1469fc0741caea1_72.jpg",
58+
Image192: "https://s3-us-west-2.amazonaws.com/slack-files2/avatars/2016-10-18/92962080834_ef14c1469fc0741caea1_192.jpg",
59+
Image512: "https://s3-us-west-2.amazonaws.com/slack-files2/avatars/2016-10-18/92962080834_ef14c1469fc0741caea1_512.jpg",
60+
Fields: getTestUserProfileCustomFields(),
5261
}
5362
}
5463

@@ -608,6 +617,9 @@ func TestGetUserProfile(t *testing.T) {
608617
if profile.DisplayName != exp.DisplayName {
609618
t.Fatalf(`profile.DisplayName = "%s", wanted "%s"`, profile.DisplayName, exp.DisplayName)
610619
}
620+
if len(profile.StatusEmojiDisplayInfo) != 1 {
621+
t.Fatalf(`expected 1 emoji, got %d`, len(profile.StatusEmojiDisplayInfo))
622+
}
611623
}
612624

613625
func TestSetFieldsMap(t *testing.T) {

0 commit comments

Comments
 (0)