event

package
v0.7.224-dev Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 2, 2026 License: AGPL-3.0, AGPL-3.0-or-later Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Accepted is the verbatim JSON body the middleware writes when a
	// handler signals plain success. Plain string (not a named type) so
	// the middleware's response type switch hits the `case string` arm
	// and writes the bytes as-is; with a named type it would fall through
	// to the JSON encoder and be re-emitted as a quoted string literal.
	Accepted            string = `{"code":0,"message":"Accepted"}`
	InternalRoutePrefix string = "/internal"
	EndCursor           string = "end"
)
View Source
const (
	// admin
	PRIVATE_POST_PAIR          = "/private/post/admin/pair/0.0.0"
	PUBLIC_POST_NODE_CHALLENGE = "/public/post/admin/challenge/0.0.0"
	PRIVATE_GET_STATS          = "/private/get/admin/stats/0.0.0"
	// moderation
	PUBLIC_POST_MODERATION_RESULT = "/public/post/moderate/result/0.0.0"
	PUBLIC_POST_REPORT            = "/public/post/report/0.0.0"
	// application
	PRIVATE_DELETE_CHAT               = "/private/delete/chat/0.0.0"
	PRIVATE_DELETE_MESSAGE            = "/private/delete/message/0.0.0"
	PRIVATE_DELETE_TWEET              = "/private/delete/tweet/0.0.0"
	PRIVATE_GET_CHAT                  = "/private/get/chat/0.0.0"
	PRIVATE_GET_CHATS                 = "/private/get/chats/0.0.0"
	PRIVATE_GET_NOTIFICATION          = "/private/get/notification/0.0.0"
	PRIVATE_GET_NOTIFICATIONS         = "/private/get/notifications/0.0.0"
	PRIVATE_POST_NOTIFICATION_READ    = "/private/post/notification/read/0.0.0"
	PRIVATE_GET_MESSAGE               = "/private/get/message/0.0.0"
	PRIVATE_GET_MESSAGES              = "/private/get/messages/0.0.0"
	PRIVATE_GET_TIMELINE              = "/private/get/timeline/0.0.0"
	PRIVATE_POST_LOGIN                = "/private/post/login/0.0.0"
	PRIVATE_POST_LOGOUT               = "/private/post/logout/0.0.0"
	PRIVATE_POST_TWEET                = "/private/post/tweet/0.0.0"
	PRIVATE_POST_IMPORT_TWITTER_TWEET = "/private/post/import/twitter/tweet/0.0.0"
	PRIVATE_POST_USER                 = "/private/post/user/0.0.0"
	PUBLIC_DELETE_REPLY               = "/public/delete/reply/0.0.0"
	PUBLIC_GET_FOLLOWINGS             = "/public/get/followings/0.0.0"
	PUBLIC_GET_FOLLOWERS              = "/public/get/followers/0.0.0"
	PUBLIC_GET_INFO                   = "/public/get/info/0.0.0"
	PUBLIC_GET_REPLIES                = "/public/get/replies/0.0.0"
	PUBLIC_GET_REPLY                  = "/public/get/reply/0.0.0"
	PUBLIC_GET_TWEET                  = "/public/get/tweet/0.0.0"
	PUBLIC_GET_TWEET_STATS            = "/public/get/tweetstats/0.0.0"
	PUBLIC_GET_TWEETS                 = "/public/get/tweets/0.0.0"
	PUBLIC_GET_USER                   = "/public/get/user/0.0.0"
	PUBLIC_GET_USERS                  = "/public/get/users/0.0.0"
	PUBLIC_GET_WHOTOFOLLOW            = "/public/get/whotofollow/0.0.0"
	PUBLIC_POST_CHAT                  = "/public/post/chat/0.0.0"
	PUBLIC_POST_FOLLOW                = "/public/post/follow/0.0.0"
	PUBLIC_POST_LIKE                  = "/public/post/like/0.0.0"
	PUBLIC_POST_MESSAGE               = "/public/post/message/0.0.0"
	PUBLIC_POST_REPLY                 = "/public/post/reply/0.0.0"
	PUBLIC_POST_RETWEET               = "/public/post/retweet/0.0.0"
	PUBLIC_POST_IS_FOLLOWING          = "/public/post/isfollowing/0.0.0"
	PUBLIC_POST_IS_FOLLOWER           = "/public/post/isfollower/0.0.0"
	PUBLIC_POST_UNFOLLOW              = "/public/post/unfollow/0.0.0"
	PUBLIC_POST_UNLIKE                = "/public/post/unlike/0.0.0"
	PUBLIC_POST_UNRETWEET             = "/public/post/unretweet/0.0.0"
	PUBLIC_POST_VIEW                  = "/public/post/view/0.0.0"
	PRIVATE_POST_UPLOAD_IMAGE         = "/private/post/image/0.0.0"
	PUBLIC_GET_IMAGE                  = "/public/get/image/0.0.0"
	PRIVATE_POST_BOOKMARK             = "/private/post/bookmark/0.0.0"
	PRIVATE_POST_UNBOOKMARK           = "/private/post/unbookmark/0.0.0"
	PRIVATE_GET_BOOKMARKS             = "/private/get/bookmarks/0.0.0"
	PUBLIC_POST_PIN                   = "/public/post/pin/0.0.0"
	PUBLIC_POST_UNPIN                 = "/public/post/unpin/0.0.0"

	PRIVATE_POST_BLOCK   = "/private/post/block/0.0.0"
	PRIVATE_POST_UNBLOCK = "/private/post/unblock/0.0.0"
	PRIVATE_GET_BLOCKS   = "/private/get/blocks/0.0.0"
	PRIVATE_POST_MUTE    = "/private/post/mute/0.0.0"
	PRIVATE_POST_UNMUTE  = "/private/post/unmute/0.0.0"
	PRIVATE_GET_MUTES    = "/private/get/mutes/0.0.0"

	PUBLIC_GET_TWEET_LIKERS     = "/public/get/tweet/likers/0.0.0"
	PUBLIC_GET_TWEET_RETWEETERS = "/public/get/tweet/retweeters/0.0.0"

	PRIVATE_POST_SUBSCRIBE_USER   = "/private/post/subscribe/user/0.0.0"
	PRIVATE_POST_UNSUBSCRIBE_USER = "/private/post/unsubscribe/user/0.0.0"

	PRIVATE_POST_MEDIA_META = "/private/post/media/meta/0.0.0"
	PRIVATE_GET_MEDIA       = "/private/get/media/0.0.0"

	PUBLIC_GET_USERS_SEARCH = "/public/get/users/search/0.0.0"

	PRIVATE_POST_TWEET_EDIT = "/private/post/tweet/edit/0.0.0"

	PRIVATE_GET_FOLLOW_REQUESTS           = "/private/get/follow/requests/0.0.0"
	PRIVATE_POST_FOLLOW_REQUEST_AUTHORIZE = "/private/post/follow/request/authorize/0.0.0"
	PRIVATE_POST_FOLLOW_REQUEST_REJECT    = "/private/post/follow/request/reject/0.0.0"

	PRIVATE_GET_FILTER                 = "/private/get/filter/0.0.0"
	PRIVATE_GET_FILTERS                = "/private/get/filters/0.0.0"
	PRIVATE_POST_FILTER                = "/private/post/filter/0.0.0"
	PRIVATE_POST_FILTER_UPDATE         = "/private/post/filter/update/0.0.0"
	PRIVATE_DELETE_FILTER              = "/private/delete/filter/0.0.0"
	PRIVATE_POST_FILTER_KEYWORD        = "/private/post/filter/keyword/0.0.0"
	PRIVATE_POST_FILTER_KEYWORD_UPDATE = "/private/post/filter/keyword/update/0.0.0"
	PRIVATE_DELETE_FILTER_KEYWORD      = "/private/delete/filter/keyword/0.0.0"
)
View Source
const MaxReportReasonLen = 256

