room

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 28, 2021 License: Apache-2.0 Imports: 10 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrEmptyToken is returned when the room token is empty
	ErrEmptyToken = errors.New("given an empty token")
	// ErrRoomNotFound is returned when a room with the given token could not be found
	ErrRoomNotFound = errors.New("room could not be found")
	// ErrUnauthorized is returned when the room could not be accessed due to being unauthorized
	ErrUnauthorized = errors.New("unauthorized error when accessing room")
	// ErrNotModeratorInLobby is returned when the room is in lobby mode but the user is not a moderator
	ErrNotModeratorInLobby = errors.New("room is in lobby mode but user is not a moderator")
	// ErrUnexpectedReturnCode is returned when the server did not respond with an expected return code
	ErrUnexpectedReturnCode = errors.New("unexpected return code")
	// ErrTooManyRequests is returned if the server returns a 429
	ErrTooManyRequests = errors.New("too many requests")
	// ErrLackingCapabilities is returned if the server lacks the required capability for the given function
	ErrLackingCapabilities = errors.New("lacking required capabilities")
	// ErrForbidden is returned if the user is forbidden from accessing the requested resource
	ErrForbidden = errors.New("request forbidden")
	// ErrUnexpectedResponse is returned if the response from the Nextcloud Talk server is not formatted as expected
	ErrUnexpectedResponse = errors.New("unexpected response")
)

Functions

This section is empty.

Types

type Message added in v0.3.0

type Message struct {
	Message          string
	ActorDisplayName string
	ReplyTo          int
}

Message represents a message to be sent

type TalkRoom

type TalkRoom struct {
	User  *user.TalkUser
	Token string
}

TalkRoom represents a room in Nextcloud Talk

func NewTalkRoom added in v0.1.0

func NewTalkRoom(tuser *user.TalkUser, token string) (*TalkRoom, error)

NewTalkRoom returns a new TalkRoom instance Token should be the Nextcloud Room Token (e.g. "d6zoa2zs" if the room URL is https://cloud.mydomain.me/call/d6zoa2zs)

func (*TalkRoom) DeleteMessage added in v0.2.0

func (t *TalkRoom) DeleteMessage(messageID int) (*ocs.TalkRoomMessageData, error)

DeleteMessage deletes the message with the given messageID on the server.

Requires "delete-messages" capability on the Nextcloud Talk server

func (*TalkRoom) ReceiveMessages

func (t *TalkRoom) ReceiveMessages(ctx context.Context) (chan ocs.TalkRoomMessageData, error)

ReceiveMessages starts watching for new messages

func (*TalkRoom) SendComplexMessage added in v0.3.0

func (t *TalkRoom) SendComplexMessage(msg *Message) (*ocs.TalkRoomMessageData, error)

SendComplexMessage sends a Message type message in the talk room

func (*TalkRoom) SendMessage

func (t *TalkRoom) SendMessage(msg string) (*ocs.TalkRoomMessageData, error)

SendMessage sends a string message in the Talk room

func (*TalkRoom) TestConnection

func (t *TalkRoom) TestConnection() error

TestConnection tests the connection with the Nextcloud Talk instance and returns an error if it could not connect

Jump to

Keyboard shortcuts

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