Documentation ¶
Index ¶
- type Config
- type ConnectionConfig
- type Group
- type InviteOptions
- type Message
- type MessageObject
- type MessageOptions
- type Object
- type OnMessageOptions
- type Service
- func (s *Service) Delete(recipients []string, cids []string, gid string)
- func (s *Service) Delivered(recipients []string, cids []string, gid string)
- func (s *Service) Edit(recipients []string, cid string, body string, gid string)
- func (s *Service) GenerateConnectionDeepLink(config ConnectionConfig) (string, error)
- func (s *Service) GenerateConnectionQR(config ConnectionConfig) ([]byte, error)
- func (s *Service) Invite(gid string, name string, members []string, opts ...InviteOptions) error
- func (s *Service) Join(gid string, members []string)
- func (s *Service) Leave(gid string, members []string)
- func (s *Service) Message(recipients []string, body string, opts ...MessageOptions) (*Message, error)
- func (s *Service) OnConnection(callback func(iss, status string))
- func (s *Service) OnInvite(callback func(m *Group))
- func (s *Service) OnJoin(callback func(iss, gid string))
- func (s *Service) OnLeave(callback func(iss, gid string))
- func (s *Service) OnMessage(callback func(cm *Message), opts ...OnMessageOptions)
- func (s *Service) Read(recipients []string, cids []string, gid string)
- func (s *Service) SelfID() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { SelfID string DeviceID string KeyID string MessagingClient messagingClient MessagingService messagingService Rest restTransport PrivateKey ed25519.PrivateKey FileInteractor remoteFile Environment string }
Config stores all configuration needed by the chat service.
type ConnectionConfig ¶
type Group ¶
type Group struct { Payload map[string]interface{} GID string Members []string Name string Link string Key string Mime string // contains filtered or unexported fields }
func (*Group) Join ¶
func (m *Group) Join()
Join sends a notification the user has joined the group.
type InviteOptions ¶
type Message ¶
type Message struct { Body string Recipients []string JTI string GID string ISS string Payload map[string]interface{} Objects []*Object // contains filtered or unexported fields }
Message represents a chat message.
func NewMessage ¶
NewMessage creates a chat message object.
func (*Message) MarkAsDelivered ¶
func (m *Message) MarkAsDelivered()
MarkAsDelivered marks the current message as delivered.
func (*Message) MarkAsRead ¶
func (m *Message) MarkAsRead()
MarkAsRead marks the current message as read.
type MessageOptions ¶
type MessageOptions struct { GID string AUD string JTI string RID string Objects []MessageObject }
type Object ¶
type Object struct { Link string Name string Mime string Expires int64 Key string Nonce string Ciphertext string // contains filtered or unexported fields }
func (*Object) BuildFromData ¶
BuildFromData builds an object from data.
func (*Object) BuildFromObject ¶
BuildFromObject builds an object from a message object payload.
func (*Object) GetContent ¶
GetContent gets the current object content.
type OnMessageOptions ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service handles all chat interactions.
func NewService ¶
NewService creates a new client for interacting with facts.
func (*Service) Delivered ¶
Delivered sends a message to confirm a list of messages (identified by it's cids) have been delivered.
func (*Service) GenerateConnectionDeepLink ¶
func (s *Service) GenerateConnectionDeepLink(config ConnectionConfig) (string, error)
func (*Service) GenerateConnectionQR ¶
func (s *Service) GenerateConnectionQR(config ConnectionConfig) ([]byte, error)
func (*Service) Message ¶
func (s *Service) Message(recipients []string, body string, opts ...MessageOptions) (*Message, error)
Message sends a message to a list of recipients.
func (*Service) OnConnection ¶
OnConnection subscribes to people connecting to your app.
func (*Service) OnMessage ¶
func (s *Service) OnMessage(callback func(cm *Message), opts ...OnMessageOptions)
OnMessage subscribes to an incoming chat message.