Add WebSocket types
This commit is contained in:
parent
6023806f7b
commit
20d99cc702
@ -1,6 +1,7 @@
|
|||||||
package types
|
package types
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
)
|
)
|
||||||
@ -28,5 +29,5 @@ func (le LemmyError) Error() string {
|
|||||||
|
|
||||||
type LemmyWebSocketMsg struct {
|
type LemmyWebSocketMsg struct {
|
||||||
Op UserOperation `json:"op"`
|
Op UserOperation `json:"op"`
|
||||||
Data any `json:"data"`
|
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