mirror of
https://github.com/hoernschen/dendrite.git
synced 2024-12-27 07:28:27 +00:00
Omit empty sync response fields
This commit is contained in:
parent
b954343d73
commit
cbfd7ab249
1 changed files with 26 additions and 26 deletions
|
@ -361,23 +361,23 @@ type Response struct {
|
||||||
NextBatch StreamingToken `json:"next_batch"`
|
NextBatch StreamingToken `json:"next_batch"`
|
||||||
AccountData struct {
|
AccountData struct {
|
||||||
Events []gomatrixserverlib.ClientEvent `json:"events,omitempty"`
|
Events []gomatrixserverlib.ClientEvent `json:"events,omitempty"`
|
||||||
} `json:"account_data"`
|
} `json:"account_data,omitempty"`
|
||||||
Presence struct {
|
Presence struct {
|
||||||
Events []gomatrixserverlib.ClientEvent `json:"events,omitempty"`
|
Events []gomatrixserverlib.ClientEvent `json:"events,omitempty"`
|
||||||
} `json:"presence"`
|
} `json:"presence,omitempty"`
|
||||||
Rooms struct {
|
Rooms struct {
|
||||||
Join map[string]JoinResponse `json:"join"`
|
Join map[string]JoinResponse `json:"join,omitempty"`
|
||||||
Peek map[string]JoinResponse `json:"peek"`
|
Peek map[string]JoinResponse `json:"peek,omitempty"`
|
||||||
Invite map[string]InviteResponse `json:"invite"`
|
Invite map[string]InviteResponse `json:"invite,omitempty"`
|
||||||
Leave map[string]LeaveResponse `json:"leave"`
|
Leave map[string]LeaveResponse `json:"leave,omitempty"`
|
||||||
} `json:"rooms"`
|
} `json:"rooms,omitempty"`
|
||||||
ToDevice struct {
|
ToDevice struct {
|
||||||
Events []gomatrixserverlib.SendToDeviceEvent `json:"events"`
|
Events []gomatrixserverlib.SendToDeviceEvent `json:"events,omitempty"`
|
||||||
} `json:"to_device"`
|
} `json:"to_device,omitempty"`
|
||||||
DeviceLists struct {
|
DeviceLists struct {
|
||||||
Changed []string `json:"changed,omitempty"`
|
Changed []string `json:"changed,omitempty"`
|
||||||
Left []string `json:"left,omitempty"`
|
Left []string `json:"left,omitempty"`
|
||||||
} `json:"device_lists"`
|
} `json:"device_lists,omitempty"`
|
||||||
DeviceListsOTKCount map[string]int `json:"device_one_time_keys_count,omitempty"`
|
DeviceListsOTKCount map[string]int `json:"device_one_time_keys_count,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -417,19 +417,19 @@ func (r *Response) IsEmpty() bool {
|
||||||
// JoinResponse represents a /sync response for a room which is under the 'join' or 'peek' key.
|
// JoinResponse represents a /sync response for a room which is under the 'join' or 'peek' key.
|
||||||
type JoinResponse struct {
|
type JoinResponse struct {
|
||||||
State struct {
|
State struct {
|
||||||
Events []gomatrixserverlib.ClientEvent `json:"events"`
|
Events []gomatrixserverlib.ClientEvent `json:"events,omitempty"`
|
||||||
} `json:"state"`
|
} `json:"state,omitempty"`
|
||||||
Timeline struct {
|
Timeline struct {
|
||||||
Events []gomatrixserverlib.ClientEvent `json:"events"`
|
Events []gomatrixserverlib.ClientEvent `json:"events,omitempty"`
|
||||||
Limited bool `json:"limited"`
|
Limited bool `json:"limited,omitempty"`
|
||||||
PrevBatch *TopologyToken `json:"prev_batch,omitempty"`
|
PrevBatch *TopologyToken `json:"prev_batch,omitempty"`
|
||||||
} `json:"timeline"`
|
} `json:"timeline,omitempty"`
|
||||||
Ephemeral struct {
|
Ephemeral struct {
|
||||||
Events []gomatrixserverlib.ClientEvent `json:"events"`
|
Events []gomatrixserverlib.ClientEvent `json:"events,omitempty"`
|
||||||
} `json:"ephemeral"`
|
} `json:"ephemeral,omitempty"`
|
||||||
AccountData struct {
|
AccountData struct {
|
||||||
Events []gomatrixserverlib.ClientEvent `json:"events"`
|
Events []gomatrixserverlib.ClientEvent `json:"events,omitempty"`
|
||||||
} `json:"account_data"`
|
} `json:"account_data,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewJoinResponse creates an empty response with initialised arrays.
|
// NewJoinResponse creates an empty response with initialised arrays.
|
||||||
|
@ -445,8 +445,8 @@ func NewJoinResponse() *JoinResponse {
|
||||||
// InviteResponse represents a /sync response for a room which is under the 'invite' key.
|
// InviteResponse represents a /sync response for a room which is under the 'invite' key.
|
||||||
type InviteResponse struct {
|
type InviteResponse struct {
|
||||||
InviteState struct {
|
InviteState struct {
|
||||||
Events []json.RawMessage `json:"events"`
|
Events []json.RawMessage `json:"events,omitempty"`
|
||||||
} `json:"invite_state"`
|
} `json:"invite_state,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewInviteResponse creates an empty response with initialised arrays.
|
// NewInviteResponse creates an empty response with initialised arrays.
|
||||||
|
@ -475,13 +475,13 @@ func NewInviteResponse(event *gomatrixserverlib.HeaderedEvent) *InviteResponse {
|
||||||
// LeaveResponse represents a /sync response for a room which is under the 'leave' key.
|
// LeaveResponse represents a /sync response for a room which is under the 'leave' key.
|
||||||
type LeaveResponse struct {
|
type LeaveResponse struct {
|
||||||
State struct {
|
State struct {
|
||||||
Events []gomatrixserverlib.ClientEvent `json:"events"`
|
Events []gomatrixserverlib.ClientEvent `json:"events,omitempty"`
|
||||||
} `json:"state"`
|
} `json:"state,omitempty"`
|
||||||
Timeline struct {
|
Timeline struct {
|
||||||
Events []gomatrixserverlib.ClientEvent `json:"events"`
|
Events []gomatrixserverlib.ClientEvent `json:"events,omitempty"`
|
||||||
Limited bool `json:"limited"`
|
Limited bool `json:"limited,omitempty"`
|
||||||
PrevBatch *TopologyToken `json:"prev_batch,omitempty"`
|
PrevBatch *TopologyToken `json:"prev_batch,omitempty"`
|
||||||
} `json:"timeline"`
|
} `json:"timeline,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewLeaveResponse creates an empty response with initialised arrays.
|
// NewLeaveResponse creates an empty response with initialised arrays.
|
||||||
|
|
Loading…
Reference in a new issue