dispatch/server/json.go

132 lines
2.6 KiB
Go
Raw Normal View History

package server
2015-01-17 01:37:21 +00:00
import (
"encoding/json"
2015-12-11 03:35:48 +00:00
"github.com/khlieng/dispatch/storage"
2015-01-17 01:37:21 +00:00
)
type WSRequest struct {
2015-06-16 22:46:58 +00:00
Type string `json:"type"`
Data json.RawMessage `json:"data"`
2015-01-17 01:37:21 +00:00
}
type WSResponse struct {
2015-06-16 22:46:58 +00:00
Type string `json:"type"`
Data interface{} `json:"data"`
2015-01-17 01:37:21 +00:00
}
type Connect struct {
Name string `json:"name"`
2015-01-17 01:37:21 +00:00
Server string `json:"server"`
TLS bool `json:"tls"`
Password string `json:"password"`
2015-01-17 01:37:21 +00:00
Nick string `json:"nick"`
Username string `json:"username"`
Realname string `json:"realname"`
2015-01-17 01:37:21 +00:00
}
type Nick struct {
Server string `json:"server"`
Old string `json:"old"`
New string `json:"new"`
}
2015-01-17 01:37:21 +00:00
type Join struct {
Server string `json:"server"`
User string `json:"user"`
Channels []string `json:"channels"`
}
type Part struct {
Join
Reason string `json:"reason,omitempty"`
}
type Mode struct {
Server string `json:"server"`
Channel string `json:"channel"`
User string `json:"user"`
Add string `json:"add"`
Remove string `json:"remove"`
}
type Quit struct {
Server string `json:"server"`
User string `json:"user"`
Reason string `json:"reason,omitempty"`
}
2015-01-17 01:37:21 +00:00
type Chat struct {
Server string `json:"server"`
From string `json:"from"`
To string `json:"to,omitempty"`
2015-01-17 01:37:21 +00:00
Message string `json:"message"`
}
type Topic struct {
Server string `json:"server"`
Channel string `json:"channel"`
Topic string `json:"topic"`
}
type Userlist struct {
Server string `json:"server"`
Channel string `json:"channel"`
Users []string `json:"users"`
}
type MOTD struct {
Server string `json:"server"`
Title string `json:"title"`
Content []string `json:"content"`
2015-01-17 01:37:21 +00:00
}
type Invite struct {
Server string `json:"server"`
Channel string `json:"channel"`
User string `json:"user"`
}
type Kick struct {
Server string `json:"server"`
Channel string `json:"channel"`
User string `json:"user"`
}
type Whois struct {
Server string `json:"server"`
User string `json:"user"`
}
type WhoisReply struct {
Nick string `json:"nick"`
Username string `json:"username"`
Host string `json:"host"`
Realname string `json:"realname"`
Server string `json:"server"`
Channels []string `json:"channels"`
}
2015-02-21 12:06:05 +00:00
type Away struct {
Server string `json:"server"`
Message string `json:"message"`
}
type SearchRequest struct {
Server string `json:"server"`
Channel string `json:"channel"`
Phrase string `json:"phrase"`
}
type SearchResult struct {
Server string `json:"server"`
Channel string `json:"channel"`
Results []storage.Message `json:"results"`
}
type Error struct {
Server string `json:"server"`
Message string `json:"message"`
}