realtime

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package realtime provides access to Rocket.Chat's realtime API via ddp

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(serverURL *url.URL, debug bool) (*Client, error)

NewClient creates a new instance and connects to the websocket.

func (*Client) AddStatusListener

func (c *Client) AddStatusListener(listener func(int))

func (*Client) ArchiveChannel

func (c *Client) ArchiveChannel(roomID string) error

ArchiveChannel archives the channel Takes roomID

https://rocket.chat/docs/developer-guides/realtime-api/method-calls/archive-rooms

func (*Client) Close

func (c *Client) Close()

Close closes the ddp session.

func (*Client) ConnectionAway

func (c *Client) ConnectionAway() error

ConnectionAway sets connection status to away.

func (*Client) ConnectionOnline

func (c *Client) ConnectionOnline() error

ConnectionOnline sets connection status to online.

func (*Client) CreateChannel

func (c *Client) CreateChannel(name string, users []string) error

CreateChannel creates a channel Takes name and users array

https://rocket.chat/docs/developer-guides/realtime-api/method-calls/create-channels

func (*Client) CreateGroup

func (c *Client) CreateGroup(name string, users []string) error

CreateGroup creates a private group Takes group name and array of users

https://rocket.chat/docs/developer-guides/realtime-api/method-calls/create-private-groups

func (*Client) DeleteChannel

func (c *Client) DeleteChannel(roomID string) error

DeleteChannel deletes the channel Takes roomId

https://rocket.chat/docs/developer-guides/realtime-api/method-calls/delete-rooms

func (*Client) DeleteMessage

func (c *Client) DeleteMessage(message *models.Message) error

DeleteMessage deletes a message takes a message object

https://rocket.chat/docs/developer-guides/realtime-api/method-calls/delete-message

func (*Client) EditMessage

func (c *Client) EditMessage(message *models.Message) error

EditMessage edits a message takes message object

https://rocket.chat/docs/developer-guides/realtime-api/method-calls/update-message

func (*Client) GetChannelID

func (c *Client) GetChannelID(name string) (string, error)

func (*Client) GetChannelRoles

func (c *Client) GetChannelRoles(roomID string) error

GetChannelRoles returns room roles

https://rocket.chat/docs/developer-guides/realtime-api/method-calls/get-room-roles

func (*Client) GetChannelSubscriptions

func (c *Client) GetChannelSubscriptions() ([]models.ChannelSubscription, error)

GetChannelSubscriptions gets users channel subscriptions Optionally includes date to get all since last check or 0 to get all

https://rocket.chat/docs/developer-guides/realtime-api/method-calls/get-subscriptions

func (*Client) GetChannelsIn

func (c *Client) GetChannelsIn() ([]models.Channel, error)

GetChannelsIn returns list of channels Optionally includes date to get all since last check or 0 to get all

https://rocket.chat/docs/developer-guides/realtime-api/method-calls/get-rooms/

func (*Client) GetPermissions

func (c *Client) GetPermissions() ([]models.Permission, error)

GetPermissions gets permissions

https://rocket.chat/docs/developer-guides/realtime-api/method-calls/get-permissions

func (*Client) GetPublicSettings

func (c *Client) GetPublicSettings() ([]models.Setting, error)

GetPublicSettings gets public settings

https://rocket.chat/docs/developer-guides/realtime-api/method-calls/get-public-settings

func (*Client) GetUserRoles

func (c *Client) GetUserRoles() error

GetUserRoles gets current users roles

https://rocket.chat/docs/developer-guides/realtime-api/method-calls/get-user-roles

func (*Client) JoinChannel

func (c *Client) JoinChannel(roomID string) error

JoinChannel joins a channel Takes roomID

https://rocket.chat/docs/developer-guides/realtime-api/method-calls/joining-channels

func (*Client) LeaveChannel

func (c *Client) LeaveChannel(roomID string) error

LeaveChannel leaves a channel Takes roomID

https://rocket.chat/docs/developer-guides/realtime-api/method-calls/leaving-rooms

func (*Client) LoadHistory

func (c *Client) LoadHistory(roomID string) ([]models.Message, error)

LoadHistory loads history Takes roomID

https://rocket.chat/docs/developer-guides/realtime-api/method-calls/load-history

func (*Client) Login

func (c *Client) Login(credentials *models.UserCredentials) (*models.User, error)

Login a user. token shouldn't be nil, otherwise the password and the email are not allowed to be nil.