MaxReportReasonLen caps the free-form reason on the wire. Reports are gossiped network-wide, so an unbounded reason field is a cheap way to bloat the topic and spam logs.

View Source
const ReportsTopic = "/warpnet/reports/1.0.0"

ReportsTopic is the global gossip topic that carries Report events from members to moderators. Single source of truth: both cmd/node/member/pubsub and cmd/node/moderator/pubsub must use this constant so they cannot drift.

Variables

View Source
var (
	ErrReportNoTargetUser = errors.New("report: empty target_user_id")
	ErrReportNoTargetNode = errors.New("report: empty target_node_id")
	ErrReportNoReason     = errors.New("report: empty reason")
	ErrReportReasonLong   = errors.New("report: reason too long")
	ErrReportNoObjectID   = errors.New("report: empty object_id for tweet")
	ErrReportBadType      = errors.New("report: unsupported moderation object type")
)

Errors are exported so callers can match against them with errors.Is — useful both in the publishing handler (which returns 4xx-style errors to the UI) and in the moderator consumer (which drops bad messages silently).

Functions

func SanitizeReport added in v0.7.59

func SanitizeReport(ev *ReportEvent)

SanitizeReport normalizes the user-typed fields of a ReportEvent so that Validate (and downstream logs) see a canonical value. Mutates in place. Idempotent.

func ValidateReport added in v0.7.59

func ValidateReport(ev ReportEvent) error

ValidateReport returns nil if the event is shape-acceptable. Run SanitizeReport first so whitespace-only fields are caught.

Called both by the member-side publishing handler (to reject bad client input) and by the moderator-side consumer (because the reports topic is open — a signed message is still untrusted content). Keep the two paths in sync by sharing this function.

Types

type AddFilterKeywordEvent added in v0.7.26

