Add WebSocket types
This commit is contained in:
parent
6023806f7b
commit
20d99cc702
@ -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"`
|
||||
}
|
||||
|
37
types/websocket.go
Normal file
37
types/websocket.go
Normal file
@ -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
|
||||
}
|
Loading…
Reference in New Issue
Block a user