Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

preliminary users.profile.(get|set) #16

Merged
merged 1 commit into from
Apr 17, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 15 additions & 9 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,16 @@ func New(token string, options ...Option) *Client {
slackURL: slackURL,
}
return &Client{
auth: &AuthService{client: wrappedcl, token: token},
bots: &BotsService{client: wrappedcl, token: token},
channels: &ChannelsService{client: wrappedcl, token: token},
chat: &ChatService{client: wrappedcl, token: token},
oauth: &OAuthService{client: wrappedcl},
reactions: &ReactionsService{client: wrappedcl, token: token},
rtm: &RTMService{client: wrappedcl, token: token},
users: &UsersService{client: wrappedcl, token: token},
debug: debug,
auth: &AuthService{client: wrappedcl, token: token},
bots: &BotsService{client: wrappedcl, token: token},
channels: &ChannelsService{client: wrappedcl, token: token},
chat: &ChatService{client: wrappedcl, token: token},
oauth: &OAuthService{client: wrappedcl},
reactions: &ReactionsService{client: wrappedcl, token: token},
rtm: &RTMService{client: wrappedcl, token: token},
users: &UsersService{client: wrappedcl, token: token},
usersProfile: &UsersProfileService{client: wrappedcl, token: token},
debug: debug,
}
}

Expand Down Expand Up @@ -153,6 +154,11 @@ func (c *Client) Users() *UsersService {
return c.users
}

// UsersProfile returns the Service object for `users.profile.*` endpoints
func (c *Client) UsersProfile() *UsersService {
return c.users
}

type httpClient struct {
client *http.Client
debug bool
Expand Down
29 changes: 18 additions & 11 deletions interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,18 @@ var OAuth2Endpoint = oauth2.Endpoint{
}

type Client struct {
auth *AuthService
bots *BotsService
channels *ChannelsService
chat *ChatService
oauth *OAuthService
reactions *ReactionsService
rtm *RTMService
users *UsersService
debug bool
slackURL string
token string
auth *AuthService
bots *BotsService
channels *ChannelsService
chat *ChatService
oauth *OAuthService
reactions *ReactionsService
rtm *RTMService
users *UsersService
usersProfile *UsersProfileService
debug bool
slackURL string
token string
}

// SlackResponse is the general response part given by all
Expand Down Expand Up @@ -172,6 +173,12 @@ type UsersService struct {
token string
}

// UsersProfileService handles all `users.profile.*` API endpoints
type UsersProfileService struct {
client *httpClient
token string
}

type Paging struct {
Count int `json:"count"`
Total int `json:"total"`
Expand Down
26 changes: 13 additions & 13 deletions objects/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,19 +206,19 @@ type ItemReaction struct {
}

type UserProfile struct {
AlwaysActive bool `json:"always_active"`
AvatarHash string `json:"avatar_hash"`
Email string `json:"email"`
FirstName string `json:"first_name"`
Image24 string `json:"image_24"`
Image32 string `json:"image_32"`
Image48 string `json:"image_48"`
Image72 string `json:"image_72"`
Image192 string `json:"image_192"`
Image512 string `json:"image_512"`
LastName string `json:"last_name"`
RealName string `json:"real_name"`
RealNameNormalized string `json:"real_name_normalized"`
AlwaysActive bool `json:"always_active,omitempty"`
AvatarHash string `json:"avatar_hash,omitempty"`
Email string `json:"email,omitempty"`
FirstName string `json:"first_name,omitempty"`
Image24 string `json:"image_24,omitempty"`
Image32 string `json:"image_32,omitempty"`
Image48 string `json:"image_48,omitempty"`
Image72 string `json:"image_72,omitempty"`
Image192 string `json:"image_192,omitempty"`
Image512 string `json:"image_512,omitempty"`
LastName string `json:"last_name,omitempty"`
RealName string `json:"real_name,omitempty"`
RealNameNormalized string `json:"real_name_normalized,omitempty"`
StatusText string `json:"status_text,omitempty"`
StatusEmoji string `json:"status_emoji,omitempty"`
}
Expand Down