Skip to content

Commit

Permalink
A Pointer Allows The Roundtrip To Omit A Field
Browse files Browse the repository at this point in the history
  • Loading branch information
joefitzgerald committed May 7, 2015
1 parent 27bcc52 commit a2fe65a
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion channels.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ type Channel struct {
Purpose ChannelPurpose `json:"purpose"`
IsMember bool `json:"is_member"`
LastRead string `json:"last_read,omitempty"`
Latest Message `json:"latest,omitempty"`
Latest *Message `json:"latest,omitempty"`
UnreadCount int `json:"unread_count,omitempty"`
NumMembers int `json:"num_members,omitempty"`
UnreadCountDisplay int `json:"unread_count_display,omitempty"`
Expand Down
2 changes: 1 addition & 1 deletion groups.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ type Group struct {
Topic ChannelTopic `json:"topic"`
Purpose ChannelPurpose `json:"purpose"`
LastRead string `json:"last_read,omitempty"`
Latest Message `json:"latest,omitempty"`
Latest *Message `json:"latest,omitempty"`
UnreadCount int `json:"unread_count,omitempty"`
NumMembers int `json:"num_members,omitempty"`
UnreadCountDisplay int `json:"unread_count_display,omitempty"`
Expand Down
16 changes: 8 additions & 8 deletions info.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,14 +145,14 @@ type Bot struct {
// Info contains various details about Users, Channels, Bots and the authenticated user
// It is returned by StartRTM
type Info struct {
Url string `json:"url,omitempty"`
User UserDetails `json:"self,omitempty"`
Team Team `json:"team,omitempty"`
Users []User `json:"users,omitempty"`
Channels []Channel `json:"channels,omitempty"`
Groups []Group `json:"groups,omitempty"`
Bots []Bot `json:"bots,omitempty"`
IMs []IM `json:"ims,omitempty"`
Url string `json:"url,omitempty"`
User *UserDetails `json:"self,omitempty"`
Team *Team `json:"team,omitempty"`
Users []User `json:"users,omitempty"`
Channels []Channel `json:"channels,omitempty"`
Groups []Group `json:"groups,omitempty"`
Bots []Bot `json:"bots,omitempty"`
IMs []IM `json:"ims,omitempty"`
}

type infoResponseFull struct {
Expand Down
4 changes: 2 additions & 2 deletions messages.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ type OutgoingMessage struct {
// Message is an auxiliary type to allow us to have a message containing sub messages
type Message struct {
Msg
SubMessage Msg `json:"message,omitempty"`
SubMessage *Msg `json:"message,omitempty"`
}

// Msg contains information about a slack message
Expand All @@ -23,7 +23,7 @@ type Msg struct {
Timestamp string `json:"ts,omitempty"`
Text string `json:"text,omitempty"`
Team string `json:"team,omitempty"`
File File `json:"file,omitempty"`
File *File `json:"file,omitempty"`
// Type may come if it's part of a message list
// e.g.: channel.history
Type string `json:"type,omitempty"`
Expand Down
8 changes: 4 additions & 4 deletions websocket_channels.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ type ChannelInfoEvent struct {
// channel_deleted
// channel_archive
// channel_unarchive
Type string `json:"type"`
ChannelId string `json:"channel"`
UserId string `json:"user,omitempty"`
Timestamp JSONTimeString `json:"ts,omitempty"`
Type string `json:"type"`
ChannelId string `json:"channel"`
UserId string `json:"user,omitempty"`
Timestamp *JSONTimeString `json:"ts,omitempty"`
}

type ChannelRenameEvent struct {
Expand Down
8 changes: 4 additions & 4 deletions websocket_teams.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ package slack

type TeamJoinEvent struct {
Type string `json:"type"`
User User `json:"user,omitempty"`
User *User `json:"user,omitempty"`
}

type TeamRenameEvent struct {
Type string `json:"type"`
Name string `json:"name,omitempty"`
EventTimestamp JSONTimeString `json:"event_ts,omitempty"`
Type string `json:"type"`
Name string `json:"name,omitempty"`
EventTimestamp *JSONTimeString `json:"event_ts,omitempty"`
}

type TeamPrefChangeEvent struct {
Expand Down

0 comments on commit a2fe65a

Please sign in to comment.