type AddFilterKeywordEvent struct {
	UserId    domain.ID `json:"user_id"`
	FilterId  domain.ID `json:"filter_id"`
	Keyword   string    `json:"keyword"`
	WholeWord bool      `json:"whole_word"`
}

AddFilterKeywordEvent defines model for AddFilterKeywordEvent.

type BlockEvent added in v0.7.26

type BlockEvent struct {
	BlockerId domain.ID `json:"blocker_id"`
	BlockeeId domain.ID `json:"blockee_id"`
}

BlockEvent defines model for BlockEvent.

type BookmarkEvent added in v0.7.26

type BookmarkEvent struct {
	UserId      domain.ID `json:"user_id"`
	TweetId     domain.ID `json:"tweet_id"`
	OwnerUserId domain.ID `json:"owner_user_id"`
}

BookmarkEvent defines model for BookmarkEvent.

type BookmarkItem added in v0.7.26

type BookmarkItem struct {
	UserId      domain.ID `json:"user_id"`
	TweetId     domain.ID `json:"tweet_id"`
	OwnerUserId domain.ID `json:"owner_user_id"`
	CreatedAt   time.Time `json:"created_at"`
}

BookmarkItem mirrors database.Bookmark on the wire.

type ChallengeEvent added in v0.5.2

type ChallengeEvent struct {
	Coordinates []ChallengeSample `json:"samples"`
}

type ChallengeResponse added in v0.5.2

type ChallengeResponse struct {
	Solutions []ChallengeSolution `json:"solutions"`
}

type ChallengeSample added in v0.5.129

type ChallengeSample struct {
	DirStack  []int `json:"dir_stack"` // every index is level and value is dir num
	FileStack []int `json:"file_stack"`
	Nonce     int64 `json:"nonce"`
}

type ChallengeSolution added in v0.5.129

type ChallengeSolution struct {
	Challenge string `json:"challenge"`
	Signature string `json:"signature"`
}

type ChatCreatedResponse

type ChatCreatedResponse = domain.Chat

ChatCreatedResponse defines model for ChatCreatedResponse.

type ChatMessageResponse

type ChatMessageResponse = domain.ChatMessage

ChatMessageResponse defines model for ChatMessageResponse.

type ChatMessagesResponse

type ChatMessagesResponse struct {
	ChatId   domain.ID            `json:"chat_id"`
	Cursor   string               `json:"cursor"`
	Messages []domain.ChatMessage `json:"messages"`
}

ChatMessagesResponse defines model for ChatMessagesResponse.

type ChatsResponse

type ChatsResponse struct {
	Chats  []domain.Chat `json:"chats"`
	Cursor string        `json:"cursor"`
	UserId domain.ID     `json:"user_id"`
}

ChatsResponse defines model for ChatsResponse.

type DeleteChatEvent

type DeleteChatEvent struct {
	ChatId domain.ID `json:"chat_id"`
}

DeleteChatEvent defines model for DeleteChatEvent.

type DeleteFilterEvent added in v0.7.26

type DeleteFilterEvent struct {
	UserId   domain.ID `json:"user_id"`
	FilterId domain.ID `json:"filter_id"`
}

DeleteFilterEvent defines model for DeleteFilterEvent.

type DeleteFilterKeywordEvent added in v0.7.26

type DeleteFilterKeywordEvent struct {
	UserId    domain.ID `json:"user_id"`
	KeywordId domain.ID `json:"keyword_id"`
}

DeleteFilterKeywordEvent defines model for DeleteFilterKeywordEvent.

type DeleteMessageEvent

type DeleteMessageEvent = GetMessageEvent

DeleteMessageEvent defines model for DeleteMessageEvent.

type DeleteReplyEvent

type DeleteReplyEvent = GetReplyEvent

DeleteReplyEvent defines model for DeleteReplyEvent.

type DeleteTweetEvent

type DeleteTweetEvent = GetTweetEvent

DeleteTweetEvent defines model for DeleteTweetEvent.

type EditTweetEvent added in v0.7.26

type EditTweetEvent struct {
	TweetId domain.ID `json:"tweet_id"`
	UserId  domain.ID `json:"user_id"`
	Text    string    `json:"text"`
}

EditTweetEvent defines model for EditTweetEvent.

type EditTweetResponse added in v0.7.26

type EditTweetResponse = domain.Tweet

EditTweetResponse defines model for EditTweetResponse.

type ErrorEvent

type ErrorEvent struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

ErrorEvent defines model for ErrorEvent.

type FollowRequestActionEvent added in v0.7.26

type FollowRequestActionEvent struct {
	UserId     domain.ID `json:"user_id"`
	FollowerId domain.ID `json:"follower_id"`
}

FollowRequestActionEvent defines model for FollowRequestActionEvent. Used for both authorize and reject — the verb is in the path.

type FollowersResponse

