event

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2025 License: AGPL-3.0, AGPL-3.0-or-later Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Accepted            acceptedResponse = `{"code":0,"message":"Accepted"}`
	InternalRoutePrefix                  = "/internal"
)
View Source
const (
	// admin
	PUBLIC_POST_NODE_VALIDATION_RESULT = "/public/post/admin/validate/result/0.0.0"
	PUBLIC_POST_NODE_CHALLENGE         = "/public/post/admin/challenge/0.0.0"
	PRIVATE_POST_PAIR                  = "/private/post/admin/pair/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"
	// 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_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_USER         = "/private/post/user/0.0.0"
	PUBLIC_DELETE_REPLY       = "/public/delete/reply/0.0.0"
	PUBLIC_GET_FOLLOWEES      = "/public/get/followees/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_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"
	PRIVATE_POST_UPLOAD_IMAGE = "/private/post/image/0.0.0"
	PUBLIC_GET_IMAGE          = "/public/get/image/0.0.0"
)
View Source
const (
	INTERNAL_POST_NODE_VALIDATE = "/internal/post/admin/validate/0.0.0"
	INTERNAL_POST_MODERATE      = "/internal/post/moderate/0.0.0"
)

internal handlers

Variables

This section is empty.

Functions

This section is empty.

Types

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   string               `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 string        `json:"user_id"`
}

ChatsResponse defines model for ChatsResponse.

type DeleteChatEvent

type DeleteChatEvent struct {
	ChatId string `json:"chat_id"`
}

DeleteChatEvent defines model for DeleteChatEvent.

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 ErrorEvent

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

ErrorEvent defines model for ErrorEvent.

type ErrorResponse

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

ErrorResponse defines model for ErrorResponse.

func (ErrorResponse) Error

func (e ErrorResponse) Error() string

type FolloweesResponse

type FolloweesResponse struct {
	Cursor    string             `json:"cursor"`
	Followees []domain.Following `json:"followees"`
	Follower  string             `json:"follower"`
}

FolloweesResponse defines model for FolloweesResponse.

type FollowersResponse

type FollowersResponse struct {
	Cursor    string             `json:"cursor"`
	Followee  string             `json:"followee"`
	Followers []domain.Following `json:"followers"`
}

FollowersResponse defines model for FollowersResponse.

type GetAllChatsEvent

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

GetAllChatsEvent defines model for GetAllChatsEvent.

type GetAllMessagesEvent

type GetAllMessagesEvent struct {
	ChatId string  `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 string  `json:"parent_id"`
	RootId   string  `json:"root_id"`
}

GetAllRepliesEvent defines model for GetAllRepliesEvent.

type GetAllTweetsEvent

type GetAllTweetsEvent struct {
	Cursor *string `json:"cursor,omitempty"`
	Limit  *uint64 `json:"limit,omitempty"`
	UserId string  `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 string `json:"user_id"`
}

GetAllUsersEvent defines model for GetAllUsersEvent.

type GetChallengeEvent added in v0.2.476

type GetChallengeEvent 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 GetChallengeResponse added in v0.2.476

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

type GetChatEvent

type GetChatEvent struct {
	ChatId string `json:"chat_id"`
}

GetChatEvent defines model for GetChatEvent.

type GetChatResponse

type GetChatResponse = domain.Chat

type GetFolloweesEvent

type GetFolloweesEvent = GetFollowersEvent

GetFolloweesEvent defines model for GetFolloweesEvent.

type GetFollowersEvent

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

GetFollowersEvent defines model for GetFollowersEvent.

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 GetLikersResponse

type GetLikersResponse = UsersResponse

GetLikersResponse defines model for GetLikersResponse.

type GetLikesCountEvent

type GetLikesCountEvent struct {
	TweetId string `json:"tweet_id"`
}

GetLikesCountEvent defines model for GetLikesCountEvent.

type GetMessageEvent

type GetMessageEvent struct {
	ChatId string `json:"chat_id"`
	Id     string `json:"id"`
}

GetMessageEvent defines model for GetMessageEvent.

type GetReTweetsCountEvent

type GetReTweetsCountEvent = GetLikesCountEvent

GetReTweetsCountEvent defines model for GetReTweetsCountEvent.

type GetReactorsEvent

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

GetLikersEvent defines model for GetLikersEvent.

type GetReplyEvent

type GetReplyEvent struct {
	ReplyId string `json:"reply_id"`
	RootId  string `json:"root_id"`
	UserId  string `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 string `json:"tweet_id"`
	UserId  string `json:"user_id"`
}

