matterclient

package
v0.26.1 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2022 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	sync.RWMutex
	*Credentials

	Team          *Team
	OtherTeams    []*Team
	Client        *model.Client4
	User          *model.User
	Users         map[string]*model.User
	MessageChan   chan *Message
	WsClient      *model.WebSocketClient
	AntiIdle      bool
	AntiIdleChan  string
	AntiIdleIntvl int
	WsQuit        bool
	WsConnected   bool
	OnWsConnect   func()

	Timeout int
	// contains filtered or unexported fields
}

func New

func New(login string, pass string, team string, server string, mfatoken string) *Client

func (*Client) DeleteMessage

func (m *Client) DeleteMessage(postID string) error

func (*Client) EditMessage

func (m *Client) EditMessage(postID string, text string) (string, error)

func (*Client) GetChannelHeader

func (m *Client) GetChannelHeader(channelID string) string

func (*Client) GetChannelID

func (m *Client) GetChannelID(name string, teamID string) string

func (*Client) GetChannelName

func (m *Client) GetChannelName(channelID string) string

func (*Client) GetChannelTeamID

func (m *Client) GetChannelTeamID(id string) string

func (*Client) GetChannels

func (m *Client) GetChannels() []*model.Channel

GetChannels returns all channels we're members off

func (m *Client) GetFileLinks(filenames []string) []string

func (*Client) GetLastViewedAt

func (m *Client) GetLastViewedAt(channelID string) int64

func (*Client) GetMoreChannels

func (m *Client) GetMoreChannels() []*model.Channel

GetMoreChannels returns existing channels where we're not a member off.

func (*Client) GetNickName

func (m *Client) GetNickName(userID string) string

func (*Client) GetPosts

func (m *Client) GetPosts(channelID string, limit int) *model.PostList

func (*Client) GetPostsSince

func (m *Client) GetPostsSince(channelID string, time int64) *model.PostList
func (m *Client) GetPublicLink(filename string) string
func (m *Client) GetPublicLinks(filenames []string) []string

func (*Client) GetStatus

func (m *Client) GetStatus(userID string) string

func (*Client) GetStatuses

func (m *Client) GetStatuses() map[string]string

func (*Client) GetTeamFromChannel

func (m *Client) GetTeamFromChannel(channelID string) string

GetTeamFromChannel returns teamId belonging to channel (DM channels have no teamId).

func (*Client) GetTeamID

func (m *Client) GetTeamID() string

func (*Client) GetTeamName

func (m *Client) GetTeamName(teamID string) string

GetTeamName returns the name of the specified teamId

func (*Client) GetUser

func (m *Client) GetUser(userID string) *model.User

func (*Client) GetUserName

func (m *Client) GetUserName(userID string) string

func (*Client) GetUsers

func (m *Client) GetUsers() map[string]*model.User

func (*Client) HandleRatelimit

func (m *Client) HandleRatelimit(name string, resp *model.Response) error

func (*Client) JoinChannel

func (m *Client) JoinChannel(channelID string) error

func (*Client) Login

func (m *Client) Login() error

Login tries to connect the client with the loging details with which it was initialized.

func (*Client) Logout

func (m *Client) Logout() error

Logout disconnects the client from the chat server.

func (*Client) PostMessage

func (m *Client) PostMessage(channelID string, text string, rootID string) (string, error)

func (*Client) PostMessageWithFiles

func (m *Client) PostMessageWithFiles(channelID string, text string, rootID string, fileIds []string) (string, error)

func (*Client) Reconnect

func (m *Client) Reconnect()

func (*Client) SearchPosts

func (m *Client) SearchPosts(query string) *model.PostList

func (*Client) SendDirectMessage

func (m *Client) SendDirectMessage(toUserID string, msg string, rootID string) error

SendDirectMessage sends a direct message to specified user

func (*Client) SendDirectMessageProps

func (m *Client) SendDirectMessageProps(toUserID string, msg string, rootID string, props map[string]interface{}) error

func (*Client) SetLogLevel

func (m *Client) SetLogLevel(level string)

SetLogLevel tries to parse the specified level and if successful sets the log level accordingly. Accepted levels are: 'debug', 'info', 'warn', 'error', 'fatal' and 'panic'.

func (*Client) UpdateChannelHeader

func (m *Client) UpdateChannelHeader(channelID string, header string)

func (*Client) UpdateChannels

func (m *Client) UpdateChannels() error

func (*Client) UpdateChannelsTeam

func (m *Client) UpdateChannelsTeam(teamID string) error

func (*Client) UpdateLastViewed

func (m *Client) UpdateLastViewed(channelID string) error

func (*Client) UpdateStatus

func (m *Client) UpdateStatus(userID string, status string) error

func (*Client) UpdateUser

func (m *Client) UpdateUser(userID string)

func (*Client) UpdateUserNick

func (m *Client) UpdateUserNick(nick string) error

func (*Client) UpdateUsers

func (m *Client) UpdateUsers() error

func (*Client) UploadFile

func (m *Client) UploadFile(data []byte, channelID string, filename string) (string, error)

func (*Client) UsernamesInChannel

func (m *Client) UsernamesInChannel(channelID string) []string

func (*Client) WsReceiver

func (m *Client) WsReceiver(ctx context.Context)

WsReceiver implements the core loop that manages the connection to the chat server. In case of a disconnect it will try to reconnect. A call to this method is blocking until the 'WsQuite' field of the MMClient object is set to 'true'.

type Credentials

type Credentials struct {
	Login            string
	Team             string
	Pass             string
	Token            string
	CookieToken      bool
	Server           string
	NoTLS            bool
	SkipTLSVerify    bool
	SkipVersionCheck bool
	MFAToken         string
}

type Message

type Message struct {
	Raw      *model.WebSocketEvent
	Post     *model.Post
	Team     string
	Channel  string
	Username string
	Text     string
	Type     string
	UserID   string
}

type Team

type Team struct {
	Team         *model.Team
	ID           string
	Channels     []*model.Channel
	MoreChannels []*model.Channel
	Users        map[string]*model.User
}

Jump to

Keyboard shortcuts

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