https://rocket.chat/docs/developer-guides/realtime-api/method-calls/login/

func (*Client) NewMessage

func (c *Client) NewMessage(channel *models.Channel, text string) *models.Message

NewMessage creates basic message with an ID, a RoomID, and a Msg Takes channel and text.

func (*Client) PinMessage

func (c *Client) PinMessage(message *models.Message) error

PinMessage pins a message takes a message object

https://rocket.chat/docs/developer-guides/realtime-api/method-calls/pin-message

func (*Client) ReactToMessage

func (c *Client) ReactToMessage(message *models.Message, reaction string) error

ReactToMessage adds a reaction to a message takes a message and emoji

https://rocket.chat/docs/developer-guides/realtime-api/method-calls/set-reaction

func (*Client) Reconnect

func (c *Client) Reconnect()

func (*Client) RegisterUser

func (c *Client) RegisterUser(credentials *models.UserCredentials) (*models.User, error)

RegisterUser a new user on the server. This function does not need a logged in user. The registered user gets logged in to set its username.

func (*Client) SendMessage

func (c *Client) SendMessage(message *models.Message) (*models.Message, error)

SendMessage sends message to channel takes message

https://rocket.chat/docs/developer-guides/realtime-api/method-calls/send-message

func (*Client) SetChannelDescription

func (c *Client) SetChannelDescription(roomID string, description string) error

SetChannelDescription sets channels description takes roomID and description

https://rocket.chat/docs/developer-guides/realtime-api/method-calls/save-room-settings

func (*Client) SetChannelJoinCode

func (c *Client) SetChannelJoinCode(roomID string, joinCode string) error

SetChannelJoinCode sets channel join code takes roomID and joinCode

https://rocket.chat/docs/developer-guides/realtime-api/method-calls/save-room-settings

func (*Client) SetChannelReadOnly

func (c *Client) SetChannelReadOnly(roomID string, readOnly bool) error

SetChannelReadOnly sets channel as read only takes roomID and boolean

https://rocket.chat/docs/developer-guides/realtime-api/method-calls/save-room-settings

func (*Client) SetChannelTopic

func (c *Client) SetChannelTopic(roomID string, topic string) error

SetChannelTopic sets channel topic takes roomID and topic

https://rocket.chat/docs/developer-guides/realtime-api/method-calls/save-room-settings

func (*Client) SetChannelType

func (c *Client) SetChannelType(roomID string, roomType string) error

SetChannelType sets the channel type takes roomID and roomType

https://rocket.chat/docs/developer-guides/realtime-api/method-calls/save-room-settings

func (*Client) SetPresence

func (c *Client) SetPresence(status string) error

SetPresence set user presence.

func (*Client) StarMessage

func (c *Client) StarMessage(message *models.Message) error

StarMessage stars message takes a message object

https://rocket.chat/docs/developer-guides/realtime-api/method-calls/star-message

func (*Client) StartTyping

func (c *Client) StartTyping(roomID string, username string) error

func (*Client) StopTyping

func (c *Client) StopTyping(roomID string, username string) error

func (*Client) Sub

func (c *Client) Sub(name string, args ...interface{}) (chan string, error)

Subscribes to stream-notify-logged Returns a buffered channel

https://rocket.chat/docs/developer-guides/realtime-api/subscriptions/stream-room-messages/

func (*Client) SubscribeToMessageStream

func (c *Client) SubscribeToMessageStream(channel *models.Channel, msgChannel chan models.Message) error

SubscribeToMessageStream Subscribes to the message updates of a channel Returns a buffered channel

https://rocket.chat/docs/developer-guides/realtime-api/subscriptions/stream-room-messages/

func (*Client) UnArchiveChannel

func (c *Client) UnArchiveChannel(roomID string) error

UnArchiveChannel unarchives the channel Takes roomID

https://rocket.chat/docs/developer-guides/realtime-api/method-calls/unarchive-rooms

func (*Client) UnPinMessage

func (c *Client) UnPinMessage(message *models.Message) error

UnPinMessage unpins message takes a message object

https://rocket.chat/docs/developer-guides/realtime-api/method-calls/unpin-messages

func (*Client) UnStarMessage

func (c *Client) UnStarMessage(message *models.Message) error

UnStarMessage unstars message takes message object

https://rocket.chat/docs/developer-guides/realtime-api/method-calls/star-message

Jump to

Keyboard shortcuts

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