Documentation
¶
Index ¶
- type Activities
- type Activity
- type ActivityHandler
- type Actor
- type Client
- func (c *Client) Connect() error
- func (c *Client) Disconnect() error
- func (c *Client) EncryptionClient() *encryption.Client
- func (c *Client) GetMessageContent(activity *Activity) (string, error)
- func (c *Client) InitializeFromMercuryEvent(event *mercury.Event) (*Activity, error)
- func (c *Client) Off(verb string, handler ActivityHandler)
- func (c *Client) On(verb string, handler ActivityHandler)
- func (c *Client) ProcessActivityEvent(event *mercury.Event) (*Activity, error)
- func (c *Client) SetEncryptionDeviceInfo(deviceURL, userID string)
- func (c *Client) SetMercuryClient(mercuryClient *mercury.Client)
- type Config
- type MessageType
- type Object
- type Participants
- type Target
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Activities ¶
type Activities struct {
Items []interface{} `json:"items,omitempty"`
}
Activities represents the activities in a conversation
type Activity ¶
type Activity struct {
ID string `json:"id,omitempty"`
ObjectType string `json:"objectType,omitempty"`
URL string `json:"url,omitempty"`
Published string `json:"published,omitempty"`
Verb string `json:"verb,omitempty"`
Actor *Actor `json:"actor,omitempty"`
Object map[string]interface{} `json:"object,omitempty"`
Target *Target `json:"target,omitempty"`
ClientTempID string `json:"clientTempId,omitempty"`
// Additional fields that might be in the data
EncryptionKeyURL string `json:"encryptionKeyUrl,omitempty"`
// Parsed content after decryption (if applicable)
Content string `json:"-"`
DecryptedObject *Object `json:"-"`
MessageType MessageType `json:"-"`
// Raw data for debugging
RawData map[string]interface{} `json:"-"`
}
Activity represents a conversation activity
type ActivityHandler ¶
type ActivityHandler func(activity *Activity)
ActivityHandler is a function that handles conversation activities
type Actor ¶
type Actor struct {
ID string `json:"id,omitempty"`
ObjectType string `json:"objectType,omitempty"`
DisplayName string `json:"displayName,omitempty"`
OrgID string `json:"orgId,omitempty"`
EmailAddress string `json:"emailAddress,omitempty"`
EntryUUID string `json:"entryUUID,omitempty"`
Type string `json:"type,omitempty"`
}
Actor represents the person who performed the activity
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the Conversation API client
func (*Client) Connect ¶
Connect starts the Mercury WebSocket connection. This is a convenience method that delegates to the underlying Mercury client. Handlers should be registered with On() before calling Connect().
func (*Client) Disconnect ¶
Disconnect stops the Mercury WebSocket connection. This is a convenience method that delegates to the underlying Mercury client.
func (*Client) EncryptionClient ¶
func (c *Client) EncryptionClient() *encryption.Client
EncryptionClient returns the encryption client for direct access.
func (*Client) GetMessageContent ¶
GetMessageContent attempts to extract the message content from an activity. If the message is encrypted, it will be decrypted using the KMS encryption key.
func (*Client) InitializeFromMercuryEvent ¶
InitializeFromMercuryEvent initializes an activity from a Mercury event
func (*Client) Off ¶
func (c *Client) Off(verb string, handler ActivityHandler)
Off removes a handler for a specific activity verb
func (*Client) On ¶
func (c *Client) On(verb string, handler ActivityHandler)
On registers a handler for a specific activity verb
func (*Client) ProcessActivityEvent ¶
ProcessActivityEvent processes a conversation activity event from Mercury. This method parses the activity but does NOT decrypt message content inline. Decryption happens in the dispatched goroutine (see dispatchActivity) so the Mercury event handler returns immediately and doesn't block on KMS.
func (*Client) SetEncryptionDeviceInfo ¶
SetEncryptionDeviceInfo passes device information to the encryption client so it can authenticate with the KMS service. Call this after device registration.
func (*Client) SetMercuryClient ¶
SetMercuryClient sets the Mercury client to use for WebSocket events
type Config ¶
type Config struct {
}
Config holds the configuration for the Conversation plugin
func DefaultConfig ¶
func DefaultConfig() *Config
DefaultConfig returns the default configuration for the Conversation plugin
type MessageType ¶
type MessageType string
MessageType represents the type of message
const ( // MessageTypePost represents a post message MessageTypePost MessageType = "post" MessageTypeShare MessageType = "share" // MessageTypeAcknowledge represents an acknowledge message MessageTypeAcknowledge MessageType = "acknowledge" // WildcardHandler is used for handling all activity types WildcardHandler = "*" )
type Object ¶
type Object struct {
ObjectType string `json:"objectType,omitempty"`
DisplayName string `json:"displayName,omitempty"`
Content string `json:"content,omitempty"`
ContentType string `json:"contentType,omitempty"`
// For reference to another activity (used in acknowledge)
ID string `json:"id,omitempty"`
URL string `json:"url,omitempty"`
Published string `json:"published,omitempty"`
}
Object represents the content of a message
type Participants ¶
type Participants struct {
Items []interface{} `json:"items,omitempty"`
}
Participants represents the participants in a conversation
type Target ¶
type Target struct {
ID string `json:"id,omitempty"`
ObjectType string `json:"objectType,omitempty"`
URL string `json:"url,omitempty"`
Published string `json:"published,omitempty"`
Participants *Participants `json:"participants,omitempty"`
Activities *Activities `json:"activities,omitempty"`
Tags []string `json:"tags,omitempty"`
GlobalID string `json:"globalId,omitempty"`
}
Target represents the conversation where the activity occurred