Documentation ¶
Index ¶
- type Channel
- type ChannelOptions
- type ChannelsService
- func (s *ChannelsService) History(ch string, opts *HistoryOptions) (*History, *http.Response, error)
- func (s *ChannelsService) Info(id string, opts *ChannelOptions) (*Channel, *http.Response, error)
- func (s *ChannelsService) List() ([]Channel, *http.Response, error)
- func (s *ChannelsService) Rename(id, name string, opts *ChannelOptions) (*Channel, *http.Response, error)
- type Client
- type ErrorResponse
- type History
- type HistoryOptions
- type Info
- type Message
- type MessageTimestamp
- type Purpose
- type Timestamp
- type Topic
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Channel ¶
type Channel struct { ID string `json:"id,omitempty"` Name string `json:"name,omitempty"` IsChannel bool `json:"is_channel,omitempty"` Created Timestamp `json:"created,omitempty"` Creator string `json:"creator,omitempty"` IsArchived bool `json:"is_archived,omitempty"` IsGeneral bool `json:"is_general,omitempty"` IsMember bool `json:"is_member,omitempty"` Topic Topic `json:"topic,omitempty"` Members []string `json:"members,omitempty"` Purpose Purpose `json:"purpose,omitempty"` NumMembers int `json:"num_members,omitempty"` Latest Message `json:"latest,omitempty"` LastRead MessageTimestamp `json:"last_read,omitempty"` UnreadCount int `json:"unread_count,omitempty"` }
Channel represents a Slack channel.
type ChannelOptions ¶
type ChannelsService ¶
type ChannelsService struct {
// contains filtered or unexported fields
}
ChannelsService handles channel-related API requests.
func (*ChannelsService) History ¶
func (s *ChannelsService) History(ch string, opts *HistoryOptions) (*History, *http.Response, error)
History retrieves the message history of a channel.
func (*ChannelsService) Info ¶
func (s *ChannelsService) Info(id string, opts *ChannelOptions) (*Channel, *http.Response, error)
Info retrieves a channel.
func (*ChannelsService) List ¶
func (s *ChannelsService) List() ([]Channel, *http.Response, error)
List returns a slice of Channels, the raw http.Response, and an optional error.
func (*ChannelsService) Rename ¶
func (s *ChannelsService) Rename(id, name string, opts *ChannelOptions) (*Channel, *http.Response, error)
Rename sets a channel's name, optionally returning an error.
type Client ¶
type Client struct { Team string APIKey string BaseURL *url.URL Channels *ChannelsService // contains filtered or unexported fields }
type ErrorResponse ¶
type ErrorResponse struct { Response *http.Response Ok bool `json:"ok"` Message string `json:"error"` }
func Error ¶
func Error(err error) *ErrorResponse
Error takes an error interface and attempts to assert it is of type *slack.ErrorResponse, returning the ErrorResponse if possible, or nil if not.
func (*ErrorResponse) Error ¶
func (r *ErrorResponse) Error() string
type History ¶
type History struct { Messages []Message `json:"messages,omitempty"` HasMore bool `json:"has_more,omitempty"` }
History is the result type for any history request.
type HistoryOptions ¶
type HistoryOptions struct { Channel string `url:"channel"` Latest string `url:"latest,omitempty"` Oldest string `url:"oldest,omitempty"` Count int `url:"count,omitempty"` }
HistoryOptions is an options type that modifies the history query for channels, groups, and IMs.
type Info ¶
type Info struct { Value string `json:"value,omitempty"` Creator string `json:"creator,omitempty"` LastSet Timestamp }
Info provides a generic type for additional data
type Message ¶
type Message struct { Text string `json:"text,omitempty"` Username string `json:"username,omitempty"` Type string `json:"type,omitempty"` Subtype string `json:"subtype,omitempty"` Timestamp MessageTimestamp `json:"ts,omitempty"` }
Message type
type MessageTimestamp ¶
func (MessageTimestamp) MarshalJSON ¶
func (t MessageTimestamp) MarshalJSON() ([]byte, error)
func (*MessageTimestamp) UnmarshalJSON ¶
func (t *MessageTimestamp) UnmarshalJSON(b []byte) error
type Timestamp ¶
Timestamp is a custom time.Time type to convert Slack's use of seconds-since-epoch timestamps
func (*Timestamp) MarshalJSON ¶
MarshalJSON implements the json encoder interface
func (*Timestamp) UnmarshalJSON ¶
UnmarshalJSON implements the json decoder interface