Documentation
¶
Index ¶
- type AdaptiveCard
- type Attachment
- type Client
- func (c *Client) Create(message *Message) (*Message, error)
- func (c *Client) CreateWithAdaptiveCard(message *Message, card AdaptiveCard, fallbackText string) (*Message, error)
- func (c *Client) CreateWithAttachment(message *Message, file *FileUpload) (*Message, error)
- func (c *Client) CreateWithBase64File(message *Message, fileName string, base64Data string) (*Message, error)
- func (c *Client) Delete(messageID string) error
- func (c *Client) Get(messageID string) (*Message, error)
- func (c *Client) List(options *ListOptions) (*MessagesPage, error)
- func (c *Client) Listen(handler MessageHandler) error
- func (c *Client) StopListening() error
- func (c *Client) Update(messageID string, message *Message) (*Message, error)
- type Config
- type FileUpload
- type ListOptions
- type Message
- type MessageHandler
- type MessagesPage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AdaptiveCard ¶
type AdaptiveCard struct {
ContentType string `json:"contentType"`
Content interface{} `json:"content"`
}
AdaptiveCard represents an Adaptive Card attachment. See https://developer.webex.com/docs/buttons-and-cards for the card schema.
func NewAdaptiveCard ¶
func NewAdaptiveCard(cardBody interface{}) AdaptiveCard
NewAdaptiveCard creates an AdaptiveCard attachment from a card body. The cardBody should be a map or struct matching the Adaptive Card schema (with "type": "AdaptiveCard", "version": "1.3", "body": [...], etc.).
type Attachment ¶
type Attachment struct {
ContentType string `json:"contentType,omitempty"`
Content interface{} `json:"content,omitempty"`
}
Attachment represents a message attachment, such as an adaptive card
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the messages API client
func (*Client) CreateWithAdaptiveCard ¶
func (c *Client) CreateWithAdaptiveCard(message *Message, card AdaptiveCard, fallbackText string) (*Message, error)
CreateWithAdaptiveCard sends a message with an Adaptive Card attachment. The fallbackText is displayed on clients that don't support adaptive cards. The card parameter should be created via NewAdaptiveCard().
func (*Client) CreateWithAttachment ¶
func (c *Client) CreateWithAttachment(message *Message, file *FileUpload) (*Message, error)
CreateWithAttachment sends a message with file attachments using multipart/form-data. This supports uploading local files directly to Webex (up to 100MB per file).
func (*Client) CreateWithBase64File ¶
func (c *Client) CreateWithBase64File(message *Message, fileName string, base64Data string) (*Message, error)
CreateWithBase64File sends a message with a base64-encoded file attachment. This is a convenience wrapper around CreateWithAttachment for base64 data.
func (*Client) List ¶
func (c *Client) List(options *ListOptions) (*MessagesPage, error)
List returns a list of messages in a room
func (*Client) Listen ¶
func (c *Client) Listen(handler MessageHandler) error
Listen starts a real-time stream of message events The provided handler will be called for each new message event
func (*Client) StopListening ¶
StopListening stops the real-time stream of message events
type Config ¶
type Config struct {
// Any configuration settings for the messages plugin can go here
MercuryConfig *mercury.Config
}
Config holds the configuration for the Messages plugin
func DefaultConfig ¶
func DefaultConfig() *Config
DefaultConfig returns the default configuration for the Messages plugin
type FileUpload ¶
type FileUpload struct {
// FileName is the name of the file (e.g., "report.pdf").
// Required when using Base64Data.
FileName string
// Base64Data is the base64-encoded file content.
// When set, the data is decoded and uploaded as a binary file.
Base64Data string
// FileBytes is the raw file content.
// Use this when you already have the file in memory as bytes.
FileBytes []byte
}
FileUpload represents a file to attach to a message. Provide either FilePath (local file) OR Base64Data + FileName.
type ListOptions ¶
type ListOptions struct {
RoomID string `url:"roomId,omitempty"`
MentionedPeople string `url:"mentionedPeople,omitempty"`
Before string `url:"before,omitempty"`
BeforeMessage string `url:"beforeMessage,omitempty"`
After string `url:"after,omitempty"`
AfterMessage string `url:"afterMessage,omitempty"`
Max int `url:"max,omitempty"`
ThreadID string `url:"threadId,omitempty"`
PersonID string `url:"personId,omitempty"`
PersonEmail string `url:"personEmail,omitempty"`
HasFiles bool `url:"hasFiles,omitempty"`
}
ListOptions contains the options for listing messages
type Message ¶
type Message struct {
ID string `json:"id,omitempty"`
RoomID string `json:"roomId,omitempty"`
RoomType string `json:"roomType,omitempty"`
ParentID string `json:"parentId,omitempty"`
ToPersonID string `json:"toPersonId,omitempty"`
ToPersonEmail string `json:"toPersonEmail,omitempty"`
Text string `json:"text,omitempty"`
Markdown string `json:"markdown,omitempty"`
HTML string `json:"html,omitempty"`
Files []string `json:"files,omitempty"`
PersonID string `json:"personId,omitempty"`
PersonEmail string `json:"personEmail,omitempty"`
Created *time.Time `json:"created,omitempty"`
Updated *time.Time `json:"updated,omitempty"`
MentionedPeople []string `json:"mentionedPeople,omitempty"`
MentionedGroups []string `json:"mentionedGroups,omitempty"`
Attachments []Attachment `json:"attachments,omitempty"`
IsVoiceClip bool `json:"isVoiceClip,omitempty"`
Errors webexsdk.ResourceErrors `json:"errors,omitempty"`
}
Message represents a Webex message
type MessageHandler ¶
type MessageHandler func(message *Message)
MessageHandler is a function that handles a message event
type MessagesPage ¶
MessagesPage represents a paginated list of messages