Documentation
¶
Index ¶
- func FormatTimeAgo(t time.Time) string
- type BoostResponse
- type ClearNotificationsResponse
- type Database
- type FollowResponse
- type Handler
- type HelpCommand
- type HelpResponse
- type LikeResponse
- type NotificationItem
- type NotificationsResponse
- type Output
- func (o *Output) Error(err error)
- func (o *Output) ErrorWithDetails(message string, details string)
- func (o *Output) IsJSON() bool
- func (o *Output) JSON(v interface{})
- func (o *Output) Print(format string, args ...interface{})
- func (o *Output) Println(text string)
- func (o *Output) Success(format string, args ...interface{})
- type PostResponse
- type Session
- type TimelinePost
- type TimelineResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FormatTimeAgo ¶
FormatTimeAgo returns a human-readable time difference
Types ¶
type BoostResponse ¶ added in v1.7.0
type BoostResponse struct {
PostID string `json:"post_id"`
Boosted bool `json:"boosted"`
Message string `json:"message"`
}
BoostResponse represents a boost/unboost response
type ClearNotificationsResponse ¶ added in v1.6.2
type ClearNotificationsResponse struct {
Status string `json:"status"`
Cleared bool `json:"cleared"`
}
ClearNotificationsResponse represents the clear-notifications output
type Database ¶
type Database interface {
CreateNote(userId interface{}, message string) (interface{}, error)
CreateNoteWithReply(userId interface{}, message string, inReplyToURI string) (interface{}, error)
ReadNoteIdWithReplyInfo(id interface{}) (error, *domain.Note)
ReadHomeTimelinePosts(accountId interface{}, limit int) (error, *[]domain.HomePost)
ReadNotificationsByAccountId(accountId interface{}, limit int) (error, *[]domain.Notification)
CountUnreadNotifications(accountId interface{}) (int, error)
DeleteAllNotifications(accountId interface{}) error
// Note/Activity lookups for like/boost
ReadNoteId(id interface{}) (error, *domain.Note)
ReadActivityById(id interface{}) (error, *domain.Activity)
ReadAccByUsername(username string) (error, *domain.Account)
// Like operations
HasLike(accountId, noteId interface{}) (bool, error)
HasLikeByObjectURI(accountId interface{}, objectURI string) (bool, error)
CreateLike(like *domain.Like) error
CreateLikeByObjectURI(like *domain.Like, objectURI string) error
DeleteLikeByAccountAndNote(accountId, noteId interface{}) error
DeleteLikeByAccountAndObjectURI(accountId interface{}, objectURI string) error
IncrementLikeCountByNoteId(noteId interface{}) error
DecrementLikeCountByNoteId(noteId interface{}) error
IncrementLikeCountByObjectURI(objectURI string) error
DecrementLikeCountByObjectURI(objectURI string) error
ReadLikeByAccountAndNote(accountId, noteId interface{}) (error, *domain.Like)
ReadLikeByAccountAndObjectURI(accountId interface{}, objectURI string) (error, *domain.Like)
CreateNotification(notification *domain.Notification) error
// Boost operations
HasBoost(accountId, noteId interface{}) (bool, error)
HasBoostByObjectURI(accountId interface{}, objectURI string) (bool, error)
CreateBoost(boost *domain.Boost) error
CreateBoostByObjectURI(boost *domain.Boost, objectURI string) error
DeleteBoostByAccountAndNote(accountId, noteId interface{}) error
DeleteBoostByAccountAndObjectURI(accountId interface{}, objectURI string) error
IncrementBoostCountByNoteId(noteId interface{}) error
DecrementBoostCountByNoteId(noteId interface{}) error
IncrementBoostCountByObjectURI(objectURI string) error
DecrementBoostCountByObjectURI(objectURI string) error
ReadBoostByAccountAndNote(accountId, noteId interface{}) (error, *domain.Boost)
ReadBoostByAccountAndObjectURI(accountId interface{}, objectURI string) (error, *domain.Boost)
// Follow operations
ReadRemoteAccountByActorURI(actorURI string) (error, *domain.RemoteAccount)
ReadFollowByAccountIds(accountId, targetAccountId interface{}) (error, *domain.Follow)
CreateLocalFollow(followerAccountId, targetAccountId interface{}) error
DeleteLocalFollow(followerAccountId, targetAccountId interface{}) error
IsFollowingLocal(followerAccountId, targetAccountId interface{}) (bool, error)
DeleteFollowByURI(uri string) error
ReadAccById(id interface{}) (error, *domain.Account)
}
Database interface for CLI operations
type FollowResponse ¶ added in v1.7.0
type FollowResponse struct {
Username string `json:"username"`
Domain string `json:"domain,omitempty"`
Following bool `json:"following"`
Pending bool `json:"pending,omitempty"`
Message string `json:"message"`
}
FollowResponse represents a follow/unfollow response
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler processes CLI commands
func NewHandler ¶
NewHandler creates a new CLI handler
type HelpCommand ¶
type HelpCommand struct {
Name string `json:"name"`
Description string `json:"description"`
Usage string `json:"usage"`
Flags []string `json:"flags,omitempty"`
}
HelpCommand represents a command in help output
type HelpResponse ¶
type HelpResponse struct {
Version string `json:"version"`
Commands []HelpCommand `json:"commands"`
GlobalFlags []string `json:"global_flags"`
}
HelpResponse represents the help output
type LikeResponse ¶ added in v1.7.0
type LikeResponse struct {
PostID string `json:"post_id"`
Liked bool `json:"liked"`
Message string `json:"message"`
}
LikeResponse represents a like/unlike response
type NotificationItem ¶
type NotificationItem struct {
ID string `json:"id"`
Type string `json:"type"`
Actor string `json:"actor"`
NotePreview string `json:"note_preview,omitempty"`
CreatedAt time.Time `json:"created_at"`
}
NotificationItem represents a notification in output
type NotificationsResponse ¶
type NotificationsResponse struct {
Notifications []NotificationItem `json:"notifications"`
UnreadCount int `json:"unread_count"`
}
NotificationsResponse represents the notifications output
type Output ¶
type Output struct {
// contains filtered or unexported fields
}
Output handles formatting responses in text or JSON format
func (*Output) ErrorWithDetails ¶
ErrorWithDetails outputs an error with additional details
type PostResponse ¶
type PostResponse struct {
ID string `json:"id"`
Message string `json:"message"`
CreatedAt time.Time `json:"created_at"`
InReplyTo string `json:"in_reply_to,omitempty"`
}
PostResponse represents a post creation response
type TimelinePost ¶
type TimelinePost struct {
ID string `json:"id"`
Author string `json:"author"`
Domain string `json:"domain,omitempty"`
Message string `json:"message"`
CreatedAt time.Time `json:"created_at"`
ReplyCount int `json:"reply_count"`
LikeCount int `json:"like_count"`
BoostCount int `json:"boost_count"`
ObjectURI string `json:"object_uri,omitempty"`
IsLocal bool `json:"is_local"`
}
TimelinePost represents a post in timeline output
type TimelineResponse ¶
type TimelineResponse struct {
Posts []TimelinePost `json:"posts"`
Count int `json:"count"`
}
TimelineResponse represents the timeline output