GetTweetEvent defines model for GetTweetEvent.

type GetTweetStatsEvent

type GetTweetStatsEvent struct {
	TweetId string `json:"tweet_id"`
	UserId  string `json:"user_id"`
}

type GetUserEvent

type GetUserEvent struct {
	UserId string `json:"user_id"`
}

GetUserEvent defines model for GetUserEvent.

type ID

type ID = string

type IDsResponse

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

type LikeEvent

type LikeEvent struct {
	TweetId string `json:"tweet_id"`
	UserId  string `json:"user_id"`
	OwnerId string `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"`
	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 Message

type Message struct {
	Body        json.RawMessage `json:"body"`
	MessageId   string          `json:"message_id"`
	NodeId      string          `json:"node_id"`
	Destination string          `json:"path"` // TODO change to 'destination'
	Timestamp   time.Time       `json:"timestamp,omitempty"`
	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   string               `json:"node_id"`
	UserID   string               `json:"user_id"`
	Type     ModerationObjectType `json:"type"`
	ObjectID *string              `json:"object_id,omitempty"`
}

type ModerationObjectType added in v0.3.129

type ModerationObjectType int
const (
	User ModerationObjectType = iota
	Tweet
	Reply
	Image
)

type ModerationResult added in v0.3.129

type ModerationResult bool

func (ModerationResult) String added in v0.3.147

func (mr ModerationResult) String() string

type ModerationResultEvent added in v0.3.129

type ModerationResultEvent struct {
	Type     ModerationObjectType `json:"type"`
	Result   ModerationResult     `json:"result"`
	Reason   *string              `json:"reason,omitempty"`
	NodeID   string               `json:"node_id"`
	UserID   string               `json:"user_id"`
	ObjectID *string              `json:"object_id,omitempty"`
}

type NewChatEvent

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

NewChatEvent defines model for NewChatEvent.

type NewFollowEvent

type NewFollowEvent = domain.Following

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           string    `json:"id"`
	ParentId     *string   `json:"parent_id,omitempty"`
	ParentUserId string    `json:"parent_user_id"`
	RootId       string    `json:"root_id"`
	Text         string    `json:"text"`
	UserId       string    `json:"user_id"`
	Username     string    `json:"username"`
}

NewReplyEvent defines model for NewReplyEvent.

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 = domain.Following

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 ReTweetsCountResponse

type ReTweetsCountResponse = LikesCountResponse

ReTweetsCountResponse defines model for ReTweetsCountResponse.

type RepliesResponse

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

RepliesResponse defines model for RepliesTreeResponse.

type TweetStatsResponse

type TweetStatsResponse struct {
	TweetId       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 string         `json:"user_id"`
}

TweetsResponse defines model for TweetsResponse.

type UnlikeEvent

type UnlikeEvent = LikeEvent

UnlikeEvent defines model for UnlikeEvent.

type UnretweetEvent

type UnretweetEvent struct {
	TweetId     string `json:"tweet_id"`
	RetweeterId string `json:"retweeter_id"`
}

UnretweetEvent defines model for UnretweetEvent.

type UploadImageEvent

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

type UploadImageResponse

type UploadImageResponse struct {
	Key string `json:"key"`
}

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 string       `json:"validated_node_id"`
	SelfHashHex     string       `json:"self_hash_hex"`
	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 string           `json:"validated_id"`
	ValidatorID string           `json:"validator_id"`
}

Jump to

Keyboard shortcuts

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