matterclient

package
v1.26.0 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2023 License: Apache-2.0 Imports: 17 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Credentials

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

type MMClient

type MMClient struct {
	sync.RWMutex
	*Credentials

	Team          *Team
	OtherTeams    []*Team
	Client        *model.Client4
	User          *model.User
	Users         map[string]*model.User
	MessageChan   chan *Message
	WsClient      *websocket.Conn
	WsQuit        bool
	WsAway        bool
	WsConnected   bool
	WsSequence    int64
	WsPingChan    chan *model.WebSocketResponse
	ServerVersion string
	OnWsConnect   func()
	// contains filtered or unexported fields
}

func New

func New(login string, pass string, team string, server string) *MMClient

New will instantiate a new Matterclient with the specified login details without connecting.

func (*MMClient) DeleteMessage added in v1.2.0

func (m *MMClient) DeleteMessage(postId string) error

func (*MMClient) EditMessage added in v1.1.0

func (m *MMClient) EditMessage(postId string, text string) (string, error)

func (*MMClient) EnableAllEvents added in v1.18.1

func (m *MMClient) EnableAllEvents()

func (*MMClient) GetChannelHeader

func (m *MMClient) GetChannelHeader(channelId string) string

func (*MMClient) GetChannelId

func (m *MMClient) GetChannelId(name string, teamId string) string

func (*MMClient) GetChannelName

func (m *MMClient) GetChannelName(channelId string) string

func (*MMClient) GetChannelTeamId added in v0.14.0

func (m *MMClient) GetChannelTeamId(id string) string

func (*MMClient) GetChannels

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

GetChannels returns all channels we're members off

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

func (*MMClient) GetLastViewedAt

func (m *MMClient) GetLastViewedAt(channelId string) int64

func (*MMClient) GetMoreChannels

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

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

func (*MMClient) GetNickName added in v1.11.1

func (m *MMClient) GetNickName(userId string) string

func (*MMClient) GetPosts

func (m *MMClient) GetPosts(channelId string, limit int) *model.PostList

func (*MMClient) GetPostsSince

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

func (*MMClient) GetStatus added in v0.6.1

func (m *MMClient) GetStatus(userId string) string

func (*MMClient) GetStatuses added in v0.9.1

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

func (*MMClient) GetTeamFromChannel

func (m *MMClient) GetTeamFromChannel(channelId string) string

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

func (*MMClient) GetTeamId added in v0.7.0

func (m *MMClient) GetTeamId() string

func (*MMClient) GetTeamName

func (m *MMClient) GetTeamName(teamId string) string

GetTeamName returns the name of the specified teamId

func (*MMClient) GetUser

func (m *MMClient) GetUser(userId string) *model.User

func (*MMClient) GetUserName added in v0.14.0

func (m *MMClient) GetUserName(userId string) string

func (*MMClient) GetUsers

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

func (*MMClient) JoinChannel

func (m *MMClient) JoinChannel(channelId string) error

func (*MMClient) Login

func (m *MMClient) Login() error

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

func (*MMClient) Logout

func (m *MMClient) Logout() error

Logout disconnects the client from the chat server.

func (*MMClient) PostMessage

func (m *MMClient) PostMessage(channelId string, text string, rootId string) (string, error)

func (*MMClient) PostMessageWithFiles added in v1.3.0

func (m *MMClient) PostMessageWithFiles(channelId string, text string, rootId string, fileIds []string) (string, error)

func (*MMClient) SearchPosts

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

func (*MMClient) SendDirectMessage

func (m *MMClient) SendDirectMessage(toUserId string, msg string, rootId string)

SendDirectMessage sends a direct message to specified user

func (*MMClient) SendDirectMessageProps added in v1.12.0

func (m *MMClient) SendDirectMessageProps(toUserId string, msg string, rootId string, props map[string]interface{})

func (*MMClient) SetDebugLog added in v1.8.0

func (m *MMClient) SetDebugLog()

SetDebugLog activates debugging logging on all Matterclient log output.

func (*MMClient) SetLogLevel

func (m *MMClient) 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 (*MMClient) StatusLoop added in v0.6.1

func (m *MMClient) StatusLoop()

StatusLoop implements a ping-cycle that ensures that the connection to the chat servers remains alive. 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'.

func (*MMClient) UpdateChannelHeader

func (m *MMClient) UpdateChannelHeader(channelId string, header string)

func (*MMClient) UpdateChannels

func (m *MMClient) UpdateChannels() error

func (*MMClient) UpdateChannelsTeam added in v1.15.0

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

func (*MMClient) UpdateLastViewed

func (m *MMClient) UpdateLastViewed(channelId string) error

func (*MMClient) UpdateStatus added in v1.9.1

func (m *MMClient) UpdateStatus(userId string, status string) error

func (*MMClient) UpdateUser added in v1.11.1

func (m *MMClient) UpdateUser(userId string)

func (*MMClient) UpdateUserNick added in v1.2.0

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

func (*MMClient) UpdateUsers

func (m *MMClient) UpdateUsers() error

func (*MMClient) UploadFile added in v1.3.0

func (m *MMClient) UploadFile(data []byte, channelId string, filename string) (string, error)

func (*MMClient) UsernamesInChannel

func (m *MMClient) UsernamesInChannel(channelId string) []string

func (*MMClient) WsReceiver

func (m *MMClient) WsReceiver()

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 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