slack

package
v1.1.5 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2020 License: LGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ResponseTypeEphemeral responseType = iota
	ResponseTypeInChannel
)
View Source
const SlackWebAPIEndpoint = "https://slack.com/api"

Variables

This section is empty.

Functions

func EscapeMessage

func EscapeMessage(s string) string

Types

type Attachment

type Attachment struct {
	AuthorName string
	Title      string
	TitleLink  string
	Text       string
	Markdown   bool
}

func (Attachment) MarshalJSON added in v1.1.1

func (a Attachment) MarshalJSON() ([]byte, error)

func (*Attachment) UnmarshalJSON added in v1.1.1

func (a *Attachment) UnmarshalJSON(data []byte) error

type InstantMessenger added in v1.1.5

type InstantMessenger struct {
	// contains filtered or unexported fields
}

func NewInstantMessenger added in v1.1.5

func NewInstantMessenger(api messageSender) *InstantMessenger

func (*InstantMessenger) SendMessage added in v1.1.5

func (im *InstantMessenger) SendMessage(user User, message Message) error

type Message added in v1.1.5

type Message struct {
	Text        string       `json:"text"`
	Attachments []Attachment `json:"attachments,omitempty"`
}

type NoSuchUserError added in v1.1.5

type NoSuchUserError struct {
	Name string
}

func (NoSuchUserError) Error added in v1.1.5

func (e NoSuchUserError) Error() string

type Response

type Response struct {
	Message
	ResponseType responseType `json:"response_type,omitempty"`
}

func NewEphemeralResponse

func NewEphemeralResponse(text string) *Response

func NewInChannelResponse

func NewInChannelResponse(text string) *Response

type TeamDirectory added in v1.1.5

type TeamDirectory struct {
	// contains filtered or unexported fields
}

func NewTeamDirectory added in v1.1.5

func NewTeamDirectory(api userLister) *TeamDirectory

func (*TeamDirectory) Fetch added in v1.1.5

func (dir *TeamDirectory) Fetch(username string) (User, error)

type User

type User struct {
	ID   string
	Name string
}

func (User) String

func (u User) String() string

type WebAPI added in v1.0.1

type WebAPI struct {
	BaseURL string
	// contains filtered or unexported fields
}

func NewWebAPI added in v1.0.1

func NewWebAPI(token string, httpClient *http.Client) *WebAPI

func (*WebAPI) Call added in v1.0.1

func (api *WebAPI) Call(method string, params url.Values) (response []byte, u *url.URL, err error)

func (*WebAPI) GetChannelTopic added in v1.0.1

func (api *WebAPI) GetChannelTopic(channelID string) (string, error)

func (*WebAPI) ListUsers added in v1.1.5

func (api *WebAPI) ListUsers() ([]User, error)

func (*WebAPI) OpenIMChannel added in v1.1.5

func (api *WebAPI) OpenIMChannel(user User) (string, error)

func (*WebAPI) PostMessage added in v1.1.5

func (api *WebAPI) PostMessage(channelID string, message Message) error

func (*WebAPI) SetChannelTopic added in v1.0.1

func (api *WebAPI) SetChannelTopic(channelID, topic string) error

type WebAPIError added in v1.0.1

type WebAPIError struct {
	Method, URL, Response string
}

func (*WebAPIError) Error added in v1.0.1

func (e *WebAPIError) Error() string

Jump to

Keyboard shortcuts

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