realtime

package
v0.9.1-0...-f613ba5 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

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)

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

func (c *Client) CreateDirectMessage(username string) (string, error)

CreateDirectMessage gets the room ID for a direct message to a given UserName

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

func (c *Client) GetMessageStreamUpdateChannel() chan models.Message

GetMessageStreamUpdateChannel returns a channel over which messages from subscribed channels are delivered. Add channels with SubscribeRoomUpdates.

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

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

func (c *Client) SubscribeRoomUpdates(rid string) error

SubscribeRoomUpdates subscribes to the message updates for a given room ID. Messages are delivered to the channel returned by GetMessageStreamUpdateChannel.

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