diff --git a/types/types.go b/types/types.go index 126e549..4920a1a 100644 --- a/types/types.go +++ b/types/types.go @@ -1,6 +1,7 @@ package types import ( + "encoding/json" "fmt" "net/http" ) @@ -27,6 +28,6 @@ func (le LemmyError) Error() string { } type LemmyWebSocketMsg struct { - Op UserOperation `json:"op"` - Data any `json:"data"` + Op UserOperation `json:"op"` + Data json.RawMessage `json:"data"` } diff --git a/types/websocket.go b/types/websocket.go new file mode 100644 index 0000000..8536f9b --- /dev/null +++ b/types/websocket.go @@ -0,0 +1,37 @@ +package types + +type UserJoin struct { + Auth string `json:"auth"` +} + +type UserJoinResponse struct { + Joined bool `json:"joined"` + LemmyResponse +} + +type CommunityJoin struct { + CommunityID int `json:"community_id"` +} + +type CommunityJoinResponse struct { + Joined bool `json:"joined"` + LemmyResponse +} + +type ModJoin struct { + CommunityID int `json:"community_id"` +} + +type ModJoinResponse struct { + Joined bool `json:"joined"` + LemmyResponse +} + +type PostJoin struct { + PostID int `json:"post_id"` +} + +type PostJoinResponse struct { + Joined bool `json:"joined"` + LemmyResponse +}