rocketchat

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Channel

type Channel struct {
	ID   string `json:"_id"`
	Name string `json:"name"`
}

Channel represents a channel in Rocket.Chat.

type Client

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

func NewClient

func NewClient(url, userID, authToken string) *Client

NewClient returns a new Rocket.Chat client.

func (*Client) ListChannels

func (c *Client) ListChannels(ctx context.Context) ([]Channel, error)

ListChannels returns a list of channels.

func (*Client) ListUsers

func (c *Client) ListUsers(ctx context.Context) ([]User, error)

ListUsers returns a list of users.

func (*Client) SendMessage

func (c *Client) SendMessage(ctx context.Context, msg *Message) error

SendMessage sends a message to a channel or user.

func (*Client) TestConnection

func (c *Client) TestConnection(ctx context.Context) error

TestConnection calls the endpoint /api/v1/me. It is intended to verify if the connection to the Rocket.Chat server works.

type Message

type Message struct {
	Text string `json:"text"`

	// Channel can either be a channel prefixed with a # or a username prefixed with an @.
	Channel string `json:"channel"`

	// Name under which the message appears.
	Alias string `json:"alias,omitempty"`
	Emoji string `json:"emoji,omitempty"`
}

Message defines a chat message.

type User

type User struct {
	ID       string `json:"_id"`
	Name     string `json:"name"`
	Username string `json:"username"`
}

User represents a user in Rocket.Chat.

Jump to

Keyboard shortcuts

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