Documentation
¶
Overview ¶
Package api contains types and methods for interacting with Revolt's REST API.
Index ¶
- Constants
- type Client
- func (c *Client) EditMessage(channelID, msgID string, content string) error
- func (c *Client) QueryNode() (*QueryNodeResponse, error)
- func (c *Client) RequestJSON(out interface{}, method, url string, opts ...httputil.RequestOption) (err error)
- func (c *Client) SendMessage(channelID string, content string) (*revolt.Message, error)
- func (c *Client) SendMessageComplex(channelID string, data SendMessageData) (*revolt.Message, error)
- func (c *Client) User(id string) (*revolt.User, error)
- type MessageReply
- type QueryNodeFeatures
- type QueryNodeFeaturesCaptcha
- type QueryNodeFeaturesService
- type QueryNodeResponse
- type SendMessageData
Constants ¶
View Source
const ( ErrNotFound = errors.Sentinel("not found") ErrForbidden = errors.Sentinel("forbidden") )
HTTP error codes
View Source
const ( EndpointQueryNode = "/" EndpointChannels = "/channels/" EndpointMessages = "/messages/" EndpointUsers = "/users/" )
Endpoint constants
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
Client is an API client.
func (*Client) EditMessage ¶
EditMessage edits the given message's content.
func (*Client) QueryNode ¶
func (c *Client) QueryNode() (*QueryNodeResponse, error)
QueryNode returns information about the remote node.
func (*Client) RequestJSON ¶
func (c *Client) RequestJSON(out interface{}, method, url string, opts ...httputil.RequestOption) (err error)
RequestJSON ...
func (*Client) SendMessage ¶
SendMessage sends a text message.
func (*Client) SendMessageComplex ¶
func (c *Client) SendMessageComplex(channelID string, data SendMessageData) (*revolt.Message, error)
SendMessageComplex sends a message to the target channel. Returns a message object on success.
type MessageReply ¶
type MessageReply struct {
// The message ID to reply to.
ID string `json:"id"`
// Whether or not this reply will mention the replied-to user.
Mention bool `json:"mention"`
}
MessageReply ...
type QueryNodeFeatures ¶
type QueryNodeFeatures struct {
Registration bool `json:"registration"`
Captcha QueryNodeFeaturesCaptcha `json:"captcha"`
Email bool `json:"email"`
InviteOnly bool `json:"invite_only"`
Autumn QueryNodeFeaturesService `json:"autumn"`
January QueryNodeFeaturesService `json:"january"`
Voso QueryNodeFeaturesService `json:"voso"`
}
QueryNodeFeatures ...
type QueryNodeFeaturesCaptcha ¶
QueryNodeFeaturesCaptcha ...
type QueryNodeFeaturesService ¶
type QueryNodeFeaturesService struct {
Enabled bool `json:"enabled"`
URL string `json:"url"`
WS string `json:"ws,omitempty"`
}
QueryNodeFeaturesService ...
type QueryNodeResponse ¶
type QueryNodeResponse struct {
Version string `json:"revolt"`
Websocket string `json:"ws"`
App string `json:"app"`
Vapid string `json:"vapid"`
Features QueryNodeFeatures
}
QueryNodeResponse ...
type SendMessageData ¶
type SendMessageData struct {
Content string `json:"content"`
Attachments []string `json:"attachments,omitempty"`
Replies []MessageReply `json:"replies,omitempty"`
// If not set, will be set to a random UUID.
Nonce string `json:"nonce"`
}
SendMessageData is the data used in c.SendMessage
Click to show internal directories.
Click to hide internal directories.