type FollowersResponse struct {
	Cursor      string      `json:"cursor"`
	FollowingId string      `json:"following_id"`
	Followers   []domain.ID `json:"followers"`
}

type FollowingsResponse added in v0.5.83

type FollowingsResponse struct {
	Cursor     string      `json:"cursor"`
	Followings []domain.ID `json:"followings"`
	FollowerId domain.ID   `json:"follower_id"`
}

FollowingsResponse defines model for FollowingsResponse.

type GetAllChatsEvent

type GetAllChatsEvent struct {
	Cursor *string   `json:"cursor,omitempty"`
	Limit  *uint64   `json:"limit,omitempty"`
	UserId domain.ID `json:"user_id"`
}

GetAllChatsEvent defines model for GetAllChatsEvent.

type GetAllMessagesEvent

type GetAllMessagesEvent struct {
	OwnerId domain.ID `json:"owner_id"`
	ChatId  domain.ID `json:"chat_id"`
	Cursor  *string   `json:"cursor,omitempty"`
	Limit   *uint64   `json:"limit,omitempty"`
}

GetAllMessagesEvent defines model for GetAllMessagesEvent.

type GetAllRepliesEvent

type GetAllRepliesEvent struct {
	Cursor   *string   `json:"cursor,omitempty"`
	Limit    *uint64   `json:"limit,omitempty"`
	ParentId domain.ID `json:"parent_id"`
	RootId   domain.ID `json:"root_id"`
}

GetAllRepliesEvent defines model for GetAllRepliesEvent.

ParentId is the parent TWEET id (not a user id) — it selects which subtree of replies inside RootId to return. Empty means "top-level replies of the thread"; the handler treats that as ParentId = RootId. RootId is the root tweet of the thread.

type GetAllTweetsEvent

type GetAllTweetsEvent struct {
	Cursor *string   `json:"cursor,omitempty"`
	Limit  *uint64   `json:"limit,omitempty"`
	UserId domain.ID `json:"user_id"`
}

GetAllTweetsEvent defines model for GetAllTweetsEvent.

type GetAllUsersEvent

type GetAllUsersEvent struct {
	Cursor *string `json:"cursor,omitempty"`
	Limit  *uint64 `json:"limit,omitempty"`

	// UserId default owner
	UserId domain.ID `json:"user_id"`
}

GetAllUsersEvent defines model for GetAllUsersEvent.

type GetBlocksEvent added in v0.7.26

type GetBlocksEvent struct {
	UserId domain.ID `json:"user_id"`
	Cursor *string   `json:"cursor,omitempty"`
	Limit  *uint64   `json:"limit,omitempty"`
}

GetBlocksEvent defines model for GetBlocksEvent.

type GetBlocksResponse added in v0.7.26

type GetBlocksResponse struct {
	Ids    []domain.ID `json:"ids"`
	Cursor string      `json:"cursor"`
}

GetBlocksResponse defines model for GetBlocksResponse.

type GetBookmarksEvent added in v0.7.26

type GetBookmarksEvent struct {
	UserId domain.ID `json:"user_id"`
	Cursor *string   `json:"cursor,omitempty"`
	Limit  *uint64   `json:"limit,omitempty"`
}

GetBookmarksEvent defines model for GetBookmarksEvent.

type GetBookmarksResponse added in v0.7.26

type GetBookmarksResponse struct {
	Items  []BookmarkItem `json:"items"`
	Cursor string         `json:"cursor"`
}

GetBookmarksResponse defines model for GetBookmarksResponse.

type GetChatEvent

type GetChatEvent struct {
	ChatId domain.ID `json:"chat_id"`
}

GetChatEvent defines model for GetChatEvent.

type GetChatResponse

type GetChatResponse = domain.Chat

type GetFilterEvent added in v0.7.26

type GetFilterEvent struct {
	UserId   domain.ID `json:"user_id"`
	FilterId domain.ID `json:"filter_id"`
}

GetFilterEvent defines model for GetFilterEvent.

type GetFilterResponse added in v0.7.26

type GetFilterResponse = domain.Filter

GetFilterResponse defines model for GetFilterResponse.

type GetFiltersEvent added in v0.7.26

type GetFiltersEvent struct {
	UserId domain.ID `json:"user_id"`
	Cursor *string   `json:"cursor,omitempty"`
	Limit  *uint64   `json:"limit,omitempty"`
}

GetFiltersEvent defines model for GetFiltersEvent.

type GetFiltersResponse added in v0.7.26

type GetFiltersResponse struct {
	Filters []domain.Filter `json:"filters"`
	Cursor  string          `json:"cursor"`
}

GetFiltersResponse defines model for GetFiltersResponse.

type GetFollowRequestsEvent added in v0.7.26

type GetFollowRequestsEvent struct {
	UserId domain.ID `json:"user_id"`
	Cursor *string   `json:"cursor,omitempty"`
	Limit  *uint64   `json:"limit,omitempty"`
}

