Documentation ¶
Index ¶
- Constants
- type AppState
- type Device
- type Devices
- type EntityUpdate
- type GroupUpdate
- type Groups
- type IntroUpdate
- type Message
- type PagedMessages
- type Reaction
- type Reactions
- type Result
- type Roost
- func (r *Roost) AcceptInvite(inviteURL string, password string) ([]byte, error)
- func (r *Roost) AddPushToken(token string) error
- func (r *Roost) CreateGroup(name string) (*RoostGroup, error)
- func (r *Roost) DeletePushToken(token string) error
- func (r *Roost) Devices() (*Devices, error)
- func (r *Roost) GetDeviceLink() (string, error)
- func (r *Roost) GetMessages(password string) error
- func (r *Roost) Group(groupID []byte) (*RoostGroup, error)
- func (r *Roost) Groups() (*Groups, error)
- func (r *Roost) Initialize(password string) error
- func (r *Roost) LeaveDeviceGroup() error
- func (r *Roost) LinkDevice(l string) error
- func (r *Roost) NewPin() (string, error)
- func (r *Roost) NextPage(results *SearchResults) (*SearchResults, error)
- func (r *Roost) RegisterHeyaTransport(authToken, host string, port int) error
- func (r *Roost) Search(groupID []byte, term, highlightStart, highlightEnd string) (*SearchResults, error)
- func (r *Roost) SetDeviceNameType(name, ty string) error
- func (r *Roost) Shutdown() error
- func (r *Roost) Slick() *slick.Slick
- func (r *Roost) TransportStates() *TransportStates
- func (r *Roost) Unlock(password string) error
- func (r *Roost) UnreadMessageCount() (int64, error)
- func (r *Roost) Updates() *Updates
- type RoostGroup
- func (rg *RoostGroup) CancelInvites() error
- func (rg *RoostGroup) CreateMessage(topicID []byte, body string) (*Message, error)
- func (rg *RoostGroup) CreateTodo(topicID []byte, label string) (*Todo, error)
- func (rg *RoostGroup) CreateTopic(label string) (*Topic, error)
- func (rg *RoostGroup) CreateTopicPinned(label string, pinned bool) (*Topic, error)
- func (rg *RoostGroup) DeleteTodo(id []byte) error
- func (rg *RoostGroup) Invite(password string) (string, error)
- func (rg *RoostGroup) MarkTopicRead(topicID []byte) error
- func (rg *RoostGroup) Message(id []byte) (*Message, error)
- func (rg *RoostGroup) Messages(topicID []byte, cursor string) (*PagedMessages, error)
- func (rg *RoostGroup) MoveTodo(complete bool, topicID []byte, from, to int) error
- func (rg *RoostGroup) MoveTopic(pinned bool, from, to int) error
- func (rg *RoostGroup) PinTopic(topicID []byte, pinned bool) error
- func (rg *RoostGroup) Reactions(entityID []byte) (*Reactions, error)
- func (rg *RoostGroup) SetReaction(entityID []byte, r string, active bool) error
- func (rg *RoostGroup) SetShowCompleted(id []byte, completed bool) error
- func (rg *RoostGroup) Todo(id []byte) (*Todo, error)
- func (rg *RoostGroup) TodoUpdater() *TodoUpdater
- func (rg *RoostGroup) Todos(topicID []byte) (*Todos, error)
- func (rg *RoostGroup) Topic(id []byte) (*Topic, error)
- func (rg *RoostGroup) Topics() (*Topics, error)
- func (rg *RoostGroup) UpdateMessage(message *Message) error
- func (rg *RoostGroup) UpdateTodo(todo *Todo) error
- func (rg *RoostGroup) UpdateTopic(topic *Topic) error
- type SearchResults
- type TableUpdate
- type Todo
- type TodoUpdater
- type Todos
- type Topic
- type Topics
- type TransportStateUpdate
- type TransportStates
- type Updates
- func (u *Updates) AppState() *AppState
- func (u *Updates) GroupUpdate() *GroupUpdate
- func (u *Updates) IntroUpdate() *IntroUpdate
- func (u *Updates) Next()
- func (u *Updates) TransportStateUpdate() *TransportStateUpdate
- func (u *Updates) Type() int
- func (u *Updates) ViewEntityUpdate() *EntityUpdate
- func (u *Updates) ViewUpdate() *ViewUpdate
- type ViewUpdate
Constants ¶
const ( StateNew = iota StateLocked StateRunning UpdateAppState = iota UpdateGroupUpdate UpdateViewUpdate UpdateEntityUpdate UpdateIntroUpdate UpdateTransportStateUpdate UpdateMessagesFetched UpdateUnknown UpdateFinished MessagesPageSize = 20 )
const PageSize = 100
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EntityUpdate ¶
type GroupUpdate ¶
type Groups ¶
type Groups struct { Count int // contains filtered or unexported fields }
func (*Groups) Group ¶
func (g *Groups) Group(i int) *RoostGroup
type Message ¶
type Message struct { ID []byte `db:"id"` GroupID []byte `db:"group_id"` CtimeSec float64 `db:"_ctime"` MtimeSec float64 `db:"_mtime"` WtimeSec float64 `db:"_wtime"` IdentityID []byte `db:"_identity_tag"` MembershipID []byte `db:"_membership_tag"` TopicID []byte `db:"topic_id"` Body string `db:"body"` }
Message is a chat message sent within the context of a topic.
type PagedMessages ¶
type PagedMessages struct { AtEnd bool Cursor string Count int // contains filtered or unexported fields }
A container for paged messages which indicates if there are further messages and provides a cursor for continued paging.
func (*PagedMessages) Message ¶
func (pm *PagedMessages) Message(i int) *Message
type Reaction ¶
type Reaction struct { ID []byte `db:"id"` GroupID []byte `db:"group_id"` CtimeSec float64 `db:"_ctime"` MtimeSec float64 `db:"_mtime"` WtimeSec float64 `db:"_wtime"` IdentityID []byte `db:"_identity_tag"` MembershipID []byte `db:"_membership_tag"` Rune string `db:"rune"` Active bool `db:"active"` EntityID []byte `db:"entity_id"` }
Reaction is a "rune" that refers to another entity (such as a message or todo item)
type Roost ¶
type Roost struct { State int // contains filtered or unexported fields }
func MakeRoostWithKeyMaker ¶
Makes a Roost instance with a given key maker. Not typically used outside of tests.
func MakeRoostWithStrongKey ¶
Makes a Roost instance for a given root directory.
func (*Roost) AcceptInvite ¶
Accepts an invite.
func (*Roost) AddPushToken ¶
Adds a push notification token to Roost.
func (*Roost) CreateGroup ¶
func (r *Roost) CreateGroup(name string) (*RoostGroup, error)
Creates a roost group (a "roost")
func (*Roost) DeletePushToken ¶
Removes a push notification token from Roost.
func (*Roost) GetDeviceLink ¶
Gets a device link which can be used to link a device to the current device group.
func (*Roost) GetMessages ¶
Gets messages. Clients should wait for an UpdateMessagesFetched event and shutdown after that.
func (*Roost) Group ¶
func (r *Roost) Group(groupID []byte) (*RoostGroup, error)
Gets a group for a specific id.
func (*Roost) Initialize ¶
Initializes roost with a given password.
func (*Roost) LeaveDeviceGroup ¶
Leave a device group and destroy all Roost data on this device, returning it to a "new" state.
func (*Roost) LinkDevice ¶
Links a device using the provided device link.
func (*Roost) NextPage ¶
func (r *Roost) NextPage(results *SearchResults) (*SearchResults, error)
Fetch the next page of results from a previous search.
func (*Roost) RegisterHeyaTransport ¶
Registers the HEYA transport which is the main transport used currently for Roost. This transport supports the sending of iOS push notifications.
func (*Roost) Search ¶
func (r *Roost) Search(groupID []byte, term, highlightStart, highlightEnd string) (*SearchResults, error)
Perform a fulltext search across all your Roosts.
func (*Roost) SetDeviceNameType ¶
Sets the current device name and type for a given roost instance.
func (*Roost) TransportStates ¶
func (r *Roost) TransportStates() *TransportStates
Get current transport states
func (*Roost) UnreadMessageCount ¶
Return the number of unread messages across all topics and groups
func (*Roost) Updates ¶
Gets a channel of events which can occur within the application. For example application state changes and updates to specific tables within the EAV database.
This channel will provide the following types:
*AppState: an update about the current state of Roost *GroupUpdate: an update about a group *TableUpdate: an update about a specific table within roost, for instance `todos`, `topics` or `messages`.
type RoostGroup ¶
type RoostGroup struct { GroupID []byte IdentityTag []byte Name string UnreadMessageCount int IncompleteTodoCount int UnreadTodoCount int // contains filtered or unexported fields }
A group (or "roost") within Roost. This represents a set of identities collaborating together in the same database.
func (*RoostGroup) CancelInvites ¶
func (rg *RoostGroup) CancelInvites() error
Cancels invites to this group.
func (*RoostGroup) CreateMessage ¶
func (rg *RoostGroup) CreateMessage(topicID []byte, body string) (*Message, error)
Creates a message in a given topic id with a textual body.
func (*RoostGroup) CreateTodo ¶
func (rg *RoostGroup) CreateTodo(topicID []byte, label string) (*Todo, error)
Creates a todo item in the given topic specified by id with a textual body.
func (*RoostGroup) CreateTopic ¶
func (rg *RoostGroup) CreateTopic(label string) (*Topic, error)
CreateTopic creates a new topic with the given name.
func (*RoostGroup) CreateTopicPinned ¶
func (rg *RoostGroup) CreateTopicPinned(label string, pinned bool) (*Topic, error)
func (*RoostGroup) DeleteTodo ¶
func (rg *RoostGroup) DeleteTodo(id []byte) error
Gets a list of all connected devices to the current identity.
func (*RoostGroup) Invite ¶
func (rg *RoostGroup) Invite(password string) (string, error)
Creates a password-protected invite.
func (*RoostGroup) MarkTopicRead ¶
func (rg *RoostGroup) MarkTopicRead(topicID []byte) error
Mark a topic as read
func (*RoostGroup) Message ¶
func (rg *RoostGroup) Message(id []byte) (*Message, error)
Gets a message for a given id.
func (*RoostGroup) Messages ¶
func (rg *RoostGroup) Messages(topicID []byte, cursor string) (*PagedMessages, error)
Gets a list of messages for a given topic id and a cursor. If cursor is "", it retrieves messages in reverse chronological order. Otherwise, use the cursor value provided by PagedMessages.
func (*RoostGroup) MoveTodo ¶
func (rg *RoostGroup) MoveTodo(complete bool, topicID []byte, from, to int) error
Moves a todo item in the given topic specified by id
func (*RoostGroup) MoveTopic ¶
func (rg *RoostGroup) MoveTopic(pinned bool, from, to int) error
Moves a topic item in the given topic specified by id
func (*RoostGroup) PinTopic ¶
func (rg *RoostGroup) PinTopic(topicID []byte, pinned bool) error
Pin a topic
func (*RoostGroup) Reactions ¶
func (rg *RoostGroup) Reactions(entityID []byte) (*Reactions, error)
Get all reactions for a given entity id
func (*RoostGroup) SetReaction ¶
func (rg *RoostGroup) SetReaction(entityID []byte, r string, active bool) error
Set a reaction to an entity
func (*RoostGroup) SetShowCompleted ¶
func (rg *RoostGroup) SetShowCompleted(id []byte, completed bool) error
Set show completed
func (*RoostGroup) Todo ¶
func (rg *RoostGroup) Todo(id []byte) (*Todo, error)
Gets a todo for a given id.
func (*RoostGroup) TodoUpdater ¶
func (rg *RoostGroup) TodoUpdater() *TodoUpdater
Create a todo updater which can be used for marking todos complete en masse
func (*RoostGroup) Todos ¶
func (rg *RoostGroup) Todos(topicID []byte) (*Todos, error)
Gets a list of todos for a given topic id.
func (*RoostGroup) Topic ¶
func (rg *RoostGroup) Topic(id []byte) (*Topic, error)
Gets a topic for a given id.
func (*RoostGroup) Topics ¶
func (rg *RoostGroup) Topics() (*Topics, error)
Gets a list of all topics.
func (*RoostGroup) UpdateMessage ¶
func (rg *RoostGroup) UpdateMessage(message *Message) error
Updates a message.
func (*RoostGroup) UpdateTopic ¶
func (rg *RoostGroup) UpdateTopic(topic *Topic) error
Updates a topic in a group.
type SearchResults ¶
type SearchResults struct { GroupID []byte Term string HighlightStart string HighlightEnd string Offset int Total int Count int // contains filtered or unexported fields }
func (*SearchResults) Result ¶
func (sr *SearchResults) Result(i int) *Result
type TableUpdate ¶
type Todo ¶
type Todo struct { ID []byte `db:"id"` GroupID []byte `db:"group_id"` CtimeSec float64 `db:"_ctime"` MtimeSec float64 `db:"_mtime"` WtimeSec float64 `db:"_wtime"` IdentityID []byte `db:"_identity_tag"` MembershipID []byte `db:"_membership_tag"` TopicID []byte `db:"topic_id"` Body string `db:"body"` CompletedAt float64 `db:"completed_at"` CompletedPosition float64 `db:"completed_position"` Deleted bool `db:"deleted"` Read bool `db:"read"` Position float64 `db:"position"` }
Todo item within a topic.
type TodoUpdater ¶
type TodoUpdater struct {
// contains filtered or unexported fields
}
func (*TodoUpdater) Commit ¶
func (tu *TodoUpdater) Commit() error
also give them new positions when you complete them
func (*TodoUpdater) MarkComplete ¶
func (tu *TodoUpdater) MarkComplete(id []byte, complete bool)
func (*TodoUpdater) MarkRead ¶
func (tu *TodoUpdater) MarkRead(id []byte, read bool)
type Todos ¶
type Todos struct { IncompleteCount int CompleteCount int // contains filtered or unexported fields }
func (*Todos) CompleteTodo ¶
func (*Todos) IncompleteTodo ¶
type Topic ¶
type Topic struct { ID []byte `db:"id"` GroupID []byte `db:"group_id"` CtimeSec float64 `db:"_ctime"` MtimeSec float64 `db:"_mtime"` WtimeSec float64 `db:"_wtime"` IdentityID []byte `db:"_identity_tag"` MembershipID []byte `db:"_membership_tag"` Label string `db:"label"` MessageLastRead float64 `db:"message_last_read"` UnreadMessageCount int `db:"unread_message_count"` IncompleteTodoCount int `db:"incomplete_todo_count"` UnreadTodoCount int `db:"unread_todo_count"` ShowCompleted bool `db:"show_completed"` Pinned bool `db:"pinned"` Position float64 `db:"position"` PinPosition float64 `db:"pin_position"` }
Topic is a organizational structure within a group.
type TransportStateUpdate ¶
type TransportStates ¶
type TransportStates struct {
// contains filtered or unexported fields
}
func (*TransportStates) Len ¶
func (t *TransportStates) Len() int
func (*TransportStates) State ¶
func (t *TransportStates) State(i int) string
func (*TransportStates) URL ¶
func (t *TransportStates) URL(i int) string
type Updates ¶
type Updates struct {
// contains filtered or unexported fields
}
*AppState: an update about the current state of Roost *GroupUpdate: an update about a group *ViewUpdate: an update about a specific view within roost, for instance `todos`, `topics` or `messages`. *EntityUpdate: an update about a specific view row within roost, for instance `todos`, `topics` or `messages`. *IntroUpdate: an update about a specific table within roost, for instance `todos`, `topics` or `messages`. *StateUpdate: an update about a specific table within roost, for instance `todos`, `topics` or `messages`.
func (*Updates) GroupUpdate ¶
func (u *Updates) GroupUpdate() *GroupUpdate
func (*Updates) IntroUpdate ¶
func (u *Updates) IntroUpdate() *IntroUpdate
func (*Updates) TransportStateUpdate ¶
func (u *Updates) TransportStateUpdate() *TransportStateUpdate
func (*Updates) ViewEntityUpdate ¶
func (u *Updates) ViewEntityUpdate() *EntityUpdate
func (*Updates) ViewUpdate ¶
func (u *Updates) ViewUpdate() *ViewUpdate
type ViewUpdate ¶
type ViewUpdate struct {
// contains filtered or unexported fields
}