From a33491b5cc24f35d67bb377af7ecdd8b84397f10 Mon Sep 17 00:00:00 2001
From: Ilya Beltsiukou <968597@gmail.com>
Date: Thu, 25 Mar 2021 14:19:01 +0300
Subject: [PATCH] Added gitignore rules. Changed http methods from string to
constants. Added easyjson for faster marshall/unmarshall json. Added constant
fot message types
---
.gitignore | 6 +
client.go | 118 +-
client_test.go | 10 +-
events.go | 34 +-
events_test.go | 4 +-
go.mod | 2 +
identifier.go | 31 +
message.go | 14 +
requests.go | 10 +
requests_easyjson.go | 1341 +++++++++++++++
responses.go | 27 +
responses_easyjson.go | 3582 +++++++++++++++++++++++++++++++++++++++++
12 files changed, 5109 insertions(+), 70 deletions(-)
create mode 100644 message.go
create mode 100644 requests_easyjson.go
create mode 100644 responses_easyjson.go
diff --git a/.gitignore b/.gitignore
index 0dd5628..e341b7a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -26,3 +26,9 @@ _testmain.go
# test editor files
*.swp
+
+# Jetbrains ide files
+.idea
+
+# VsCode files
+.vscode
diff --git a/client.go b/client.go
index d0bb0c5..0561630 100644
--- a/client.go
+++ b/client.go
@@ -187,16 +187,30 @@ func (cli *Client) StopSync() {
func (cli *Client) MakeRequest(method string, httpURL string, reqBody interface{}, resBody interface{}) error {
var req *http.Request
var err error
+ var body io.Reader = nil
+
if reqBody != nil {
buf := new(bytes.Buffer)
- if err := json.NewEncoder(buf).Encode(reqBody); err != nil {
- return err
+ if marshaller, ok := reqBody.(json.Marshaler); ok {
+ var data []byte
+ data, err = marshaller.MarshalJSON()
+ if err != nil {
+ return err
+ }
+ _, err = buf.Write(data)
+ if err != nil {
+ return err
+ }
+ } else {
+ if err = json.NewEncoder(buf).Encode(reqBody); err != nil {
+ return err
+ }
}
- req, err = http.NewRequest(method, httpURL, buf)
- } else {
- req, err = http.NewRequest(method, httpURL, nil)
+ body = buf
}
+ req, err = http.NewRequest(method, httpURL, body)
+
if err != nil {
return err
}
@@ -242,6 +256,18 @@ func (cli *Client) MakeRequest(method string, httpURL string, reqBody interface{
}
if resBody != nil && res.Body != nil {
+ if unmarshaller, ok := resBody.(json.Unmarshaler); ok {
+ var data []byte
+ data, err = ioutil.ReadAll(res.Body)
+ if err != nil {
+ return err
+ }
+ err = unmarshaller.UnmarshalJSON(data)
+ if err != nil {
+ return err
+ }
+ return nil
+ }
return json.NewDecoder(res.Body).Decode(&resBody)
}
@@ -251,7 +277,7 @@ func (cli *Client) MakeRequest(method string, httpURL string, reqBody interface{
// CreateFilter makes an HTTP request according to http://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-user-userid-filter
func (cli *Client) CreateFilter(filter json.RawMessage) (resp *RespCreateFilter, err error) {
urlPath := cli.BuildURL("user", cli.UserID, "filter")
- err = cli.MakeRequest("POST", urlPath, &filter, &resp)
+ err = cli.MakeRequest(http.MethodPost, urlPath, &filter, &resp)
return
}
@@ -273,12 +299,12 @@ func (cli *Client) SyncRequest(timeout int, since, filterID string, fullState bo
query["full_state"] = "true"
}
urlPath := cli.BuildURLWithQuery([]string{"sync"}, query)
- err = cli.MakeRequest("GET", urlPath, nil, &resp)
+ err = cli.MakeRequest(http.MethodGet, urlPath, nil, &resp)
return
}
func (cli *Client) register(u string, req *ReqRegister) (resp *RespRegister, uiaResp *RespUserInteractive, err error) {
- err = cli.MakeRequest("POST", u, req, &resp)
+ err = cli.MakeRequest(http.MethodPost, u, req, &resp)
if err != nil {
httpErr, ok := err.(HTTPError)
if !ok { // network error
@@ -353,7 +379,7 @@ func (cli *Client) RegisterDummy(req *ReqRegister) (*RespRegister, error) {
// This does not set credentials on this client instance. See SetCredentials() instead.
func (cli *Client) Login(req *ReqLogin) (resp *RespLogin, err error) {
urlPath := cli.BuildURL("login")
- err = cli.MakeRequest("POST", urlPath, req, &resp)
+ err = cli.MakeRequest(http.MethodPost, urlPath, req, &resp)
return
}
@@ -361,7 +387,7 @@ func (cli *Client) Login(req *ReqLogin) (resp *RespLogin, err error) {
// This does not clear the credentials from the client instance. See ClearCredentials() instead.
func (cli *Client) Logout() (resp *RespLogout, err error) {
urlPath := cli.BuildURL("logout")
- err = cli.MakeRequest("POST", urlPath, nil, &resp)
+ err = cli.MakeRequest(http.MethodPost, urlPath, nil, &resp)
return
}
@@ -369,14 +395,14 @@ func (cli *Client) Logout() (resp *RespLogout, err error) {
// This does not clear the credentials from the client instance. See ClearCredentails() instead.
func (cli *Client) LogoutAll() (resp *RespLogoutAll, err error) {
urlPath := cli.BuildURL("logout/all")
- err = cli.MakeRequest("POST", urlPath, nil, &resp)
+ err = cli.MakeRequest(http.MethodPost, urlPath, nil, &resp)
return
}
// Versions returns the list of supported Matrix versions on this homeserver. See http://matrix.org/docs/spec/client_server/r0.2.0.html#get-matrix-client-versions
func (cli *Client) Versions() (resp *RespVersions, err error) {
urlPath := cli.BuildBaseURL("_matrix", "client", "versions")
- err = cli.MakeRequest("GET", urlPath, nil, &resp)
+ err = cli.MakeRequest(http.MethodGet, urlPath, nil, &resp)
return
}
@@ -395,7 +421,7 @@ func (cli *Client) PublicRooms(limit int, since string, server string) (resp *Re
}
urlPath := cli.BuildURLWithQuery([]string{"publicRooms"}, args)
- err = cli.MakeRequest("GET", urlPath, nil, &resp)
+ err = cli.MakeRequest(http.MethodGet, urlPath, nil, &resp)
return
}
@@ -423,7 +449,7 @@ func (cli *Client) PublicRoomsFiltered(limit int, since string, server string, f
})
}
- err = cli.MakeRequest("POST", urlPath, content, &resp)
+ err = cli.MakeRequest(http.MethodPost, urlPath, content, &resp)
return
}
@@ -440,21 +466,21 @@ func (cli *Client) JoinRoom(roomIDorAlias, serverName string, content interface{
} else {
urlPath = cli.BuildURL("join", roomIDorAlias)
}
- err = cli.MakeRequest("POST", urlPath, content, &resp)
+ err = cli.MakeRequest(http.MethodPost, urlPath, content, &resp)
return
}
// GetDisplayName returns the display name of the user from the specified MXID. See https://matrix.org/docs/spec/client_server/r0.2.0.html#get-matrix-client-r0-profile-userid-displayname
func (cli *Client) GetDisplayName(mxid string) (resp *RespUserDisplayName, err error) {
urlPath := cli.BuildURL("profile", mxid, "displayname")
- err = cli.MakeRequest("GET", urlPath, nil, &resp)
+ err = cli.MakeRequest(http.MethodGet, urlPath, nil, &resp)
return
}
// GetOwnDisplayName returns the user's display name. See https://matrix.org/docs/spec/client_server/r0.2.0.html#get-matrix-client-r0-profile-userid-displayname
func (cli *Client) GetOwnDisplayName() (resp *RespUserDisplayName, err error) {
urlPath := cli.BuildURL("profile", cli.UserID, "displayname")
- err = cli.MakeRequest("GET", urlPath, nil, &resp)
+ err = cli.MakeRequest(http.MethodGet, urlPath, nil, &resp)
return
}
@@ -464,7 +490,7 @@ func (cli *Client) SetDisplayName(displayName string) (err error) {
s := struct {
DisplayName string `json:"displayname"`
}{displayName}
- err = cli.MakeRequest("PUT", urlPath, &s, nil)
+ err = cli.MakeRequest(http.MethodPut, urlPath, &s, nil)
return
}
@@ -475,7 +501,7 @@ func (cli *Client) GetAvatarURL() (string, error) {
AvatarURL string `json:"avatar_url"`
}{}
- err := cli.MakeRequest("GET", urlPath, nil, &s)
+ err := cli.MakeRequest(http.MethodGet, urlPath, nil, &s)
if err != nil {
return "", err
}
@@ -489,7 +515,7 @@ func (cli *Client) SetAvatarURL(url string) error {
s := struct {
AvatarURL string `json:"avatar_url"`
}{url}
- err := cli.MakeRequest("PUT", urlPath, &s, nil)
+ err := cli.MakeRequest(http.MethodPut, urlPath, &s, nil)
if err != nil {
return err
}
@@ -500,7 +526,7 @@ func (cli *Client) SetAvatarURL(url string) error {
// GetStatus returns the status of the user from the specified MXID. See https://matrix.org/docs/spec/client_server/r0.6.0#get-matrix-client-r0-presence-userid-status
func (cli *Client) GetStatus(mxid string) (resp *RespUserStatus, err error) {
urlPath := cli.BuildURL("presence", mxid, "status")
- err = cli.MakeRequest("GET", urlPath, nil, &resp)
+ err = cli.MakeRequest(http.MethodGet, urlPath, nil, &resp)
return
}
@@ -516,7 +542,7 @@ func (cli *Client) SetStatus(presence, status string) (err error) {
Presence string `json:"presence"`
StatusMsg string `json:"status_msg"`
}{presence, status}
- err = cli.MakeRequest("PUT", urlPath, &s, nil)
+ err = cli.MakeRequest(http.MethodPut, urlPath, &s, nil)
return
}
@@ -525,7 +551,7 @@ func (cli *Client) SetStatus(presence, status string) (err error) {
func (cli *Client) SendMessageEvent(roomID string, eventType string, contentJSON interface{}) (resp *RespSendEvent, err error) {
txnID := txnID()
urlPath := cli.BuildURL("rooms", roomID, "send", eventType, txnID)
- err = cli.MakeRequest("PUT", urlPath, contentJSON, &resp)
+ err = cli.MakeRequest(http.MethodPut, urlPath, contentJSON, &resp)
return
}
@@ -533,7 +559,7 @@ func (cli *Client) SendMessageEvent(roomID string, eventType string, contentJSON
// contentJSON should be a pointer to something that can be encoded as JSON using json.Marshal.
func (cli *Client) SendStateEvent(roomID, eventType, stateKey string, contentJSON interface{}) (resp *RespSendEvent, err error) {
urlPath := cli.BuildURL("rooms", roomID, "state", eventType, stateKey)
- err = cli.MakeRequest("PUT", urlPath, contentJSON, &resp)
+ err = cli.MakeRequest(http.MethodPut, urlPath, contentJSON, &resp)
return
}
@@ -541,14 +567,14 @@ func (cli *Client) SendStateEvent(roomID, eventType, stateKey string, contentJSO
// See http://matrix.org/docs/spec/client_server/r0.2.0.html#m-text
func (cli *Client) SendText(roomID, text string) (*RespSendEvent, error) {
return cli.SendMessageEvent(roomID, "m.room.message",
- TextMessage{MsgType: "m.text", Body: text})
+ TextMessage{MsgType: TextMessageType, Body: text})
}
// SendFormattedText sends an m.room.message event into the given room with a msgtype of m.text, supports a subset of HTML for formatting.
// See https://matrix.org/docs/spec/client_server/r0.6.0#m-text
func (cli *Client) SendFormattedText(roomID, text, formattedText string) (*RespSendEvent, error) {
return cli.SendMessageEvent(roomID, "m.room.message",
- TextMessage{MsgType: "m.text", Body: text, FormattedBody: formattedText, Format: "org.matrix.custom.html"})
+ TextMessage{MsgType: TextMessageType, Body: text, FormattedBody: formattedText, Format: "org.matrix.custom.html"})
}
// SendImage sends an m.room.message event into the given room with a msgtype of m.image
@@ -556,7 +582,7 @@ func (cli *Client) SendFormattedText(roomID, text, formattedText string) (*RespS
func (cli *Client) SendImage(roomID, body, url string) (*RespSendEvent, error) {
return cli.SendMessageEvent(roomID, "m.room.message",
ImageMessage{
- MsgType: "m.image",
+ MsgType: ImageMessageType,
Body: body,
URL: url,
})
@@ -567,7 +593,7 @@ func (cli *Client) SendImage(roomID, body, url string) (*RespSendEvent, error) {
func (cli *Client) SendVideo(roomID, body, url string) (*RespSendEvent, error) {
return cli.SendMessageEvent(roomID, "m.room.message",
VideoMessage{
- MsgType: "m.video",
+ MsgType: VideoMessageType,
Body: body,
URL: url,
})
@@ -577,21 +603,21 @@ func (cli *Client) SendVideo(roomID, body, url string) (*RespSendEvent, error) {
// See http://matrix.org/docs/spec/client_server/r0.2.0.html#m-notice
func (cli *Client) SendNotice(roomID, text string) (*RespSendEvent, error) {
return cli.SendMessageEvent(roomID, "m.room.message",
- TextMessage{MsgType: "m.notice", Body: text})
+ TextMessage{MsgType: NoticeMessageType, Body: text})
}
// RedactEvent redacts the given event. See http://matrix.org/docs/spec/client_server/r0.2.0.html#put-matrix-client-r0-rooms-roomid-redact-eventid-txnid
func (cli *Client) RedactEvent(roomID, eventID string, req *ReqRedact) (resp *RespSendEvent, err error) {
txnID := txnID()
urlPath := cli.BuildURL("rooms", roomID, "redact", eventID, txnID)
- err = cli.MakeRequest("PUT", urlPath, req, &resp)
+ err = cli.MakeRequest(http.MethodPut, urlPath, req, &resp)
return
}
// MarkRead marks eventID in roomID as read, signifying the event, and all before it have been read. See https://matrix.org/docs/spec/client_server/r0.6.0#post-matrix-client-r0-rooms-roomid-receipt-receipttype-eventid
func (cli *Client) MarkRead(roomID, eventID string) error {
urlPath := cli.BuildURL("rooms", roomID, "receipt", "m.read", eventID)
- return cli.MakeRequest("POST", urlPath, nil, nil)
+ return cli.MakeRequest(http.MethodPost, urlPath, nil, nil)
}
// CreateRoom creates a new Matrix room. See https://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-createroom
@@ -601,56 +627,56 @@ func (cli *Client) MarkRead(roomID, eventID string) error {
// fmt.Println("Room:", resp.RoomID)
func (cli *Client) CreateRoom(req *ReqCreateRoom) (resp *RespCreateRoom, err error) {
urlPath := cli.BuildURL("createRoom")
- err = cli.MakeRequest("POST", urlPath, req, &resp)
+ err = cli.MakeRequest(http.MethodPost, urlPath, req, &resp)
return
}
// LeaveRoom leaves the given room. See http://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-rooms-roomid-leave
func (cli *Client) LeaveRoom(roomID string) (resp *RespLeaveRoom, err error) {
u := cli.BuildURL("rooms", roomID, "leave")
- err = cli.MakeRequest("POST", u, struct{}{}, &resp)
+ err = cli.MakeRequest(http.MethodPost, u, struct{}{}, &resp)
return
}
// ForgetRoom forgets a room entirely. See http://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-rooms-roomid-forget
func (cli *Client) ForgetRoom(roomID string) (resp *RespForgetRoom, err error) {
u := cli.BuildURL("rooms", roomID, "forget")
- err = cli.MakeRequest("POST", u, struct{}{}, &resp)
+ err = cli.MakeRequest(http.MethodPost, u, struct{}{}, &resp)
return
}
// InviteUser invites a user to a room. See http://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-rooms-roomid-invite
func (cli *Client) InviteUser(roomID string, req *ReqInviteUser) (resp *RespInviteUser, err error) {
u := cli.BuildURL("rooms", roomID, "invite")
- err = cli.MakeRequest("POST", u, req, &resp)
+ err = cli.MakeRequest(http.MethodPost, u, req, &resp)
return
}
// InviteUserByThirdParty invites a third-party identifier to a room. See http://matrix.org/docs/spec/client_server/r0.2.0.html#invite-by-third-party-id-endpoint
func (cli *Client) InviteUserByThirdParty(roomID string, req *ReqInvite3PID) (resp *RespInviteUser, err error) {
u := cli.BuildURL("rooms", roomID, "invite")
- err = cli.MakeRequest("POST", u, req, &resp)
+ err = cli.MakeRequest(http.MethodPost, u, req, &resp)
return
}
// KickUser kicks a user from a room. See http://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-rooms-roomid-kick
func (cli *Client) KickUser(roomID string, req *ReqKickUser) (resp *RespKickUser, err error) {
u := cli.BuildURL("rooms", roomID, "kick")
- err = cli.MakeRequest("POST", u, req, &resp)
+ err = cli.MakeRequest(http.MethodPost, u, req, &resp)
return
}
// BanUser bans a user from a room. See http://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-rooms-roomid-ban
func (cli *Client) BanUser(roomID string, req *ReqBanUser) (resp *RespBanUser, err error) {
u := cli.BuildURL("rooms", roomID, "ban")
- err = cli.MakeRequest("POST", u, req, &resp)
+ err = cli.MakeRequest(http.MethodPost, u, req, &resp)
return
}
// UnbanUser unbans a user from a room. See http://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-rooms-roomid-unban
func (cli *Client) UnbanUser(roomID string, req *ReqUnbanUser) (resp *RespUnbanUser, err error) {
u := cli.BuildURL("rooms", roomID, "unban")
- err = cli.MakeRequest("POST", u, req, &resp)
+ err = cli.MakeRequest(http.MethodPost, u, req, &resp)
return
}
@@ -658,7 +684,7 @@ func (cli *Client) UnbanUser(roomID string, req *ReqUnbanUser) (resp *RespUnbanU
func (cli *Client) UserTyping(roomID string, typing bool, timeout int64) (resp *RespTyping, err error) {
req := ReqTyping{Typing: typing, Timeout: timeout}
u := cli.BuildURL("rooms", roomID, "typing", cli.UserID)
- err = cli.MakeRequest("PUT", u, req, &resp)
+ err = cli.MakeRequest(http.MethodPut, u, req, &resp)
return
}
@@ -667,7 +693,7 @@ func (cli *Client) UserTyping(roomID string, typing bool, timeout int64) (resp *
// See http://matrix.org/docs/spec/client_server/r0.2.0.html#get-matrix-client-r0-rooms-roomid-state-eventtype-statekey
func (cli *Client) StateEvent(roomID, eventType, stateKey string, outContent interface{}) (err error) {
u := cli.BuildURL("rooms", roomID, "state", eventType, stateKey)
- err = cli.MakeRequest("GET", u, nil, outContent)
+ err = cli.MakeRequest(http.MethodGet, u, nil, outContent)
return
}
@@ -686,7 +712,7 @@ func (cli *Client) UploadLink(link string) (*RespMediaUpload, error) {
// UploadToContentRepo uploads the given bytes to the content repository and returns an MXC URI.
// See http://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-media-r0-upload
func (cli *Client) UploadToContentRepo(content io.Reader, contentType string, contentLength int64) (*RespMediaUpload, error) {
- req, err := http.NewRequest("POST", cli.BuildBaseURL("_matrix/media/r0/upload"), content)
+ req, err := http.NewRequest(http.MethodPost, cli.BuildBaseURL("_matrix/media/r0/upload"), content)
if err != nil {
return nil, err
}
@@ -734,7 +760,7 @@ func (cli *Client) UploadToContentRepo(content io.Reader, contentType string, co
// This API is primarily designed for application services which may want to efficiently look up joined members in a room.
func (cli *Client) JoinedMembers(roomID string) (resp *RespJoinedMembers, err error) {
u := cli.BuildURL("rooms", roomID, "joined_members")
- err = cli.MakeRequest("GET", u, nil, &resp)
+ err = cli.MakeRequest(http.MethodGet, u, nil, &resp)
return
}
@@ -744,7 +770,7 @@ func (cli *Client) JoinedMembers(roomID string) (resp *RespJoinedMembers, err er
// This API is primarily designed for application services which may want to efficiently look up joined rooms.
func (cli *Client) JoinedRooms() (resp *RespJoinedRooms, err error) {
u := cli.BuildURL("joined_rooms")
- err = cli.MakeRequest("GET", u, nil, &resp)
+ err = cli.MakeRequest(http.MethodGet, u, nil, &resp)
return
}
@@ -764,7 +790,7 @@ func (cli *Client) Messages(roomID, from, to string, dir rune, limit int) (resp
}
urlPath := cli.BuildURLWithQuery([]string{"rooms", roomID, "messages"}, query)
- err = cli.MakeRequest("GET", urlPath, nil, &resp)
+ err = cli.MakeRequest(http.MethodGet, urlPath, nil, &resp)
return
}
@@ -772,7 +798,7 @@ func (cli *Client) Messages(roomID, from, to string, dir rune, limit int) (resp
// See http://matrix.org/docs/spec/client_server/r0.2.0.html#get-matrix-client-r0-voip-turnserver
func (cli *Client) TurnServer() (resp *RespTurnServer, err error) {
urlPath := cli.BuildURL("voip", "turnServer")
- err = cli.MakeRequest("GET", urlPath, nil, &resp)
+ err = cli.MakeRequest(http.MethodGet, urlPath, nil, &resp)
return
}
diff --git a/client_test.go b/client_test.go
index 5b323f8..a572bc7 100644
--- a/client_test.go
+++ b/client_test.go
@@ -10,7 +10,7 @@ import (
func TestClient_LeaveRoom(t *testing.T) {
cli := mockClient(func(req *http.Request) (*http.Response, error) {
- if req.Method == "POST" && req.URL.Path == "/_matrix/client/r0/rooms/!foo:bar/leave" {
+ if req.Method == http.MethodPost && req.URL.Path == "/_matrix/client/r0/rooms/!foo:bar/leave" {
return &http.Response{
StatusCode: 200,
Body: ioutil.NopCloser(bytes.NewBufferString(`{}`)),
@@ -26,7 +26,7 @@ func TestClient_LeaveRoom(t *testing.T) {
func TestClient_GetAvatarUrl(t *testing.T) {
cli := mockClient(func(req *http.Request) (*http.Response, error) {
- if req.Method == "GET" && req.URL.Path == "/_matrix/client/r0/profile/@user:test.gomatrix.org/avatar_url" {
+ if req.Method == http.MethodGet && req.URL.Path == "/_matrix/client/r0/profile/@user:test.gomatrix.org/avatar_url" {
return &http.Response{
StatusCode: 200,
Body: ioutil.NopCloser(bytes.NewBufferString(`{"avatar_url":"mxc://matrix.org/iJaUjkshgdfsdkjfn"}`)),
@@ -47,7 +47,7 @@ func TestClient_GetAvatarUrl(t *testing.T) {
func TestClient_SetAvatarUrl(t *testing.T) {
cli := mockClient(func(req *http.Request) (*http.Response, error) {
- if req.Method == "PUT" && req.URL.Path == "/_matrix/client/r0/profile/@user:test.gomatrix.org/avatar_url" {
+ if req.Method == http.MethodPut && req.URL.Path == "/_matrix/client/r0/profile/@user:test.gomatrix.org/avatar_url" {
return &http.Response{
StatusCode: 200,
Body: ioutil.NopCloser(bytes.NewBufferString(`{}`)),
@@ -63,7 +63,7 @@ func TestClient_SetAvatarUrl(t *testing.T) {
func TestClient_StateEvent(t *testing.T) {
cli := mockClient(func(req *http.Request) (*http.Response, error) {
- if req.Method == "GET" && req.URL.Path == "/_matrix/client/r0/rooms/!foo:bar/state/m.room.name" {
+ if req.Method == http.MethodGet && req.URL.Path == "/_matrix/client/r0/rooms/!foo:bar/state/m.room.name" {
return &http.Response{
StatusCode: 200,
Body: ioutil.NopCloser(bytes.NewBufferString(`{"name":"Room Name Goes Here"}`)),
@@ -86,7 +86,7 @@ func TestClient_StateEvent(t *testing.T) {
func TestClient_PublicRooms(t *testing.T) {
cli := mockClient(func(req *http.Request) (*http.Response, error) {
- if req.Method == "GET" && req.URL.Path == "/_matrix/client/r0/publicRooms" {
+ if req.Method == http.MethodGet && req.URL.Path == "/_matrix/client/r0/publicRooms" {
return &http.Response{
StatusCode: 200,
Body: ioutil.NopCloser(bytes.NewBufferString(`{
diff --git a/events.go b/events.go
index cbc70a8..2aab842 100644
--- a/events.go
+++ b/events.go
@@ -43,10 +43,10 @@ func (event *Event) MessageType() (msgtype string, ok bool) {
// TextMessage is the contents of a Matrix formated message event.
type TextMessage struct {
- MsgType string `json:"msgtype"`
- Body string `json:"body"`
- FormattedBody string `json:"formatted_body"`
- Format string `json:"format"`
+ MsgType MessageType `json:"msgtype"`
+ Body string `json:"body"`
+ FormattedBody string `json:"formatted_body"`
+ Format string `json:"format"`
}
// ThumbnailInfo contains info about an thumbnail image - http://matrix.org/docs/spec/client_server/r0.2.0.html#m-image
@@ -80,26 +80,26 @@ type VideoInfo struct {
// VideoMessage is an m.video - http://matrix.org/docs/spec/client_server/r0.2.0.html#m-video
type VideoMessage struct {
- MsgType string `json:"msgtype"`
- Body string `json:"body"`
- URL string `json:"url"`
- Info VideoInfo `json:"info"`
+ MsgType MessageType `json:"msgtype"`
+ Body string `json:"body"`
+ URL string `json:"url"`
+ Info VideoInfo `json:"info"`
}
// ImageMessage is an m.image event
type ImageMessage struct {
- MsgType string `json:"msgtype"`
- Body string `json:"body"`
- URL string `json:"url"`
- Info ImageInfo `json:"info"`
+ MsgType MessageType `json:"msgtype"`
+ Body string `json:"body"`
+ URL string `json:"url"`
+ Info ImageInfo `json:"info"`
}
// An HTMLMessage is the contents of a Matrix HTML formated message event.
type HTMLMessage struct {
- Body string `json:"body"`
- MsgType string `json:"msgtype"`
- Format string `json:"format"`
- FormattedBody string `json:"formatted_body"`
+ Body string `json:"body"`
+ MsgType MessageType `json:"msgtype"`
+ Format string `json:"format"`
+ FormattedBody string `json:"formatted_body"`
}
// FileInfo contains info about an file - http://matrix.org/docs/spec/client_server/r0.2.0.html#m-file
@@ -147,7 +147,7 @@ var htmlRegex = regexp.MustCompile("<[^<]+?>")
// GetHTMLMessage returns an HTMLMessage with the body set to a stripped version of the provided HTML, in addition
// to the provided HTML.
-func GetHTMLMessage(msgtype, htmlText string) HTMLMessage {
+func GetHTMLMessage(msgtype MessageType, htmlText string) HTMLMessage {
return HTMLMessage{
Body: html.UnescapeString(htmlRegex.ReplaceAllLiteralString(htmlText, "")),
MsgType: msgtype,
diff --git a/events_test.go b/events_test.go
index 3ac5cca..8f38ea4 100644
--- a/events_test.go
+++ b/events_test.go
@@ -94,14 +94,14 @@ func TestEventWithoutMessageType(t *testing.T) {
var testHTML = `
`
func TestGetHTMLMessage(t *testing.T) {
- msg := GetHTMLMessage("m.text", testHTML)
+ msg := GetHTMLMessage(TextMessageType, testHTML)
if expected := "abcdefghijklmnopqrs"; msg.Body != expected {
t.Fatalf("TestGetHTMLMessage: got '%s', expected '%s'", msg.Body, expected)
}
if msg.FormattedBody != testHTML {
t.Fatalf("TestGetHTMLMessage: got '%s', expected '%s'", msg.FormattedBody, testHTML)
}
- if msg.MsgType != "m.text" {
+ if msg.MsgType != TextMessageType {
t.Fatalf("TestGetHTMLMessage: got '%s', expected 'm.text'", msg.FormattedBody)
}
if expected := "org.matrix.custom.html"; msg.Format != expected {
diff --git a/go.mod b/go.mod
index 18e69bf..f55983f 100644
--- a/go.mod
+++ b/go.mod
@@ -1,3 +1,5 @@
module github.com/matrix-org/gomatrix
go 1.12
+
+require github.com/mailru/easyjson v0.7.7 // indirect
diff --git a/identifier.go b/identifier.go
index 4a61d08..c12cd8a 100644
--- a/identifier.go
+++ b/identifier.go
@@ -1,7 +1,14 @@
package gomatrix
+import (
+ "github.com/mailru/easyjson"
+ "github.com/mailru/easyjson/jlexer"
+ "github.com/mailru/easyjson/jwriter"
+)
+
// Identifier is the interface for https://matrix.org/docs/spec/client_server/r0.6.0#identifier-types
type Identifier interface {
+ easyjson.MarshalerUnmarshaler
// Returns the identifier type
// https://matrix.org/docs/spec/client_server/r0.6.0#identifier-types
Type() string
@@ -18,6 +25,14 @@ func (i UserIdentifier) Type() string {
return "m.id.user"
}
+func (i UserIdentifier) MarshalEasyJSON(w *jwriter.Writer) {
+ w.String(i.IDType)
+}
+
+func (i UserIdentifier) UnmarshalEasyJSON(w *jlexer.Lexer) {
+ i.IDType = w.String()
+}
+
// NewUserIdentifier creates a new UserIdentifier with IDType set to "m.id.user"
func NewUserIdentifier(user string) UserIdentifier {
return UserIdentifier{
@@ -38,6 +53,14 @@ func (i ThirdpartyIdentifier) Type() string {
return "m.id.thirdparty"
}
+func (i ThirdpartyIdentifier) MarshalEasyJSON(w *jwriter.Writer) {
+ w.String(i.IDType)
+}
+
+func (i ThirdpartyIdentifier) UnmarshalEasyJSON(w *jlexer.Lexer) {
+ i.IDType = w.String()
+}
+
// NewThirdpartyIdentifier creates a new UserIdentifier with IDType set to "m.id.user"
func NewThirdpartyIdentifier(medium, address string) ThirdpartyIdentifier {
return ThirdpartyIdentifier{
@@ -59,6 +82,14 @@ func (i PhoneIdentifier) Type() string {
return "m.id.phone"
}
+func (i PhoneIdentifier) MarshalEasyJSON(w *jwriter.Writer) {
+ w.String(i.IDType)
+}
+
+func (i PhoneIdentifier) UnmarshalEasyJSON(w *jlexer.Lexer) {
+ i.IDType = w.String()
+}
+
// NewPhoneIdentifier creates a new UserIdentifier with IDType set to "m.id.user"
func NewPhoneIdentifier(country, phone string) PhoneIdentifier {
return PhoneIdentifier{
diff --git a/message.go b/message.go
new file mode 100644
index 0000000..f47feb4
--- /dev/null
+++ b/message.go
@@ -0,0 +1,14 @@
+package gomatrix
+
+type MessageType string
+
+const (
+ TextMessageType MessageType = "m.text"
+ EmoteMessageType MessageType = "m.emote"
+ NoticeMessageType MessageType = "m.notice"
+ ImageMessageType MessageType = "m.image"
+ FileMessageType MessageType = "m.file"
+ AudioMessageType MessageType = "m.audio"
+ LocationMessageType MessageType = "m.location"
+ VideoMessageType MessageType = "m.video"
+)
diff --git a/requests.go b/requests.go
index 31c426d..290abae 100644
--- a/requests.go
+++ b/requests.go
@@ -1,6 +1,7 @@
package gomatrix
// ReqRegister is the JSON request for http://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-register
+//easyjson:json
type ReqRegister struct {
Username string `json:"username,omitempty"`
BindEmail bool `json:"bind_email,omitempty"`
@@ -11,6 +12,7 @@ type ReqRegister struct {
}
// ReqLogin is the JSON request for http://matrix.org/docs/spec/client_server/r0.6.0.html#post-matrix-client-r0-login
+//easyjson:json
type ReqLogin struct {
Type string `json:"type"`
Identifier Identifier `json:"identifier,omitempty"`
@@ -24,6 +26,7 @@ type ReqLogin struct {
}
// ReqCreateRoom is the JSON request for https://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-createroom
+//easyjson:json
type ReqCreateRoom struct {
Visibility string `json:"visibility,omitempty"`
RoomAliasName string `json:"room_alias_name,omitempty"`
@@ -38,12 +41,14 @@ type ReqCreateRoom struct {
}
// ReqRedact is the JSON request for http://matrix.org/docs/spec/client_server/r0.2.0.html#put-matrix-client-r0-rooms-roomid-redact-eventid-txnid
+//easyjson:json
type ReqRedact struct {
Reason string `json:"reason,omitempty"`
}
// ReqInvite3PID is the JSON request for https://matrix.org/docs/spec/client_server/r0.2.0.html#id57
// It is also a JSON object used in https://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-createroom
+//easyjson:json
type ReqInvite3PID struct {
IDServer string `json:"id_server"`
Medium string `json:"medium"`
@@ -51,28 +56,33 @@ type ReqInvite3PID struct {
}
// ReqInviteUser is the JSON request for http://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-rooms-roomid-invite
+//easyjson:json
type ReqInviteUser struct {
UserID string `json:"user_id"`
}
// ReqKickUser is the JSON request for http://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-rooms-roomid-kick
+//easyjson:json
type ReqKickUser struct {
Reason string `json:"reason,omitempty"`
UserID string `json:"user_id"`
}
// ReqBanUser is the JSON request for http://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-rooms-roomid-ban
+//easyjson:json
type ReqBanUser struct {
Reason string `json:"reason,omitempty"`
UserID string `json:"user_id"`
}
// ReqUnbanUser is the JSON request for http://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-rooms-roomid-unban
+//easyjson:json
type ReqUnbanUser struct {
UserID string `json:"user_id"`
}
// ReqTyping is the JSON request for https://matrix.org/docs/spec/client_server/r0.2.0.html#put-matrix-client-r0-rooms-roomid-typing-userid
+//easyjson:json
type ReqTyping struct {
Typing bool `json:"typing"`
Timeout int64 `json:"timeout"`
diff --git a/requests_easyjson.go b/requests_easyjson.go
new file mode 100644
index 0000000..23232b6
--- /dev/null
+++ b/requests_easyjson.go
@@ -0,0 +1,1341 @@
+// Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
+
+package gomatrix
+
+import (
+ json "encoding/json"
+ easyjson "github.com/mailru/easyjson"
+ jlexer "github.com/mailru/easyjson/jlexer"
+ jwriter "github.com/mailru/easyjson/jwriter"
+)
+
+// suppress unused package warning
+var (
+ _ *json.RawMessage
+ _ *jlexer.Lexer
+ _ *jwriter.Writer
+ _ easyjson.Marshaler
+)
+
+func easyjson11d1a9baDecodeGithubComMatrixOrgGomatrix(in *jlexer.Lexer, out *ReqUnbanUser) {
+ isTopLevel := in.IsStart()
+ if in.IsNull() {
+ if isTopLevel {
+ in.Consumed()
+ }
+ in.Skip()
+ return
+ }
+ in.Delim('{')
+ for !in.IsDelim('}') {
+ key := in.UnsafeFieldName(false)
+ in.WantColon()
+ if in.IsNull() {
+ in.Skip()
+ in.WantComma()
+ continue
+ }
+ switch key {
+ case "user_id":
+ out.UserID = string(in.String())
+ default:
+ in.SkipRecursive()
+ }
+ in.WantComma()
+ }
+ in.Delim('}')
+ if isTopLevel {
+ in.Consumed()
+ }
+}
+func easyjson11d1a9baEncodeGithubComMatrixOrgGomatrix(out *jwriter.Writer, in ReqUnbanUser) {
+ out.RawByte('{')
+ first := true
+ _ = first
+ {
+ const prefix string = ",\"user_id\":"
+ out.RawString(prefix[1:])
+ out.String(string(in.UserID))
+ }
+ out.RawByte('}')
+}
+
+// MarshalJSON supports json.Marshaler interface
+func (v ReqUnbanUser) MarshalJSON() ([]byte, error) {
+ w := jwriter.Writer{}
+ easyjson11d1a9baEncodeGithubComMatrixOrgGomatrix(&w, v)
+ return w.Buffer.BuildBytes(), w.Error
+}
+
+// MarshalEasyJSON supports easyjson.Marshaler interface
+func (v ReqUnbanUser) MarshalEasyJSON(w *jwriter.Writer) {
+ easyjson11d1a9baEncodeGithubComMatrixOrgGomatrix(w, v)
+}
+
+// UnmarshalJSON supports json.Unmarshaler interface
+func (v *ReqUnbanUser) UnmarshalJSON(data []byte) error {
+ r := jlexer.Lexer{Data: data}
+ easyjson11d1a9baDecodeGithubComMatrixOrgGomatrix(&r, v)
+ return r.Error()
+}
+
+// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
+func (v *ReqUnbanUser) UnmarshalEasyJSON(l *jlexer.Lexer) {
+ easyjson11d1a9baDecodeGithubComMatrixOrgGomatrix(l, v)
+}
+func easyjson11d1a9baDecodeGithubComMatrixOrgGomatrix1(in *jlexer.Lexer, out *ReqTyping) {
+ isTopLevel := in.IsStart()
+ if in.IsNull() {
+ if isTopLevel {
+ in.Consumed()
+ }
+ in.Skip()
+ return
+ }
+ in.Delim('{')
+ for !in.IsDelim('}') {
+ key := in.UnsafeFieldName(false)
+ in.WantColon()
+ if in.IsNull() {
+ in.Skip()
+ in.WantComma()
+ continue
+ }
+ switch key {
+ case "typing":
+ out.Typing = bool(in.Bool())
+ case "timeout":
+ out.Timeout = int64(in.Int64())
+ default:
+ in.SkipRecursive()
+ }
+ in.WantComma()
+ }
+ in.Delim('}')
+ if isTopLevel {
+ in.Consumed()
+ }
+}
+func easyjson11d1a9baEncodeGithubComMatrixOrgGomatrix1(out *jwriter.Writer, in ReqTyping) {
+ out.RawByte('{')
+ first := true
+ _ = first
+ {
+ const prefix string = ",\"typing\":"
+ out.RawString(prefix[1:])
+ out.Bool(bool(in.Typing))
+ }
+ {
+ const prefix string = ",\"timeout\":"
+ out.RawString(prefix)
+ out.Int64(int64(in.Timeout))
+ }
+ out.RawByte('}')
+}
+
+// MarshalJSON supports json.Marshaler interface
+func (v ReqTyping) MarshalJSON() ([]byte, error) {
+ w := jwriter.Writer{}
+ easyjson11d1a9baEncodeGithubComMatrixOrgGomatrix1(&w, v)
+ return w.Buffer.BuildBytes(), w.Error
+}
+
+// MarshalEasyJSON supports easyjson.Marshaler interface
+func (v ReqTyping) MarshalEasyJSON(w *jwriter.Writer) {
+ easyjson11d1a9baEncodeGithubComMatrixOrgGomatrix1(w, v)
+}
+
+// UnmarshalJSON supports json.Unmarshaler interface
+func (v *ReqTyping) UnmarshalJSON(data []byte) error {
+ r := jlexer.Lexer{Data: data}
+ easyjson11d1a9baDecodeGithubComMatrixOrgGomatrix1(&r, v)
+ return r.Error()
+}
+
+// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
+func (v *ReqTyping) UnmarshalEasyJSON(l *jlexer.Lexer) {
+ easyjson11d1a9baDecodeGithubComMatrixOrgGomatrix1(l, v)
+}
+func easyjson11d1a9baDecodeGithubComMatrixOrgGomatrix2(in *jlexer.Lexer, out *ReqRegister) {
+ isTopLevel := in.IsStart()
+ if in.IsNull() {
+ if isTopLevel {
+ in.Consumed()
+ }
+ in.Skip()
+ return
+ }
+ in.Delim('{')
+ for !in.IsDelim('}') {
+ key := in.UnsafeFieldName(false)
+ in.WantColon()
+ if in.IsNull() {
+ in.Skip()
+ in.WantComma()
+ continue
+ }
+ switch key {
+ case "username":
+ out.Username = string(in.String())
+ case "bind_email":
+ out.BindEmail = bool(in.Bool())
+ case "password":
+ out.Password = string(in.String())
+ case "device_id":
+ out.DeviceID = string(in.String())
+ case "initial_device_display_name":
+ out.InitialDeviceDisplayName = string(in.String())
+ case "auth":
+ if m, ok := out.Auth.(easyjson.Unmarshaler); ok {
+ m.UnmarshalEasyJSON(in)
+ } else if m, ok := out.Auth.(json.Unmarshaler); ok {
+ _ = m.UnmarshalJSON(in.Raw())
+ } else {
+ out.Auth = in.Interface()
+ }
+ default:
+ in.SkipRecursive()
+ }
+ in.WantComma()
+ }
+ in.Delim('}')
+ if isTopLevel {
+ in.Consumed()
+ }
+}
+func easyjson11d1a9baEncodeGithubComMatrixOrgGomatrix2(out *jwriter.Writer, in ReqRegister) {
+ out.RawByte('{')
+ first := true
+ _ = first
+ if in.Username != "" {
+ const prefix string = ",\"username\":"
+ first = false
+ out.RawString(prefix[1:])
+ out.String(string(in.Username))
+ }
+ if in.BindEmail {
+ const prefix string = ",\"bind_email\":"
+ if first {
+ first = false
+ out.RawString(prefix[1:])
+ } else {
+ out.RawString(prefix)
+ }
+ out.Bool(bool(in.BindEmail))
+ }
+ if in.Password != "" {
+ const prefix string = ",\"password\":"
+ if first {
+ first = false
+ out.RawString(prefix[1:])
+ } else {
+ out.RawString(prefix)
+ }
+ out.String(string(in.Password))
+ }
+ if in.DeviceID != "" {
+ const prefix string = ",\"device_id\":"
+ if first {
+ first = false
+ out.RawString(prefix[1:])
+ } else {
+ out.RawString(prefix)
+ }
+ out.String(string(in.DeviceID))
+ }
+ {
+ const prefix string = ",\"initial_device_display_name\":"
+ if first {
+ first = false
+ out.RawString(prefix[1:])
+ } else {
+ out.RawString(prefix)
+ }
+ out.String(string(in.InitialDeviceDisplayName))
+ }
+ if in.Auth != nil {
+ const prefix string = ",\"auth\":"
+ out.RawString(prefix)
+ if m, ok := in.Auth.(easyjson.Marshaler); ok {
+ m.MarshalEasyJSON(out)
+ } else if m, ok := in.Auth.(json.Marshaler); ok {
+ out.Raw(m.MarshalJSON())
+ } else {
+ out.Raw(json.Marshal(in.Auth))
+ }
+ }
+ out.RawByte('}')
+}
+
+// MarshalJSON supports json.Marshaler interface
+func (v ReqRegister) MarshalJSON() ([]byte, error) {
+ w := jwriter.Writer{}
+ easyjson11d1a9baEncodeGithubComMatrixOrgGomatrix2(&w, v)
+ return w.Buffer.BuildBytes(), w.Error
+}
+
+// MarshalEasyJSON supports easyjson.Marshaler interface
+func (v ReqRegister) MarshalEasyJSON(w *jwriter.Writer) {
+ easyjson11d1a9baEncodeGithubComMatrixOrgGomatrix2(w, v)
+}
+
+// UnmarshalJSON supports json.Unmarshaler interface
+func (v *ReqRegister) UnmarshalJSON(data []byte) error {
+ r := jlexer.Lexer{Data: data}
+ easyjson11d1a9baDecodeGithubComMatrixOrgGomatrix2(&r, v)
+ return r.Error()
+}
+
+// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
+func (v *ReqRegister) UnmarshalEasyJSON(l *jlexer.Lexer) {
+ easyjson11d1a9baDecodeGithubComMatrixOrgGomatrix2(l, v)
+}
+func easyjson11d1a9baDecodeGithubComMatrixOrgGomatrix3(in *jlexer.Lexer, out *ReqRedact) {
+ isTopLevel := in.IsStart()
+ if in.IsNull() {
+ if isTopLevel {
+ in.Consumed()
+ }
+ in.Skip()
+ return
+ }
+ in.Delim('{')
+ for !in.IsDelim('}') {
+ key := in.UnsafeFieldName(false)
+ in.WantColon()
+ if in.IsNull() {
+ in.Skip()
+ in.WantComma()
+ continue
+ }
+ switch key {
+ case "reason":
+ out.Reason = string(in.String())
+ default:
+ in.SkipRecursive()
+ }
+ in.WantComma()
+ }
+ in.Delim('}')
+ if isTopLevel {
+ in.Consumed()
+ }
+}
+func easyjson11d1a9baEncodeGithubComMatrixOrgGomatrix3(out *jwriter.Writer, in ReqRedact) {
+ out.RawByte('{')
+ first := true
+ _ = first
+ if in.Reason != "" {
+ const prefix string = ",\"reason\":"
+ first = false
+ out.RawString(prefix[1:])
+ out.String(string(in.Reason))
+ }
+ out.RawByte('}')
+}
+
+// MarshalJSON supports json.Marshaler interface
+func (v ReqRedact) MarshalJSON() ([]byte, error) {
+ w := jwriter.Writer{}
+ easyjson11d1a9baEncodeGithubComMatrixOrgGomatrix3(&w, v)
+ return w.Buffer.BuildBytes(), w.Error
+}
+
+// MarshalEasyJSON supports easyjson.Marshaler interface
+func (v ReqRedact) MarshalEasyJSON(w *jwriter.Writer) {
+ easyjson11d1a9baEncodeGithubComMatrixOrgGomatrix3(w, v)
+}
+
+// UnmarshalJSON supports json.Unmarshaler interface
+func (v *ReqRedact) UnmarshalJSON(data []byte) error {
+ r := jlexer.Lexer{Data: data}
+ easyjson11d1a9baDecodeGithubComMatrixOrgGomatrix3(&r, v)
+ return r.Error()
+}
+
+// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
+func (v *ReqRedact) UnmarshalEasyJSON(l *jlexer.Lexer) {
+ easyjson11d1a9baDecodeGithubComMatrixOrgGomatrix3(l, v)
+}
+func easyjson11d1a9baDecodeGithubComMatrixOrgGomatrix4(in *jlexer.Lexer, out *ReqLogin) {
+ isTopLevel := in.IsStart()
+ if in.IsNull() {
+ if isTopLevel {
+ in.Consumed()
+ }
+ in.Skip()
+ return
+ }
+ in.Delim('{')
+ for !in.IsDelim('}') {
+ key := in.UnsafeFieldName(false)
+ in.WantColon()
+ if in.IsNull() {
+ in.Skip()
+ in.WantComma()
+ continue
+ }
+ switch key {
+ case "type":
+ out.Type = string(in.String())
+ case "identifier":
+ out.Identifier.UnmarshalEasyJSON(in)
+ case "password":
+ out.Password = string(in.String())
+ case "medium":
+ out.Medium = string(in.String())
+ case "user":
+ out.User = string(in.String())
+ case "address":
+ out.Address = string(in.String())
+ case "token":
+ out.Token = string(in.String())
+ case "device_id":
+ out.DeviceID = string(in.String())
+ case "initial_device_display_name":
+ out.InitialDeviceDisplayName = string(in.String())
+ default:
+ in.SkipRecursive()
+ }
+ in.WantComma()
+ }
+ in.Delim('}')
+ if isTopLevel {
+ in.Consumed()
+ }
+}
+func easyjson11d1a9baEncodeGithubComMatrixOrgGomatrix4(out *jwriter.Writer, in ReqLogin) {
+ out.RawByte('{')
+ first := true
+ _ = first
+ {
+ const prefix string = ",\"type\":"
+ out.RawString(prefix[1:])
+ out.String(string(in.Type))
+ }
+ if in.Identifier != nil {
+ const prefix string = ",\"identifier\":"
+ out.RawString(prefix)
+ in.Identifier.MarshalEasyJSON(out)
+ }
+ if in.Password != "" {
+ const prefix string = ",\"password\":"
+ out.RawString(prefix)
+ out.String(string(in.Password))
+ }
+ if in.Medium != "" {
+ const prefix string = ",\"medium\":"
+ out.RawString(prefix)
+ out.String(string(in.Medium))
+ }
+ if in.User != "" {
+ const prefix string = ",\"user\":"
+ out.RawString(prefix)
+ out.String(string(in.User))
+ }
+ if in.Address != "" {
+ const prefix string = ",\"address\":"
+ out.RawString(prefix)
+ out.String(string(in.Address))
+ }
+ if in.Token != "" {
+ const prefix string = ",\"token\":"
+ out.RawString(prefix)
+ out.String(string(in.Token))
+ }
+ if in.DeviceID != "" {
+ const prefix string = ",\"device_id\":"
+ out.RawString(prefix)
+ out.String(string(in.DeviceID))
+ }
+ if in.InitialDeviceDisplayName != "" {
+ const prefix string = ",\"initial_device_display_name\":"
+ out.RawString(prefix)
+ out.String(string(in.InitialDeviceDisplayName))
+ }
+ out.RawByte('}')
+}
+
+// MarshalJSON supports json.Marshaler interface
+func (v ReqLogin) MarshalJSON() ([]byte, error) {
+ w := jwriter.Writer{}
+ easyjson11d1a9baEncodeGithubComMatrixOrgGomatrix4(&w, v)
+ return w.Buffer.BuildBytes(), w.Error
+}
+
+// MarshalEasyJSON supports easyjson.Marshaler interface
+func (v ReqLogin) MarshalEasyJSON(w *jwriter.Writer) {
+ easyjson11d1a9baEncodeGithubComMatrixOrgGomatrix4(w, v)
+}
+
+// UnmarshalJSON supports json.Unmarshaler interface
+func (v *ReqLogin) UnmarshalJSON(data []byte) error {
+ r := jlexer.Lexer{Data: data}
+ easyjson11d1a9baDecodeGithubComMatrixOrgGomatrix4(&r, v)
+ return r.Error()
+}
+
+// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
+func (v *ReqLogin) UnmarshalEasyJSON(l *jlexer.Lexer) {
+ easyjson11d1a9baDecodeGithubComMatrixOrgGomatrix4(l, v)
+}
+func easyjson11d1a9baDecodeGithubComMatrixOrgGomatrix5(in *jlexer.Lexer, out *ReqKickUser) {
+ isTopLevel := in.IsStart()
+ if in.IsNull() {
+ if isTopLevel {
+ in.Consumed()
+ }
+ in.Skip()
+ return
+ }
+ in.Delim('{')
+ for !in.IsDelim('}') {
+ key := in.UnsafeFieldName(false)
+ in.WantColon()
+ if in.IsNull() {
+ in.Skip()
+ in.WantComma()
+ continue
+ }
+ switch key {
+ case "reason":
+ out.Reason = string(in.String())
+ case "user_id":
+ out.UserID = string(in.String())
+ default:
+ in.SkipRecursive()
+ }
+ in.WantComma()
+ }
+ in.Delim('}')
+ if isTopLevel {
+ in.Consumed()
+ }
+}
+func easyjson11d1a9baEncodeGithubComMatrixOrgGomatrix5(out *jwriter.Writer, in ReqKickUser) {
+ out.RawByte('{')
+ first := true
+ _ = first
+ if in.Reason != "" {
+ const prefix string = ",\"reason\":"
+ first = false
+ out.RawString(prefix[1:])
+ out.String(string(in.Reason))
+ }
+ {
+ const prefix string = ",\"user_id\":"
+ if first {
+ first = false
+ out.RawString(prefix[1:])
+ } else {
+ out.RawString(prefix)
+ }
+ out.String(string(in.UserID))
+ }
+ out.RawByte('}')
+}
+
+// MarshalJSON supports json.Marshaler interface
+func (v ReqKickUser) MarshalJSON() ([]byte, error) {
+ w := jwriter.Writer{}
+ easyjson11d1a9baEncodeGithubComMatrixOrgGomatrix5(&w, v)
+ return w.Buffer.BuildBytes(), w.Error
+}
+
+// MarshalEasyJSON supports easyjson.Marshaler interface
+func (v ReqKickUser) MarshalEasyJSON(w *jwriter.Writer) {
+ easyjson11d1a9baEncodeGithubComMatrixOrgGomatrix5(w, v)
+}
+
+// UnmarshalJSON supports json.Unmarshaler interface
+func (v *ReqKickUser) UnmarshalJSON(data []byte) error {
+ r := jlexer.Lexer{Data: data}
+ easyjson11d1a9baDecodeGithubComMatrixOrgGomatrix5(&r, v)
+ return r.Error()
+}
+
+// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
+func (v *ReqKickUser) UnmarshalEasyJSON(l *jlexer.Lexer) {
+ easyjson11d1a9baDecodeGithubComMatrixOrgGomatrix5(l, v)
+}
+func easyjson11d1a9baDecodeGithubComMatrixOrgGomatrix6(in *jlexer.Lexer, out *ReqInviteUser) {
+ isTopLevel := in.IsStart()
+ if in.IsNull() {
+ if isTopLevel {
+ in.Consumed()
+ }
+ in.Skip()
+ return
+ }
+ in.Delim('{')
+ for !in.IsDelim('}') {
+ key := in.UnsafeFieldName(false)
+ in.WantColon()
+ if in.IsNull() {
+ in.Skip()
+ in.WantComma()
+ continue
+ }
+ switch key {
+ case "user_id":
+ out.UserID = string(in.String())
+ default:
+ in.SkipRecursive()
+ }
+ in.WantComma()
+ }
+ in.Delim('}')
+ if isTopLevel {
+ in.Consumed()
+ }
+}
+func easyjson11d1a9baEncodeGithubComMatrixOrgGomatrix6(out *jwriter.Writer, in ReqInviteUser) {
+ out.RawByte('{')
+ first := true
+ _ = first
+ {
+ const prefix string = ",\"user_id\":"
+ out.RawString(prefix[1:])
+ out.String(string(in.UserID))
+ }
+ out.RawByte('}')
+}
+
+// MarshalJSON supports json.Marshaler interface
+func (v ReqInviteUser) MarshalJSON() ([]byte, error) {
+ w := jwriter.Writer{}
+ easyjson11d1a9baEncodeGithubComMatrixOrgGomatrix6(&w, v)
+ return w.Buffer.BuildBytes(), w.Error
+}
+
+// MarshalEasyJSON supports easyjson.Marshaler interface
+func (v ReqInviteUser) MarshalEasyJSON(w *jwriter.Writer) {
+ easyjson11d1a9baEncodeGithubComMatrixOrgGomatrix6(w, v)
+}
+
+// UnmarshalJSON supports json.Unmarshaler interface
+func (v *ReqInviteUser) UnmarshalJSON(data []byte) error {
+ r := jlexer.Lexer{Data: data}
+ easyjson11d1a9baDecodeGithubComMatrixOrgGomatrix6(&r, v)
+ return r.Error()
+}
+
+// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
+func (v *ReqInviteUser) UnmarshalEasyJSON(l *jlexer.Lexer) {
+ easyjson11d1a9baDecodeGithubComMatrixOrgGomatrix6(l, v)
+}
+func easyjson11d1a9baDecodeGithubComMatrixOrgGomatrix7(in *jlexer.Lexer, out *ReqInvite3PID) {
+ isTopLevel := in.IsStart()
+ if in.IsNull() {
+ if isTopLevel {
+ in.Consumed()
+ }
+ in.Skip()
+ return
+ }
+ in.Delim('{')
+ for !in.IsDelim('}') {
+ key := in.UnsafeFieldName(false)
+ in.WantColon()
+ if in.IsNull() {
+ in.Skip()
+ in.WantComma()
+ continue
+ }
+ switch key {
+ case "id_server":
+ out.IDServer = string(in.String())
+ case "medium":
+ out.Medium = string(in.String())
+ case "address":
+ out.Address = string(in.String())
+ default:
+ in.SkipRecursive()
+ }
+ in.WantComma()
+ }
+ in.Delim('}')
+ if isTopLevel {
+ in.Consumed()
+ }
+}
+func easyjson11d1a9baEncodeGithubComMatrixOrgGomatrix7(out *jwriter.Writer, in ReqInvite3PID) {
+ out.RawByte('{')
+ first := true
+ _ = first
+ {
+ const prefix string = ",\"id_server\":"
+ out.RawString(prefix[1:])
+ out.String(string(in.IDServer))
+ }
+ {
+ const prefix string = ",\"medium\":"
+ out.RawString(prefix)
+ out.String(string(in.Medium))
+ }
+ {
+ const prefix string = ",\"address\":"
+ out.RawString(prefix)
+ out.String(string(in.Address))
+ }
+ out.RawByte('}')
+}
+
+// MarshalJSON supports json.Marshaler interface
+func (v ReqInvite3PID) MarshalJSON() ([]byte, error) {
+ w := jwriter.Writer{}
+ easyjson11d1a9baEncodeGithubComMatrixOrgGomatrix7(&w, v)
+ return w.Buffer.BuildBytes(), w.Error
+}
+
+// MarshalEasyJSON supports easyjson.Marshaler interface
+func (v ReqInvite3PID) MarshalEasyJSON(w *jwriter.Writer) {
+ easyjson11d1a9baEncodeGithubComMatrixOrgGomatrix7(w, v)
+}
+
+// UnmarshalJSON supports json.Unmarshaler interface
+func (v *ReqInvite3PID) UnmarshalJSON(data []byte) error {
+ r := jlexer.Lexer{Data: data}
+ easyjson11d1a9baDecodeGithubComMatrixOrgGomatrix7(&r, v)
+ return r.Error()
+}
+
+// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
+func (v *ReqInvite3PID) UnmarshalEasyJSON(l *jlexer.Lexer) {
+ easyjson11d1a9baDecodeGithubComMatrixOrgGomatrix7(l, v)
+}
+func easyjson11d1a9baDecodeGithubComMatrixOrgGomatrix8(in *jlexer.Lexer, out *ReqCreateRoom) {
+ isTopLevel := in.IsStart()
+ if in.IsNull() {
+ if isTopLevel {
+ in.Consumed()
+ }
+ in.Skip()
+ return
+ }
+ in.Delim('{')
+ for !in.IsDelim('}') {
+ key := in.UnsafeFieldName(false)
+ in.WantColon()
+ if in.IsNull() {
+ in.Skip()
+ in.WantComma()
+ continue
+ }
+ switch key {
+ case "visibility":
+ out.Visibility = string(in.String())
+ case "room_alias_name":
+ out.RoomAliasName = string(in.String())
+ case "name":
+ out.Name = string(in.String())
+ case "topic":
+ out.Topic = string(in.String())
+ case "invite":
+ if in.IsNull() {
+ in.Skip()
+ out.Invite = nil
+ } else {
+ in.Delim('[')
+ if out.Invite == nil {
+ if !in.IsDelim(']') {
+ out.Invite = make([]string, 0, 4)
+ } else {
+ out.Invite = []string{}
+ }
+ } else {
+ out.Invite = (out.Invite)[:0]
+ }
+ for !in.IsDelim(']') {
+ var v1 string
+ v1 = string(in.String())
+ out.Invite = append(out.Invite, v1)
+ in.WantComma()
+ }
+ in.Delim(']')
+ }
+ case "invite_3pid":
+ if in.IsNull() {
+ in.Skip()
+ out.Invite3PID = nil
+ } else {
+ in.Delim('[')
+ if out.Invite3PID == nil {
+ if !in.IsDelim(']') {
+ out.Invite3PID = make([]ReqInvite3PID, 0, 1)
+ } else {
+ out.Invite3PID = []ReqInvite3PID{}
+ }
+ } else {
+ out.Invite3PID = (out.Invite3PID)[:0]
+ }
+ for !in.IsDelim(']') {
+ var v2 ReqInvite3PID
+ (v2).UnmarshalEasyJSON(in)
+ out.Invite3PID = append(out.Invite3PID, v2)
+ in.WantComma()
+ }
+ in.Delim(']')
+ }
+ case "creation_content":
+ if in.IsNull() {
+ in.Skip()
+ } else {
+ in.Delim('{')
+ if !in.IsDelim('}') {
+ out.CreationContent = make(map[string]interface{})
+ } else {
+ out.CreationContent = nil
+ }
+ for !in.IsDelim('}') {
+ key := string(in.String())
+ in.WantColon()
+ var v3 interface{}
+ if m, ok := v3.(easyjson.Unmarshaler); ok {
+ m.UnmarshalEasyJSON(in)
+ } else if m, ok := v3.(json.Unmarshaler); ok {
+ _ = m.UnmarshalJSON(in.Raw())
+ } else {
+ v3 = in.Interface()
+ }
+ (out.CreationContent)[key] = v3
+ in.WantComma()
+ }
+ in.Delim('}')
+ }
+ case "initial_state":
+ if in.IsNull() {
+ in.Skip()
+ out.InitialState = nil
+ } else {
+ in.Delim('[')
+ if out.InitialState == nil {
+ if !in.IsDelim(']') {
+ out.InitialState = make([]Event, 0, 0)
+ } else {
+ out.InitialState = []Event{}
+ }
+ } else {
+ out.InitialState = (out.InitialState)[:0]
+ }
+ for !in.IsDelim(']') {
+ var v4 Event
+ easyjson11d1a9baDecodeGithubComMatrixOrgGomatrix9(in, &v4)
+ out.InitialState = append(out.InitialState, v4)
+ in.WantComma()
+ }
+ in.Delim(']')
+ }
+ case "preset":
+ out.Preset = string(in.String())
+ case "is_direct":
+ out.IsDirect = bool(in.Bool())
+ default:
+ in.SkipRecursive()
+ }
+ in.WantComma()
+ }
+ in.Delim('}')
+ if isTopLevel {
+ in.Consumed()
+ }
+}
+func easyjson11d1a9baEncodeGithubComMatrixOrgGomatrix8(out *jwriter.Writer, in ReqCreateRoom) {
+ out.RawByte('{')
+ first := true
+ _ = first
+ if in.Visibility != "" {
+ const prefix string = ",\"visibility\":"
+ first = false
+ out.RawString(prefix[1:])
+ out.String(string(in.Visibility))
+ }
+ if in.RoomAliasName != "" {
+ const prefix string = ",\"room_alias_name\":"
+ if first {
+ first = false
+ out.RawString(prefix[1:])
+ } else {
+ out.RawString(prefix)
+ }
+ out.String(string(in.RoomAliasName))
+ }
+ if in.Name != "" {
+ const prefix string = ",\"name\":"
+ if first {
+ first = false
+ out.RawString(prefix[1:])
+ } else {
+ out.RawString(prefix)
+ }
+ out.String(string(in.Name))
+ }
+ if in.Topic != "" {
+ const prefix string = ",\"topic\":"
+ if first {
+ first = false
+ out.RawString(prefix[1:])
+ } else {
+ out.RawString(prefix)
+ }
+ out.String(string(in.Topic))
+ }
+ if len(in.Invite) != 0 {
+ const prefix string = ",\"invite\":"
+ if first {
+ first = false
+ out.RawString(prefix[1:])
+ } else {
+ out.RawString(prefix)
+ }
+ {
+ out.RawByte('[')
+ for v5, v6 := range in.Invite {
+ if v5 > 0 {
+ out.RawByte(',')
+ }
+ out.String(string(v6))
+ }
+ out.RawByte(']')
+ }
+ }
+ if len(in.Invite3PID) != 0 {
+ const prefix string = ",\"invite_3pid\":"
+ if first {
+ first = false
+ out.RawString(prefix[1:])
+ } else {
+ out.RawString(prefix)
+ }
+ {
+ out.RawByte('[')
+ for v7, v8 := range in.Invite3PID {
+ if v7 > 0 {
+ out.RawByte(',')
+ }
+ (v8).MarshalEasyJSON(out)
+ }
+ out.RawByte(']')
+ }
+ }
+ if len(in.CreationContent) != 0 {
+ const prefix string = ",\"creation_content\":"
+ if first {
+ first = false
+ out.RawString(prefix[1:])
+ } else {
+ out.RawString(prefix)
+ }
+ {
+ out.RawByte('{')
+ v9First := true
+ for v9Name, v9Value := range in.CreationContent {
+ if v9First {
+ v9First = false
+ } else {
+ out.RawByte(',')
+ }
+ out.String(string(v9Name))
+ out.RawByte(':')
+ if m, ok := v9Value.(easyjson.Marshaler); ok {
+ m.MarshalEasyJSON(out)
+ } else if m, ok := v9Value.(json.Marshaler); ok {
+ out.Raw(m.MarshalJSON())
+ } else {
+ out.Raw(json.Marshal(v9Value))
+ }
+ }
+ out.RawByte('}')
+ }
+ }
+ if len(in.InitialState) != 0 {
+ const prefix string = ",\"initial_state\":"
+ if first {
+ first = false
+ out.RawString(prefix[1:])
+ } else {
+ out.RawString(prefix)
+ }
+ {
+ out.RawByte('[')
+ for v10, v11 := range in.InitialState {
+ if v10 > 0 {
+ out.RawByte(',')
+ }
+ easyjson11d1a9baEncodeGithubComMatrixOrgGomatrix9(out, v11)
+ }
+ out.RawByte(']')
+ }
+ }
+ if in.Preset != "" {
+ const prefix string = ",\"preset\":"
+ if first {
+ first = false
+ out.RawString(prefix[1:])
+ } else {
+ out.RawString(prefix)
+ }
+ out.String(string(in.Preset))
+ }
+ if in.IsDirect {
+ const prefix string = ",\"is_direct\":"
+ if first {
+ first = false
+ out.RawString(prefix[1:])
+ } else {
+ out.RawString(prefix)
+ }
+ out.Bool(bool(in.IsDirect))
+ }
+ out.RawByte('}')
+}
+
+// MarshalJSON supports json.Marshaler interface
+func (v ReqCreateRoom) MarshalJSON() ([]byte, error) {
+ w := jwriter.Writer{}
+ easyjson11d1a9baEncodeGithubComMatrixOrgGomatrix8(&w, v)
+ return w.Buffer.BuildBytes(), w.Error
+}
+
+// MarshalEasyJSON supports easyjson.Marshaler interface
+func (v ReqCreateRoom) MarshalEasyJSON(w *jwriter.Writer) {
+ easyjson11d1a9baEncodeGithubComMatrixOrgGomatrix8(w, v)
+}
+
+// UnmarshalJSON supports json.Unmarshaler interface
+func (v *ReqCreateRoom) UnmarshalJSON(data []byte) error {
+ r := jlexer.Lexer{Data: data}
+ easyjson11d1a9baDecodeGithubComMatrixOrgGomatrix8(&r, v)
+ return r.Error()
+}
+
+// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
+func (v *ReqCreateRoom) UnmarshalEasyJSON(l *jlexer.Lexer) {
+ easyjson11d1a9baDecodeGithubComMatrixOrgGomatrix8(l, v)
+}
+func easyjson11d1a9baDecodeGithubComMatrixOrgGomatrix9(in *jlexer.Lexer, out *Event) {
+ isTopLevel := in.IsStart()
+ if in.IsNull() {
+ if isTopLevel {
+ in.Consumed()
+ }
+ in.Skip()
+ return
+ }
+ in.Delim('{')
+ for !in.IsDelim('}') {
+ key := in.UnsafeFieldName(false)
+ in.WantColon()
+ if in.IsNull() {
+ in.Skip()
+ in.WantComma()
+ continue
+ }
+ switch key {
+ case "state_key":
+ if in.IsNull() {
+ in.Skip()
+ out.StateKey = nil
+ } else {
+ if out.StateKey == nil {
+ out.StateKey = new(string)
+ }
+ *out.StateKey = string(in.String())
+ }
+ case "sender":
+ out.Sender = string(in.String())
+ case "type":
+ out.Type = string(in.String())
+ case "origin_server_ts":
+ out.Timestamp = int64(in.Int64())
+ case "event_id":
+ out.ID = string(in.String())
+ case "room_id":
+ out.RoomID = string(in.String())
+ case "redacts":
+ out.Redacts = string(in.String())
+ case "unsigned":
+ if in.IsNull() {
+ in.Skip()
+ } else {
+ in.Delim('{')
+ out.Unsigned = make(map[string]interface{})
+ for !in.IsDelim('}') {
+ key := string(in.String())
+ in.WantColon()
+ var v12 interface{}
+ if m, ok := v12.(easyjson.Unmarshaler); ok {
+ m.UnmarshalEasyJSON(in)
+ } else if m, ok := v12.(json.Unmarshaler); ok {
+ _ = m.UnmarshalJSON(in.Raw())
+ } else {
+ v12 = in.Interface()
+ }
+ (out.Unsigned)[key] = v12
+ in.WantComma()
+ }
+ in.Delim('}')
+ }
+ case "content":
+ if in.IsNull() {
+ in.Skip()
+ } else {
+ in.Delim('{')
+ out.Content = make(map[string]interface{})
+ for !in.IsDelim('}') {
+ key := string(in.String())
+ in.WantColon()
+ var v13 interface{}
+ if m, ok := v13.(easyjson.Unmarshaler); ok {
+ m.UnmarshalEasyJSON(in)
+ } else if m, ok := v13.(json.Unmarshaler); ok {
+ _ = m.UnmarshalJSON(in.Raw())
+ } else {
+ v13 = in.Interface()
+ }
+ (out.Content)[key] = v13
+ in.WantComma()
+ }
+ in.Delim('}')
+ }
+ case "prev_content":
+ if in.IsNull() {
+ in.Skip()
+ } else {
+ in.Delim('{')
+ if !in.IsDelim('}') {
+ out.PrevContent = make(map[string]interface{})
+ } else {
+ out.PrevContent = nil
+ }
+ for !in.IsDelim('}') {
+ key := string(in.String())
+ in.WantColon()
+ var v14 interface{}
+ if m, ok := v14.(easyjson.Unmarshaler); ok {
+ m.UnmarshalEasyJSON(in)
+ } else if m, ok := v14.(json.Unmarshaler); ok {
+ _ = m.UnmarshalJSON(in.Raw())
+ } else {
+ v14 = in.Interface()
+ }
+ (out.PrevContent)[key] = v14
+ in.WantComma()
+ }
+ in.Delim('}')
+ }
+ default:
+ in.SkipRecursive()
+ }
+ in.WantComma()
+ }
+ in.Delim('}')
+ if isTopLevel {
+ in.Consumed()
+ }
+}
+func easyjson11d1a9baEncodeGithubComMatrixOrgGomatrix9(out *jwriter.Writer, in Event) {
+ out.RawByte('{')
+ first := true
+ _ = first
+ if in.StateKey != nil {
+ const prefix string = ",\"state_key\":"
+ first = false
+ out.RawString(prefix[1:])
+ out.String(string(*in.StateKey))
+ }
+ {
+ const prefix string = ",\"sender\":"
+ if first {
+ first = false
+ out.RawString(prefix[1:])
+ } else {
+ out.RawString(prefix)
+ }
+ out.String(string(in.Sender))
+ }
+ {
+ const prefix string = ",\"type\":"
+ out.RawString(prefix)
+ out.String(string(in.Type))
+ }
+ {
+ const prefix string = ",\"origin_server_ts\":"
+ out.RawString(prefix)
+ out.Int64(int64(in.Timestamp))
+ }
+ {
+ const prefix string = ",\"event_id\":"
+ out.RawString(prefix)
+ out.String(string(in.ID))
+ }
+ {
+ const prefix string = ",\"room_id\":"
+ out.RawString(prefix)
+ out.String(string(in.RoomID))
+ }
+ if in.Redacts != "" {
+ const prefix string = ",\"redacts\":"
+ out.RawString(prefix)
+ out.String(string(in.Redacts))
+ }
+ {
+ const prefix string = ",\"unsigned\":"
+ out.RawString(prefix)
+ if in.Unsigned == nil && (out.Flags&jwriter.NilMapAsEmpty) == 0 {
+ out.RawString(`null`)
+ } else {
+ out.RawByte('{')
+ v15First := true
+ for v15Name, v15Value := range in.Unsigned {
+ if v15First {
+ v15First = false
+ } else {
+ out.RawByte(',')
+ }
+ out.String(string(v15Name))
+ out.RawByte(':')
+ if m, ok := v15Value.(easyjson.Marshaler); ok {
+ m.MarshalEasyJSON(out)
+ } else if m, ok := v15Value.(json.Marshaler); ok {
+ out.Raw(m.MarshalJSON())
+ } else {
+ out.Raw(json.Marshal(v15Value))
+ }
+ }
+ out.RawByte('}')
+ }
+ }
+ {
+ const prefix string = ",\"content\":"
+ out.RawString(prefix)
+ if in.Content == nil && (out.Flags&jwriter.NilMapAsEmpty) == 0 {
+ out.RawString(`null`)
+ } else {
+ out.RawByte('{')
+ v16First := true
+ for v16Name, v16Value := range in.Content {
+ if v16First {
+ v16First = false
+ } else {
+ out.RawByte(',')
+ }
+ out.String(string(v16Name))
+ out.RawByte(':')
+ if m, ok := v16Value.(easyjson.Marshaler); ok {
+ m.MarshalEasyJSON(out)
+ } else if m, ok := v16Value.(json.Marshaler); ok {
+ out.Raw(m.MarshalJSON())
+ } else {
+ out.Raw(json.Marshal(v16Value))
+ }
+ }
+ out.RawByte('}')
+ }
+ }
+ if len(in.PrevContent) != 0 {
+ const prefix string = ",\"prev_content\":"
+ out.RawString(prefix)
+ {
+ out.RawByte('{')
+ v17First := true
+ for v17Name, v17Value := range in.PrevContent {
+ if v17First {
+ v17First = false
+ } else {
+ out.RawByte(',')
+ }
+ out.String(string(v17Name))
+ out.RawByte(':')
+ if m, ok := v17Value.(easyjson.Marshaler); ok {
+ m.MarshalEasyJSON(out)
+ } else if m, ok := v17Value.(json.Marshaler); ok {
+ out.Raw(m.MarshalJSON())
+ } else {
+ out.Raw(json.Marshal(v17Value))
+ }
+ }
+ out.RawByte('}')
+ }
+ }
+ out.RawByte('}')
+}
+func easyjson11d1a9baDecodeGithubComMatrixOrgGomatrix10(in *jlexer.Lexer, out *ReqBanUser) {
+ isTopLevel := in.IsStart()
+ if in.IsNull() {
+ if isTopLevel {
+ in.Consumed()
+ }
+ in.Skip()
+ return
+ }
+ in.Delim('{')
+ for !in.IsDelim('}') {
+ key := in.UnsafeFieldName(false)
+ in.WantColon()
+ if in.IsNull() {
+ in.Skip()
+ in.WantComma()
+ continue
+ }
+ switch key {
+ case "reason":
+ out.Reason = string(in.String())
+ case "user_id":
+ out.UserID = string(in.String())
+ default:
+ in.SkipRecursive()
+ }
+ in.WantComma()
+ }
+ in.Delim('}')
+ if isTopLevel {
+ in.Consumed()
+ }
+}
+func easyjson11d1a9baEncodeGithubComMatrixOrgGomatrix10(out *jwriter.Writer, in ReqBanUser) {
+ out.RawByte('{')
+ first := true
+ _ = first
+ if in.Reason != "" {
+ const prefix string = ",\"reason\":"
+ first = false
+ out.RawString(prefix[1:])
+ out.String(string(in.Reason))
+ }
+ {
+ const prefix string = ",\"user_id\":"
+ if first {
+ first = false
+ out.RawString(prefix[1:])
+ } else {
+ out.RawString(prefix)
+ }
+ out.String(string(in.UserID))
+ }
+ out.RawByte('}')
+}
+
+// MarshalJSON supports json.Marshaler interface
+func (v ReqBanUser) MarshalJSON() ([]byte, error) {
+ w := jwriter.Writer{}
+ easyjson11d1a9baEncodeGithubComMatrixOrgGomatrix10(&w, v)
+ return w.Buffer.BuildBytes(), w.Error
+}
+
+// MarshalEasyJSON supports easyjson.Marshaler interface
+func (v ReqBanUser) MarshalEasyJSON(w *jwriter.Writer) {
+ easyjson11d1a9baEncodeGithubComMatrixOrgGomatrix10(w, v)
+}
+
+// UnmarshalJSON supports json.Unmarshaler interface
+func (v *ReqBanUser) UnmarshalJSON(data []byte) error {
+ r := jlexer.Lexer{Data: data}
+ easyjson11d1a9baDecodeGithubComMatrixOrgGomatrix10(&r, v)
+ return r.Error()
+}
+
+// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
+func (v *ReqBanUser) UnmarshalEasyJSON(l *jlexer.Lexer) {
+ easyjson11d1a9baDecodeGithubComMatrixOrgGomatrix10(l, v)
+}
diff --git a/responses.go b/responses.go
index f488e69..3d755cb 100644
--- a/responses.go
+++ b/responses.go
@@ -2,6 +2,7 @@ package gomatrix
// RespError is the standard JSON error response from Homeservers. It also implements the Golang "error" interface.
// See http://matrix.org/docs/spec/client_server/r0.2.0.html#api-standards
+//easyjson:json
type RespError struct {
ErrCode string `json:"errcode"`
Err string `json:"error"`
@@ -13,16 +14,19 @@ func (e RespError) Error() string {
}
// RespCreateFilter is the JSON response for http://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-user-userid-filter
+//easyjson:json
type RespCreateFilter struct {
FilterID string `json:"filter_id"`
}
// RespVersions is the JSON response for http://matrix.org/docs/spec/client_server/r0.2.0.html#get-matrix-client-versions
+//easyjson:json
type RespVersions struct {
Versions []string `json:"versions"`
}
// RespPublicRooms is the JSON response for http://matrix.org/speculator/spec/HEAD/client_server/unstable.html#get-matrix-client-unstable-publicrooms
+//easyjson:json
type RespPublicRooms struct {
TotalRoomCountEstimate int `json:"total_room_count_estimate"`
PrevBatch string `json:"prev_batch"`
@@ -31,37 +35,47 @@ type RespPublicRooms struct {
}
// RespJoinRoom is the JSON response for http://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-rooms-roomid-join
+//easyjson:json
type RespJoinRoom struct {
RoomID string `json:"room_id"`
}
// RespLeaveRoom is the JSON response for http://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-rooms-roomid-leave
+//easyjson:json
type RespLeaveRoom struct{}
// RespForgetRoom is the JSON response for http://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-rooms-roomid-forget
+//easyjson:json
type RespForgetRoom struct{}
// RespInviteUser is the JSON response for http://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-rooms-roomid-invite
+//easyjson:json
type RespInviteUser struct{}
// RespKickUser is the JSON response for http://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-rooms-roomid-kick
+//easyjson:json
type RespKickUser struct{}
// RespBanUser is the JSON response for http://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-rooms-roomid-ban
+//easyjson:json
type RespBanUser struct{}
// RespUnbanUser is the JSON response for http://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-rooms-roomid-unban
+//easyjson:json
type RespUnbanUser struct{}
// RespTyping is the JSON response for https://matrix.org/docs/spec/client_server/r0.2.0.html#put-matrix-client-r0-rooms-roomid-typing-userid
+//easyjson:json
type RespTyping struct{}
// RespJoinedRooms is the JSON response for TODO-SPEC https://github.com/matrix-org/synapse/pull/1680
+//easyjson:json
type RespJoinedRooms struct {
JoinedRooms []string `json:"joined_rooms"`
}
// RespJoinedMembers is the JSON response for TODO-SPEC https://github.com/matrix-org/synapse/pull/1680
+//easyjson:json
type RespJoinedMembers struct {
Joined map[string]struct {
DisplayName *string `json:"display_name"`
@@ -70,6 +84,7 @@ type RespJoinedMembers struct {
}
// RespMessages is the JSON response for https://matrix.org/docs/spec/client_server/r0.2.0.html#get-matrix-client-r0-rooms-roomid-messages
+//easyjson:json
type RespMessages struct {
Start string `json:"start"`
Chunk []Event `json:"chunk"`
@@ -77,16 +92,19 @@ type RespMessages struct {
}
// RespSendEvent is the JSON response for http://matrix.org/docs/spec/client_server/r0.2.0.html#put-matrix-client-r0-rooms-roomid-send-eventtype-txnid
+//easyjson:json
type RespSendEvent struct {
EventID string `json:"event_id"`
}
// RespMediaUpload is the JSON response for http://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-media-r0-upload
+//easyjson:json
type RespMediaUpload struct {
ContentURI string `json:"content_uri"`
}
// RespUserInteractive is the JSON response for https://matrix.org/docs/spec/client_server/r0.2.0.html#user-interactive-authentication-api
+//easyjson:json
type RespUserInteractive struct {
Flows []struct {
Stages []string `json:"stages"`
@@ -109,11 +127,13 @@ func (r RespUserInteractive) HasSingleStageFlow(stageName string) bool {
}
// RespUserDisplayName is the JSON response for https://matrix.org/docs/spec/client_server/r0.2.0.html#get-matrix-client-r0-profile-userid-displayname
+//easyjson:json
type RespUserDisplayName struct {
DisplayName string `json:"displayname"`
}
// RespUserStatus is the JSON response for https://matrix.org/docs/spec/client_server/r0.6.0#get-matrix-client-r0-presence-userid-status
+//easyjson:json
type RespUserStatus struct {
Presence string `json:"presence"`
StatusMsg string `json:"status_msg"`
@@ -122,6 +142,7 @@ type RespUserStatus struct {
}
// RespRegister is the JSON response for http://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-register
+//easyjson:json
type RespRegister struct {
AccessToken string `json:"access_token"`
DeviceID string `json:"device_id"`
@@ -131,6 +152,7 @@ type RespRegister struct {
}
// RespLogin is the JSON response for http://matrix.org/docs/spec/client_server/r0.6.0.html#post-matrix-client-r0-login
+//easyjson:json
type RespLogin struct {
AccessToken string `json:"access_token"`
DeviceID string `json:"device_id"`
@@ -150,17 +172,21 @@ type DiscoveryInformation struct {
}
// RespLogout is the JSON response for http://matrix.org/docs/spec/client_server/r0.6.0.html#post-matrix-client-r0-logout
+//easyjson:json
type RespLogout struct{}
// RespLogoutAll is the JSON response for https://matrix.org/docs/spec/client_server/r0.6.0#post-matrix-client-r0-logout-all
+//easyjson:json
type RespLogoutAll struct{}
// RespCreateRoom is the JSON response for https://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-client-r0-createroom
+//easyjson:json
type RespCreateRoom struct {
RoomID string `json:"room_id"`
}
// RespSync is the JSON response for http://matrix.org/docs/spec/client_server/r0.2.0.html#get-matrix-client-r0-sync
+//easyjson:json
type RespSync struct {
NextBatch string `json:"next_batch"`
AccountData struct {
@@ -202,6 +228,7 @@ type RespSync struct {
}
// RespTurnServer is the JSON response from a Turn Server
+//easyjson:json
type RespTurnServer struct {
Username string `json:"username"`
Password string `json:"password"`
diff --git a/responses_easyjson.go b/responses_easyjson.go
new file mode 100644
index 0000000..f9c46b2
--- /dev/null
+++ b/responses_easyjson.go
@@ -0,0 +1,3582 @@
+// Code generated by easyjson for marshaling/unmarshaling. DO NOT EDIT.
+
+package gomatrix
+
+import (
+ json "encoding/json"
+ easyjson "github.com/mailru/easyjson"
+ jlexer "github.com/mailru/easyjson/jlexer"
+ jwriter "github.com/mailru/easyjson/jwriter"
+)
+
+// suppress unused package warning
+var (
+ _ *json.RawMessage
+ _ *jlexer.Lexer
+ _ *jwriter.Writer
+ _ easyjson.Marshaler
+)
+
+func easyjson559270aeDecodeGithubComMatrixOrgGomatrix(in *jlexer.Lexer, out *RespVersions) {
+ isTopLevel := in.IsStart()
+ if in.IsNull() {
+ if isTopLevel {
+ in.Consumed()
+ }
+ in.Skip()
+ return
+ }
+ in.Delim('{')
+ for !in.IsDelim('}') {
+ key := in.UnsafeFieldName(false)
+ in.WantColon()
+ if in.IsNull() {
+ in.Skip()
+ in.WantComma()
+ continue
+ }
+ switch key {
+ case "versions":
+ if in.IsNull() {
+ in.Skip()
+ out.Versions = nil
+ } else {
+ in.Delim('[')
+ if out.Versions == nil {
+ if !in.IsDelim(']') {
+ out.Versions = make([]string, 0, 4)
+ } else {
+ out.Versions = []string{}
+ }
+ } else {
+ out.Versions = (out.Versions)[:0]
+ }
+ for !in.IsDelim(']') {
+ var v1 string
+ v1 = string(in.String())
+ out.Versions = append(out.Versions, v1)
+ in.WantComma()
+ }
+ in.Delim(']')
+ }
+ default:
+ in.SkipRecursive()
+ }
+ in.WantComma()
+ }
+ in.Delim('}')
+ if isTopLevel {
+ in.Consumed()
+ }
+}
+func easyjson559270aeEncodeGithubComMatrixOrgGomatrix(out *jwriter.Writer, in RespVersions) {
+ out.RawByte('{')
+ first := true
+ _ = first
+ {
+ const prefix string = ",\"versions\":"
+ out.RawString(prefix[1:])
+ if in.Versions == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 {
+ out.RawString("null")
+ } else {
+ out.RawByte('[')
+ for v2, v3 := range in.Versions {
+ if v2 > 0 {
+ out.RawByte(',')
+ }
+ out.String(string(v3))
+ }
+ out.RawByte(']')
+ }
+ }
+ out.RawByte('}')
+}
+
+// MarshalJSON supports json.Marshaler interface
+func (v RespVersions) MarshalJSON() ([]byte, error) {
+ w := jwriter.Writer{}
+ easyjson559270aeEncodeGithubComMatrixOrgGomatrix(&w, v)
+ return w.Buffer.BuildBytes(), w.Error
+}
+
+// MarshalEasyJSON supports easyjson.Marshaler interface
+func (v RespVersions) MarshalEasyJSON(w *jwriter.Writer) {
+ easyjson559270aeEncodeGithubComMatrixOrgGomatrix(w, v)
+}
+
+// UnmarshalJSON supports json.Unmarshaler interface
+func (v *RespVersions) UnmarshalJSON(data []byte) error {
+ r := jlexer.Lexer{Data: data}
+ easyjson559270aeDecodeGithubComMatrixOrgGomatrix(&r, v)
+ return r.Error()
+}
+
+// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
+func (v *RespVersions) UnmarshalEasyJSON(l *jlexer.Lexer) {
+ easyjson559270aeDecodeGithubComMatrixOrgGomatrix(l, v)
+}
+func easyjson559270aeDecodeGithubComMatrixOrgGomatrix1(in *jlexer.Lexer, out *RespUserStatus) {
+ isTopLevel := in.IsStart()
+ if in.IsNull() {
+ if isTopLevel {
+ in.Consumed()
+ }
+ in.Skip()
+ return
+ }
+ in.Delim('{')
+ for !in.IsDelim('}') {
+ key := in.UnsafeFieldName(false)
+ in.WantColon()
+ if in.IsNull() {
+ in.Skip()
+ in.WantComma()
+ continue
+ }
+ switch key {
+ case "presence":
+ out.Presence = string(in.String())
+ case "status_msg":
+ out.StatusMsg = string(in.String())
+ case "last_active_ago":
+ out.LastActiveAgo = int(in.Int())
+ case "currently_active":
+ out.CurrentlyActive = bool(in.Bool())
+ default:
+ in.SkipRecursive()
+ }
+ in.WantComma()
+ }
+ in.Delim('}')
+ if isTopLevel {
+ in.Consumed()
+ }
+}
+func easyjson559270aeEncodeGithubComMatrixOrgGomatrix1(out *jwriter.Writer, in RespUserStatus) {
+ out.RawByte('{')
+ first := true
+ _ = first
+ {
+ const prefix string = ",\"presence\":"
+ out.RawString(prefix[1:])
+ out.String(string(in.Presence))
+ }
+ {
+ const prefix string = ",\"status_msg\":"
+ out.RawString(prefix)
+ out.String(string(in.StatusMsg))
+ }
+ {
+ const prefix string = ",\"last_active_ago\":"
+ out.RawString(prefix)
+ out.Int(int(in.LastActiveAgo))
+ }
+ {
+ const prefix string = ",\"currently_active\":"
+ out.RawString(prefix)
+ out.Bool(bool(in.CurrentlyActive))
+ }
+ out.RawByte('}')
+}
+
+// MarshalJSON supports json.Marshaler interface
+func (v RespUserStatus) MarshalJSON() ([]byte, error) {
+ w := jwriter.Writer{}
+ easyjson559270aeEncodeGithubComMatrixOrgGomatrix1(&w, v)
+ return w.Buffer.BuildBytes(), w.Error
+}
+
+// MarshalEasyJSON supports easyjson.Marshaler interface
+func (v RespUserStatus) MarshalEasyJSON(w *jwriter.Writer) {
+ easyjson559270aeEncodeGithubComMatrixOrgGomatrix1(w, v)
+}
+
+// UnmarshalJSON supports json.Unmarshaler interface
+func (v *RespUserStatus) UnmarshalJSON(data []byte) error {
+ r := jlexer.Lexer{Data: data}
+ easyjson559270aeDecodeGithubComMatrixOrgGomatrix1(&r, v)
+ return r.Error()
+}
+
+// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
+func (v *RespUserStatus) UnmarshalEasyJSON(l *jlexer.Lexer) {
+ easyjson559270aeDecodeGithubComMatrixOrgGomatrix1(l, v)
+}
+func easyjson559270aeDecodeGithubComMatrixOrgGomatrix2(in *jlexer.Lexer, out *RespUserInteractive) {
+ isTopLevel := in.IsStart()
+ if in.IsNull() {
+ if isTopLevel {
+ in.Consumed()
+ }
+ in.Skip()
+ return
+ }
+ in.Delim('{')
+ for !in.IsDelim('}') {
+ key := in.UnsafeFieldName(false)
+ in.WantColon()
+ if in.IsNull() {
+ in.Skip()
+ in.WantComma()
+ continue
+ }
+ switch key {
+ case "flows":
+ if in.IsNull() {
+ in.Skip()
+ out.Flows = nil
+ } else {
+ in.Delim('[')
+ if out.Flows == nil {
+ if !in.IsDelim(']') {
+ out.Flows = make([]struct {
+ Stages []string `json:"stages"`
+ }, 0, 2)
+ } else {
+ out.Flows = []struct {
+ Stages []string `json:"stages"`
+ }{}
+ }
+ } else {
+ out.Flows = (out.Flows)[:0]
+ }
+ for !in.IsDelim(']') {
+ var v4 struct {
+ Stages []string `json:"stages"`
+ }
+ easyjson559270aeDecode(in, &v4)
+ out.Flows = append(out.Flows, v4)
+ in.WantComma()
+ }
+ in.Delim(']')
+ }
+ case "params":
+ if in.IsNull() {
+ in.Skip()
+ } else {
+ in.Delim('{')
+ out.Params = make(map[string]interface{})
+ for !in.IsDelim('}') {
+ key := string(in.String())
+ in.WantColon()
+ var v5 interface{}
+ if m, ok := v5.(easyjson.Unmarshaler); ok {
+ m.UnmarshalEasyJSON(in)
+ } else if m, ok := v5.(json.Unmarshaler); ok {
+ _ = m.UnmarshalJSON(in.Raw())
+ } else {
+ v5 = in.Interface()
+ }
+ (out.Params)[key] = v5
+ in.WantComma()
+ }
+ in.Delim('}')
+ }
+ case "session":
+ out.Session = string(in.String())
+ case "completed":
+ if in.IsNull() {
+ in.Skip()
+ out.Completed = nil
+ } else {
+ in.Delim('[')
+ if out.Completed == nil {
+ if !in.IsDelim(']') {
+ out.Completed = make([]string, 0, 4)
+ } else {
+ out.Completed = []string{}
+ }
+ } else {
+ out.Completed = (out.Completed)[:0]
+ }
+ for !in.IsDelim(']') {
+ var v6 string
+ v6 = string(in.String())
+ out.Completed = append(out.Completed, v6)
+ in.WantComma()
+ }
+ in.Delim(']')
+ }
+ case "errcode":
+ out.ErrCode = string(in.String())
+ case "error":
+ out.Error = string(in.String())
+ default:
+ in.SkipRecursive()
+ }
+ in.WantComma()
+ }
+ in.Delim('}')
+ if isTopLevel {
+ in.Consumed()
+ }
+}
+func easyjson559270aeEncodeGithubComMatrixOrgGomatrix2(out *jwriter.Writer, in RespUserInteractive) {
+ out.RawByte('{')
+ first := true
+ _ = first
+ {
+ const prefix string = ",\"flows\":"
+ out.RawString(prefix[1:])
+ if in.Flows == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 {
+ out.RawString("null")
+ } else {
+ out.RawByte('[')
+ for v7, v8 := range in.Flows {
+ if v7 > 0 {
+ out.RawByte(',')
+ }
+ easyjson559270aeEncode(out, v8)
+ }
+ out.RawByte(']')
+ }
+ }
+ {
+ const prefix string = ",\"params\":"
+ out.RawString(prefix)
+ if in.Params == nil && (out.Flags&jwriter.NilMapAsEmpty) == 0 {
+ out.RawString(`null`)
+ } else {
+ out.RawByte('{')
+ v9First := true
+ for v9Name, v9Value := range in.Params {
+ if v9First {
+ v9First = false
+ } else {
+ out.RawByte(',')
+ }
+ out.String(string(v9Name))
+ out.RawByte(':')
+ if m, ok := v9Value.(easyjson.Marshaler); ok {
+ m.MarshalEasyJSON(out)
+ } else if m, ok := v9Value.(json.Marshaler); ok {
+ out.Raw(m.MarshalJSON())
+ } else {
+ out.Raw(json.Marshal(v9Value))
+ }
+ }
+ out.RawByte('}')
+ }
+ }
+ {
+ const prefix string = ",\"session\":"
+ out.RawString(prefix)
+ out.String(string(in.Session))
+ }
+ {
+ const prefix string = ",\"completed\":"
+ out.RawString(prefix)
+ if in.Completed == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 {
+ out.RawString("null")
+ } else {
+ out.RawByte('[')
+ for v10, v11 := range in.Completed {
+ if v10 > 0 {
+ out.RawByte(',')
+ }
+ out.String(string(v11))
+ }
+ out.RawByte(']')
+ }
+ }
+ {
+ const prefix string = ",\"errcode\":"
+ out.RawString(prefix)
+ out.String(string(in.ErrCode))
+ }
+ {
+ const prefix string = ",\"error\":"
+ out.RawString(prefix)
+ out.String(string(in.Error))
+ }
+ out.RawByte('}')
+}
+
+// MarshalJSON supports json.Marshaler interface
+func (v RespUserInteractive) MarshalJSON() ([]byte, error) {
+ w := jwriter.Writer{}
+ easyjson559270aeEncodeGithubComMatrixOrgGomatrix2(&w, v)
+ return w.Buffer.BuildBytes(), w.Error
+}
+
+// MarshalEasyJSON supports easyjson.Marshaler interface
+func (v RespUserInteractive) MarshalEasyJSON(w *jwriter.Writer) {
+ easyjson559270aeEncodeGithubComMatrixOrgGomatrix2(w, v)
+}
+
+// UnmarshalJSON supports json.Unmarshaler interface
+func (v *RespUserInteractive) UnmarshalJSON(data []byte) error {
+ r := jlexer.Lexer{Data: data}
+ easyjson559270aeDecodeGithubComMatrixOrgGomatrix2(&r, v)
+ return r.Error()
+}
+
+// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
+func (v *RespUserInteractive) UnmarshalEasyJSON(l *jlexer.Lexer) {
+ easyjson559270aeDecodeGithubComMatrixOrgGomatrix2(l, v)
+}
+func easyjson559270aeDecode(in *jlexer.Lexer, out *struct {
+ Stages []string `json:"stages"`
+}) {
+ isTopLevel := in.IsStart()
+ if in.IsNull() {
+ if isTopLevel {
+ in.Consumed()
+ }
+ in.Skip()
+ return
+ }
+ in.Delim('{')
+ for !in.IsDelim('}') {
+ key := in.UnsafeFieldName(false)
+ in.WantColon()
+ if in.IsNull() {
+ in.Skip()
+ in.WantComma()
+ continue
+ }
+ switch key {
+ case "stages":
+ if in.IsNull() {
+ in.Skip()
+ out.Stages = nil
+ } else {
+ in.Delim('[')
+ if out.Stages == nil {
+ if !in.IsDelim(']') {
+ out.Stages = make([]string, 0, 4)
+ } else {
+ out.Stages = []string{}
+ }
+ } else {
+ out.Stages = (out.Stages)[:0]
+ }
+ for !in.IsDelim(']') {
+ var v12 string
+ v12 = string(in.String())
+ out.Stages = append(out.Stages, v12)
+ in.WantComma()
+ }
+ in.Delim(']')
+ }
+ default:
+ in.SkipRecursive()
+ }
+ in.WantComma()
+ }
+ in.Delim('}')
+ if isTopLevel {
+ in.Consumed()
+ }
+}
+func easyjson559270aeEncode(out *jwriter.Writer, in struct {
+ Stages []string `json:"stages"`
+}) {
+ out.RawByte('{')
+ first := true
+ _ = first
+ {
+ const prefix string = ",\"stages\":"
+ out.RawString(prefix[1:])
+ if in.Stages == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 {
+ out.RawString("null")
+ } else {
+ out.RawByte('[')
+ for v13, v14 := range in.Stages {
+ if v13 > 0 {
+ out.RawByte(',')
+ }
+ out.String(string(v14))
+ }
+ out.RawByte(']')
+ }
+ }
+ out.RawByte('}')
+}
+func easyjson559270aeDecodeGithubComMatrixOrgGomatrix3(in *jlexer.Lexer, out *RespUserDisplayName) {
+ isTopLevel := in.IsStart()
+ if in.IsNull() {
+ if isTopLevel {
+ in.Consumed()
+ }
+ in.Skip()
+ return
+ }
+ in.Delim('{')
+ for !in.IsDelim('}') {
+ key := in.UnsafeFieldName(false)
+ in.WantColon()
+ if in.IsNull() {
+ in.Skip()
+ in.WantComma()
+ continue
+ }
+ switch key {
+ case "displayname":
+ out.DisplayName = string(in.String())
+ default:
+ in.SkipRecursive()
+ }
+ in.WantComma()
+ }
+ in.Delim('}')
+ if isTopLevel {
+ in.Consumed()
+ }
+}
+func easyjson559270aeEncodeGithubComMatrixOrgGomatrix3(out *jwriter.Writer, in RespUserDisplayName) {
+ out.RawByte('{')
+ first := true
+ _ = first
+ {
+ const prefix string = ",\"displayname\":"
+ out.RawString(prefix[1:])
+ out.String(string(in.DisplayName))
+ }
+ out.RawByte('}')
+}
+
+// MarshalJSON supports json.Marshaler interface
+func (v RespUserDisplayName) MarshalJSON() ([]byte, error) {
+ w := jwriter.Writer{}
+ easyjson559270aeEncodeGithubComMatrixOrgGomatrix3(&w, v)
+ return w.Buffer.BuildBytes(), w.Error
+}
+
+// MarshalEasyJSON supports easyjson.Marshaler interface
+func (v RespUserDisplayName) MarshalEasyJSON(w *jwriter.Writer) {
+ easyjson559270aeEncodeGithubComMatrixOrgGomatrix3(w, v)
+}
+
+// UnmarshalJSON supports json.Unmarshaler interface
+func (v *RespUserDisplayName) UnmarshalJSON(data []byte) error {
+ r := jlexer.Lexer{Data: data}
+ easyjson559270aeDecodeGithubComMatrixOrgGomatrix3(&r, v)
+ return r.Error()
+}
+
+// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
+func (v *RespUserDisplayName) UnmarshalEasyJSON(l *jlexer.Lexer) {
+ easyjson559270aeDecodeGithubComMatrixOrgGomatrix3(l, v)
+}
+func easyjson559270aeDecodeGithubComMatrixOrgGomatrix4(in *jlexer.Lexer, out *RespUnbanUser) {
+ isTopLevel := in.IsStart()
+ if in.IsNull() {
+ if isTopLevel {
+ in.Consumed()
+ }
+ in.Skip()
+ return
+ }
+ in.Delim('{')
+ for !in.IsDelim('}') {
+ key := in.UnsafeFieldName(false)
+ in.WantColon()
+ if in.IsNull() {
+ in.Skip()
+ in.WantComma()
+ continue
+ }
+ switch key {
+ default:
+ in.SkipRecursive()
+ }
+ in.WantComma()
+ }
+ in.Delim('}')
+ if isTopLevel {
+ in.Consumed()
+ }
+}
+func easyjson559270aeEncodeGithubComMatrixOrgGomatrix4(out *jwriter.Writer, in RespUnbanUser) {
+ out.RawByte('{')
+ first := true
+ _ = first
+ out.RawByte('}')
+}
+
+// MarshalJSON supports json.Marshaler interface
+func (v RespUnbanUser) MarshalJSON() ([]byte, error) {
+ w := jwriter.Writer{}
+ easyjson559270aeEncodeGithubComMatrixOrgGomatrix4(&w, v)
+ return w.Buffer.BuildBytes(), w.Error
+}
+
+// MarshalEasyJSON supports easyjson.Marshaler interface
+func (v RespUnbanUser) MarshalEasyJSON(w *jwriter.Writer) {
+ easyjson559270aeEncodeGithubComMatrixOrgGomatrix4(w, v)
+}
+
+// UnmarshalJSON supports json.Unmarshaler interface
+func (v *RespUnbanUser) UnmarshalJSON(data []byte) error {
+ r := jlexer.Lexer{Data: data}
+ easyjson559270aeDecodeGithubComMatrixOrgGomatrix4(&r, v)
+ return r.Error()
+}
+
+// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
+func (v *RespUnbanUser) UnmarshalEasyJSON(l *jlexer.Lexer) {
+ easyjson559270aeDecodeGithubComMatrixOrgGomatrix4(l, v)
+}
+func easyjson559270aeDecodeGithubComMatrixOrgGomatrix5(in *jlexer.Lexer, out *RespTyping) {
+ isTopLevel := in.IsStart()
+ if in.IsNull() {
+ if isTopLevel {
+ in.Consumed()
+ }
+ in.Skip()
+ return
+ }
+ in.Delim('{')
+ for !in.IsDelim('}') {
+ key := in.UnsafeFieldName(false)
+ in.WantColon()
+ if in.IsNull() {
+ in.Skip()
+ in.WantComma()
+ continue
+ }
+ switch key {
+ default:
+ in.SkipRecursive()
+ }
+ in.WantComma()
+ }
+ in.Delim('}')
+ if isTopLevel {
+ in.Consumed()
+ }
+}
+func easyjson559270aeEncodeGithubComMatrixOrgGomatrix5(out *jwriter.Writer, in RespTyping) {
+ out.RawByte('{')
+ first := true
+ _ = first
+ out.RawByte('}')
+}
+
+// MarshalJSON supports json.Marshaler interface
+func (v RespTyping) MarshalJSON() ([]byte, error) {
+ w := jwriter.Writer{}
+ easyjson559270aeEncodeGithubComMatrixOrgGomatrix5(&w, v)
+ return w.Buffer.BuildBytes(), w.Error
+}
+
+// MarshalEasyJSON supports easyjson.Marshaler interface
+func (v RespTyping) MarshalEasyJSON(w *jwriter.Writer) {
+ easyjson559270aeEncodeGithubComMatrixOrgGomatrix5(w, v)
+}
+
+// UnmarshalJSON supports json.Unmarshaler interface
+func (v *RespTyping) UnmarshalJSON(data []byte) error {
+ r := jlexer.Lexer{Data: data}
+ easyjson559270aeDecodeGithubComMatrixOrgGomatrix5(&r, v)
+ return r.Error()
+}
+
+// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
+func (v *RespTyping) UnmarshalEasyJSON(l *jlexer.Lexer) {
+ easyjson559270aeDecodeGithubComMatrixOrgGomatrix5(l, v)
+}
+func easyjson559270aeDecodeGithubComMatrixOrgGomatrix6(in *jlexer.Lexer, out *RespTurnServer) {
+ isTopLevel := in.IsStart()
+ if in.IsNull() {
+ if isTopLevel {
+ in.Consumed()
+ }
+ in.Skip()
+ return
+ }
+ in.Delim('{')
+ for !in.IsDelim('}') {
+ key := in.UnsafeFieldName(false)
+ in.WantColon()
+ if in.IsNull() {
+ in.Skip()
+ in.WantComma()
+ continue
+ }
+ switch key {
+ case "username":
+ out.Username = string(in.String())
+ case "password":
+ out.Password = string(in.String())
+ case "ttl":
+ out.TTL = int(in.Int())
+ case "uris":
+ if in.IsNull() {
+ in.Skip()
+ out.URIs = nil
+ } else {
+ in.Delim('[')
+ if out.URIs == nil {
+ if !in.IsDelim(']') {
+ out.URIs = make([]string, 0, 4)
+ } else {
+ out.URIs = []string{}
+ }
+ } else {
+ out.URIs = (out.URIs)[:0]
+ }
+ for !in.IsDelim(']') {
+ var v15 string
+ v15 = string(in.String())
+ out.URIs = append(out.URIs, v15)
+ in.WantComma()
+ }
+ in.Delim(']')
+ }
+ default:
+ in.SkipRecursive()
+ }
+ in.WantComma()
+ }
+ in.Delim('}')
+ if isTopLevel {
+ in.Consumed()
+ }
+}
+func easyjson559270aeEncodeGithubComMatrixOrgGomatrix6(out *jwriter.Writer, in RespTurnServer) {
+ out.RawByte('{')
+ first := true
+ _ = first
+ {
+ const prefix string = ",\"username\":"
+ out.RawString(prefix[1:])
+ out.String(string(in.Username))
+ }
+ {
+ const prefix string = ",\"password\":"
+ out.RawString(prefix)
+ out.String(string(in.Password))
+ }
+ {
+ const prefix string = ",\"ttl\":"
+ out.RawString(prefix)
+ out.Int(int(in.TTL))
+ }
+ {
+ const prefix string = ",\"uris\":"
+ out.RawString(prefix)
+ if in.URIs == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 {
+ out.RawString("null")
+ } else {
+ out.RawByte('[')
+ for v16, v17 := range in.URIs {
+ if v16 > 0 {
+ out.RawByte(',')
+ }
+ out.String(string(v17))
+ }
+ out.RawByte(']')
+ }
+ }
+ out.RawByte('}')
+}
+
+// MarshalJSON supports json.Marshaler interface
+func (v RespTurnServer) MarshalJSON() ([]byte, error) {
+ w := jwriter.Writer{}
+ easyjson559270aeEncodeGithubComMatrixOrgGomatrix6(&w, v)
+ return w.Buffer.BuildBytes(), w.Error
+}
+
+// MarshalEasyJSON supports easyjson.Marshaler interface
+func (v RespTurnServer) MarshalEasyJSON(w *jwriter.Writer) {
+ easyjson559270aeEncodeGithubComMatrixOrgGomatrix6(w, v)
+}
+
+// UnmarshalJSON supports json.Unmarshaler interface
+func (v *RespTurnServer) UnmarshalJSON(data []byte) error {
+ r := jlexer.Lexer{Data: data}
+ easyjson559270aeDecodeGithubComMatrixOrgGomatrix6(&r, v)
+ return r.Error()
+}
+
+// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
+func (v *RespTurnServer) UnmarshalEasyJSON(l *jlexer.Lexer) {
+ easyjson559270aeDecodeGithubComMatrixOrgGomatrix6(l, v)
+}
+func easyjson559270aeDecodeGithubComMatrixOrgGomatrix7(in *jlexer.Lexer, out *RespSync) {
+ isTopLevel := in.IsStart()
+ if in.IsNull() {
+ if isTopLevel {
+ in.Consumed()
+ }
+ in.Skip()
+ return
+ }
+ in.Delim('{')
+ for !in.IsDelim('}') {
+ key := in.UnsafeFieldName(false)
+ in.WantColon()
+ if in.IsNull() {
+ in.Skip()
+ in.WantComma()
+ continue
+ }
+ switch key {
+ case "next_batch":
+ out.NextBatch = string(in.String())
+ case "account_data":
+ easyjson559270aeDecode1(in, &out.AccountData)
+ case "presence":
+ easyjson559270aeDecode1(in, &out.Presence)
+ case "rooms":
+ easyjson559270aeDecode2(in, &out.Rooms)
+ default:
+ in.SkipRecursive()
+ }
+ in.WantComma()
+ }
+ in.Delim('}')
+ if isTopLevel {
+ in.Consumed()
+ }
+}
+func easyjson559270aeEncodeGithubComMatrixOrgGomatrix7(out *jwriter.Writer, in RespSync) {
+ out.RawByte('{')
+ first := true
+ _ = first
+ {
+ const prefix string = ",\"next_batch\":"
+ out.RawString(prefix[1:])
+ out.String(string(in.NextBatch))
+ }
+ {
+ const prefix string = ",\"account_data\":"
+ out.RawString(prefix)
+ easyjson559270aeEncode1(out, in.AccountData)
+ }
+ {
+ const prefix string = ",\"presence\":"
+ out.RawString(prefix)
+ easyjson559270aeEncode1(out, in.Presence)
+ }
+ {
+ const prefix string = ",\"rooms\":"
+ out.RawString(prefix)
+ easyjson559270aeEncode2(out, in.Rooms)
+ }
+ out.RawByte('}')
+}
+
+// MarshalJSON supports json.Marshaler interface
+func (v RespSync) MarshalJSON() ([]byte, error) {
+ w := jwriter.Writer{}
+ easyjson559270aeEncodeGithubComMatrixOrgGomatrix7(&w, v)
+ return w.Buffer.BuildBytes(), w.Error
+}
+
+// MarshalEasyJSON supports easyjson.Marshaler interface
+func (v RespSync) MarshalEasyJSON(w *jwriter.Writer) {
+ easyjson559270aeEncodeGithubComMatrixOrgGomatrix7(w, v)
+}
+
+// UnmarshalJSON supports json.Unmarshaler interface
+func (v *RespSync) UnmarshalJSON(data []byte) error {
+ r := jlexer.Lexer{Data: data}
+ easyjson559270aeDecodeGithubComMatrixOrgGomatrix7(&r, v)
+ return r.Error()
+}
+
+// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
+func (v *RespSync) UnmarshalEasyJSON(l *jlexer.Lexer) {
+ easyjson559270aeDecodeGithubComMatrixOrgGomatrix7(l, v)
+}
+func easyjson559270aeDecode2(in *jlexer.Lexer, out *struct {
+ Leave map[string]struct {
+ State struct {
+ Events []Event `json:"events"`
+ } `json:"state"`
+ Timeline struct {
+ Events []Event `json:"events"`
+ Limited bool `json:"limited"`
+ PrevBatch string `json:"prev_batch"`
+ } `json:"timeline"`
+ } `json:"leave"`
+ Join map[string]struct {
+ State struct {
+ Events []Event `json:"events"`
+ } `json:"state"`
+ Timeline struct {
+ Events []Event `json:"events"`
+ Limited bool `json:"limited"`
+ PrevBatch string `json:"prev_batch"`
+ } `json:"timeline"`
+ Ephemeral struct {
+ Events []Event `json:"events"`
+ } `json:"ephemeral"`
+ } `json:"join"`
+ Invite map[string]struct {
+ State struct{ Events []Event } `json:"invite_state"`
+ } `json:"invite"`
+}) {
+ isTopLevel := in.IsStart()
+ if in.IsNull() {
+ if isTopLevel {
+ in.Consumed()
+ }
+ in.Skip()
+ return
+ }
+ in.Delim('{')
+ for !in.IsDelim('}') {
+ key := in.UnsafeFieldName(false)
+ in.WantColon()
+ if in.IsNull() {
+ in.Skip()
+ in.WantComma()
+ continue
+ }
+ switch key {
+ case "leave":
+ if in.IsNull() {
+ in.Skip()
+ } else {
+ in.Delim('{')
+ out.Leave = make(map[string]struct {
+ State struct {
+ Events []Event `json:"events"`
+ } `json:"state"`
+ Timeline struct {
+ Events []Event `json:"events"`
+ Limited bool `json:"limited"`
+ PrevBatch string `json:"prev_batch"`
+ } `json:"timeline"`
+ })
+ for !in.IsDelim('}') {
+ key := string(in.String())
+ in.WantColon()
+ var v18 struct {
+ State struct {
+ Events []Event `json:"events"`
+ } `json:"state"`
+ Timeline struct {
+ Events []Event `json:"events"`
+ Limited bool `json:"limited"`
+ PrevBatch string `json:"prev_batch"`
+ } `json:"timeline"`
+ }
+ easyjson559270aeDecode3(in, &v18)
+ (out.Leave)[key] = v18
+ in.WantComma()
+ }
+ in.Delim('}')
+ }
+ case "join":
+ if in.IsNull() {
+ in.Skip()
+ } else {
+ in.Delim('{')
+ out.Join = make(map[string]struct {
+ State struct {
+ Events []Event `json:"events"`
+ } `json:"state"`
+ Timeline struct {
+ Events []Event `json:"events"`
+ Limited bool `json:"limited"`
+ PrevBatch string `json:"prev_batch"`
+ } `json:"timeline"`
+ Ephemeral struct {
+ Events []Event `json:"events"`
+ } `json:"ephemeral"`
+ })
+ for !in.IsDelim('}') {
+ key := string(in.String())
+ in.WantColon()
+ var v19 struct {
+ State struct {
+ Events []Event `json:"events"`
+ } `json:"state"`
+ Timeline struct {
+ Events []Event `json:"events"`
+ Limited bool `json:"limited"`
+ PrevBatch string `json:"prev_batch"`
+ } `json:"timeline"`
+ Ephemeral struct {
+ Events []Event `json:"events"`
+ } `json:"ephemeral"`
+ }
+ easyjson559270aeDecode4(in, &v19)
+ (out.Join)[key] = v19
+ in.WantComma()
+ }
+ in.Delim('}')
+ }
+ case "invite":
+ if in.IsNull() {
+ in.Skip()
+ } else {
+ in.Delim('{')
+ out.Invite = make(map[string]struct {
+ State struct{ Events []Event } `json:"invite_state"`
+ })
+ for !in.IsDelim('}') {
+ key := string(in.String())
+ in.WantColon()
+ var v20 struct {
+ State struct{ Events []Event } `json:"invite_state"`
+ }
+ easyjson559270aeDecode5(in, &v20)
+ (out.Invite)[key] = v20
+ in.WantComma()
+ }
+ in.Delim('}')
+ }
+ default:
+ in.SkipRecursive()
+ }
+ in.WantComma()
+ }
+ in.Delim('}')
+ if isTopLevel {
+ in.Consumed()
+ }
+}
+func easyjson559270aeEncode2(out *jwriter.Writer, in struct {
+ Leave map[string]struct {
+ State struct {
+ Events []Event `json:"events"`
+ } `json:"state"`
+ Timeline struct {
+ Events []Event `json:"events"`
+ Limited bool `json:"limited"`
+ PrevBatch string `json:"prev_batch"`
+ } `json:"timeline"`
+ } `json:"leave"`
+ Join map[string]struct {
+ State struct {
+ Events []Event `json:"events"`
+ } `json:"state"`
+ Timeline struct {
+ Events []Event `json:"events"`
+ Limited bool `json:"limited"`
+ PrevBatch string `json:"prev_batch"`
+ } `json:"timeline"`
+ Ephemeral struct {
+ Events []Event `json:"events"`
+ } `json:"ephemeral"`
+ } `json:"join"`
+ Invite map[string]struct {
+ State struct{ Events []Event } `json:"invite_state"`
+ } `json:"invite"`
+}) {
+ out.RawByte('{')
+ first := true
+ _ = first
+ {
+ const prefix string = ",\"leave\":"
+ out.RawString(prefix[1:])
+ if in.Leave == nil && (out.Flags&jwriter.NilMapAsEmpty) == 0 {
+ out.RawString(`null`)
+ } else {
+ out.RawByte('{')
+ v21First := true
+ for v21Name, v21Value := range in.Leave {
+ if v21First {
+ v21First = false
+ } else {
+ out.RawByte(',')
+ }
+ out.String(string(v21Name))
+ out.RawByte(':')
+ easyjson559270aeEncode3(out, v21Value)
+ }
+ out.RawByte('}')
+ }
+ }
+ {
+ const prefix string = ",\"join\":"
+ out.RawString(prefix)
+ if in.Join == nil && (out.Flags&jwriter.NilMapAsEmpty) == 0 {
+ out.RawString(`null`)
+ } else {
+ out.RawByte('{')
+ v22First := true
+ for v22Name, v22Value := range in.Join {
+ if v22First {
+ v22First = false
+ } else {
+ out.RawByte(',')
+ }
+ out.String(string(v22Name))
+ out.RawByte(':')
+ easyjson559270aeEncode4(out, v22Value)
+ }
+ out.RawByte('}')
+ }
+ }
+ {
+ const prefix string = ",\"invite\":"
+ out.RawString(prefix)
+ if in.Invite == nil && (out.Flags&jwriter.NilMapAsEmpty) == 0 {
+ out.RawString(`null`)
+ } else {
+ out.RawByte('{')
+ v23First := true
+ for v23Name, v23Value := range in.Invite {
+ if v23First {
+ v23First = false
+ } else {
+ out.RawByte(',')
+ }
+ out.String(string(v23Name))
+ out.RawByte(':')
+ easyjson559270aeEncode5(out, v23Value)
+ }
+ out.RawByte('}')
+ }
+ }
+ out.RawByte('}')
+}
+func easyjson559270aeDecode5(in *jlexer.Lexer, out *struct {
+ State struct{ Events []Event } `json:"invite_state"`
+}) {
+ isTopLevel := in.IsStart()
+ if in.IsNull() {
+ if isTopLevel {
+ in.Consumed()
+ }
+ in.Skip()
+ return
+ }
+ in.Delim('{')
+ for !in.IsDelim('}') {
+ key := in.UnsafeFieldName(false)
+ in.WantColon()
+ if in.IsNull() {
+ in.Skip()
+ in.WantComma()
+ continue
+ }
+ switch key {
+ case "invite_state":
+ easyjson559270aeDecode6(in, &out.State)
+ default:
+ in.SkipRecursive()
+ }
+ in.WantComma()
+ }
+ in.Delim('}')
+ if isTopLevel {
+ in.Consumed()
+ }
+}
+func easyjson559270aeEncode5(out *jwriter.Writer, in struct {
+ State struct{ Events []Event } `json:"invite_state"`
+}) {
+ out.RawByte('{')
+ first := true
+ _ = first
+ {
+ const prefix string = ",\"invite_state\":"
+ out.RawString(prefix[1:])
+ easyjson559270aeEncode6(out, in.State)
+ }
+ out.RawByte('}')
+}
+func easyjson559270aeDecode6(in *jlexer.Lexer, out *struct{ Events []Event }) {
+ isTopLevel := in.IsStart()
+ if in.IsNull() {
+ if isTopLevel {
+ in.Consumed()
+ }
+ in.Skip()
+ return
+ }
+ in.Delim('{')
+ for !in.IsDelim('}') {
+ key := in.UnsafeFieldName(false)
+ in.WantColon()
+ if in.IsNull() {
+ in.Skip()
+ in.WantComma()
+ continue
+ }
+ switch key {
+ case "Events":
+ if in.IsNull() {
+ in.Skip()
+ out.Events = nil
+ } else {
+ in.Delim('[')
+ if out.Events == nil {
+ if !in.IsDelim(']') {
+ out.Events = make([]Event, 0, 0)
+ } else {
+ out.Events = []Event{}
+ }
+ } else {
+ out.Events = (out.Events)[:0]
+ }
+ for !in.IsDelim(']') {
+ var v24 Event
+ easyjson559270aeDecodeGithubComMatrixOrgGomatrix8(in, &v24)
+ out.Events = append(out.Events, v24)
+ in.WantComma()
+ }
+ in.Delim(']')
+ }
+ default:
+ in.SkipRecursive()
+ }
+ in.WantComma()
+ }
+ in.Delim('}')
+ if isTopLevel {
+ in.Consumed()
+ }
+}
+func easyjson559270aeEncode6(out *jwriter.Writer, in struct{ Events []Event }) {
+ out.RawByte('{')
+ first := true
+ _ = first
+ {
+ const prefix string = ",\"Events\":"
+ out.RawString(prefix[1:])
+ if in.Events == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 {
+ out.RawString("null")
+ } else {
+ out.RawByte('[')
+ for v25, v26 := range in.Events {
+ if v25 > 0 {
+ out.RawByte(',')
+ }
+ easyjson559270aeEncodeGithubComMatrixOrgGomatrix8(out, v26)
+ }
+ out.RawByte(']')
+ }
+ }
+ out.RawByte('}')
+}
+func easyjson559270aeDecodeGithubComMatrixOrgGomatrix8(in *jlexer.Lexer, out *Event) {
+ isTopLevel := in.IsStart()
+ if in.IsNull() {
+ if isTopLevel {
+ in.Consumed()
+ }
+ in.Skip()
+ return
+ }
+ in.Delim('{')
+ for !in.IsDelim('}') {
+ key := in.UnsafeFieldName(false)
+ in.WantColon()
+ if in.IsNull() {
+ in.Skip()
+ in.WantComma()
+ continue
+ }
+ switch key {
+ case "state_key":
+ if in.IsNull() {
+ in.Skip()
+ out.StateKey = nil
+ } else {
+ if out.StateKey == nil {
+ out.StateKey = new(string)
+ }
+ *out.StateKey = string(in.String())
+ }
+ case "sender":
+ out.Sender = string(in.String())
+ case "type":
+ out.Type = string(in.String())
+ case "origin_server_ts":
+ out.Timestamp = int64(in.Int64())
+ case "event_id":
+ out.ID = string(in.String())
+ case "room_id":
+ out.RoomID = string(in.String())
+ case "redacts":
+ out.Redacts = string(in.String())
+ case "unsigned":
+ if in.IsNull() {
+ in.Skip()
+ } else {
+ in.Delim('{')
+ out.Unsigned = make(map[string]interface{})
+ for !in.IsDelim('}') {
+ key := string(in.String())
+ in.WantColon()
+ var v27 interface{}
+ if m, ok := v27.(easyjson.Unmarshaler); ok {
+ m.UnmarshalEasyJSON(in)
+ } else if m, ok := v27.(json.Unmarshaler); ok {
+ _ = m.UnmarshalJSON(in.Raw())
+ } else {
+ v27 = in.Interface()
+ }
+ (out.Unsigned)[key] = v27
+ in.WantComma()
+ }
+ in.Delim('}')
+ }
+ case "content":
+ if in.IsNull() {
+ in.Skip()
+ } else {
+ in.Delim('{')
+ out.Content = make(map[string]interface{})
+ for !in.IsDelim('}') {
+ key := string(in.String())
+ in.WantColon()
+ var v28 interface{}
+ if m, ok := v28.(easyjson.Unmarshaler); ok {
+ m.UnmarshalEasyJSON(in)
+ } else if m, ok := v28.(json.Unmarshaler); ok {
+ _ = m.UnmarshalJSON(in.Raw())
+ } else {
+ v28 = in.Interface()
+ }
+ (out.Content)[key] = v28
+ in.WantComma()
+ }
+ in.Delim('}')
+ }
+ case "prev_content":
+ if in.IsNull() {
+ in.Skip()
+ } else {
+ in.Delim('{')
+ if !in.IsDelim('}') {
+ out.PrevContent = make(map[string]interface{})
+ } else {
+ out.PrevContent = nil
+ }
+ for !in.IsDelim('}') {
+ key := string(in.String())
+ in.WantColon()
+ var v29 interface{}
+ if m, ok := v29.(easyjson.Unmarshaler); ok {
+ m.UnmarshalEasyJSON(in)
+ } else if m, ok := v29.(json.Unmarshaler); ok {
+ _ = m.UnmarshalJSON(in.Raw())
+ } else {
+ v29 = in.Interface()
+ }
+ (out.PrevContent)[key] = v29
+ in.WantComma()
+ }
+ in.Delim('}')
+ }
+ default:
+ in.SkipRecursive()
+ }
+ in.WantComma()
+ }
+ in.Delim('}')
+ if isTopLevel {
+ in.Consumed()
+ }
+}
+func easyjson559270aeEncodeGithubComMatrixOrgGomatrix8(out *jwriter.Writer, in Event) {
+ out.RawByte('{')
+ first := true
+ _ = first
+ if in.StateKey != nil {
+ const prefix string = ",\"state_key\":"
+ first = false
+ out.RawString(prefix[1:])
+ out.String(string(*in.StateKey))
+ }
+ {
+ const prefix string = ",\"sender\":"
+ if first {
+ first = false
+ out.RawString(prefix[1:])
+ } else {
+ out.RawString(prefix)
+ }
+ out.String(string(in.Sender))
+ }
+ {
+ const prefix string = ",\"type\":"
+ out.RawString(prefix)
+ out.String(string(in.Type))
+ }
+ {
+ const prefix string = ",\"origin_server_ts\":"
+ out.RawString(prefix)
+ out.Int64(int64(in.Timestamp))
+ }
+ {
+ const prefix string = ",\"event_id\":"
+ out.RawString(prefix)
+ out.String(string(in.ID))
+ }
+ {
+ const prefix string = ",\"room_id\":"
+ out.RawString(prefix)
+ out.String(string(in.RoomID))
+ }
+ if in.Redacts != "" {
+ const prefix string = ",\"redacts\":"
+ out.RawString(prefix)
+ out.String(string(in.Redacts))
+ }
+ {
+ const prefix string = ",\"unsigned\":"
+ out.RawString(prefix)
+ if in.Unsigned == nil && (out.Flags&jwriter.NilMapAsEmpty) == 0 {
+ out.RawString(`null`)
+ } else {
+ out.RawByte('{')
+ v30First := true
+ for v30Name, v30Value := range in.Unsigned {
+ if v30First {
+ v30First = false
+ } else {
+ out.RawByte(',')
+ }
+ out.String(string(v30Name))
+ out.RawByte(':')
+ if m, ok := v30Value.(easyjson.Marshaler); ok {
+ m.MarshalEasyJSON(out)
+ } else if m, ok := v30Value.(json.Marshaler); ok {
+ out.Raw(m.MarshalJSON())
+ } else {
+ out.Raw(json.Marshal(v30Value))
+ }
+ }
+ out.RawByte('}')
+ }
+ }
+ {
+ const prefix string = ",\"content\":"
+ out.RawString(prefix)
+ if in.Content == nil && (out.Flags&jwriter.NilMapAsEmpty) == 0 {
+ out.RawString(`null`)
+ } else {
+ out.RawByte('{')
+ v31First := true
+ for v31Name, v31Value := range in.Content {
+ if v31First {
+ v31First = false
+ } else {
+ out.RawByte(',')
+ }
+ out.String(string(v31Name))
+ out.RawByte(':')
+ if m, ok := v31Value.(easyjson.Marshaler); ok {
+ m.MarshalEasyJSON(out)
+ } else if m, ok := v31Value.(json.Marshaler); ok {
+ out.Raw(m.MarshalJSON())
+ } else {
+ out.Raw(json.Marshal(v31Value))
+ }
+ }
+ out.RawByte('}')
+ }
+ }
+ if len(in.PrevContent) != 0 {
+ const prefix string = ",\"prev_content\":"
+ out.RawString(prefix)
+ {
+ out.RawByte('{')
+ v32First := true
+ for v32Name, v32Value := range in.PrevContent {
+ if v32First {
+ v32First = false
+ } else {
+ out.RawByte(',')
+ }
+ out.String(string(v32Name))
+ out.RawByte(':')
+ if m, ok := v32Value.(easyjson.Marshaler); ok {
+ m.MarshalEasyJSON(out)
+ } else if m, ok := v32Value.(json.Marshaler); ok {
+ out.Raw(m.MarshalJSON())
+ } else {
+ out.Raw(json.Marshal(v32Value))
+ }
+ }
+ out.RawByte('}')
+ }
+ }
+ out.RawByte('}')
+}
+func easyjson559270aeDecode4(in *jlexer.Lexer, out *struct {
+ State struct {
+ Events []Event `json:"events"`
+ } `json:"state"`
+ Timeline struct {
+ Events []Event `json:"events"`
+ Limited bool `json:"limited"`
+ PrevBatch string `json:"prev_batch"`
+ } `json:"timeline"`
+ Ephemeral struct {
+ Events []Event `json:"events"`
+ } `json:"ephemeral"`
+}) {
+ isTopLevel := in.IsStart()
+ if in.IsNull() {
+ if isTopLevel {
+ in.Consumed()
+ }
+ in.Skip()
+ return
+ }
+ in.Delim('{')
+ for !in.IsDelim('}') {
+ key := in.UnsafeFieldName(false)
+ in.WantColon()
+ if in.IsNull() {
+ in.Skip()
+ in.WantComma()
+ continue
+ }
+ switch key {
+ case "state":
+ easyjson559270aeDecode1(in, &out.State)
+ case "timeline":
+ easyjson559270aeDecode7(in, &out.Timeline)
+ case "ephemeral":
+ easyjson559270aeDecode1(in, &out.Ephemeral)
+ default:
+ in.SkipRecursive()
+ }
+ in.WantComma()
+ }
+ in.Delim('}')
+ if isTopLevel {
+ in.Consumed()
+ }
+}
+func easyjson559270aeEncode4(out *jwriter.Writer, in struct {
+ State struct {
+ Events []Event `json:"events"`
+ } `json:"state"`
+ Timeline struct {
+ Events []Event `json:"events"`
+ Limited bool `json:"limited"`
+ PrevBatch string `json:"prev_batch"`
+ } `json:"timeline"`
+ Ephemeral struct {
+ Events []Event `json:"events"`
+ } `json:"ephemeral"`
+}) {
+ out.RawByte('{')
+ first := true
+ _ = first
+ {
+ const prefix string = ",\"state\":"
+ out.RawString(prefix[1:])
+ easyjson559270aeEncode1(out, in.State)
+ }
+ {
+ const prefix string = ",\"timeline\":"
+ out.RawString(prefix)
+ easyjson559270aeEncode7(out, in.Timeline)
+ }
+ {
+ const prefix string = ",\"ephemeral\":"
+ out.RawString(prefix)
+ easyjson559270aeEncode1(out, in.Ephemeral)
+ }
+ out.RawByte('}')
+}
+func easyjson559270aeDecode7(in *jlexer.Lexer, out *struct {
+ Events []Event `json:"events"`
+ Limited bool `json:"limited"`
+ PrevBatch string `json:"prev_batch"`
+}) {
+ isTopLevel := in.IsStart()
+ if in.IsNull() {
+ if isTopLevel {
+ in.Consumed()
+ }
+ in.Skip()
+ return
+ }
+ in.Delim('{')
+ for !in.IsDelim('}') {
+ key := in.UnsafeFieldName(false)
+ in.WantColon()
+ if in.IsNull() {
+ in.Skip()
+ in.WantComma()
+ continue
+ }
+ switch key {
+ case "events":
+ if in.IsNull() {
+ in.Skip()
+ out.Events = nil
+ } else {
+ in.Delim('[')
+ if out.Events == nil {
+ if !in.IsDelim(']') {
+ out.Events = make([]Event, 0, 0)
+ } else {
+ out.Events = []Event{}
+ }
+ } else {
+ out.Events = (out.Events)[:0]
+ }
+ for !in.IsDelim(']') {
+ var v33 Event
+ easyjson559270aeDecodeGithubComMatrixOrgGomatrix8(in, &v33)
+ out.Events = append(out.Events, v33)
+ in.WantComma()
+ }
+ in.Delim(']')
+ }
+ case "limited":
+ out.Limited = bool(in.Bool())
+ case "prev_batch":
+ out.PrevBatch = string(in.String())
+ default:
+ in.SkipRecursive()
+ }
+ in.WantComma()
+ }
+ in.Delim('}')
+ if isTopLevel {
+ in.Consumed()
+ }
+}
+func easyjson559270aeEncode7(out *jwriter.Writer, in struct {
+ Events []Event `json:"events"`
+ Limited bool `json:"limited"`
+ PrevBatch string `json:"prev_batch"`
+}) {
+ out.RawByte('{')
+ first := true
+ _ = first
+ {
+ const prefix string = ",\"events\":"
+ out.RawString(prefix[1:])
+ if in.Events == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 {
+ out.RawString("null")
+ } else {
+ out.RawByte('[')
+ for v34, v35 := range in.Events {
+ if v34 > 0 {
+ out.RawByte(',')
+ }
+ easyjson559270aeEncodeGithubComMatrixOrgGomatrix8(out, v35)
+ }
+ out.RawByte(']')
+ }
+ }
+ {
+ const prefix string = ",\"limited\":"
+ out.RawString(prefix)
+ out.Bool(bool(in.Limited))
+ }
+ {
+ const prefix string = ",\"prev_batch\":"
+ out.RawString(prefix)
+ out.String(string(in.PrevBatch))
+ }
+ out.RawByte('}')
+}
+func easyjson559270aeDecode3(in *jlexer.Lexer, out *struct {
+ State struct {
+ Events []Event `json:"events"`
+ } `json:"state"`
+ Timeline struct {
+ Events []Event `json:"events"`
+ Limited bool `json:"limited"`
+ PrevBatch string `json:"prev_batch"`
+ } `json:"timeline"`
+}) {
+ isTopLevel := in.IsStart()
+ if in.IsNull() {
+ if isTopLevel {
+ in.Consumed()
+ }
+ in.Skip()
+ return
+ }
+ in.Delim('{')
+ for !in.IsDelim('}') {
+ key := in.UnsafeFieldName(false)
+ in.WantColon()
+ if in.IsNull() {
+ in.Skip()
+ in.WantComma()
+ continue
+ }
+ switch key {
+ case "state":
+ easyjson559270aeDecode1(in, &out.State)
+ case "timeline":
+ easyjson559270aeDecode7(in, &out.Timeline)
+ default:
+ in.SkipRecursive()
+ }
+ in.WantComma()
+ }
+ in.Delim('}')
+ if isTopLevel {
+ in.Consumed()
+ }
+}
+func easyjson559270aeEncode3(out *jwriter.Writer, in struct {
+ State struct {
+ Events []Event `json:"events"`
+ } `json:"state"`
+ Timeline struct {
+ Events []Event `json:"events"`
+ Limited bool `json:"limited"`
+ PrevBatch string `json:"prev_batch"`
+ } `json:"timeline"`
+}) {
+ out.RawByte('{')
+ first := true
+ _ = first
+ {
+ const prefix string = ",\"state\":"
+ out.RawString(prefix[1:])
+ easyjson559270aeEncode1(out, in.State)
+ }
+ {
+ const prefix string = ",\"timeline\":"
+ out.RawString(prefix)
+ easyjson559270aeEncode7(out, in.Timeline)
+ }
+ out.RawByte('}')
+}
+func easyjson559270aeDecode1(in *jlexer.Lexer, out *struct {
+ Events []Event `json:"events"`
+}) {
+ isTopLevel := in.IsStart()
+ if in.IsNull() {
+ if isTopLevel {
+ in.Consumed()
+ }
+ in.Skip()
+ return
+ }
+ in.Delim('{')
+ for !in.IsDelim('}') {
+ key := in.UnsafeFieldName(false)
+ in.WantColon()
+ if in.IsNull() {
+ in.Skip()
+ in.WantComma()
+ continue
+ }
+ switch key {
+ case "events":
+ if in.IsNull() {
+ in.Skip()
+ out.Events = nil
+ } else {
+ in.Delim('[')
+ if out.Events == nil {
+ if !in.IsDelim(']') {
+ out.Events = make([]Event, 0, 0)
+ } else {
+ out.Events = []Event{}
+ }
+ } else {
+ out.Events = (out.Events)[:0]
+ }
+ for !in.IsDelim(']') {
+ var v36 Event
+ easyjson559270aeDecodeGithubComMatrixOrgGomatrix8(in, &v36)
+ out.Events = append(out.Events, v36)
+ in.WantComma()
+ }
+ in.Delim(']')
+ }
+ default:
+ in.SkipRecursive()
+ }
+ in.WantComma()
+ }
+ in.Delim('}')
+ if isTopLevel {
+ in.Consumed()
+ }
+}
+func easyjson559270aeEncode1(out *jwriter.Writer, in struct {
+ Events []Event `json:"events"`
+}) {
+ out.RawByte('{')
+ first := true
+ _ = first
+ {
+ const prefix string = ",\"events\":"
+ out.RawString(prefix[1:])
+ if in.Events == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 {
+ out.RawString("null")
+ } else {
+ out.RawByte('[')
+ for v37, v38 := range in.Events {
+ if v37 > 0 {
+ out.RawByte(',')
+ }
+ easyjson559270aeEncodeGithubComMatrixOrgGomatrix8(out, v38)
+ }
+ out.RawByte(']')
+ }
+ }
+ out.RawByte('}')
+}
+func easyjson559270aeDecodeGithubComMatrixOrgGomatrix9(in *jlexer.Lexer, out *RespSendEvent) {
+ isTopLevel := in.IsStart()
+ if in.IsNull() {
+ if isTopLevel {
+ in.Consumed()
+ }
+ in.Skip()
+ return
+ }
+ in.Delim('{')
+ for !in.IsDelim('}') {
+ key := in.UnsafeFieldName(false)
+ in.WantColon()
+ if in.IsNull() {
+ in.Skip()
+ in.WantComma()
+ continue
+ }
+ switch key {
+ case "event_id":
+ out.EventID = string(in.String())
+ default:
+ in.SkipRecursive()
+ }
+ in.WantComma()
+ }
+ in.Delim('}')
+ if isTopLevel {
+ in.Consumed()
+ }
+}
+func easyjson559270aeEncodeGithubComMatrixOrgGomatrix9(out *jwriter.Writer, in RespSendEvent) {
+ out.RawByte('{')
+ first := true
+ _ = first
+ {
+ const prefix string = ",\"event_id\":"
+ out.RawString(prefix[1:])
+ out.String(string(in.EventID))
+ }
+ out.RawByte('}')
+}
+
+// MarshalJSON supports json.Marshaler interface
+func (v RespSendEvent) MarshalJSON() ([]byte, error) {
+ w := jwriter.Writer{}
+ easyjson559270aeEncodeGithubComMatrixOrgGomatrix9(&w, v)
+ return w.Buffer.BuildBytes(), w.Error
+}
+
+// MarshalEasyJSON supports easyjson.Marshaler interface
+func (v RespSendEvent) MarshalEasyJSON(w *jwriter.Writer) {
+ easyjson559270aeEncodeGithubComMatrixOrgGomatrix9(w, v)
+}
+
+// UnmarshalJSON supports json.Unmarshaler interface
+func (v *RespSendEvent) UnmarshalJSON(data []byte) error {
+ r := jlexer.Lexer{Data: data}
+ easyjson559270aeDecodeGithubComMatrixOrgGomatrix9(&r, v)
+ return r.Error()
+}
+
+// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
+func (v *RespSendEvent) UnmarshalEasyJSON(l *jlexer.Lexer) {
+ easyjson559270aeDecodeGithubComMatrixOrgGomatrix9(l, v)
+}
+func easyjson559270aeDecodeGithubComMatrixOrgGomatrix10(in *jlexer.Lexer, out *RespRegister) {
+ isTopLevel := in.IsStart()
+ if in.IsNull() {
+ if isTopLevel {
+ in.Consumed()
+ }
+ in.Skip()
+ return
+ }
+ in.Delim('{')
+ for !in.IsDelim('}') {
+ key := in.UnsafeFieldName(false)
+ in.WantColon()
+ if in.IsNull() {
+ in.Skip()
+ in.WantComma()
+ continue
+ }
+ switch key {
+ case "access_token":
+ out.AccessToken = string(in.String())
+ case "device_id":
+ out.DeviceID = string(in.String())
+ case "home_server":
+ out.HomeServer = string(in.String())
+ case "refresh_token":
+ out.RefreshToken = string(in.String())
+ case "user_id":
+ out.UserID = string(in.String())
+ default:
+ in.SkipRecursive()
+ }
+ in.WantComma()
+ }
+ in.Delim('}')
+ if isTopLevel {
+ in.Consumed()
+ }
+}
+func easyjson559270aeEncodeGithubComMatrixOrgGomatrix10(out *jwriter.Writer, in RespRegister) {
+ out.RawByte('{')
+ first := true
+ _ = first
+ {
+ const prefix string = ",\"access_token\":"
+ out.RawString(prefix[1:])
+ out.String(string(in.AccessToken))
+ }
+ {
+ const prefix string = ",\"device_id\":"
+ out.RawString(prefix)
+ out.String(string(in.DeviceID))
+ }
+ {
+ const prefix string = ",\"home_server\":"
+ out.RawString(prefix)
+ out.String(string(in.HomeServer))
+ }
+ {
+ const prefix string = ",\"refresh_token\":"
+ out.RawString(prefix)
+ out.String(string(in.RefreshToken))
+ }
+ {
+ const prefix string = ",\"user_id\":"
+ out.RawString(prefix)
+ out.String(string(in.UserID))
+ }
+ out.RawByte('}')
+}
+
+// MarshalJSON supports json.Marshaler interface
+func (v RespRegister) MarshalJSON() ([]byte, error) {
+ w := jwriter.Writer{}
+ easyjson559270aeEncodeGithubComMatrixOrgGomatrix10(&w, v)
+ return w.Buffer.BuildBytes(), w.Error
+}
+
+// MarshalEasyJSON supports easyjson.Marshaler interface
+func (v RespRegister) MarshalEasyJSON(w *jwriter.Writer) {
+ easyjson559270aeEncodeGithubComMatrixOrgGomatrix10(w, v)
+}
+
+// UnmarshalJSON supports json.Unmarshaler interface
+func (v *RespRegister) UnmarshalJSON(data []byte) error {
+ r := jlexer.Lexer{Data: data}
+ easyjson559270aeDecodeGithubComMatrixOrgGomatrix10(&r, v)
+ return r.Error()
+}
+
+// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
+func (v *RespRegister) UnmarshalEasyJSON(l *jlexer.Lexer) {
+ easyjson559270aeDecodeGithubComMatrixOrgGomatrix10(l, v)
+}
+func easyjson559270aeDecodeGithubComMatrixOrgGomatrix11(in *jlexer.Lexer, out *RespPublicRooms) {
+ isTopLevel := in.IsStart()
+ if in.IsNull() {
+ if isTopLevel {
+ in.Consumed()
+ }
+ in.Skip()
+ return
+ }
+ in.Delim('{')
+ for !in.IsDelim('}') {
+ key := in.UnsafeFieldName(false)
+ in.WantColon()
+ if in.IsNull() {
+ in.Skip()
+ in.WantComma()
+ continue
+ }
+ switch key {
+ case "total_room_count_estimate":
+ out.TotalRoomCountEstimate = int(in.Int())
+ case "prev_batch":
+ out.PrevBatch = string(in.String())
+ case "next_batch":
+ out.NextBatch = string(in.String())
+ case "chunk":
+ if in.IsNull() {
+ in.Skip()
+ out.Chunk = nil
+ } else {
+ in.Delim('[')
+ if out.Chunk == nil {
+ if !in.IsDelim(']') {
+ out.Chunk = make([]PublicRoom, 0, 0)
+ } else {
+ out.Chunk = []PublicRoom{}
+ }
+ } else {
+ out.Chunk = (out.Chunk)[:0]
+ }
+ for !in.IsDelim(']') {
+ var v39 PublicRoom
+ easyjson559270aeDecodeGithubComMatrixOrgGomatrix12(in, &v39)
+ out.Chunk = append(out.Chunk, v39)
+ in.WantComma()
+ }
+ in.Delim(']')
+ }
+ default:
+ in.SkipRecursive()
+ }
+ in.WantComma()
+ }
+ in.Delim('}')
+ if isTopLevel {
+ in.Consumed()
+ }
+}
+func easyjson559270aeEncodeGithubComMatrixOrgGomatrix11(out *jwriter.Writer, in RespPublicRooms) {
+ out.RawByte('{')
+ first := true
+ _ = first
+ {
+ const prefix string = ",\"total_room_count_estimate\":"
+ out.RawString(prefix[1:])
+ out.Int(int(in.TotalRoomCountEstimate))
+ }
+ {
+ const prefix string = ",\"prev_batch\":"
+ out.RawString(prefix)
+ out.String(string(in.PrevBatch))
+ }
+ {
+ const prefix string = ",\"next_batch\":"
+ out.RawString(prefix)
+ out.String(string(in.NextBatch))
+ }
+ {
+ const prefix string = ",\"chunk\":"
+ out.RawString(prefix)
+ if in.Chunk == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 {
+ out.RawString("null")
+ } else {
+ out.RawByte('[')
+ for v40, v41 := range in.Chunk {
+ if v40 > 0 {
+ out.RawByte(',')
+ }
+ easyjson559270aeEncodeGithubComMatrixOrgGomatrix12(out, v41)
+ }
+ out.RawByte(']')
+ }
+ }
+ out.RawByte('}')
+}
+
+// MarshalJSON supports json.Marshaler interface
+func (v RespPublicRooms) MarshalJSON() ([]byte, error) {
+ w := jwriter.Writer{}
+ easyjson559270aeEncodeGithubComMatrixOrgGomatrix11(&w, v)
+ return w.Buffer.BuildBytes(), w.Error
+}
+
+// MarshalEasyJSON supports easyjson.Marshaler interface
+func (v RespPublicRooms) MarshalEasyJSON(w *jwriter.Writer) {
+ easyjson559270aeEncodeGithubComMatrixOrgGomatrix11(w, v)
+}
+
+// UnmarshalJSON supports json.Unmarshaler interface
+func (v *RespPublicRooms) UnmarshalJSON(data []byte) error {
+ r := jlexer.Lexer{Data: data}
+ easyjson559270aeDecodeGithubComMatrixOrgGomatrix11(&r, v)
+ return r.Error()
+}
+
+// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
+func (v *RespPublicRooms) UnmarshalEasyJSON(l *jlexer.Lexer) {
+ easyjson559270aeDecodeGithubComMatrixOrgGomatrix11(l, v)
+}
+func easyjson559270aeDecodeGithubComMatrixOrgGomatrix12(in *jlexer.Lexer, out *PublicRoom) {
+ isTopLevel := in.IsStart()
+ if in.IsNull() {
+ if isTopLevel {
+ in.Consumed()
+ }
+ in.Skip()
+ return
+ }
+ in.Delim('{')
+ for !in.IsDelim('}') {
+ key := in.UnsafeFieldName(false)
+ in.WantColon()
+ if in.IsNull() {
+ in.Skip()
+ in.WantComma()
+ continue
+ }
+ switch key {
+ case "canonical_alias":
+ out.CanonicalAlias = string(in.String())
+ case "name":
+ out.Name = string(in.String())
+ case "world_readable":
+ out.WorldReadable = bool(in.Bool())
+ case "topic":
+ out.Topic = string(in.String())
+ case "num_joined_members":
+ out.NumJoinedMembers = int(in.Int())
+ case "avatar_url":
+ out.AvatarURL = string(in.String())
+ case "room_id":
+ out.RoomID = string(in.String())
+ case "guest_can_join":
+ out.GuestCanJoin = bool(in.Bool())
+ case "aliases":
+ if in.IsNull() {
+ in.Skip()
+ out.Aliases = nil
+ } else {
+ in.Delim('[')
+ if out.Aliases == nil {
+ if !in.IsDelim(']') {
+ out.Aliases = make([]string, 0, 4)
+ } else {
+ out.Aliases = []string{}
+ }
+ } else {
+ out.Aliases = (out.Aliases)[:0]
+ }
+ for !in.IsDelim(']') {
+ var v42 string
+ v42 = string(in.String())
+ out.Aliases = append(out.Aliases, v42)
+ in.WantComma()
+ }
+ in.Delim(']')
+ }
+ default:
+ in.SkipRecursive()
+ }
+ in.WantComma()
+ }
+ in.Delim('}')
+ if isTopLevel {
+ in.Consumed()
+ }
+}
+func easyjson559270aeEncodeGithubComMatrixOrgGomatrix12(out *jwriter.Writer, in PublicRoom) {
+ out.RawByte('{')
+ first := true
+ _ = first
+ {
+ const prefix string = ",\"canonical_alias\":"
+ out.RawString(prefix[1:])
+ out.String(string(in.CanonicalAlias))
+ }
+ {
+ const prefix string = ",\"name\":"
+ out.RawString(prefix)
+ out.String(string(in.Name))
+ }
+ {
+ const prefix string = ",\"world_readable\":"
+ out.RawString(prefix)
+ out.Bool(bool(in.WorldReadable))
+ }
+ {
+ const prefix string = ",\"topic\":"
+ out.RawString(prefix)
+ out.String(string(in.Topic))
+ }
+ {
+ const prefix string = ",\"num_joined_members\":"
+ out.RawString(prefix)
+ out.Int(int(in.NumJoinedMembers))
+ }
+ {
+ const prefix string = ",\"avatar_url\":"
+ out.RawString(prefix)
+ out.String(string(in.AvatarURL))
+ }
+ {
+ const prefix string = ",\"room_id\":"
+ out.RawString(prefix)
+ out.String(string(in.RoomID))
+ }
+ {
+ const prefix string = ",\"guest_can_join\":"
+ out.RawString(prefix)
+ out.Bool(bool(in.GuestCanJoin))
+ }
+ {
+ const prefix string = ",\"aliases\":"
+ out.RawString(prefix)
+ if in.Aliases == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 {
+ out.RawString("null")
+ } else {
+ out.RawByte('[')
+ for v43, v44 := range in.Aliases {
+ if v43 > 0 {
+ out.RawByte(',')
+ }
+ out.String(string(v44))
+ }
+ out.RawByte(']')
+ }
+ }
+ out.RawByte('}')
+}
+func easyjson559270aeDecodeGithubComMatrixOrgGomatrix13(in *jlexer.Lexer, out *RespMessages) {
+ isTopLevel := in.IsStart()
+ if in.IsNull() {
+ if isTopLevel {
+ in.Consumed()
+ }
+ in.Skip()
+ return
+ }
+ in.Delim('{')
+ for !in.IsDelim('}') {
+ key := in.UnsafeFieldName(false)
+ in.WantColon()
+ if in.IsNull() {
+ in.Skip()
+ in.WantComma()
+ continue
+ }
+ switch key {
+ case "start":
+ out.Start = string(in.String())
+ case "chunk":
+ if in.IsNull() {
+ in.Skip()
+ out.Chunk = nil
+ } else {
+ in.Delim('[')
+ if out.Chunk == nil {
+ if !in.IsDelim(']') {
+ out.Chunk = make([]Event, 0, 0)
+ } else {
+ out.Chunk = []Event{}
+ }
+ } else {
+ out.Chunk = (out.Chunk)[:0]
+ }
+ for !in.IsDelim(']') {
+ var v45 Event
+ easyjson559270aeDecodeGithubComMatrixOrgGomatrix8(in, &v45)
+ out.Chunk = append(out.Chunk, v45)
+ in.WantComma()
+ }
+ in.Delim(']')
+ }
+ case "end":
+ out.End = string(in.String())
+ default:
+ in.SkipRecursive()
+ }
+ in.WantComma()
+ }
+ in.Delim('}')
+ if isTopLevel {
+ in.Consumed()
+ }
+}
+func easyjson559270aeEncodeGithubComMatrixOrgGomatrix13(out *jwriter.Writer, in RespMessages) {
+ out.RawByte('{')
+ first := true
+ _ = first
+ {
+ const prefix string = ",\"start\":"
+ out.RawString(prefix[1:])
+ out.String(string(in.Start))
+ }
+ {
+ const prefix string = ",\"chunk\":"
+ out.RawString(prefix)
+ if in.Chunk == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 {
+ out.RawString("null")
+ } else {
+ out.RawByte('[')
+ for v46, v47 := range in.Chunk {
+ if v46 > 0 {
+ out.RawByte(',')
+ }
+ easyjson559270aeEncodeGithubComMatrixOrgGomatrix8(out, v47)
+ }
+ out.RawByte(']')
+ }
+ }
+ {
+ const prefix string = ",\"end\":"
+ out.RawString(prefix)
+ out.String(string(in.End))
+ }
+ out.RawByte('}')
+}
+
+// MarshalJSON supports json.Marshaler interface
+func (v RespMessages) MarshalJSON() ([]byte, error) {
+ w := jwriter.Writer{}
+ easyjson559270aeEncodeGithubComMatrixOrgGomatrix13(&w, v)
+ return w.Buffer.BuildBytes(), w.Error
+}
+
+// MarshalEasyJSON supports easyjson.Marshaler interface
+func (v RespMessages) MarshalEasyJSON(w *jwriter.Writer) {
+ easyjson559270aeEncodeGithubComMatrixOrgGomatrix13(w, v)
+}
+
+// UnmarshalJSON supports json.Unmarshaler interface
+func (v *RespMessages) UnmarshalJSON(data []byte) error {
+ r := jlexer.Lexer{Data: data}
+ easyjson559270aeDecodeGithubComMatrixOrgGomatrix13(&r, v)
+ return r.Error()
+}
+
+// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
+func (v *RespMessages) UnmarshalEasyJSON(l *jlexer.Lexer) {
+ easyjson559270aeDecodeGithubComMatrixOrgGomatrix13(l, v)
+}
+func easyjson559270aeDecodeGithubComMatrixOrgGomatrix14(in *jlexer.Lexer, out *RespMediaUpload) {
+ isTopLevel := in.IsStart()
+ if in.IsNull() {
+ if isTopLevel {
+ in.Consumed()
+ }
+ in.Skip()
+ return
+ }
+ in.Delim('{')
+ for !in.IsDelim('}') {
+ key := in.UnsafeFieldName(false)
+ in.WantColon()
+ if in.IsNull() {
+ in.Skip()
+ in.WantComma()
+ continue
+ }
+ switch key {
+ case "content_uri":
+ out.ContentURI = string(in.String())
+ default:
+ in.SkipRecursive()
+ }
+ in.WantComma()
+ }
+ in.Delim('}')
+ if isTopLevel {
+ in.Consumed()
+ }
+}
+func easyjson559270aeEncodeGithubComMatrixOrgGomatrix14(out *jwriter.Writer, in RespMediaUpload) {
+ out.RawByte('{')
+ first := true
+ _ = first
+ {
+ const prefix string = ",\"content_uri\":"
+ out.RawString(prefix[1:])
+ out.String(string(in.ContentURI))
+ }
+ out.RawByte('}')
+}
+
+// MarshalJSON supports json.Marshaler interface
+func (v RespMediaUpload) MarshalJSON() ([]byte, error) {
+ w := jwriter.Writer{}
+ easyjson559270aeEncodeGithubComMatrixOrgGomatrix14(&w, v)
+ return w.Buffer.BuildBytes(), w.Error
+}
+
+// MarshalEasyJSON supports easyjson.Marshaler interface
+func (v RespMediaUpload) MarshalEasyJSON(w *jwriter.Writer) {
+ easyjson559270aeEncodeGithubComMatrixOrgGomatrix14(w, v)
+}
+
+// UnmarshalJSON supports json.Unmarshaler interface
+func (v *RespMediaUpload) UnmarshalJSON(data []byte) error {
+ r := jlexer.Lexer{Data: data}
+ easyjson559270aeDecodeGithubComMatrixOrgGomatrix14(&r, v)
+ return r.Error()
+}
+
+// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
+func (v *RespMediaUpload) UnmarshalEasyJSON(l *jlexer.Lexer) {
+ easyjson559270aeDecodeGithubComMatrixOrgGomatrix14(l, v)
+}
+func easyjson559270aeDecodeGithubComMatrixOrgGomatrix15(in *jlexer.Lexer, out *RespLogoutAll) {
+ isTopLevel := in.IsStart()
+ if in.IsNull() {
+ if isTopLevel {
+ in.Consumed()
+ }
+ in.Skip()
+ return
+ }
+ in.Delim('{')
+ for !in.IsDelim('}') {
+ key := in.UnsafeFieldName(false)
+ in.WantColon()
+ if in.IsNull() {
+ in.Skip()
+ in.WantComma()
+ continue
+ }
+ switch key {
+ default:
+ in.SkipRecursive()
+ }
+ in.WantComma()
+ }
+ in.Delim('}')
+ if isTopLevel {
+ in.Consumed()
+ }
+}
+func easyjson559270aeEncodeGithubComMatrixOrgGomatrix15(out *jwriter.Writer, in RespLogoutAll) {
+ out.RawByte('{')
+ first := true
+ _ = first
+ out.RawByte('}')
+}
+
+// MarshalJSON supports json.Marshaler interface
+func (v RespLogoutAll) MarshalJSON() ([]byte, error) {
+ w := jwriter.Writer{}
+ easyjson559270aeEncodeGithubComMatrixOrgGomatrix15(&w, v)
+ return w.Buffer.BuildBytes(), w.Error
+}
+
+// MarshalEasyJSON supports easyjson.Marshaler interface
+func (v RespLogoutAll) MarshalEasyJSON(w *jwriter.Writer) {
+ easyjson559270aeEncodeGithubComMatrixOrgGomatrix15(w, v)
+}
+
+// UnmarshalJSON supports json.Unmarshaler interface
+func (v *RespLogoutAll) UnmarshalJSON(data []byte) error {
+ r := jlexer.Lexer{Data: data}
+ easyjson559270aeDecodeGithubComMatrixOrgGomatrix15(&r, v)
+ return r.Error()
+}
+
+// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
+func (v *RespLogoutAll) UnmarshalEasyJSON(l *jlexer.Lexer) {
+ easyjson559270aeDecodeGithubComMatrixOrgGomatrix15(l, v)
+}
+func easyjson559270aeDecodeGithubComMatrixOrgGomatrix16(in *jlexer.Lexer, out *RespLogout) {
+ isTopLevel := in.IsStart()
+ if in.IsNull() {
+ if isTopLevel {
+ in.Consumed()
+ }
+ in.Skip()
+ return
+ }
+ in.Delim('{')
+ for !in.IsDelim('}') {
+ key := in.UnsafeFieldName(false)
+ in.WantColon()
+ if in.IsNull() {
+ in.Skip()
+ in.WantComma()
+ continue
+ }
+ switch key {
+ default:
+ in.SkipRecursive()
+ }
+ in.WantComma()
+ }
+ in.Delim('}')
+ if isTopLevel {
+ in.Consumed()
+ }
+}
+func easyjson559270aeEncodeGithubComMatrixOrgGomatrix16(out *jwriter.Writer, in RespLogout) {
+ out.RawByte('{')
+ first := true
+ _ = first
+ out.RawByte('}')
+}
+
+// MarshalJSON supports json.Marshaler interface
+func (v RespLogout) MarshalJSON() ([]byte, error) {
+ w := jwriter.Writer{}
+ easyjson559270aeEncodeGithubComMatrixOrgGomatrix16(&w, v)
+ return w.Buffer.BuildBytes(), w.Error
+}
+
+// MarshalEasyJSON supports easyjson.Marshaler interface
+func (v RespLogout) MarshalEasyJSON(w *jwriter.Writer) {
+ easyjson559270aeEncodeGithubComMatrixOrgGomatrix16(w, v)
+}
+
+// UnmarshalJSON supports json.Unmarshaler interface
+func (v *RespLogout) UnmarshalJSON(data []byte) error {
+ r := jlexer.Lexer{Data: data}
+ easyjson559270aeDecodeGithubComMatrixOrgGomatrix16(&r, v)
+ return r.Error()
+}
+
+// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
+func (v *RespLogout) UnmarshalEasyJSON(l *jlexer.Lexer) {
+ easyjson559270aeDecodeGithubComMatrixOrgGomatrix16(l, v)
+}
+func easyjson559270aeDecodeGithubComMatrixOrgGomatrix17(in *jlexer.Lexer, out *RespLogin) {
+ isTopLevel := in.IsStart()
+ if in.IsNull() {
+ if isTopLevel {
+ in.Consumed()
+ }
+ in.Skip()
+ return
+ }
+ in.Delim('{')
+ for !in.IsDelim('}') {
+ key := in.UnsafeFieldName(false)
+ in.WantColon()
+ if in.IsNull() {
+ in.Skip()
+ in.WantComma()
+ continue
+ }
+ switch key {
+ case "access_token":
+ out.AccessToken = string(in.String())
+ case "device_id":
+ out.DeviceID = string(in.String())
+ case "home_server":
+ out.HomeServer = string(in.String())
+ case "user_id":
+ out.UserID = string(in.String())
+ case "well_known":
+ (out.WellKnown).UnmarshalEasyJSON(in)
+ default:
+ in.SkipRecursive()
+ }
+ in.WantComma()
+ }
+ in.Delim('}')
+ if isTopLevel {
+ in.Consumed()
+ }
+}
+func easyjson559270aeEncodeGithubComMatrixOrgGomatrix17(out *jwriter.Writer, in RespLogin) {
+ out.RawByte('{')
+ first := true
+ _ = first
+ {
+ const prefix string = ",\"access_token\":"
+ out.RawString(prefix[1:])
+ out.String(string(in.AccessToken))
+ }
+ {
+ const prefix string = ",\"device_id\":"
+ out.RawString(prefix)
+ out.String(string(in.DeviceID))
+ }
+ {
+ const prefix string = ",\"home_server\":"
+ out.RawString(prefix)
+ out.String(string(in.HomeServer))
+ }
+ {
+ const prefix string = ",\"user_id\":"
+ out.RawString(prefix)
+ out.String(string(in.UserID))
+ }
+ {
+ const prefix string = ",\"well_known\":"
+ out.RawString(prefix)
+ (in.WellKnown).MarshalEasyJSON(out)
+ }
+ out.RawByte('}')
+}
+
+// MarshalJSON supports json.Marshaler interface
+func (v RespLogin) MarshalJSON() ([]byte, error) {
+ w := jwriter.Writer{}
+ easyjson559270aeEncodeGithubComMatrixOrgGomatrix17(&w, v)
+ return w.Buffer.BuildBytes(), w.Error
+}
+
+// MarshalEasyJSON supports easyjson.Marshaler interface
+func (v RespLogin) MarshalEasyJSON(w *jwriter.Writer) {
+ easyjson559270aeEncodeGithubComMatrixOrgGomatrix17(w, v)
+}
+
+// UnmarshalJSON supports json.Unmarshaler interface
+func (v *RespLogin) UnmarshalJSON(data []byte) error {
+ r := jlexer.Lexer{Data: data}
+ easyjson559270aeDecodeGithubComMatrixOrgGomatrix17(&r, v)
+ return r.Error()
+}
+
+// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
+func (v *RespLogin) UnmarshalEasyJSON(l *jlexer.Lexer) {
+ easyjson559270aeDecodeGithubComMatrixOrgGomatrix17(l, v)
+}
+func easyjson559270aeDecodeGithubComMatrixOrgGomatrix18(in *jlexer.Lexer, out *RespLeaveRoom) {
+ isTopLevel := in.IsStart()
+ if in.IsNull() {
+ if isTopLevel {
+ in.Consumed()
+ }
+ in.Skip()
+ return
+ }
+ in.Delim('{')
+ for !in.IsDelim('}') {
+ key := in.UnsafeFieldName(false)
+ in.WantColon()
+ if in.IsNull() {
+ in.Skip()
+ in.WantComma()
+ continue
+ }
+ switch key {
+ default:
+ in.SkipRecursive()
+ }
+ in.WantComma()
+ }
+ in.Delim('}')
+ if isTopLevel {
+ in.Consumed()
+ }
+}
+func easyjson559270aeEncodeGithubComMatrixOrgGomatrix18(out *jwriter.Writer, in RespLeaveRoom) {
+ out.RawByte('{')
+ first := true
+ _ = first
+ out.RawByte('}')
+}
+
+// MarshalJSON supports json.Marshaler interface
+func (v RespLeaveRoom) MarshalJSON() ([]byte, error) {
+ w := jwriter.Writer{}
+ easyjson559270aeEncodeGithubComMatrixOrgGomatrix18(&w, v)
+ return w.Buffer.BuildBytes(), w.Error
+}
+
+// MarshalEasyJSON supports easyjson.Marshaler interface
+func (v RespLeaveRoom) MarshalEasyJSON(w *jwriter.Writer) {
+ easyjson559270aeEncodeGithubComMatrixOrgGomatrix18(w, v)
+}
+
+// UnmarshalJSON supports json.Unmarshaler interface
+func (v *RespLeaveRoom) UnmarshalJSON(data []byte) error {
+ r := jlexer.Lexer{Data: data}
+ easyjson559270aeDecodeGithubComMatrixOrgGomatrix18(&r, v)
+ return r.Error()
+}
+
+// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
+func (v *RespLeaveRoom) UnmarshalEasyJSON(l *jlexer.Lexer) {
+ easyjson559270aeDecodeGithubComMatrixOrgGomatrix18(l, v)
+}
+func easyjson559270aeDecodeGithubComMatrixOrgGomatrix19(in *jlexer.Lexer, out *RespKickUser) {
+ isTopLevel := in.IsStart()
+ if in.IsNull() {
+ if isTopLevel {
+ in.Consumed()
+ }
+ in.Skip()
+ return
+ }
+ in.Delim('{')
+ for !in.IsDelim('}') {
+ key := in.UnsafeFieldName(false)
+ in.WantColon()
+ if in.IsNull() {
+ in.Skip()
+ in.WantComma()
+ continue
+ }
+ switch key {
+ default:
+ in.SkipRecursive()
+ }
+ in.WantComma()
+ }
+ in.Delim('}')
+ if isTopLevel {
+ in.Consumed()
+ }
+}
+func easyjson559270aeEncodeGithubComMatrixOrgGomatrix19(out *jwriter.Writer, in RespKickUser) {
+ out.RawByte('{')
+ first := true
+ _ = first
+ out.RawByte('}')
+}
+
+// MarshalJSON supports json.Marshaler interface
+func (v RespKickUser) MarshalJSON() ([]byte, error) {
+ w := jwriter.Writer{}
+ easyjson559270aeEncodeGithubComMatrixOrgGomatrix19(&w, v)
+ return w.Buffer.BuildBytes(), w.Error
+}
+
+// MarshalEasyJSON supports easyjson.Marshaler interface
+func (v RespKickUser) MarshalEasyJSON(w *jwriter.Writer) {
+ easyjson559270aeEncodeGithubComMatrixOrgGomatrix19(w, v)
+}
+
+// UnmarshalJSON supports json.Unmarshaler interface
+func (v *RespKickUser) UnmarshalJSON(data []byte) error {
+ r := jlexer.Lexer{Data: data}
+ easyjson559270aeDecodeGithubComMatrixOrgGomatrix19(&r, v)
+ return r.Error()
+}
+
+// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
+func (v *RespKickUser) UnmarshalEasyJSON(l *jlexer.Lexer) {
+ easyjson559270aeDecodeGithubComMatrixOrgGomatrix19(l, v)
+}
+func easyjson559270aeDecodeGithubComMatrixOrgGomatrix20(in *jlexer.Lexer, out *RespJoinedRooms) {
+ isTopLevel := in.IsStart()
+ if in.IsNull() {
+ if isTopLevel {
+ in.Consumed()
+ }
+ in.Skip()
+ return
+ }
+ in.Delim('{')
+ for !in.IsDelim('}') {
+ key := in.UnsafeFieldName(false)
+ in.WantColon()
+ if in.IsNull() {
+ in.Skip()
+ in.WantComma()
+ continue
+ }
+ switch key {
+ case "joined_rooms":
+ if in.IsNull() {
+ in.Skip()
+ out.JoinedRooms = nil
+ } else {
+ in.Delim('[')
+ if out.JoinedRooms == nil {
+ if !in.IsDelim(']') {
+ out.JoinedRooms = make([]string, 0, 4)
+ } else {
+ out.JoinedRooms = []string{}
+ }
+ } else {
+ out.JoinedRooms = (out.JoinedRooms)[:0]
+ }
+ for !in.IsDelim(']') {
+ var v48 string
+ v48 = string(in.String())
+ out.JoinedRooms = append(out.JoinedRooms, v48)
+ in.WantComma()
+ }
+ in.Delim(']')
+ }
+ default:
+ in.SkipRecursive()
+ }
+ in.WantComma()
+ }
+ in.Delim('}')
+ if isTopLevel {
+ in.Consumed()
+ }
+}
+func easyjson559270aeEncodeGithubComMatrixOrgGomatrix20(out *jwriter.Writer, in RespJoinedRooms) {
+ out.RawByte('{')
+ first := true
+ _ = first
+ {
+ const prefix string = ",\"joined_rooms\":"
+ out.RawString(prefix[1:])
+ if in.JoinedRooms == nil && (out.Flags&jwriter.NilSliceAsEmpty) == 0 {
+ out.RawString("null")
+ } else {
+ out.RawByte('[')
+ for v49, v50 := range in.JoinedRooms {
+ if v49 > 0 {
+ out.RawByte(',')
+ }
+ out.String(string(v50))
+ }
+ out.RawByte(']')
+ }
+ }
+ out.RawByte('}')
+}
+
+// MarshalJSON supports json.Marshaler interface
+func (v RespJoinedRooms) MarshalJSON() ([]byte, error) {
+ w := jwriter.Writer{}
+ easyjson559270aeEncodeGithubComMatrixOrgGomatrix20(&w, v)
+ return w.Buffer.BuildBytes(), w.Error
+}
+
+// MarshalEasyJSON supports easyjson.Marshaler interface
+func (v RespJoinedRooms) MarshalEasyJSON(w *jwriter.Writer) {
+ easyjson559270aeEncodeGithubComMatrixOrgGomatrix20(w, v)
+}
+
+// UnmarshalJSON supports json.Unmarshaler interface
+func (v *RespJoinedRooms) UnmarshalJSON(data []byte) error {
+ r := jlexer.Lexer{Data: data}
+ easyjson559270aeDecodeGithubComMatrixOrgGomatrix20(&r, v)
+ return r.Error()
+}
+
+// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
+func (v *RespJoinedRooms) UnmarshalEasyJSON(l *jlexer.Lexer) {
+ easyjson559270aeDecodeGithubComMatrixOrgGomatrix20(l, v)
+}
+func easyjson559270aeDecodeGithubComMatrixOrgGomatrix21(in *jlexer.Lexer, out *RespJoinedMembers) {
+ isTopLevel := in.IsStart()
+ if in.IsNull() {
+ if isTopLevel {
+ in.Consumed()
+ }
+ in.Skip()
+ return
+ }
+ in.Delim('{')
+ for !in.IsDelim('}') {
+ key := in.UnsafeFieldName(false)
+ in.WantColon()
+ if in.IsNull() {
+ in.Skip()
+ in.WantComma()
+ continue
+ }
+ switch key {
+ case "joined":
+ if in.IsNull() {
+ in.Skip()
+ } else {
+ in.Delim('{')
+ out.Joined = make(map[string]struct {
+ DisplayName *string `json:"display_name"`
+ AvatarURL *string `json:"avatar_url"`
+ })
+ for !in.IsDelim('}') {
+ key := string(in.String())
+ in.WantColon()
+ var v51 struct {
+ DisplayName *string `json:"display_name"`
+ AvatarURL *string `json:"avatar_url"`
+ }
+ easyjson559270aeDecode8(in, &v51)
+ (out.Joined)[key] = v51
+ in.WantComma()
+ }
+ in.Delim('}')
+ }
+ default:
+ in.SkipRecursive()
+ }
+ in.WantComma()
+ }
+ in.Delim('}')
+ if isTopLevel {
+ in.Consumed()
+ }
+}
+func easyjson559270aeEncodeGithubComMatrixOrgGomatrix21(out *jwriter.Writer, in RespJoinedMembers) {
+ out.RawByte('{')
+ first := true
+ _ = first
+ {
+ const prefix string = ",\"joined\":"
+ out.RawString(prefix[1:])
+ if in.Joined == nil && (out.Flags&jwriter.NilMapAsEmpty) == 0 {
+ out.RawString(`null`)
+ } else {
+ out.RawByte('{')
+ v52First := true
+ for v52Name, v52Value := range in.Joined {
+ if v52First {
+ v52First = false
+ } else {
+ out.RawByte(',')
+ }
+ out.String(string(v52Name))
+ out.RawByte(':')
+ easyjson559270aeEncode8(out, v52Value)
+ }
+ out.RawByte('}')
+ }
+ }
+ out.RawByte('}')
+}
+
+// MarshalJSON supports json.Marshaler interface
+func (v RespJoinedMembers) MarshalJSON() ([]byte, error) {
+ w := jwriter.Writer{}
+ easyjson559270aeEncodeGithubComMatrixOrgGomatrix21(&w, v)
+ return w.Buffer.BuildBytes(), w.Error
+}
+
+// MarshalEasyJSON supports easyjson.Marshaler interface
+func (v RespJoinedMembers) MarshalEasyJSON(w *jwriter.Writer) {
+ easyjson559270aeEncodeGithubComMatrixOrgGomatrix21(w, v)
+}
+
+// UnmarshalJSON supports json.Unmarshaler interface
+func (v *RespJoinedMembers) UnmarshalJSON(data []byte) error {
+ r := jlexer.Lexer{Data: data}
+ easyjson559270aeDecodeGithubComMatrixOrgGomatrix21(&r, v)
+ return r.Error()
+}
+
+// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
+func (v *RespJoinedMembers) UnmarshalEasyJSON(l *jlexer.Lexer) {
+ easyjson559270aeDecodeGithubComMatrixOrgGomatrix21(l, v)
+}
+func easyjson559270aeDecode8(in *jlexer.Lexer, out *struct {
+ DisplayName *string `json:"display_name"`
+ AvatarURL *string `json:"avatar_url"`
+}) {
+ isTopLevel := in.IsStart()
+ if in.IsNull() {
+ if isTopLevel {
+ in.Consumed()
+ }
+ in.Skip()
+ return
+ }
+ in.Delim('{')
+ for !in.IsDelim('}') {
+ key := in.UnsafeFieldName(false)
+ in.WantColon()
+ if in.IsNull() {
+ in.Skip()
+ in.WantComma()
+ continue
+ }
+ switch key {
+ case "display_name":
+ if in.IsNull() {
+ in.Skip()
+ out.DisplayName = nil
+ } else {
+ if out.DisplayName == nil {
+ out.DisplayName = new(string)
+ }
+ *out.DisplayName = string(in.String())
+ }
+ case "avatar_url":
+ if in.IsNull() {
+ in.Skip()
+ out.AvatarURL = nil
+ } else {
+ if out.AvatarURL == nil {
+ out.AvatarURL = new(string)
+ }
+ *out.AvatarURL = string(in.String())
+ }
+ default:
+ in.SkipRecursive()
+ }
+ in.WantComma()
+ }
+ in.Delim('}')
+ if isTopLevel {
+ in.Consumed()
+ }
+}
+func easyjson559270aeEncode8(out *jwriter.Writer, in struct {
+ DisplayName *string `json:"display_name"`
+ AvatarURL *string `json:"avatar_url"`
+}) {
+ out.RawByte('{')
+ first := true
+ _ = first
+ {
+ const prefix string = ",\"display_name\":"
+ out.RawString(prefix[1:])
+ if in.DisplayName == nil {
+ out.RawString("null")
+ } else {
+ out.String(string(*in.DisplayName))
+ }
+ }
+ {
+ const prefix string = ",\"avatar_url\":"
+ out.RawString(prefix)
+ if in.AvatarURL == nil {
+ out.RawString("null")
+ } else {
+ out.String(string(*in.AvatarURL))
+ }
+ }
+ out.RawByte('}')
+}
+func easyjson559270aeDecodeGithubComMatrixOrgGomatrix22(in *jlexer.Lexer, out *RespJoinRoom) {
+ isTopLevel := in.IsStart()
+ if in.IsNull() {
+ if isTopLevel {
+ in.Consumed()
+ }
+ in.Skip()
+ return
+ }
+ in.Delim('{')
+ for !in.IsDelim('}') {
+ key := in.UnsafeFieldName(false)
+ in.WantColon()
+ if in.IsNull() {
+ in.Skip()
+ in.WantComma()
+ continue
+ }
+ switch key {
+ case "room_id":
+ out.RoomID = string(in.String())
+ default:
+ in.SkipRecursive()
+ }
+ in.WantComma()
+ }
+ in.Delim('}')
+ if isTopLevel {
+ in.Consumed()
+ }
+}
+func easyjson559270aeEncodeGithubComMatrixOrgGomatrix22(out *jwriter.Writer, in RespJoinRoom) {
+ out.RawByte('{')
+ first := true
+ _ = first
+ {
+ const prefix string = ",\"room_id\":"
+ out.RawString(prefix[1:])
+ out.String(string(in.RoomID))
+ }
+ out.RawByte('}')
+}
+
+// MarshalJSON supports json.Marshaler interface
+func (v RespJoinRoom) MarshalJSON() ([]byte, error) {
+ w := jwriter.Writer{}
+ easyjson559270aeEncodeGithubComMatrixOrgGomatrix22(&w, v)
+ return w.Buffer.BuildBytes(), w.Error
+}
+
+// MarshalEasyJSON supports easyjson.Marshaler interface
+func (v RespJoinRoom) MarshalEasyJSON(w *jwriter.Writer) {
+ easyjson559270aeEncodeGithubComMatrixOrgGomatrix22(w, v)
+}
+
+// UnmarshalJSON supports json.Unmarshaler interface
+func (v *RespJoinRoom) UnmarshalJSON(data []byte) error {
+ r := jlexer.Lexer{Data: data}
+ easyjson559270aeDecodeGithubComMatrixOrgGomatrix22(&r, v)
+ return r.Error()
+}
+
+// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
+func (v *RespJoinRoom) UnmarshalEasyJSON(l *jlexer.Lexer) {
+ easyjson559270aeDecodeGithubComMatrixOrgGomatrix22(l, v)
+}
+func easyjson559270aeDecodeGithubComMatrixOrgGomatrix23(in *jlexer.Lexer, out *RespInviteUser) {
+ isTopLevel := in.IsStart()
+ if in.IsNull() {
+ if isTopLevel {
+ in.Consumed()
+ }
+ in.Skip()
+ return
+ }
+ in.Delim('{')
+ for !in.IsDelim('}') {
+ key := in.UnsafeFieldName(false)
+ in.WantColon()
+ if in.IsNull() {
+ in.Skip()
+ in.WantComma()
+ continue
+ }
+ switch key {
+ default:
+ in.SkipRecursive()
+ }
+ in.WantComma()
+ }
+ in.Delim('}')
+ if isTopLevel {
+ in.Consumed()
+ }
+}
+func easyjson559270aeEncodeGithubComMatrixOrgGomatrix23(out *jwriter.Writer, in RespInviteUser) {
+ out.RawByte('{')
+ first := true
+ _ = first
+ out.RawByte('}')
+}
+
+// MarshalJSON supports json.Marshaler interface
+func (v RespInviteUser) MarshalJSON() ([]byte, error) {
+ w := jwriter.Writer{}
+ easyjson559270aeEncodeGithubComMatrixOrgGomatrix23(&w, v)
+ return w.Buffer.BuildBytes(), w.Error
+}
+
+// MarshalEasyJSON supports easyjson.Marshaler interface
+func (v RespInviteUser) MarshalEasyJSON(w *jwriter.Writer) {
+ easyjson559270aeEncodeGithubComMatrixOrgGomatrix23(w, v)
+}
+
+// UnmarshalJSON supports json.Unmarshaler interface
+func (v *RespInviteUser) UnmarshalJSON(data []byte) error {
+ r := jlexer.Lexer{Data: data}
+ easyjson559270aeDecodeGithubComMatrixOrgGomatrix23(&r, v)
+ return r.Error()
+}
+
+// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
+func (v *RespInviteUser) UnmarshalEasyJSON(l *jlexer.Lexer) {
+ easyjson559270aeDecodeGithubComMatrixOrgGomatrix23(l, v)
+}
+func easyjson559270aeDecodeGithubComMatrixOrgGomatrix24(in *jlexer.Lexer, out *RespForgetRoom) {
+ isTopLevel := in.IsStart()
+ if in.IsNull() {
+ if isTopLevel {
+ in.Consumed()
+ }
+ in.Skip()
+ return
+ }
+ in.Delim('{')
+ for !in.IsDelim('}') {
+ key := in.UnsafeFieldName(false)
+ in.WantColon()
+ if in.IsNull() {
+ in.Skip()
+ in.WantComma()
+ continue
+ }
+ switch key {
+ default:
+ in.SkipRecursive()
+ }
+ in.WantComma()
+ }
+ in.Delim('}')
+ if isTopLevel {
+ in.Consumed()
+ }
+}
+func easyjson559270aeEncodeGithubComMatrixOrgGomatrix24(out *jwriter.Writer, in RespForgetRoom) {
+ out.RawByte('{')
+ first := true
+ _ = first
+ out.RawByte('}')
+}
+
+// MarshalJSON supports json.Marshaler interface
+func (v RespForgetRoom) MarshalJSON() ([]byte, error) {
+ w := jwriter.Writer{}
+ easyjson559270aeEncodeGithubComMatrixOrgGomatrix24(&w, v)
+ return w.Buffer.BuildBytes(), w.Error
+}
+
+// MarshalEasyJSON supports easyjson.Marshaler interface
+func (v RespForgetRoom) MarshalEasyJSON(w *jwriter.Writer) {
+ easyjson559270aeEncodeGithubComMatrixOrgGomatrix24(w, v)
+}
+
+// UnmarshalJSON supports json.Unmarshaler interface
+func (v *RespForgetRoom) UnmarshalJSON(data []byte) error {
+ r := jlexer.Lexer{Data: data}
+ easyjson559270aeDecodeGithubComMatrixOrgGomatrix24(&r, v)
+ return r.Error()
+}
+
+// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
+func (v *RespForgetRoom) UnmarshalEasyJSON(l *jlexer.Lexer) {
+ easyjson559270aeDecodeGithubComMatrixOrgGomatrix24(l, v)
+}
+func easyjson559270aeDecodeGithubComMatrixOrgGomatrix25(in *jlexer.Lexer, out *RespError) {
+ isTopLevel := in.IsStart()
+ if in.IsNull() {
+ if isTopLevel {
+ in.Consumed()
+ }
+ in.Skip()
+ return
+ }
+ in.Delim('{')
+ for !in.IsDelim('}') {
+ key := in.UnsafeFieldName(false)
+ in.WantColon()
+ if in.IsNull() {
+ in.Skip()
+ in.WantComma()
+ continue
+ }
+ switch key {
+ case "errcode":
+ out.ErrCode = string(in.String())
+ case "error":
+ out.Err = string(in.String())
+ default:
+ in.SkipRecursive()
+ }
+ in.WantComma()
+ }
+ in.Delim('}')
+ if isTopLevel {
+ in.Consumed()
+ }
+}
+func easyjson559270aeEncodeGithubComMatrixOrgGomatrix25(out *jwriter.Writer, in RespError) {
+ out.RawByte('{')
+ first := true
+ _ = first
+ {
+ const prefix string = ",\"errcode\":"
+ out.RawString(prefix[1:])
+ out.String(string(in.ErrCode))
+ }
+ {
+ const prefix string = ",\"error\":"
+ out.RawString(prefix)
+ out.String(string(in.Err))
+ }
+ out.RawByte('}')
+}
+
+// MarshalJSON supports json.Marshaler interface
+func (v RespError) MarshalJSON() ([]byte, error) {
+ w := jwriter.Writer{}
+ easyjson559270aeEncodeGithubComMatrixOrgGomatrix25(&w, v)
+ return w.Buffer.BuildBytes(), w.Error
+}
+
+// MarshalEasyJSON supports easyjson.Marshaler interface
+func (v RespError) MarshalEasyJSON(w *jwriter.Writer) {
+ easyjson559270aeEncodeGithubComMatrixOrgGomatrix25(w, v)
+}
+
+// UnmarshalJSON supports json.Unmarshaler interface
+func (v *RespError) UnmarshalJSON(data []byte) error {
+ r := jlexer.Lexer{Data: data}
+ easyjson559270aeDecodeGithubComMatrixOrgGomatrix25(&r, v)
+ return r.Error()
+}
+
+// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
+func (v *RespError) UnmarshalEasyJSON(l *jlexer.Lexer) {
+ easyjson559270aeDecodeGithubComMatrixOrgGomatrix25(l, v)
+}
+func easyjson559270aeDecodeGithubComMatrixOrgGomatrix26(in *jlexer.Lexer, out *RespCreateRoom) {
+ isTopLevel := in.IsStart()
+ if in.IsNull() {
+ if isTopLevel {
+ in.Consumed()
+ }
+ in.Skip()
+ return
+ }
+ in.Delim('{')
+ for !in.IsDelim('}') {
+ key := in.UnsafeFieldName(false)
+ in.WantColon()
+ if in.IsNull() {
+ in.Skip()
+ in.WantComma()
+ continue
+ }
+ switch key {
+ case "room_id":
+ out.RoomID = string(in.String())
+ default:
+ in.SkipRecursive()
+ }
+ in.WantComma()
+ }
+ in.Delim('}')
+ if isTopLevel {
+ in.Consumed()
+ }
+}
+func easyjson559270aeEncodeGithubComMatrixOrgGomatrix26(out *jwriter.Writer, in RespCreateRoom) {
+ out.RawByte('{')
+ first := true
+ _ = first
+ {
+ const prefix string = ",\"room_id\":"
+ out.RawString(prefix[1:])
+ out.String(string(in.RoomID))
+ }
+ out.RawByte('}')
+}
+
+// MarshalJSON supports json.Marshaler interface
+func (v RespCreateRoom) MarshalJSON() ([]byte, error) {
+ w := jwriter.Writer{}
+ easyjson559270aeEncodeGithubComMatrixOrgGomatrix26(&w, v)
+ return w.Buffer.BuildBytes(), w.Error
+}
+
+// MarshalEasyJSON supports easyjson.Marshaler interface
+func (v RespCreateRoom) MarshalEasyJSON(w *jwriter.Writer) {
+ easyjson559270aeEncodeGithubComMatrixOrgGomatrix26(w, v)
+}
+
+// UnmarshalJSON supports json.Unmarshaler interface
+func (v *RespCreateRoom) UnmarshalJSON(data []byte) error {
+ r := jlexer.Lexer{Data: data}
+ easyjson559270aeDecodeGithubComMatrixOrgGomatrix26(&r, v)
+ return r.Error()
+}
+
+// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
+func (v *RespCreateRoom) UnmarshalEasyJSON(l *jlexer.Lexer) {
+ easyjson559270aeDecodeGithubComMatrixOrgGomatrix26(l, v)
+}
+func easyjson559270aeDecodeGithubComMatrixOrgGomatrix27(in *jlexer.Lexer, out *RespCreateFilter) {
+ isTopLevel := in.IsStart()
+ if in.IsNull() {
+ if isTopLevel {
+ in.Consumed()
+ }
+ in.Skip()
+ return
+ }
+ in.Delim('{')
+ for !in.IsDelim('}') {
+ key := in.UnsafeFieldName(false)
+ in.WantColon()
+ if in.IsNull() {
+ in.Skip()
+ in.WantComma()
+ continue
+ }
+ switch key {
+ case "filter_id":
+ out.FilterID = string(in.String())
+ default:
+ in.SkipRecursive()
+ }
+ in.WantComma()
+ }
+ in.Delim('}')
+ if isTopLevel {
+ in.Consumed()
+ }
+}
+func easyjson559270aeEncodeGithubComMatrixOrgGomatrix27(out *jwriter.Writer, in RespCreateFilter) {
+ out.RawByte('{')
+ first := true
+ _ = first
+ {
+ const prefix string = ",\"filter_id\":"
+ out.RawString(prefix[1:])
+ out.String(string(in.FilterID))
+ }
+ out.RawByte('}')
+}
+
+// MarshalJSON supports json.Marshaler interface
+func (v RespCreateFilter) MarshalJSON() ([]byte, error) {
+ w := jwriter.Writer{}
+ easyjson559270aeEncodeGithubComMatrixOrgGomatrix27(&w, v)
+ return w.Buffer.BuildBytes(), w.Error
+}
+
+// MarshalEasyJSON supports easyjson.Marshaler interface
+func (v RespCreateFilter) MarshalEasyJSON(w *jwriter.Writer) {
+ easyjson559270aeEncodeGithubComMatrixOrgGomatrix27(w, v)
+}
+
+// UnmarshalJSON supports json.Unmarshaler interface
+func (v *RespCreateFilter) UnmarshalJSON(data []byte) error {
+ r := jlexer.Lexer{Data: data}
+ easyjson559270aeDecodeGithubComMatrixOrgGomatrix27(&r, v)
+ return r.Error()
+}
+
+// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
+func (v *RespCreateFilter) UnmarshalEasyJSON(l *jlexer.Lexer) {
+ easyjson559270aeDecodeGithubComMatrixOrgGomatrix27(l, v)
+}
+func easyjson559270aeDecodeGithubComMatrixOrgGomatrix28(in *jlexer.Lexer, out *RespBanUser) {
+ isTopLevel := in.IsStart()
+ if in.IsNull() {
+ if isTopLevel {
+ in.Consumed()
+ }
+ in.Skip()
+ return
+ }
+ in.Delim('{')
+ for !in.IsDelim('}') {
+ key := in.UnsafeFieldName(false)
+ in.WantColon()
+ if in.IsNull() {
+ in.Skip()
+ in.WantComma()
+ continue
+ }
+ switch key {
+ default:
+ in.SkipRecursive()
+ }
+ in.WantComma()
+ }
+ in.Delim('}')
+ if isTopLevel {
+ in.Consumed()
+ }
+}
+func easyjson559270aeEncodeGithubComMatrixOrgGomatrix28(out *jwriter.Writer, in RespBanUser) {
+ out.RawByte('{')
+ first := true
+ _ = first
+ out.RawByte('}')
+}
+
+// MarshalJSON supports json.Marshaler interface
+func (v RespBanUser) MarshalJSON() ([]byte, error) {
+ w := jwriter.Writer{}
+ easyjson559270aeEncodeGithubComMatrixOrgGomatrix28(&w, v)
+ return w.Buffer.BuildBytes(), w.Error
+}
+
+// MarshalEasyJSON supports easyjson.Marshaler interface
+func (v RespBanUser) MarshalEasyJSON(w *jwriter.Writer) {
+ easyjson559270aeEncodeGithubComMatrixOrgGomatrix28(w, v)
+}
+
+// UnmarshalJSON supports json.Unmarshaler interface
+func (v *RespBanUser) UnmarshalJSON(data []byte) error {
+ r := jlexer.Lexer{Data: data}
+ easyjson559270aeDecodeGithubComMatrixOrgGomatrix28(&r, v)
+ return r.Error()
+}
+
+// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
+func (v *RespBanUser) UnmarshalEasyJSON(l *jlexer.Lexer) {
+ easyjson559270aeDecodeGithubComMatrixOrgGomatrix28(l, v)
+}
+func easyjson559270aeDecodeGithubComMatrixOrgGomatrix29(in *jlexer.Lexer, out *DiscoveryInformation) {
+ isTopLevel := in.IsStart()
+ if in.IsNull() {
+ if isTopLevel {
+ in.Consumed()
+ }
+ in.Skip()
+ return
+ }
+ in.Delim('{')
+ for !in.IsDelim('}') {
+ key := in.UnsafeFieldName(false)
+ in.WantColon()
+ if in.IsNull() {
+ in.Skip()
+ in.WantComma()
+ continue
+ }
+ switch key {
+ case "m.homeserver":
+ easyjson559270aeDecode9(in, &out.Homeserver)
+ case "m.identitiy_server":
+ easyjson559270aeDecode9(in, &out.IdentityServer)
+ default:
+ in.SkipRecursive()
+ }
+ in.WantComma()
+ }
+ in.Delim('}')
+ if isTopLevel {
+ in.Consumed()
+ }
+}
+func easyjson559270aeEncodeGithubComMatrixOrgGomatrix29(out *jwriter.Writer, in DiscoveryInformation) {
+ out.RawByte('{')
+ first := true
+ _ = first
+ {
+ const prefix string = ",\"m.homeserver\":"
+ out.RawString(prefix[1:])
+ easyjson559270aeEncode9(out, in.Homeserver)
+ }
+ {
+ const prefix string = ",\"m.identitiy_server\":"
+ out.RawString(prefix)
+ easyjson559270aeEncode9(out, in.IdentityServer)
+ }
+ out.RawByte('}')
+}
+
+// MarshalJSON supports json.Marshaler interface
+func (v DiscoveryInformation) MarshalJSON() ([]byte, error) {
+ w := jwriter.Writer{}
+ easyjson559270aeEncodeGithubComMatrixOrgGomatrix29(&w, v)
+ return w.Buffer.BuildBytes(), w.Error
+}
+
+// MarshalEasyJSON supports easyjson.Marshaler interface
+func (v DiscoveryInformation) MarshalEasyJSON(w *jwriter.Writer) {
+ easyjson559270aeEncodeGithubComMatrixOrgGomatrix29(w, v)
+}
+
+// UnmarshalJSON supports json.Unmarshaler interface
+func (v *DiscoveryInformation) UnmarshalJSON(data []byte) error {
+ r := jlexer.Lexer{Data: data}
+ easyjson559270aeDecodeGithubComMatrixOrgGomatrix29(&r, v)
+ return r.Error()
+}
+
+// UnmarshalEasyJSON supports easyjson.Unmarshaler interface
+func (v *DiscoveryInformation) UnmarshalEasyJSON(l *jlexer.Lexer) {
+ easyjson559270aeDecodeGithubComMatrixOrgGomatrix29(l, v)
+}
+func easyjson559270aeDecode9(in *jlexer.Lexer, out *struct {
+ BaseURL string `json:"base_url"`
+}) {
+ isTopLevel := in.IsStart()
+ if in.IsNull() {
+ if isTopLevel {
+ in.Consumed()
+ }
+ in.Skip()
+ return
+ }
+ in.Delim('{')
+ for !in.IsDelim('}') {
+ key := in.UnsafeFieldName(false)
+ in.WantColon()
+ if in.IsNull() {
+ in.Skip()
+ in.WantComma()
+ continue
+ }
+ switch key {
+ case "base_url":
+ out.BaseURL = string(in.String())
+ default:
+ in.SkipRecursive()
+ }
+ in.WantComma()
+ }
+ in.Delim('}')
+ if isTopLevel {
+ in.Consumed()
+ }
+}
+func easyjson559270aeEncode9(out *jwriter.Writer, in struct {
+ BaseURL string `json:"base_url"`
+}) {
+ out.RawByte('{')
+ first := true
+ _ = first
+ {
+ const prefix string = ",\"base_url\":"
+ out.RawString(prefix[1:])
+ out.String(string(in.BaseURL))
+ }
+ out.RawByte('}')
+}