GetFollowRequestsEvent defines model for GetFollowRequestsEvent.

type GetFollowRequestsResponse added in v0.7.26

type GetFollowRequestsResponse struct {
	FollowerIds []domain.ID `json:"follower_ids"`
	Cursor      string      `json:"cursor"`
}

GetFollowRequestsResponse defines model for GetFollowRequestsResponse.

type GetFollowersEvent

type GetFollowersEvent struct {
	Cursor *string   `json:"cursor,omitempty"`
	Limit  *uint64   `json:"limit,omitempty"`
	UserId domain.ID `json:"user_id"`
}

GetFollowersEvent defines model for GetFollowersEvent.

type GetFollowingsEvent added in v0.5.83

type GetFollowingsEvent = GetFollowersEvent

GetFollowingsEvent defines model for GetFollowingsEvent.

type GetImageEvent

type GetImageEvent struct {
	UserId string `json:"user_id"`
	// Image mime type + "," + base64
	Key string `json:"key"`
}

type GetImageResponse

type GetImageResponse struct {
	// Image mime type + "," + base64
	File string `json:"file"`
}

type GetIsFollowerEvent added in v0.5.83

type GetIsFollowerEvent = GetIsFollowingEvent

type GetIsFollowingEvent added in v0.5.83

type GetIsFollowingEvent struct {
	UserId domain.ID `json:"user_id"`
}

type GetLikersResponse

type GetLikersResponse = UsersResponse

GetLikersResponse defines model for GetLikersResponse.

type GetLikesCountEvent

type GetLikesCountEvent struct {
	TweetId domain.ID `json:"tweet_id"`
}

GetLikesCountEvent defines model for GetLikesCountEvent.

type GetMediaEvent added in v0.7.26

type GetMediaEvent struct {
	UserId domain.ID `json:"user_id"`
	Key    string    `json:"key"`
}

GetMediaEvent defines model for GetMediaEvent.

type GetMediaResponse added in v0.7.26

type GetMediaResponse struct {
	Key         string  `json:"key"`
	Description string  `json:"description"`
	FocusX      float32 `json:"focus_x"`
	FocusY      float32 `json:"focus_y"`
}

GetMediaResponse defines model for GetMediaResponse.

type GetMessageEvent

type GetMessageEvent struct {
	ChatId domain.ID `json:"chat_id"`
	Id     domain.ID `json:"id"`
}

GetMessageEvent defines model for GetMessageEvent.

type GetMutesEvent added in v0.7.26

type GetMutesEvent = GetBlocksEvent

GetMutesEvent defines model for GetMutesEvent.

type GetMutesResponse added in v0.7.26

type GetMutesResponse = GetBlocksResponse

GetMutesResponse defines model for GetMutesResponse.

type GetNotificationEvent added in v0.7.26

type GetNotificationEvent struct {
	NotificationId domain.ID `json:"notification_id"`
}

GetNotificationEvent defines model for GetNotificationEvent.

type GetNotificationResponse added in v0.7.26

type GetNotificationResponse = domain.Notification

GetNotificationResponse defines model for GetNotificationResponse.

type GetNotificationsEvent added in v0.5.30

type GetNotificationsEvent struct {
	Cursor *string `json:"cursor,omitempty"`
	Limit  *uint64 `json:"limit,omitempty"`
}

type GetNotificationsResponse added in v0.5.30

type GetNotificationsResponse struct {
	Cursor        string                `json:"cursor"`
	UnreadCount   uint64                `json:"unread_count"`
	Notifications []domain.Notification `json:"notifications"`
}

type GetReTweetsCountEvent

type GetReTweetsCountEvent = GetLikesCountEvent

GetReTweetsCountEvent defines model for GetReTweetsCountEvent.

type GetReplyEvent

type GetReplyEvent struct {
	ReplyId domain.ID `json:"reply_id"`
	RootId  domain.ID `json:"root_id"`
	UserId  domain.ID `json:"user_id"`
}

GetReplyEvent defines model for GetReplyEvent.

type GetRetweetersResponse

type GetRetweetersResponse = UsersResponse

GetRetweetersResponse defines model for GetRetweetersResponse.

type GetTimelineEvent

type GetTimelineEvent = GetAllTweetsEvent

GetTimelineEvent defines model for GetTimelineEvent.

type GetTweetEvent

type GetTweetEvent struct {
	TweetId domain.ID `json:"tweet_id"`
	UserId  domain.ID `json:"user_id"`
}

GetTweetEvent defines model for GetTweetEvent.

type GetTweetLikersEvent added in v0.7.26

type GetTweetLikersEvent struct {
	TweetId     domain.ID `json:"tweet_id"`
	OwnerUserId domain.ID `json:"owner_user_id"`
	Cursor      *string   `json:"cursor,omitempty"`
	Limit       *uint64   `json:"limit,omitempty"`
}

