objects

package
v0.0.0-...-1aaae71 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 27, 2019 License: MIT Imports: 5 Imported by: 6

Documentation

Index

Constants

View Source
const (
	ButtonActionType = "button"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action struct {
	Confirm         *Confirmation   `json:"confirm,omitempty"`
	DataSource      string          `json:"data_source,omitempty"`
	MinQueryLength  int             `json:"min_query_length,omitempty"`
	Name            string          `json:"name"`
	OptionGroups    OptionGroupList `json:"option_groups,omitempty"`
	Options         OptionList      `json:"options,omitempty"`
	SelectedOptions OptionList      `json:"selected_options,omitempty"`
	Style           string          `json:"style,omitempty"`
	Text            string          `json:"text"`
	Type            string          `json:"type"`
	Value           string          `json:"value"`
}

Action is used in conjunction with message buttons

type ActionList

type ActionList []*Action

func (*ActionList) Append

func (l *ActionList) Append(a *Action) *ActionList

type Attachment

type Attachment struct {
	Actions        ActionList          `json:"actions,omitempty"` // for buttons
	AttachmentType string              `json:"attachment_type"`
	AuthorName     string              `json:"author_name"`
	AuthorLink     string              `json:"author_link"`
	AuthorIcon     string              `json:"author_icon"`
	CallbackID     string              `json:"callback_id,omitempty"` // for buttons
	Color          string              `json:"color,omitempty"`
	Fallback       string              `json:"fallback"`
	Fields         AttachmentFieldList `json:"fields"`
	Footer         string              `json:"footer"`
	FooterIcon     string              `json:"footer_icon"`
	ImageURL       string              `json:"image_url"`
	ThumbURL       string              `json:"thumb_url"`
	Pretext        string              `json:"pretext,omitempty"`
	Text           string              `json:"text"`
	Timestamp      Timestamp           `json:"ts"`
	Title          string              `json:"title"`
	TitleLink      string              `json:"title_link"`
}

type AttachmentField

type AttachmentField struct {
	Title string `json:"title"`
	Value string `json:"value"`
	Short bool   `json:"short"`
}

type AttachmentFieldList

type AttachmentFieldList []*AttachmentField

func (*AttachmentFieldList) Append

type AttachmentList

type AttachmentList []*Attachment

func (*AttachmentList) Append

func (l *AttachmentList) Append(a *Attachment) *AttachmentList

func (*AttachmentList) Decode

func (l *AttachmentList) Decode(buf string) error

func (*AttachmentList) Encode

func (l *AttachmentList) Encode() (string, error)

type AuthTestResponse

type AuthTestResponse struct {
	URL    string `json:"url"`
	Team   string `json:"team"`
	User   string `json:"user"`
	TeamID string `json:"team_id"`
	UserID string `json:"user_id"`
}

AuthTestResponse is the data structure response from auth.test

type Bot

type Bot struct {
	ID      string `json:"id"`
	AppID   string `json:"app_id"`
	Deleted bool   `json:"deleted"`
	Name    string `json:"name"`
	Icons   Icons  `json:"icons"`
}

type Channel

type Channel struct {
	Group
	IsChannel   bool `json:"is_channel"`
	IsGeneral   bool `json:"is_general"`
	IsMember    bool `json:"is_member"`
	IsOrgShared bool `json:"is_org_shared"`
	IsShared    bool `json:"is_shared"`
}

type ChannelList

type ChannelList []*Channel

type ChannelsHistoryResponse

type ChannelsHistoryResponse struct {
	HasMore  bool        `json:"has_more"`
	Latest   string      `json:"latest"`
	Messages MessageList `json:"messages"`
}

type ChatResponse

type ChatResponse struct {
	Channel   string      `json:"channel"`
	Timestamp string      `json:"ts"`
	Message   interface{} `json:"message"` // TODO
}

type Comment

type Comment struct {
	ID        string    `json:"id,omitempty"`
	Created   EpochTime `json:"created,omitempty"`
	Timestamp EpochTime `json:"timestamp,omitempty"`
	User      string    `json:"user,omitempty"`
	Comment   string    `json:"comment,omitempty"`
}

type Confirmation

type Confirmation struct {
	Title       string `json:"title"`
	Text        string `json:"text"`
	OkText      string `json:"ok_text"`
	DismissText string `json:"dismiss_text"`
}

Confirmation is used in conjunction with message buttons

type Conversation

type Conversation struct {
	ID                 string    `json:"id"`
	Created            EpochTime `json:"created"`
	IsOpen             bool      `json:"is_open"`
	LastRead           string    `json:"last_read,omitempty"`
	Latest             *Message  `json:"latest,omitempty"`
	UnreadCount        int       `json:"unread_count,omitempty"`
	UnreadCountDisplay int       `json:"unread_count_display,omitempty"`
}

Conversation is a structure that is never used by itself: it's re-used to describe a basic conversation profile by being embedded in other objects

type Dialog

type Dialog struct {
	CallbackID  string         `json:"callback_id"`
	Title       string         `json:"title"`
	SubmitLabel string         `json:"submit_label"`
	Elements    DialogElements `json:"elements"`
}

func (*Dialog) Decode

func (d *Dialog) Decode(buf string) error

func (*Dialog) Encode

func (d *Dialog) Encode() (string, error)

type DialogElement

type DialogElement struct {
	Label       string `json:"label"`
	Type        string `json:"type"`
	Name        string `json:"name"`
	Hint        string `json:"hint,omitempty"`
	MaxLength   int    `json:"max_length,omitempty"`
	MinLength   int    `json:"min_length,omitempty"`
	Optional    bool   `json:"optional,omitempty"`
	Placeholder string `json:"placeholder,omitempty"`
	Subtype     string `json:"subtype,omitempty"`
	Value       string `json:"value,omitempty"`
}

DialogElements represents elements in dialog, including text, textarea, and select

type DialogElements

type DialogElements []*DialogElement

type DialogResponse

type DialogResponse struct {
	ResponseMetadata struct {
		Messages []string `json:"messages"`
	} `json:"response_metadata"`
}

type DialogSubmission

type DialogSubmission struct {
	ActionTimestamp string            `json:"action_ts"`
	Submission      map[string]string `json:"submission"`
	Token           string            `json:"token"`
	TriggerID       string            `json:"trigger_id"`
	Team            struct {
		Domain string `json:"domain"`
		ID     string `json:"id"`
	} `json:"team"`
	Channel struct {
		ID   string `json:"id"`
		Name string `json:"name"`
	} `json:"channel"`
	User struct {
		ID   string `json:"id"`
		Name string `json:"name"`
	} `json:"user"`
}

type Edited

type Edited struct {
	Timestamp string `json:"ts"`
	User      string `json:"user"`
}

type EmojiListResponse

type EmojiListResponse map[string]string

type EphemeralResponse

type EphemeralResponse struct {
	MessageTimestamp string `json:"message_ts"`
}

type EpochTime

type EpochTime int64

func (EpochTime) Add

func (t EpochTime) Add(seconds int64) EpochTime

func (EpochTime) Int

func (t EpochTime) Int() int

type ErrorResponse

type ErrorResponse struct {
	Code    int    `json:"code"`
	Message string `json:"msg"`
}

ErrorResponse wraps errors returned by Slack. It's usually a string, but it could be a structure. https://api.slack.com/rtm#handling_responses

func (*ErrorResponse) String

func (e *ErrorResponse) String() string

func (*ErrorResponse) UnmarshalJSON

func (e *ErrorResponse) UnmarshalJSON(data []byte) error

type File

type File struct {
	ID           string
	Name         string
	User         string
	Created      int    `json:"created"`   // The created property is a unix timestamp representing when the file was created.
	Timestamp    int    `json:"timestamp"` // Deprecated
	Updated      int    `json:"updated"`   // The updated property (for Post filetypes only) is a unix timestamp of when the Post was last edited.
	MimeType     string `json:"mimetype"`  // The mimetype and filetype props do not have a 1-to-1 mapping, as multiple different files types ('html', 'js', etc.) share the same mime type.
	FileType     string `json:"filetype"`
	PrettyType   string `json:"pretty_type"` // The pretty_type property contains a human-readable version of the type.
	Mode         string `json:"mode"`        // The mode property contains one of hosted, external, snippet or post.
	Editable     bool   `json:"editable"`    // The editable property indicates that files are stored in editable mode.
	IsExternal   bool   `json:"is_external"` // The is_external property indicates whether the master copy of a file is stored within the system or not. If the file is_external, then the url property will point to the externally-hosted master file. Further, the external_type property will indicate what kind of external file it is, e.g. dropbox or gdoc.
	ExternalType string `json:"external_type"`
	Size         int    `json:"size"` // The size parameter is the filesize in bytes. Snippets are limited to a maximum file size of 1 megabyte.

	URL                string `json:"url"`          // Deprecated - never set
	URLDownload        string `json:"url_download"` // Deprecated - never set
	URLPrivate         string `json:"url_private"`
	URLPrivateDownload string `json:"url_private_download"`

	ImageExifRotation string `json:"image_exif_rotation"`
	OriginalWidth     int    `json:"original_w"`
	OriginalHeight    int    `json:"original_h"`
	Thumb64           string `json:"thumb_64"`
	Thumb80           string `json:"thumb_80"`
	Thumb160          string `json:"thumb_160"`
	Thumb360          string `json:"thumb_360"`
	Thumb360Gif       string `json:"thumb_360_gif"`
	Thumb360W         int    `json:"thumb_360_w"`
	Thumb360H         int    `json:"thumb_360_h"`
	Thumb480          string `json:"thumb_480"`
	Thumb480W         int    `json:"thumb_480_w"`
	Thumb480H         int    `json:"thumb_480_h"`
	Thumb720          string `json:"thumb_720"`
	Thumb720W         int    `json:"thumb_720_w"`
	Thumb720H         int    `json:"thumb_720_h"`
	Thumb960          string `json:"thumb_960"`
	Thumb960W         int    `json:"thumb_960_w"`
	Thumb960H         int    `json:"thumb_960_h"`
	Thumb1024         string `json:"thumb_1024"`
	Thumb1024W        int    `json:"thumb_1024_w"`
	Thumb1024H        int    `json:"thumb_1024_h"`

	Permalink       string `json:"permalink"`
	PermalinkPublic string `json:"permalink_public"`

	EditLink         string `json:"edit_link"`
	Preview          string `json:"preview"`
	PreviewHighlight string `json:"preview_highlight"`
	Lines            int    `json:"lines"`
	LinesMore        int    `json:"lines_more"`

	IsPublic        bool     `json:"is_public"`
	PublicURLShared bool     `json:"public_url_shared"`
	Channels        []string `json:"channels"`
	Groups          []string `json:"groups"`
	IMs             []string `json:"ims"`
	InitialComment  Comment  `json:"initial_comment"`
	CommentsCount   int      `json:"comments_count"`
	NumStars        int      `json:"num_stars"`
	IsStarred       bool     `json:"is_starred"`

	Title     string       `json:"title"`
	Reactions ReactionList `json:"reactions,omitempty"`
}

File represents a file object (https://api.slack.com/types/file)

type GenericResponse

type GenericResponse struct {
	OK        bool          `json:"ok"`
	ReplyTo   int           `json:"reply_to,omitempty"`
	Error     ErrorResponse `json:"error,omitempty"`
	Timestamp string        `json:"ts"`
}

GenericResponse is the generic response part given by all slack API response.

type Group

type Group struct {
	Conversation
	Creator        string   `json:"creator"`
	IsArchived     bool     `json:"is_archived"`
	IsGroup        bool     `json:"is_group"`
	IsMPIM         bool     `json:"is_mpim"`
	Members        []string `json:"members"`
	Name           string   `json:"name"`
	NameNormalized string   `json:"name_normalized"`
	NumMembers     int      `json:"num_members,omitempty"`
	PreviousNames  []string `json:"previous_names,omitempty"`
	Purpose        Purpose  `json:"purpose"`
	Topic          Topic    `json:"topic"`
}

Group contains information about a private channel. Private channels were once known as "private groups."

type GroupList

type GroupList []*Group

GroupList is a list of groups.

type IM

type IM struct {
	Conversation
	IsIM          bool   `json:"is_im"`
	User          string `json:"user"`
	IsUserDeleted bool   `json:"is_user_deleted"`
}

type Icon

type Icon struct {
	IconURL   string `json:"icon_url,omitempty"`
	IconEmoji string `json:"icon_emoji,omitempty"`
}

type Icons

type Icons struct {
	Image36 string `json:"image_36"`
	Image48 string `json:"image_48"`
	Image72 string `json:"image_72"`
}

type InteractiveButtonRequest

type InteractiveButtonRequest struct {
	ActionTimestamp string     `json:"action_ts"`
	Actions         ActionList `json:"actions"`
	AttachmentID    int        `json:"attachment_id,string"`
	CallbackID      string     `json:"callback_id"`
	Channel         struct {
		ID   string `json:"id"`
		Name string `json:"name"`
	} `json:"channel"`
	IsAppUnfurl      bool            `json:"is_app_unfurl"`
	MessageTimestamp string          `json:"message_ts"`
	OriginalMessage  *Message        `json:"original_message"`
	Options          OptionList      `json:"options"`
	OptionGroups     OptionGroupList `json:"option_groups"`
	ResponseURL      string          `json:"response_url"`
	Team             struct {
		Domain string `json:"domain"`
		ID     string `json:"id"`
	} `json:"team"`
	Token     string `json:"token"`
	TriggerID string `json:"trigger_id"`
	User      struct {
		ID   string `json:"id"`
		Name string `json:"name"`
	} `json:"user"`
}

InteractiveButtonRequest is a request that is sent when a user hits a Slack button. Note: this is experimental

type Message

type Message struct {
	Attachments AttachmentList `json:"attachments"`
	Channel     string         `json:"channel"`
	Edited      *Edited        `json:"edited"`
	IsStarred   bool           `json:"is_starred"`
	PinnedTo    []string       `json:"pinned_to"`
	Text        string         `json:"text"`
	Timestamp   string         `json:"ts"`
	Type        string         `json:"type"`
	User        string         `json:"user"`

	// Message Subtypes
	Subtype string `json:"subtype"`

	// Hidden Subtypes
	Hidden           bool   `json:"hidden,omitempty"`     // message_changed, message_deleted, unpinned_item
	DeletedTimestamp string `json:"deleted_ts,omitempty"` // message_deleted
	EventTimestamp   string `json:"event_ts,omitempty"`

	// bot_message (https://api.slack.com/events/message/bot_message)
	BotID    string `json:"bot_id,omitempty"`
	Username string `json:"username,omitempty"`
	Icons    *Icon  `json:"icons,omitempty"`

	// channel_join, group_join
	Inviter string `json:"inviter,omitempty"`

	// channel_topic, group_topic
	Topic string `json:"topic,omitempty"`

	// channel_purpose, group_purpose
	Purpose string `json:"purpose,omitempty"`

	// channel_name, group_name
	Name    string `json:"name,omitempty"`
	OldName string `json:"old_name,omitempty"`

	// channel_archive, group_archive
	Members []string `json:"members,omitempty"`

	// file_share
	Upload bool `json:"upload,omitempty"`

	// file_comment
	Comment *Comment `json:"comment,omitempty"`

	// pinned_item
	ItemType string `json:"item_type,omitempty"`

	// https://api.slack.com/rtm
	ReplyTo int    `json:"reply_to,omitempty"`
	Team    string `json:"team,omitempty"`

	// reactions
	Reactions ReactionList `json:"reactions,omitempty"`
}

Message is a representation of a message, as obtained by the RTM or Events API. This is NOT what you use when you are posting a message. See ChatService#PostMessage and MessageParams for that.

type MessageList

type MessageList []*Message

type OAuthAccessResponse

type OAuthAccessResponse struct {
	AccessToken string `json:"access_token"`
	Scope       string `json:"scope"`
}

type Option

type Option struct {
	Text        string `json:"text"`
	Value       string `json:"value"`
	Description string `json:"description"`
}

type OptionGroup

type OptionGroup struct {
	Text    string     `json:"text"`
	Options OptionList `json:"options"`
}

type OptionGroupList

type OptionGroupList []*OptionGroup

type OptionList

type OptionList []*Option

type Paging

type Paging struct {
	Count int `json:"count"`
	Total int `json:"total"`
	Page  int `json:"page"`
	Pages int `json:"pages"`
}

type PermalinkResponse

type PermalinkResponse struct {
	Channel   string `json:"channel"`
	Permalink string `json:"permalink"`
}

type Presence

type Presence string
const (
	Presencective Presence = "away"
	PresenceAway  Presence = "away"
)

type Purpose

type Purpose struct {
	Value   string    `json:"value"`
	Creator string    `json:"creator"`
	LastSet EpochTime `json:"last_set"`
}

type RTMResponse

type RTMResponse struct {
	URL      string       `json:"url"`
	Self     *UserDetails `json:"self"`
	Team     *Team        `json:"team"`
	Users    []*User      `json:"users"`
	Channels []*Channel   `json:"channels"`
	Groups   []*Group     `json:"groups"`
	Bots     []*Bot       `json:"bots"`
	IMs      []*IM        `json:"ims"`
}

type Reaction

type Reaction struct {
	Count int      `json:"count"`
	Name  string   `json:"name"`
	Users []string `json:"users"`
}

type ReactionList

type ReactionList []*Reaction

type ReactionsGetResponse

type ReactionsGetResponse struct {
	Channel string   `json:"channel"`
	Comment string   `json:"comment"`
	File    *File    `json:"file"`
	Message *Message `json:"message"`
	Type    string   `json:"type"`
}

ReactionsGetResponse represents the response obtained from reactions.get API (https://api.slack.com/methods/reactions.get)

type ReactionsGetResponseList

type ReactionsGetResponseList []ReactionsGetResponse

type ReactionsListResponse

type ReactionsListResponse struct {
	Items  ReactionsGetResponseList `json:"items"`
	Paging Paging                   `json:"paging"`
}

type Reminder

type Reminder struct {
	ID                string    `json:"id"`
	Creator           string    `json:"creator"`
	User              string    `json:"user"`
	Text              string    `json:"text"`
	Recurring         bool      `json:"recurring"`
	Time              EpochTime `json:"time,omitempty"`
	CompleteTimestamp EpochTime `json:"complete_ts,omitempty"`
}

type ReminderList

type ReminderList []*Reminder

type StarredItem

type StarredItem interface{}

type StarredItemList

type StarredItemList []StarredItem

type StarsListResponse

type StarsListResponse struct {
	Items  StarredItemList `json:"items"`
	Paging Paging          `json:"paging"`
}

type Team

type Team struct {
	ID                string                 `json:"id"`
	Name              string                 `json:"name"`
	Domain            string                 `json:"domain"`
	EmailDomain       string                 `json:"email_domain"`
	EnterpriseID      string                 `json:"enterprise_id,omitempty"`
	EnterpriseName    string                 `json:"enterprise_name,omitempty"`
	Icon              map[string]interface{} `json:"icon"`
	MsgEditWindowMins int                    `json:"msg_edit_window_mins"`
	OverStorageLimit  bool                   `json:"over_storage_limit"`
	Prefs             interface{}            `json:"prefs"`
	Plan              string                 `json:"plan"`
}

type ThreadInfo

type ThreadInfo struct {
	Complete bool `json:"complete"`
	Count    int  `json:"count"`
}

type Timestamp

type Timestamp float64

func (*Timestamp) UnmarshalJSON

func (t *Timestamp) UnmarshalJSON(data []byte) error

type Topic

type Topic struct {
	Value   string    `json:"value"`
	Creator string    `json:"creator"`
	LastSet EpochTime `json:"last_set"`
}

type User

type User struct {
	Color             string      `json:"color"`
	Deleted           bool        `json:"deleted"`
	ID                string      `json:"id"`
	IsAdmin           bool        `json:"is_admin"`
	IsBot             bool        `json:"is_bot"`
	IsOwner           bool        `json:"is_owner"`
	IsPrimaryOwner    bool        `json:"is_primary_owner"`
	IsRestricted      bool        `json:"is_restricted"`
	IsUltraRestricted bool        `json:"is_ultra_restricted"`
	Name              string      `json:"name"`
	Profile           UserProfile `json:"profile"`
	RealName          string      `json:"real_name"`
	Status            string      `json:"status,omitempty"`
	TeamID            string      `json:"team_id"`
	TZ                string      `json:"tz,omitempty"`
	TZLabel           string      `json:"tz_label"`
	TZOffset          int         `json:"tz_offset"`
	Updated           int         `json:"updated"`
}

type UserDetails

type UserDetails struct {
	ID             string    `json:"id"`
	Name           string    `json:"name"`
	Created        EpochTime `json:"created"`
	ManualPresence string    `json:"manual_presence"`
	Prefs          UserPrefs `json:"prefs"`
}

UserDetails is only provided by rtm.start response

type UserList

type UserList []*User

type UserPrefs

type UserPrefs struct{} // TODO

type UserPresence

type UserPresence struct {
	AutoAway        bool     `json:"auto_away,omitempty"`
	ConnectionCount int      `json:"connection_count,omitempty"`
	LastActivity    int      `json:"last_activity,omitempty"`
	ManualAway      bool     `json:"manual_away,omitempty"`
	Online          bool     `json:"online"`
	Presence        Presence `json:"presence"`
}

type UserProfile

type UserProfile struct {
	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"`
}

func (*UserProfile) Decode

func (p *UserProfile) Decode(buf string) error

func (*UserProfile) Encode

func (p *UserProfile) Encode() (string, error)

type Usergroup

type Usergroup struct {
	AutoProvision       bool            `json:"auto_provision"`
	AutoType            string          `json:"auto_type"`
	CreatedBy           string          `json:"created_by"`
	DateCreate          EpochTime       `json:"date_create"`
	DateDelete          EpochTime       `json:"date_delete"`
	DateUpdate          EpochTime       `json:"date_update"`
	DeletedBy           string          `json:"deleted_by"`
	Description         string          `json:"description"`
	EnterpriseSubteamID string          `json:"enterprise_subteam_id"`
	Handle              string          `json:"handle"`
	ID                  string          `json:"id"`
	IsExternal          bool            `json:"is_external"`
	IsSubteam           bool            `json:"is_subteam"`
	IsUsergroup         bool            `json:"is_usergroup"`
	Name                string          `json:"name"`
	Prefs               *UsergroupPrefs `json:"prefs"`
	TeamID              string          `json:"team_id"`
	UpdatedBy           string          `json:"updated_by"`
	Users               []string        `json:"users"`
	UserCount           int             `json:"user_count"`
}

Usergroup represents a single UserGroup (like @accounting or @marketing). This should not be confused with private channels or multi-person messages. This is an alias that points to a collection of users and/or channels for notification purposes.

type UsergroupList

type UsergroupList []*Usergroup

UsergroupList is a list of UserGroup

type UsergroupPrefs

type UsergroupPrefs struct {
	Channels []string `json:"channels"`
	Groups   []string `json:"groups"`
}

UsergroupPrefs is the list of preferences for channels and groups for a given Usergroup.

type UsergroupUsersList

type UsergroupUsersList []string

UsergroupUsersList is the list of users in a given Usergroup.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL