MCPcopy Create free account
hub / github.com/daodst/chat / UnmarshalJSON

Method UnmarshalJSON

roomserver/api/query.go:383–402  ·  view source on GitHub ↗
(data []byte)

Source from the content-addressed store, hash-verified

381}
382
383func (r *QueryBulkStateContentResponse) UnmarshalJSON(data []byte) error {
384 wireFormat := make(map[string]string)
385 err := json.Unmarshal(data, &wireFormat)
386 if err != nil {
387 return err
388 }
389 r.Rooms = make(map[string]map[gomatrixserverlib.StateKeyTuple]string)
390 for roomTuple, value := range wireFormat {
391 fields := strings.Split(roomTuple, "\x1F")
392 roomID := fields[0]
393 if r.Rooms[roomID] == nil {
394 r.Rooms[roomID] = make(map[gomatrixserverlib.StateKeyTuple]string)
395 }
396 r.Rooms[roomID][gomatrixserverlib.StateKeyTuple{
397 EventType: fields[1],
398 StateKey: fields[2],
399 }] = value
400 }
401 return nil
402}
403
404// MarshalJSON stringifies the StateKeyTuple keys so they can be sent over the wire in HTTP API mode.
405func (r *QueryCurrentStateResponse) MarshalJSON() ([]byte, error) {

Callers

nothing calls this directly

Calls 1

SplitMethod · 0.80

Tested by

no test coverage detected