GetTweetLikersEvent defines model for GetTweetLikersEvent.

type GetTweetRetweetersEvent added in v0.7.26

type GetTweetRetweetersEvent = GetTweetLikersEvent

GetTweetRetweetersEvent defines model for GetTweetRetweetersEvent.

type GetTweetStatsEvent

type GetTweetStatsEvent struct {
	TweetId domain.ID `json:"tweet_id"`
	UserId  domain.ID `json:"user_id"`
}

type GetUserEvent

type GetUserEvent struct {
	UserId domain.ID `json:"user_id"`
}

GetUserEvent defines model for GetUserEvent.

type IDsResponse

type IDsResponse struct {
	Cursor string      `json:"cursor"`
	Users  []domain.ID `json:"users"`
}

type ImportTweetEvent added in v0.7.206

type ImportTweetEvent struct {
	Id        string   `json:"id"`
	Text      string   `json:"text"`
	CreatedAt string   `json:"created_at"`
	Images    []string `json:"images,omitempty"`
}

ImportTweetEvent defines model for ImportTweetEvent.

One pre-parsed original tweet streamed from the business browser dashboard. The browser unzips and filters the X archive client-side (dropping retweets, replies, GIFs and videos) and streams only the kept tweets, so the node never buffers the whole archive. Images are raw base64 of the still photos (at most four), without a data-URL prefix.

type ImportTwitterArchiveResponse added in v0.7.194

type ImportTwitterArchiveResponse struct {
	ImportedTweets int `json:"imported_tweets"`
	ImportedImages int `json:"imported_images"`
	SkippedTweets  int `json:"skipped_tweets"`
}

ImportTwitterArchiveResponse defines model for ImportTwitterArchiveResponse.

type IsFollowerResponse added in v0.5.83

type IsFollowerResponse struct {
	IsFollower bool `json:"is_follower"`
}

type IsFollowingResponse added in v0.5.83

type IsFollowingResponse struct {
	IsFollowing bool `json:"is_following"`
}

type LikeEvent

type LikeEvent struct {
	TweetId domain.ID `json:"tweet_id"`
	UserId  domain.ID `json:"user_id"`
	OwnerId domain.ID `json:"owner_id"`
}

LikeEvent defines model for LikeEvent.

type LikesCountResponse

type LikesCountResponse struct {
	Count uint64 `json:"count"`
}

LikesCountResponse defines model for LikesCountResponse.

type LoginEvent

type LoginEvent struct {
	Password string `json:"password"` //nolint:gosec
	Username string `json:"username"`
}

LoginEvent defines model for LoginEvent.

type LoginResponse

type LoginResponse = domain.AuthNodeInfo

LoginResponse defines model for LoginResponse.

type LogoutEvent

type LogoutEvent struct {
	Token string `json:"token"`
}

LogoutEvent defines model for LogoutEvent.

type MarkNotificationReadEvent added in v0.7.26

type MarkNotificationReadEvent struct {
	NotificationId domain.ID `json:"notification_id"`
}

MarkNotificationReadEvent flips a single notification's read flag.

type Message

type Message struct {
	Body        json.RawMessage `json:"body"`
	MessageId   domain.ID       `json:"message_id"`
	NodeId      domain.ID       `json:"node_id"`
	Destination string          `json:"path"` // TODO change to 'destination'
	Timestamp   time.Time       `json:"timestamp"`
	Version     string          `json:"version"`
	Signature   string          `json:"signature"`
}

Message defines model for Message.

type MessageBody

type MessageBody any

MessageBody defines model for Message.Body.

type ModerationEvent added in v0.3.129

type ModerationEvent struct {
	NodeID   domain.ID                   `json:"node_id"`
	UserID   domain.ID                   `json:"user_id"`
	Type     domain.ModerationObjectType `json:"type"`
	ObjectID *domain.ID                  `json:"object_id,omitempty"`
}

type ModerationResultEvent added in v0.3.129

type ModerationResultEvent struct {
	Type     domain.ModerationObjectType `json:"type"`
	Result   domain.ModerationResult     `json:"result"`
	Reason   *string                     `json:"reason,omitempty"`
	Model    domain.ModelType            `json:"model"`
	UserID   domain.ID                   `json:"user_id"`
	ObjectID *domain.ID                  `json:"object_id,omitempty"`
	// ModeratorID is the peer id of the moderator that issued this
	// verdict. Carried inside the payload (rather than read from the
	// stream connection) because the verdict reaches the receiver via
	// pubsub → SelfStream, and the loopback connection's RemotePeer
	// would be the local node, not the moderator.
	ModeratorID domain.ID `json:"moderator_id,omitempty"`
}

type MuteEvent added in v0.7.26

type MuteEvent struct {
	MuterId domain.ID `json:"muter_id"`
	MuteeId domain.ID `json:"mutee_id"`
}

