Documentation
¶
Index ¶
- type Agent
- type AgentKey
- type GroupMember
- type Message
- type SQLiteStore
- func (s *SQLiteStore) AddGroupMember(groupID, memberID int64) error
- func (s *SQLiteStore) AddKey(agentID int64, fingerprint, publicKey string) error
- func (s *SQLiteStore) AgentByEmail(email string) (*Agent, error)
- func (s *SQLiteStore) AgentByFingerprint(fingerprint string) (*Agent, error)
- func (s *SQLiteStore) AgentByID(id int64) (*Agent, error)
- func (s *SQLiteStore) AgentByName(name string) (*Agent, error)
- func (s *SQLiteStore) Close() error
- func (s *SQLiteStore) CreateAgent(name, fingerprint, publicKey string, invitedBy int64) (*Agent, error)
- func (s *SQLiteStore) CreateChannel(name, bio string) (*Agent, error)
- func (s *SQLiteStore) CreateGroup(name, bio string, adminID int64) (*Agent, error)
- func (s *SQLiteStore) CreateInvite(createdBy int64) (string, error)
- func (s *SQLiteStore) GetMessage(id int64) (*Message, error)
- func (s *SQLiteStore) GroupMembers(groupID int64) ([]GroupMember, error)
- func (s *SQLiteStore) GroupRole(groupID, agentID int64) (string, error)
- func (s *SQLiteStore) Inbox(agentID int64, all bool, after *time.Time) ([]Message, error)
- func (s *SQLiteStore) IsGroupMember(groupID, agentID int64) (bool, error)
- func (s *SQLiteStore) ListAgents() ([]Agent, error)
- func (s *SQLiteStore) ListKeys(agentID int64) ([]AgentKey, error)
- func (s *SQLiteStore) MarkRead(id int64) error
- func (s *SQLiteStore) RedeemInvite(code, name, fingerprint, publicKey string) (*Agent, error)
- func (s *SQLiteStore) RemoveGroupMember(groupID, memberID int64) error
- func (s *SQLiteStore) RemoveKey(agentID int64, fingerprint string) error
- func (s *SQLiteStore) SendMessage(fromID, toID int64, body string, fileName, filePath *string) (int64, error)
- func (s *SQLiteStore) UnreadCount(agentID int64) (int, error)
- func (s *SQLiteStore) UnreadCounts(agentID int64) (map[string]int, error)
- func (s *SQLiteStore) UpdateBio(id int64, bio string) error
- func (s *SQLiteStore) UpdateEmail(id int64, email *string) error
- type Store
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Agent ¶
type Agent struct {
ID int64 `json:"id"`
Name string `json:"name"`
Fingerprint string `json:"fingerprint,omitempty"`
PublicKey string `json:"-"`
Bio string `json:"bio,omitempty"`
Email *string `json:"email,omitempty"`
Public bool `json:"public,omitempty"`
JoinedAt time.Time `json:"joined_at"`
InvitedBy int64 `json:"invited_by,omitempty"`
}
type GroupMember ¶
type Message ¶
type Message struct {
ID int64 `json:"id"`
FromID int64 `json:"-"`
FromName string `json:"from"`
ToID int64 `json:"-"`
ToName string `json:"to"`
Body string `json:"message"`
FileName *string `json:"file,omitempty"`
FilePath *string `json:"-"`
CreatedAt time.Time `json:"at"`
ReadAt *time.Time `json:"read_at,omitempty"`
}
type SQLiteStore ¶
type SQLiteStore struct {
// contains filtered or unexported fields
}
func NewSQLite ¶
func NewSQLite(dataDir string) (*SQLiteStore, error)
func (*SQLiteStore) AddGroupMember ¶
func (s *SQLiteStore) AddGroupMember(groupID, memberID int64) error
func (*SQLiteStore) AddKey ¶
func (s *SQLiteStore) AddKey(agentID int64, fingerprint, publicKey string) error
func (*SQLiteStore) AgentByEmail ¶
func (s *SQLiteStore) AgentByEmail(email string) (*Agent, error)
func (*SQLiteStore) AgentByFingerprint ¶
func (s *SQLiteStore) AgentByFingerprint(fingerprint string) (*Agent, error)
func (*SQLiteStore) AgentByName ¶
func (s *SQLiteStore) AgentByName(name string) (*Agent, error)
func (*SQLiteStore) Close ¶
func (s *SQLiteStore) Close() error
func (*SQLiteStore) CreateAgent ¶
func (s *SQLiteStore) CreateAgent(name, fingerprint, publicKey string, invitedBy int64) (*Agent, error)
func (*SQLiteStore) CreateChannel ¶
func (s *SQLiteStore) CreateChannel(name, bio string) (*Agent, error)
func (*SQLiteStore) CreateGroup ¶
func (s *SQLiteStore) CreateGroup(name, bio string, adminID int64) (*Agent, error)
func (*SQLiteStore) CreateInvite ¶
func (s *SQLiteStore) CreateInvite(createdBy int64) (string, error)
func (*SQLiteStore) GetMessage ¶
func (s *SQLiteStore) GetMessage(id int64) (*Message, error)
func (*SQLiteStore) GroupMembers ¶
func (s *SQLiteStore) GroupMembers(groupID int64) ([]GroupMember, error)
func (*SQLiteStore) GroupRole ¶
func (s *SQLiteStore) GroupRole(groupID, agentID int64) (string, error)
func (*SQLiteStore) IsGroupMember ¶
func (s *SQLiteStore) IsGroupMember(groupID, agentID int64) (bool, error)
func (*SQLiteStore) ListAgents ¶
func (s *SQLiteStore) ListAgents() ([]Agent, error)
func (*SQLiteStore) MarkRead ¶
func (s *SQLiteStore) MarkRead(id int64) error
func (*SQLiteStore) RedeemInvite ¶
func (s *SQLiteStore) RedeemInvite(code, name, fingerprint, publicKey string) (*Agent, error)
func (*SQLiteStore) RemoveGroupMember ¶
func (s *SQLiteStore) RemoveGroupMember(groupID, memberID int64) error
func (*SQLiteStore) RemoveKey ¶
func (s *SQLiteStore) RemoveKey(agentID int64, fingerprint string) error
func (*SQLiteStore) SendMessage ¶
func (*SQLiteStore) UnreadCount ¶
func (s *SQLiteStore) UnreadCount(agentID int64) (int, error)
func (*SQLiteStore) UnreadCounts ¶
func (s *SQLiteStore) UnreadCounts(agentID int64) (map[string]int, error)
func (*SQLiteStore) UpdateEmail ¶
func (s *SQLiteStore) UpdateEmail(id int64, email *string) error
type Store ¶
type Store interface {
// Agents
AgentByFingerprint(fingerprint string) (*Agent, error)
AgentByID(id int64) (*Agent, error)
AgentByName(name string) (*Agent, error)
CreateAgent(name, fingerprint, publicKey string, invitedBy int64) (*Agent, error)
CreateChannel(name, bio string) (*Agent, error)
UpdateBio(id int64, bio string) error
UpdateEmail(id int64, email *string) error
AgentByEmail(email string) (*Agent, error)
ListAgents() ([]Agent, error)
// Messages
SendMessage(fromID, toID int64, body string, fileName, filePath *string) (int64, error)
Inbox(agentID int64, all bool, after *time.Time) ([]Message, error)
GetMessage(id int64) (*Message, error)
MarkRead(id int64) error
UnreadCount(agentID int64) (int, error)
UnreadCounts(agentID int64) (map[string]int, error)
// Keys
AddKey(agentID int64, fingerprint, publicKey string) error
RemoveKey(agentID int64, fingerprint string) error
ListKeys(agentID int64) ([]AgentKey, error)
// Groups
CreateGroup(name, bio string, adminID int64) (*Agent, error)
AddGroupMember(groupID, memberID int64) error
RemoveGroupMember(groupID, memberID int64) error
GroupMembers(groupID int64) ([]GroupMember, error)
GroupRole(groupID, agentID int64) (string, error)
IsGroupMember(groupID, agentID int64) (bool, error)
// Invites
CreateInvite(createdBy int64) (string, error)
RedeemInvite(code, name, fingerprint, publicKey string) (*Agent, error)
Close() error
}
Click to show internal directories.
Click to hide internal directories.