slack

package
v0.0.0-...-ce9b616 Latest Latest
Warning

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

Go to latest
Published: May 29, 2020 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReplaceIdFormatToName

func ReplaceIdFormatToName(s string) string

Types

type MessageRepositoryOnSlack

type MessageRepositoryOnSlack struct {
	SlackClient *SlackClient
	// contains filtered or unexported fields
}

func NewMessageRepository

func NewMessageRepository(timelineChannelID string, s SlackClient, db leveldb.DB) MessageRepositoryOnSlack

func (MessageRepositoryOnSlack) Delete

func (r MessageRepositoryOnSlack) Delete(message timeline.Message) error

func (MessageRepositoryOnSlack) FindMessageInTimeline

func (r MessageRepositoryOnSlack) FindMessageInTimeline(message timeline.Message) (*timeline.Message, error)

func (MessageRepositoryOnSlack) Put

type RTMClient

type RTMClient interface {
	ConnectToRTM() (RTMConnection, error)
}

type RTMConnection

type RTMConnection interface {
	Read() ([]byte, error)
	Close() error
}

type SlackClient

type SlackClient struct {
	Token string
	// contains filtered or unexported fields
}

func NewSlackClient

func NewSlackClient(token string, logger *log.Logger) SlackClient

func (SlackClient) ConnectToRTM

func (cli SlackClient) ConnectToRTM() (RTMConnection, error)

type SlackMessage

type SlackMessage struct {
	Raw       string `json:"-"`
	Type      string `json:"type"`
	UserID    string `json:"user"`
	Text      string `json:"text"`
	ChannelID string `json:"channel"`
	TimeStamp string `json:"ts"`
	SubType   string `json:"subtype"`
}

func (*SlackMessage) IsDeletedMessage

func (m *SlackMessage) IsDeletedMessage() bool

func (*SlackMessage) IsMessageToPost

func (m *SlackMessage) IsMessageToPost() bool

func (*SlackMessage) ToInternal

func (m *SlackMessage) ToInternal() timeline.Message

type SlackRTMConnection

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

func (SlackRTMConnection) Close

func (c SlackRTMConnection) Close() error

func (SlackRTMConnection) Read

func (c SlackRTMConnection) Read() ([]byte, error)

type SlackRetryAble

type SlackRetryAble struct {
	N int
	// contains filtered or unexported fields
}

func (*SlackRetryAble) GetRequest

func (r *SlackRetryAble) GetRequest(url string) (*http.Response, error)

func (*SlackRetryAble) PostReqest

func (r *SlackRetryAble) PostReqest(url string, params url.Values) (*http.Response, error)

type SlackTimelineWorker

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

func NewSlackTimelineWorker

func NewSlackTimelineWorker(rtmClient RTMClient) SlackTimelineWorker

func (SlackTimelineWorker) Polling

func (w SlackTimelineWorker) Polling(
	messageChan, deletedMessageChan chan *timeline.Message,
	errorChan chan error,
	endChan chan bool,
	userCacheClearChan chan interface{},
)

type User

type User struct {
	ID      string  `json:"id"`
	Name    string  `json:"name"`
	Profile profile `json:"profile"`
}

func (User) ToInternal

func (u User) ToInternal() timeline.User

type UserRepositoryOnSlack

type UserRepositoryOnSlack struct {
	SlackClient SlackClient
	// contains filtered or unexported fields
}

func NewUserRepository

func NewUserRepository(s SlackClient) UserRepositoryOnSlack

func (UserRepositoryOnSlack) Clear

func (r UserRepositoryOnSlack) Clear() error

func (UserRepositoryOnSlack) Get

func (r UserRepositoryOnSlack) Get(userID string) (*timeline.User, error)

func (UserRepositoryOnSlack) GetAll

func (r UserRepositoryOnSlack) GetAll() ([]timeline.User, error)

Jump to

Keyboard shortcuts

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