MuteEvent defines model for MuteEvent.

type NewChatEvent

type NewChatEvent struct {
	ChatId      *domain.ID `json:"chat_id,omitempty"`
	OtherUserId domain.ID  `json:"other_user_id"`
	OwnerId     domain.ID  `json:"owner_id"`
}

NewChatEvent defines model for NewChatEvent.

type NewFilterEvent added in v0.7.26

type NewFilterEvent = domain.Filter

NewFilterEvent defines model for NewFilterEvent.

type NewFollowEvent

type NewFollowEvent = struct {
	FollowerId  domain.ID `json:"follower_id"`
	FollowingId domain.ID `json:"following_id"`
}

NewFollowEvent defines model for NewFollowEvent.

type NewMessageEvent

type NewMessageEvent = domain.ChatMessage

NewMessageEvent defines model for NewMessageEvent.

type NewMessageResponse

type NewMessageResponse = domain.ChatMessage

NewMessageResponse defines model for NewMessageResponse.

type NewReplyEvent

type NewReplyEvent struct {
	CreatedAt    time.Time  `json:"created_at"`
	Id           domain.ID  `json:"id"`
	ParentId     *domain.ID `json:"parent_id,omitempty"`
	ParentUserId domain.ID  `json:"parent_user_id"`
	RootId       domain.ID  `json:"root_id"`
	Text         string     `json:"text"`
	UserId       domain.ID  `json:"user_id"`
	Username     string     `json:"username"`
}

NewReplyEvent defines model for NewReplyEvent.

ParentId is the parent TWEET id this reply is attached to (nil/empty means the reply hangs directly off RootId). ParentUserId is the user id of the parent tweet's author — that's the routing key the server uses to forward the request to the right node when the parent tweet lives on a remote peer.

type NewReplyResponse

type NewReplyResponse = domain.Tweet

NewReplyResponse defines model for NewReplyResponse.

type NewRetweetEvent

type NewRetweetEvent = domain.Tweet

NewRetweetEvent defines model for NewRetweetEvent.

type NewTweetEvent

type NewTweetEvent = domain.Tweet

NewTweetEvent defines model for NewTweetEvent.

type NewUnfollowEvent

type NewUnfollowEvent = NewFollowEvent

NewUnfollowEvent defines model for NewUnfollowEvent.

type NewUserEvent

type NewUserEvent = domain.User

NewUserEvent defines model for NewUserEvent.

type Owner

type Owner = domain.Owner

Owner defines model for Owner.

type PinTweetEvent added in v0.7.26

type PinTweetEvent struct {
	UserId  domain.ID `json:"user_id"`
	TweetId domain.ID `json:"tweet_id"`
}

PinTweetEvent defines model for PinTweetEvent.

type ReTweetsCountResponse

type ReTweetsCountResponse = LikesCountResponse

ReTweetsCountResponse defines model for ReTweetsCountResponse.

type RepliesResponse

type RepliesResponse struct {
	Cursor  string             `json:"cursor"`
	Replies []domain.ReplyNode `json:"replies"`
	UserId  *domain.ID         `json:"user_id,omitempty"`
}

RepliesResponse defines model for RepliesTreeResponse.

type ReportEvent added in v0.7.59

type ReportEvent struct {
	Type         domain.ModerationObjectType `json:"type"`
	TargetUserID domain.ID                   `json:"target_user_id"`
	TargetNodeID domain.ID                   `json:"target_node_id"`
	ObjectID     *domain.ID                  `json:"object_id,omitempty"`
	Reason       string                      `json:"reason"`
}

ReportEvent is published by a member node on the reports pubsub topic when a user clicks Report in the UI. It carries enough for a moderator to fetch the actual offending content (TargetNodeID is a routing hint so the moderator can hit the owner's node directly instead of looking it up via PUBLIC_GET_USER).

ObjectID is the tweet id for Type == ModerationTweetType and is nil when Type == ModerationUserType (the user itself is the target).

type ResponseError added in v0.5.140

type ResponseError struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

ErrorResponse defines model for ErrorResponse.

func (ResponseError) Error added in v0.5.140

func (e ResponseError) Error() string

type SearchUsersEvent added in v0.7.26

type SearchUsersEvent struct {
	Query  string  `json:"query"`
	Cursor *string `json:"cursor,omitempty"`
	Limit  *uint64 `json:"limit,omitempty"`
}

SearchUsersEvent defines model for SearchUsersEvent.

type SearchUsersResponse added in v0.7.26

type SearchUsersResponse = UsersResponse

SearchUsersResponse defines model for SearchUsersResponse.

type SubscribeUserEvent added in v0.7.26

type SubscribeUserEvent struct {
	SelfId   domain.ID `json:"self_id"`
	TargetId domain.ID `json:"target_id"`
}

SubscribeUserEvent defines model for SubscribeUserEvent.

type TweetStatsResponse

type TweetStatsResponse struct {
	TweetId       domain.ID `json:"tweet_id"`
	RetweetsCount uint64    `json:"retweets_count"`
	LikeCount     uint64    `json:"likes_count"`
	RepliesCount  uint64    `json:"replies_count"`
	ViewsCount    uint64    `json:"views_count"`
}

type TweetsResponse

type TweetsResponse struct {
	Cursor string         `json:"cursor"`
	Tweets []domain.Tweet `json:"tweets"`
	UserId domain.ID      `json:"user_id"`
}

TweetsResponse defines model for TweetsResponse.

type UnblockEvent added in v0.7.26

type UnblockEvent = BlockEvent

UnblockEvent defines model for UnblockEvent.

type UnbookmarkEvent added in v0.7.26

type UnbookmarkEvent struct {
	UserId  domain.ID `json:"user_id"`
	TweetId domain.ID `json:"tweet_id"`
}

UnbookmarkEvent defines model for UnbookmarkEvent.

type UnlikeEvent

type UnlikeEvent = LikeEvent

UnlikeEvent defines model for UnlikeEvent.

type UnmuteEvent added in v0.7.26

type UnmuteEvent = MuteEvent

UnmuteEvent defines model for UnmuteEvent.

type UnpinTweetEvent added in v0.7.26

type UnpinTweetEvent = PinTweetEvent

UnpinTweetEvent defines model for UnpinTweetEvent.

type UnretweetEvent

type UnretweetEvent struct {
	TweetId     domain.ID `json:"tweet_id"`
	RetweeterId domain.ID `json:"retweeter_id"`
}

UnretweetEvent defines model for UnretweetEvent.

type UnsubscribeUserEvent added in v0.7.26

type UnsubscribeUserEvent = SubscribeUserEvent

UnsubscribeUserEvent defines model for UnsubscribeUserEvent.

type UpdateFilterEvent added in v0.7.26

type UpdateFilterEvent = domain.Filter

UpdateFilterEvent defines model for UpdateFilterEvent.

type UpdateFilterKeywordEvent added in v0.7.26

type UpdateFilterKeywordEvent struct {
	UserId    domain.ID `json:"user_id"`
	KeywordId domain.ID `json:"keyword_id"`
	Keyword   string    `json:"keyword"`
	WholeWord bool      `json:"whole_word"`
}

UpdateFilterKeywordEvent defines model for UpdateFilterKeywordEvent.

type UpdateMediaMetaEvent added in v0.7.26

type UpdateMediaMetaEvent struct {
	UserId      domain.ID `json:"user_id"`
	Key         string    `json:"key"`
	Description string    `json:"description"`
	FocusX      float32   `json:"focus_x"`
	FocusY      float32   `json:"focus_y"`
}

UpdateMediaMetaEvent defines model for UpdateMediaMetaEvent.

type UploadImageEvent

type UploadImageEvent struct {
	// Image mime type + "," + base64
	Image1 string `json:"image1"`
	Image2 string `json:"image2"`
	Image3 string `json:"image3"`
	Image4 string `json:"image4"`
}

type UploadImageResponse

type UploadImageResponse struct {
	Key1 string `json:"key1"`
	Key2 string `json:"key2"`
	Key3 string `json:"key3"`
	Key4 string `json:"key4"`
}

type UsersResponse

type UsersResponse struct {
	Cursor string        `json:"cursor"`
	Users  []domain.User `json:"users"`
}

UsersResponse defines model for UsersResponse.

type ValidationEvent added in v0.3.75

type ValidationEvent struct {
	ValidatedNodeID domain.ID      `json:"validated_node_id"`
	SelfHashHex     string         `json:"self_hash_hex"`
	Challenge       ChallengeEvent `json:"challenge"`
	User            *domain.User   `json:"user"`
}

type ValidationResult added in v0.3.75

type ValidationResult int
const (
	Invalid ValidationResult = iota
	Valid
)

func (ValidationResult) String added in v0.3.141

func (vr ValidationResult) String() string

type ValidationResultEvent added in v0.3.116

type ValidationResultEvent struct {
	Result      ValidationResult `json:"result"`
	Reason      *string          `json:"reason,omitempty"`
	ValidatedID domain.ID        `json:"validated_id"`
	ValidatorID domain.ID        `json:"validator_id"`
}

type ViewEvent added in v0.6.316

type ViewEvent struct {
	TweetId  domain.ID `json:"tweet_id"`
	UserId   domain.ID `json:"user_id"`
	ViewerId domain.ID `json:"viewer_id"`
}

ViewEvent defines model for ViewEvent. UserId is the tweet author's id; ViewerId is the viewer's id.

type ViewsCountResponse added in v0.6.316

type ViewsCountResponse = LikesCountResponse

ViewsCountResponse defines model for ViewsCountResponse.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL