contentType --> eventType
parent
1e1d9490bf
commit
01f97255fe
|
@ -179,6 +179,8 @@ def main(in_file, out_file):
|
||||||
return DictField(str_to_field(value[1:-1]))
|
return DictField(str_to_field(value[1:-1]))
|
||||||
if value in OBJECTS:
|
if value in OBJECTS:
|
||||||
return SpecObjectField(value)
|
return SpecObjectField(value)
|
||||||
|
if value.startswith('Enums.'):
|
||||||
|
return EnumField(value[len('Enums.'):])
|
||||||
|
|
||||||
match value:
|
match value:
|
||||||
case 'value':
|
case 'value':
|
||||||
|
@ -210,7 +212,7 @@ def main(in_file, out_file):
|
||||||
@property
|
@property
|
||||||
def elm_name(self):
|
def elm_name(self):
|
||||||
if self.key == 'type':
|
if self.key == 'type':
|
||||||
return 'contentType'
|
return 'eventType'
|
||||||
else:
|
else:
|
||||||
words = self.key.lower().replace('_', ' ').replace('.', ' ').split(' ')
|
words = self.key.lower().replace('_', ' ').replace('.', ' ').split(' ')
|
||||||
words = ''.join([w.capitalize() for w in words])
|
words = ''.join([w.capitalize() for w in words])
|
||||||
|
|
|
@ -139,7 +139,7 @@ cookies =
|
||||||
|> Matrix.Room.mostRecentEvents
|
|> Matrix.Room.mostRecentEvents
|
||||||
|> List.filterMap
|
|> List.filterMap
|
||||||
(\event ->
|
(\event ->
|
||||||
case Matrix.Event.contentType event of
|
case Matrix.Event.eventType event of
|
||||||
"me.noordstar.demo_cookie" ->
|
"me.noordstar.demo_cookie" ->
|
||||||
Just (Matrix.Event.sender event)
|
Just (Matrix.Event.sender event)
|
||||||
|
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -9,7 +9,7 @@ module Internal.Api.GetEvent.V1.SpecObjects exposing
|
||||||
|
|
||||||
{-| Automatically generated 'SpecObjects'
|
{-| Automatically generated 'SpecObjects'
|
||||||
|
|
||||||
Last generated at Unix time 1676311233
|
Last generated at Unix time 1680263083
|
||||||
|
|
||||||
-}
|
-}
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ type alias ClientEvent =
|
||||||
, roomId : String
|
, roomId : String
|
||||||
, sender : String
|
, sender : String
|
||||||
, stateKey : Maybe String
|
, stateKey : Maybe String
|
||||||
, contentType : String
|
, eventType : String
|
||||||
, unsigned : Maybe UnsignedData
|
, unsigned : Maybe UnsignedData
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ encodeClientEvent data =
|
||||||
, ( "room_id", Just <| E.string data.roomId )
|
, ( "room_id", Just <| E.string data.roomId )
|
||||||
, ( "sender", Just <| E.string data.sender )
|
, ( "sender", Just <| E.string data.sender )
|
||||||
, ( "state_key", Maybe.map E.string data.stateKey )
|
, ( "state_key", Maybe.map E.string data.stateKey )
|
||||||
, ( "type", Just <| E.string data.contentType )
|
, ( "type", Just <| E.string data.eventType )
|
||||||
, ( "unsigned", Maybe.map encodeUnsignedData data.unsigned )
|
, ( "unsigned", Maybe.map encodeUnsignedData data.unsigned )
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ clientEventDecoder : D.Decoder ClientEvent
|
||||||
clientEventDecoder =
|
clientEventDecoder =
|
||||||
D.map8
|
D.map8
|
||||||
(\a b c d e f g h ->
|
(\a b c d e f g h ->
|
||||||
{ content = a, eventId = b, originServerTs = c, roomId = d, sender = e, stateKey = f, contentType = g, unsigned = h }
|
{ content = a, eventId = b, originServerTs = c, roomId = d, sender = e, stateKey = f, eventType = g, unsigned = h }
|
||||||
)
|
)
|
||||||
(D.field "content" D.value)
|
(D.field "content" D.value)
|
||||||
(D.field "event_id" D.string)
|
(D.field "event_id" D.string)
|
||||||
|
|
|
@ -9,7 +9,7 @@ module Internal.Api.GetMessages.V1.SpecObjects exposing
|
||||||
|
|
||||||
{-| Automatically generated 'SpecObjects'
|
{-| Automatically generated 'SpecObjects'
|
||||||
|
|
||||||
Last generated at Unix time 1679486096
|
Last generated at Unix time 1680263083
|
||||||
|
|
||||||
-}
|
-}
|
||||||
|
|
||||||
|
@ -59,7 +59,7 @@ type alias RoomEvent =
|
||||||
, prevContent : Maybe E.Value
|
, prevContent : Maybe E.Value
|
||||||
, roomId : String
|
, roomId : String
|
||||||
, stateKey : Maybe String
|
, stateKey : Maybe String
|
||||||
, contentType : String
|
, eventType : String
|
||||||
, userId : String
|
, userId : String
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ encodeRoomEvent data =
|
||||||
, ( "prev_content", data.prevContent )
|
, ( "prev_content", data.prevContent )
|
||||||
, ( "room_id", Just <| E.string data.roomId )
|
, ( "room_id", Just <| E.string data.roomId )
|
||||||
, ( "state_key", Maybe.map E.string data.stateKey )
|
, ( "state_key", Maybe.map E.string data.stateKey )
|
||||||
, ( "type", Just <| E.string data.contentType )
|
, ( "type", Just <| E.string data.eventType )
|
||||||
, ( "user_id", Just <| E.string data.userId )
|
, ( "user_id", Just <| E.string data.userId )
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ roomEventDecoder : D.Decoder RoomEvent
|
||||||
roomEventDecoder =
|
roomEventDecoder =
|
||||||
D.map9
|
D.map9
|
||||||
(\a b c d e f g h i ->
|
(\a b c d e f g h i ->
|
||||||
{ age = a, content = b, eventId = c, originServerTs = d, prevContent = e, roomId = f, stateKey = g, contentType = h, userId = i }
|
{ age = a, content = b, eventId = c, originServerTs = d, prevContent = e, roomId = f, stateKey = g, eventType = h, userId = i }
|
||||||
)
|
)
|
||||||
(opField "age" D.int)
|
(opField "age" D.int)
|
||||||
(D.field "content" D.value)
|
(D.field "content" D.value)
|
||||||
|
|
|
@ -12,7 +12,7 @@ module Internal.Api.GetMessages.V2.SpecObjects exposing
|
||||||
|
|
||||||
{-| Automatically generated 'SpecObjects'
|
{-| Automatically generated 'SpecObjects'
|
||||||
|
|
||||||
Last generated at Unix time 1679486096
|
Last generated at Unix time 1680263083
|
||||||
|
|
||||||
-}
|
-}
|
||||||
|
|
||||||
|
@ -62,7 +62,7 @@ type alias RoomEvent =
|
||||||
, roomId : String
|
, roomId : String
|
||||||
, sender : String
|
, sender : String
|
||||||
, stateKey : Maybe String
|
, stateKey : Maybe String
|
||||||
, contentType : String
|
, eventType : String
|
||||||
, unsigned : Maybe UnsignedData
|
, unsigned : Maybe UnsignedData
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,7 +77,7 @@ encodeRoomEvent data =
|
||||||
, ( "room_id", Just <| E.string data.roomId )
|
, ( "room_id", Just <| E.string data.roomId )
|
||||||
, ( "sender", Just <| E.string data.sender )
|
, ( "sender", Just <| E.string data.sender )
|
||||||
, ( "state_key", Maybe.map E.string data.stateKey )
|
, ( "state_key", Maybe.map E.string data.stateKey )
|
||||||
, ( "type", Just <| E.string data.contentType )
|
, ( "type", Just <| E.string data.eventType )
|
||||||
, ( "unsigned", Maybe.map encodeUnsignedData data.unsigned )
|
, ( "unsigned", Maybe.map encodeUnsignedData data.unsigned )
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ roomEventDecoder : D.Decoder RoomEvent
|
||||||
roomEventDecoder =
|
roomEventDecoder =
|
||||||
D.map9
|
D.map9
|
||||||
(\a b c d e f g h i ->
|
(\a b c d e f g h i ->
|
||||||
{ content = a, eventId = b, originServerTs = c, prevContent = d, roomId = e, sender = f, stateKey = g, contentType = h, unsigned = i }
|
{ content = a, eventId = b, originServerTs = c, prevContent = d, roomId = e, sender = f, stateKey = g, eventType = h, unsigned = i }
|
||||||
)
|
)
|
||||||
(D.field "content" D.value)
|
(D.field "content" D.value)
|
||||||
(D.field "event_id" D.string)
|
(D.field "event_id" D.string)
|
||||||
|
|
|
@ -19,7 +19,7 @@ upcastRoomEvent old =
|
||||||
, originServerTs = old.originServerTs
|
, originServerTs = old.originServerTs
|
||||||
, roomId = old.roomId
|
, roomId = old.roomId
|
||||||
, sender = old.userId
|
, sender = old.userId
|
||||||
, contentType = old.contentType
|
, eventType = old.eventType
|
||||||
, prevContent = old.prevContent
|
, prevContent = old.prevContent
|
||||||
, stateKey = old.stateKey
|
, stateKey = old.stateKey
|
||||||
, unsigned =
|
, unsigned =
|
||||||
|
|
|
@ -15,7 +15,7 @@ module Internal.Api.GetMessages.V3.SpecObjects exposing
|
||||||
|
|
||||||
{-| Automatically generated 'SpecObjects'
|
{-| Automatically generated 'SpecObjects'
|
||||||
|
|
||||||
Last generated at Unix time 1679486096
|
Last generated at Unix time 1680263083
|
||||||
|
|
||||||
-}
|
-}
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ type alias RoomEvent =
|
||||||
, roomId : String
|
, roomId : String
|
||||||
, sender : String
|
, sender : String
|
||||||
, stateKey : Maybe String
|
, stateKey : Maybe String
|
||||||
, contentType : String
|
, eventType : String
|
||||||
, unsigned : Maybe UnsignedData
|
, unsigned : Maybe UnsignedData
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@ encodeRoomEvent data =
|
||||||
, ( "room_id", Just <| E.string data.roomId )
|
, ( "room_id", Just <| E.string data.roomId )
|
||||||
, ( "sender", Just <| E.string data.sender )
|
, ( "sender", Just <| E.string data.sender )
|
||||||
, ( "state_key", Maybe.map E.string data.stateKey )
|
, ( "state_key", Maybe.map E.string data.stateKey )
|
||||||
, ( "type", Just <| E.string data.contentType )
|
, ( "type", Just <| E.string data.eventType )
|
||||||
, ( "unsigned", Maybe.map encodeUnsignedData data.unsigned )
|
, ( "unsigned", Maybe.map encodeUnsignedData data.unsigned )
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@ roomEventDecoder : D.Decoder RoomEvent
|
||||||
roomEventDecoder =
|
roomEventDecoder =
|
||||||
D.map9
|
D.map9
|
||||||
(\a b c d e f g h i ->
|
(\a b c d e f g h i ->
|
||||||
{ content = a, eventId = b, originServerTs = c, prevContent = d, roomId = e, sender = f, stateKey = g, contentType = h, unsigned = i }
|
{ content = a, eventId = b, originServerTs = c, prevContent = d, roomId = e, sender = f, stateKey = g, eventType = h, unsigned = i }
|
||||||
)
|
)
|
||||||
(D.field "content" D.value)
|
(D.field "content" D.value)
|
||||||
(D.field "event_id" D.string)
|
(D.field "event_id" D.string)
|
||||||
|
@ -115,7 +115,7 @@ type alias RoomStateEvent =
|
||||||
, roomId : String
|
, roomId : String
|
||||||
, sender : String
|
, sender : String
|
||||||
, stateKey : String
|
, stateKey : String
|
||||||
, contentType : String
|
, eventType : String
|
||||||
, unsigned : Maybe UnsignedData
|
, unsigned : Maybe UnsignedData
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,7 +130,7 @@ encodeRoomStateEvent data =
|
||||||
, ( "room_id", Just <| E.string data.roomId )
|
, ( "room_id", Just <| E.string data.roomId )
|
||||||
, ( "sender", Just <| E.string data.sender )
|
, ( "sender", Just <| E.string data.sender )
|
||||||
, ( "state_key", Just <| E.string data.stateKey )
|
, ( "state_key", Just <| E.string data.stateKey )
|
||||||
, ( "type", Just <| E.string data.contentType )
|
, ( "type", Just <| E.string data.eventType )
|
||||||
, ( "unsigned", Maybe.map encodeUnsignedData data.unsigned )
|
, ( "unsigned", Maybe.map encodeUnsignedData data.unsigned )
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -139,7 +139,7 @@ roomStateEventDecoder : D.Decoder RoomStateEvent
|
||||||
roomStateEventDecoder =
|
roomStateEventDecoder =
|
||||||
D.map9
|
D.map9
|
||||||
(\a b c d e f g h i ->
|
(\a b c d e f g h i ->
|
||||||
{ content = a, eventId = b, originServerTs = c, prevContent = d, roomId = e, sender = f, stateKey = g, contentType = h, unsigned = i }
|
{ content = a, eventId = b, originServerTs = c, prevContent = d, roomId = e, sender = f, stateKey = g, eventType = h, unsigned = i }
|
||||||
)
|
)
|
||||||
(D.field "content" D.value)
|
(D.field "content" D.value)
|
||||||
(D.field "event_id" D.string)
|
(D.field "event_id" D.string)
|
||||||
|
|
|
@ -20,7 +20,7 @@ upcastRoomEvent old =
|
||||||
, originServerTs = old.originServerTs
|
, originServerTs = old.originServerTs
|
||||||
, roomId = old.roomId
|
, roomId = old.roomId
|
||||||
, sender = old.sender
|
, sender = old.sender
|
||||||
, contentType = old.contentType
|
, eventType = old.eventType
|
||||||
, prevContent = old.prevContent
|
, prevContent = old.prevContent
|
||||||
, stateKey = old.stateKey
|
, stateKey = old.stateKey
|
||||||
, unsigned =
|
, unsigned =
|
||||||
|
|
|
@ -12,7 +12,7 @@ module Internal.Api.GetMessages.V4.SpecObjects exposing
|
||||||
|
|
||||||
{-| Automatically generated 'SpecObjects'
|
{-| Automatically generated 'SpecObjects'
|
||||||
|
|
||||||
Last generated at Unix time 1679486096
|
Last generated at Unix time 1680263084
|
||||||
|
|
||||||
-}
|
-}
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ type alias ClientEvent =
|
||||||
, roomId : String
|
, roomId : String
|
||||||
, sender : String
|
, sender : String
|
||||||
, stateKey : Maybe String
|
, stateKey : Maybe String
|
||||||
, contentType : String
|
, eventType : String
|
||||||
, unsigned : Maybe UnsignedData
|
, unsigned : Maybe UnsignedData
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ encodeClientEvent data =
|
||||||
, ( "room_id", Just <| E.string data.roomId )
|
, ( "room_id", Just <| E.string data.roomId )
|
||||||
, ( "sender", Just <| E.string data.sender )
|
, ( "sender", Just <| E.string data.sender )
|
||||||
, ( "state_key", Maybe.map E.string data.stateKey )
|
, ( "state_key", Maybe.map E.string data.stateKey )
|
||||||
, ( "type", Just <| E.string data.contentType )
|
, ( "type", Just <| E.string data.eventType )
|
||||||
, ( "unsigned", Maybe.map encodeUnsignedData data.unsigned )
|
, ( "unsigned", Maybe.map encodeUnsignedData data.unsigned )
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ clientEventDecoder : D.Decoder ClientEvent
|
||||||
clientEventDecoder =
|
clientEventDecoder =
|
||||||
D.map8
|
D.map8
|
||||||
(\a b c d e f g h ->
|
(\a b c d e f g h ->
|
||||||
{ content = a, eventId = b, originServerTs = c, roomId = d, sender = e, stateKey = f, contentType = g, unsigned = h }
|
{ content = a, eventId = b, originServerTs = c, roomId = d, sender = e, stateKey = f, eventType = g, unsigned = h }
|
||||||
)
|
)
|
||||||
(D.field "content" D.value)
|
(D.field "content" D.value)
|
||||||
(D.field "event_id" D.string)
|
(D.field "event_id" D.string)
|
||||||
|
|
|
@ -22,7 +22,7 @@ upcastRoomEvent old =
|
||||||
, roomId = old.roomId
|
, roomId = old.roomId
|
||||||
, sender = old.sender
|
, sender = old.sender
|
||||||
, stateKey = old.stateKey
|
, stateKey = old.stateKey
|
||||||
, contentType = old.contentType
|
, eventType = old.eventType
|
||||||
, unsigned = Maybe.map (upcastUnsigned old.prevContent) old.unsigned
|
, unsigned = Maybe.map (upcastUnsigned old.prevContent) old.unsigned
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ upcastRoomStateEvent old =
|
||||||
, roomId = old.roomId
|
, roomId = old.roomId
|
||||||
, sender = old.sender
|
, sender = old.sender
|
||||||
, stateKey = Just old.stateKey
|
, stateKey = Just old.stateKey
|
||||||
, contentType = old.contentType
|
, eventType = old.eventType
|
||||||
, unsigned = Maybe.map (upcastUnsigned old.prevContent) old.unsigned
|
, unsigned = Maybe.map (upcastUnsigned old.prevContent) old.unsigned
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ module Internal.Api.Sync.V1.SpecObjects exposing
|
||||||
|
|
||||||
{-| Automatically generated 'SpecObjects'
|
{-| Automatically generated 'SpecObjects'
|
||||||
|
|
||||||
Last generated at Unix time 1676625734
|
Last generated at Unix time 1680263084
|
||||||
|
|
||||||
-}
|
-}
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@ type alias ClientEventWithoutRoomId =
|
||||||
, originServerTs : Timestamp
|
, originServerTs : Timestamp
|
||||||
, sender : String
|
, sender : String
|
||||||
, stateKey : Maybe String
|
, stateKey : Maybe String
|
||||||
, contentType : String
|
, eventType : String
|
||||||
, unsigned : Maybe UnsignedData
|
, unsigned : Maybe UnsignedData
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ encodeClientEventWithoutRoomId data =
|
||||||
, ( "origin_server_ts", Just <| encodeTimestamp data.originServerTs )
|
, ( "origin_server_ts", Just <| encodeTimestamp data.originServerTs )
|
||||||
, ( "sender", Just <| E.string data.sender )
|
, ( "sender", Just <| E.string data.sender )
|
||||||
, ( "state_key", Maybe.map E.string data.stateKey )
|
, ( "state_key", Maybe.map E.string data.stateKey )
|
||||||
, ( "type", Just <| E.string data.contentType )
|
, ( "type", Just <| E.string data.eventType )
|
||||||
, ( "unsigned", Maybe.map encodeUnsignedData data.unsigned )
|
, ( "unsigned", Maybe.map encodeUnsignedData data.unsigned )
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ clientEventWithoutRoomIdDecoder : D.Decoder ClientEventWithoutRoomId
|
||||||
clientEventWithoutRoomIdDecoder =
|
clientEventWithoutRoomIdDecoder =
|
||||||
D.map7
|
D.map7
|
||||||
(\a b c d e f g ->
|
(\a b c d e f g ->
|
||||||
{ content = a, eventId = b, originServerTs = c, sender = d, stateKey = e, contentType = f, unsigned = g }
|
{ content = a, eventId = b, originServerTs = c, sender = d, stateKey = e, eventType = f, unsigned = g }
|
||||||
)
|
)
|
||||||
(D.field "content" D.value)
|
(D.field "content" D.value)
|
||||||
(D.field "event_id" D.string)
|
(D.field "event_id" D.string)
|
||||||
|
@ -163,7 +163,7 @@ ephemeralDecoder =
|
||||||
-}
|
-}
|
||||||
type alias Event =
|
type alias Event =
|
||||||
{ content : E.Value
|
{ content : E.Value
|
||||||
, contentType : String
|
, eventType : String
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -171,7 +171,7 @@ encodeEvent : Event -> E.Value
|
||||||
encodeEvent data =
|
encodeEvent data =
|
||||||
maybeObject
|
maybeObject
|
||||||
[ ( "content", Just <| data.content )
|
[ ( "content", Just <| data.content )
|
||||||
, ( "type", Just <| E.string data.contentType )
|
, ( "type", Just <| E.string data.eventType )
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@ -179,7 +179,7 @@ eventDecoder : D.Decoder Event
|
||||||
eventDecoder =
|
eventDecoder =
|
||||||
D.map2
|
D.map2
|
||||||
(\a b ->
|
(\a b ->
|
||||||
{ content = a, contentType = b }
|
{ content = a, eventType = b }
|
||||||
)
|
)
|
||||||
(D.field "content" D.value)
|
(D.field "content" D.value)
|
||||||
(D.field "type" D.string)
|
(D.field "type" D.string)
|
||||||
|
@ -457,7 +457,7 @@ type alias StrippedStateEvent =
|
||||||
{ content : E.Value
|
{ content : E.Value
|
||||||
, sender : String
|
, sender : String
|
||||||
, stateKey : String
|
, stateKey : String
|
||||||
, contentType : String
|
, eventType : String
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -467,7 +467,7 @@ encodeStrippedStateEvent data =
|
||||||
[ ( "content", Just <| data.content )
|
[ ( "content", Just <| data.content )
|
||||||
, ( "sender", Just <| E.string data.sender )
|
, ( "sender", Just <| E.string data.sender )
|
||||||
, ( "state_key", Just <| E.string data.stateKey )
|
, ( "state_key", Just <| E.string data.stateKey )
|
||||||
, ( "type", Just <| E.string data.contentType )
|
, ( "type", Just <| E.string data.eventType )
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@ -475,7 +475,7 @@ strippedStateEventDecoder : D.Decoder StrippedStateEvent
|
||||||
strippedStateEventDecoder =
|
strippedStateEventDecoder =
|
||||||
D.map4
|
D.map4
|
||||||
(\a b c d ->
|
(\a b c d ->
|
||||||
{ content = a, sender = b, stateKey = c, contentType = d }
|
{ content = a, sender = b, stateKey = c, eventType = d }
|
||||||
)
|
)
|
||||||
(D.field "content" D.value)
|
(D.field "content" D.value)
|
||||||
(D.field "sender" D.string)
|
(D.field "sender" D.string)
|
||||||
|
|
|
@ -63,7 +63,7 @@ module Internal.Api.Sync.V2.SpecObjects exposing
|
||||||
|
|
||||||
{-| Automatically generated 'SpecObjects'
|
{-| Automatically generated 'SpecObjects'
|
||||||
|
|
||||||
Last generated at Unix time 1676625735
|
Last generated at Unix time 1680263084
|
||||||
|
|
||||||
-}
|
-}
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ type alias ClientEventWithoutRoomId =
|
||||||
, originServerTs : Timestamp
|
, originServerTs : Timestamp
|
||||||
, sender : String
|
, sender : String
|
||||||
, stateKey : Maybe String
|
, stateKey : Maybe String
|
||||||
, contentType : String
|
, eventType : String
|
||||||
, unsigned : Maybe UnsignedData
|
, unsigned : Maybe UnsignedData
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,7 +119,7 @@ encodeClientEventWithoutRoomId data =
|
||||||
, ( "origin_server_ts", Just <| encodeTimestamp data.originServerTs )
|
, ( "origin_server_ts", Just <| encodeTimestamp data.originServerTs )
|
||||||
, ( "sender", Just <| E.string data.sender )
|
, ( "sender", Just <| E.string data.sender )
|
||||||
, ( "state_key", Maybe.map E.string data.stateKey )
|
, ( "state_key", Maybe.map E.string data.stateKey )
|
||||||
, ( "type", Just <| E.string data.contentType )
|
, ( "type", Just <| E.string data.eventType )
|
||||||
, ( "unsigned", Maybe.map encodeUnsignedData data.unsigned )
|
, ( "unsigned", Maybe.map encodeUnsignedData data.unsigned )
|
||||||
]
|
]
|
||||||
|
|
||||||
|
@ -128,7 +128,7 @@ clientEventWithoutRoomIdDecoder : D.Decoder ClientEventWithoutRoomId
|
||||||
clientEventWithoutRoomIdDecoder =
|
clientEventWithoutRoomIdDecoder =
|
||||||
D.map7
|
D.map7
|
||||||
(\a b c d e f g ->
|
(\a b c d e f g ->
|
||||||
{ content = a, eventId = b, originServerTs = c, sender = d, stateKey = e, contentType = f, unsigned = g }
|
{ content = a, eventId = b, originServerTs = c, sender = d, stateKey = e, eventType = f, unsigned = g }
|
||||||
)
|
)
|
||||||
(D.field "content" D.value)
|
(D.field "content" D.value)
|
||||||
(D.field "event_id" D.string)
|
(D.field "event_id" D.string)
|
||||||
|
@ -166,7 +166,7 @@ ephemeralDecoder =
|
||||||
-}
|
-}
|
||||||
type alias Event =
|
type alias Event =
|
||||||
{ content : E.Value
|
{ content : E.Value
|
||||||
, contentType : String
|
, eventType : String
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -174,7 +174,7 @@ encodeEvent : Event -> E.Value
|
||||||
encodeEvent data =
|
encodeEvent data =
|
||||||
maybeObject
|
maybeObject
|
||||||
[ ( "content", Just <| data.content )
|
[ ( "content", Just <| data.content )
|
||||||
, ( "type", Just <| E.string data.contentType )
|
, ( "type", Just <| E.string data.eventType )
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@ -182,7 +182,7 @@ eventDecoder : D.Decoder Event
|
||||||
eventDecoder =
|
eventDecoder =
|
||||||
D.map2
|
D.map2
|
||||||
(\a b ->
|
(\a b ->
|
||||||
{ content = a, contentType = b }
|
{ content = a, eventType = b }
|
||||||
)
|
)
|
||||||
(D.field "content" D.value)
|
(D.field "content" D.value)
|
||||||
(D.field "type" D.string)
|
(D.field "type" D.string)
|
||||||
|
@ -463,7 +463,7 @@ type alias StrippedStateEvent =
|
||||||
{ content : E.Value
|
{ content : E.Value
|
||||||
, sender : String
|
, sender : String
|
||||||
, stateKey : String
|
, stateKey : String
|
||||||
, contentType : String
|
, eventType : String
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -473,7 +473,7 @@ encodeStrippedStateEvent data =
|
||||||
[ ( "content", Just <| data.content )
|
[ ( "content", Just <| data.content )
|
||||||
, ( "sender", Just <| E.string data.sender )
|
, ( "sender", Just <| E.string data.sender )
|
||||||
, ( "state_key", Just <| E.string data.stateKey )
|
, ( "state_key", Just <| E.string data.stateKey )
|
||||||
, ( "type", Just <| E.string data.contentType )
|
, ( "type", Just <| E.string data.eventType )
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@ -481,7 +481,7 @@ strippedStateEventDecoder : D.Decoder StrippedStateEvent
|
||||||
strippedStateEventDecoder =
|
strippedStateEventDecoder =
|
||||||
D.map4
|
D.map4
|
||||||
(\a b c d ->
|
(\a b c d ->
|
||||||
{ content = a, sender = b, stateKey = c, contentType = d }
|
{ content = a, sender = b, stateKey = c, eventType = d }
|
||||||
)
|
)
|
||||||
(D.field "content" D.value)
|
(D.field "content" D.value)
|
||||||
(D.field "sender" D.string)
|
(D.field "sender" D.string)
|
||||||
|
|
|
@ -47,7 +47,7 @@ upcastClientEventWithoutRoomId old =
|
||||||
, originServerTs = old.originServerTs
|
, originServerTs = old.originServerTs
|
||||||
, sender = old.sender
|
, sender = old.sender
|
||||||
, stateKey = old.stateKey
|
, stateKey = old.stateKey
|
||||||
, contentType = old.contentType
|
, eventType = old.eventType
|
||||||
, unsigned = Maybe.map upcastUnsigned old.unsigned
|
, unsigned = Maybe.map upcastUnsigned old.unsigned
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -49,7 +49,7 @@ initFromGetEvent output =
|
||||||
, roomId = output.roomId
|
, roomId = output.roomId
|
||||||
, sender = output.sender
|
, sender = output.sender
|
||||||
, stateKey = output.stateKey
|
, stateKey = output.stateKey
|
||||||
, contentType = output.contentType
|
, eventType = output.eventType
|
||||||
, unsigned =
|
, unsigned =
|
||||||
output.unsigned
|
output.unsigned
|
||||||
|> Maybe.map
|
|> Maybe.map
|
||||||
|
@ -75,7 +75,7 @@ initFromGetMessages output =
|
||||||
, roomId = output.roomId
|
, roomId = output.roomId
|
||||||
, sender = output.sender
|
, sender = output.sender
|
||||||
, stateKey = output.stateKey
|
, stateKey = output.stateKey
|
||||||
, contentType = output.contentType
|
, eventType = output.eventType
|
||||||
, unsigned =
|
, unsigned =
|
||||||
output.unsigned
|
output.unsigned
|
||||||
|> Maybe.map
|
|> Maybe.map
|
||||||
|
@ -101,7 +101,7 @@ initFromClientEventWithoutRoomId rId output =
|
||||||
, roomId = rId
|
, roomId = rId
|
||||||
, sender = output.sender
|
, sender = output.sender
|
||||||
, stateKey = output.stateKey
|
, stateKey = output.stateKey
|
||||||
, contentType = output.contentType
|
, eventType = output.eventType
|
||||||
, unsigned =
|
, unsigned =
|
||||||
output.unsigned
|
output.unsigned
|
||||||
|> Maybe.map
|
|> Maybe.map
|
||||||
|
@ -156,9 +156,9 @@ stateKey =
|
||||||
withoutCredentials >> Internal.stateKey
|
withoutCredentials >> Internal.stateKey
|
||||||
|
|
||||||
|
|
||||||
contentType : Event -> String
|
eventType : Event -> String
|
||||||
contentType =
|
eventType =
|
||||||
withoutCredentials >> Internal.contentType
|
withoutCredentials >> Internal.eventType
|
||||||
|
|
||||||
|
|
||||||
age : Event -> Maybe Int
|
age : Event -> Maybe Int
|
||||||
|
|
|
@ -39,7 +39,7 @@ withoutCredentials (RoomInvite { invite }) =
|
||||||
invite
|
invite
|
||||||
|
|
||||||
|
|
||||||
getEvent : { contentType : String, stateKey : String } -> RoomInvite -> Maybe Internal.RoomInviteEvent
|
getEvent : { eventType : String, stateKey : String } -> RoomInvite -> Maybe Internal.RoomInviteEvent
|
||||||
getEvent data =
|
getEvent data =
|
||||||
withoutCredentials >> Internal.getEvent data
|
withoutCredentials >> Internal.getEvent data
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ initFromJoinedRoom data jroom =
|
||||||
jroom.accountData
|
jroom.accountData
|
||||||
|> Maybe.map .events
|
|> Maybe.map .events
|
||||||
|> Maybe.withDefault []
|
|> Maybe.withDefault []
|
||||||
|> List.map (\{ contentType, content } -> ( contentType, content ))
|
|> List.map (\{ eventType, content } -> ( eventType, content ))
|
||||||
|> Dict.fromList
|
|> Dict.fromList
|
||||||
, ephemeral =
|
, ephemeral =
|
||||||
jroom.ephemeral
|
jroom.ephemeral
|
||||||
|
@ -86,6 +86,11 @@ initFromJoinedRoom data jroom =
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
accountData : String -> Room -> Maybe E.Value
|
||||||
|
accountData key =
|
||||||
|
withoutCredentials >> Internal.accountData key
|
||||||
|
|
||||||
|
|
||||||
{-| Adds an internal event to the `Room`. An internal event is a custom event
|
{-| Adds an internal event to the `Room`. An internal event is a custom event
|
||||||
that has been generated by the client.
|
that has been generated by the client.
|
||||||
-}
|
-}
|
||||||
|
|
|
@ -12,7 +12,7 @@ type IEvent
|
||||||
, roomId : String
|
, roomId : String
|
||||||
, sender : String
|
, sender : String
|
||||||
, stateKey : Maybe String
|
, stateKey : Maybe String
|
||||||
, contentType : String
|
, eventType : String
|
||||||
, unsigned :
|
, unsigned :
|
||||||
Maybe
|
Maybe
|
||||||
{ age : Maybe Int
|
{ age : Maybe Int
|
||||||
|
@ -30,7 +30,7 @@ init :
|
||||||
, roomId : String
|
, roomId : String
|
||||||
, sender : String
|
, sender : String
|
||||||
, stateKey : Maybe String
|
, stateKey : Maybe String
|
||||||
, contentType : String
|
, eventType : String
|
||||||
, unsigned :
|
, unsigned :
|
||||||
Maybe
|
Maybe
|
||||||
{ age : Maybe Int
|
{ age : Maybe Int
|
||||||
|
@ -78,9 +78,9 @@ stateKey (IEvent e) =
|
||||||
e.stateKey
|
e.stateKey
|
||||||
|
|
||||||
|
|
||||||
contentType : IEvent -> String
|
eventType : IEvent -> String
|
||||||
contentType (IEvent e) =
|
eventType (IEvent e) =
|
||||||
e.contentType
|
e.eventType
|
||||||
|
|
||||||
|
|
||||||
age : IEvent -> Maybe Int
|
age : IEvent -> Maybe Int
|
||||||
|
@ -102,7 +102,7 @@ transactionId (IEvent e) =
|
||||||
|
|
||||||
|
|
||||||
type BlindEvent
|
type BlindEvent
|
||||||
= BlindEvent { contentType : String, content : E.Value }
|
= BlindEvent { eventType : String, content : E.Value }
|
||||||
|
|
||||||
|
|
||||||
blindContent : BlindEvent -> E.Value
|
blindContent : BlindEvent -> E.Value
|
||||||
|
@ -112,4 +112,4 @@ blindContent (BlindEvent be) =
|
||||||
|
|
||||||
blindContentType : BlindEvent -> String
|
blindContentType : BlindEvent -> String
|
||||||
blindContentType (BlindEvent be) =
|
blindContentType (BlindEvent be) =
|
||||||
be.contentType
|
be.eventType
|
||||||
|
|
|
@ -19,24 +19,24 @@ type RoomInviteEvent
|
||||||
{ content : E.Value
|
{ content : E.Value
|
||||||
, sender : String
|
, sender : String
|
||||||
, stateKey : String
|
, stateKey : String
|
||||||
, contentType : String
|
, eventType : String
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
init : { roomId : String, events : List { content : E.Value, sender : String, stateKey : String, contentType : String } } -> IRoomInvite
|
init : { roomId : String, events : List { content : E.Value, sender : String, stateKey : String, eventType : String } } -> IRoomInvite
|
||||||
init data =
|
init data =
|
||||||
data.events
|
data.events
|
||||||
|> List.map
|
|> List.map
|
||||||
(\event ->
|
(\event ->
|
||||||
( ( event.contentType, event.stateKey ), RoomInviteEvent event )
|
( ( event.eventType, event.stateKey ), RoomInviteEvent event )
|
||||||
)
|
)
|
||||||
|> Dict.fromList
|
|> Dict.fromList
|
||||||
|> (\e -> IRoomInvite { roomId = data.roomId, events = e })
|
|> (\e -> IRoomInvite { roomId = data.roomId, events = e })
|
||||||
|
|
||||||
|
|
||||||
getEvent : { contentType : String, stateKey : String } -> IRoomInvite -> Maybe RoomInviteEvent
|
getEvent : { eventType : String, stateKey : String } -> IRoomInvite -> Maybe RoomInviteEvent
|
||||||
getEvent data (IRoomInvite { events }) =
|
getEvent data (IRoomInvite { events }) =
|
||||||
Dict.get ( data.contentType, data.stateKey ) events
|
Dict.get ( data.eventType, data.stateKey ) events
|
||||||
|
|
||||||
|
|
||||||
getAllEvents : IRoomInvite -> List RoomInviteEvent
|
getAllEvents : IRoomInvite -> List RoomInviteEvent
|
||||||
|
@ -64,6 +64,6 @@ stateKey (RoomInviteEvent data) =
|
||||||
data.stateKey
|
data.stateKey
|
||||||
|
|
||||||
|
|
||||||
contentType : RoomInviteEvent -> String
|
eventType : RoomInviteEvent -> String
|
||||||
contentType (RoomInviteEvent data) =
|
eventType (RoomInviteEvent data) =
|
||||||
data.contentType
|
data.eventType
|
||||||
|
|
|
@ -12,7 +12,7 @@ addEvent : IEvent -> StateManager -> StateManager
|
||||||
addEvent event oldManager =
|
addEvent event oldManager =
|
||||||
case Event.stateKey event of
|
case Event.stateKey event of
|
||||||
Just key ->
|
Just key ->
|
||||||
Dict.insert ( Event.contentType event, key ) event oldManager
|
Dict.insert ( Event.eventType event, key ) event oldManager
|
||||||
|
|
||||||
Nothing ->
|
Nothing ->
|
||||||
oldManager
|
oldManager
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
module Matrix.Event exposing
|
module Matrix.Event exposing
|
||||||
( Event, contentType, content, stateKey
|
( Event, eventType, content, stateKey
|
||||||
, eventId, roomId, sender, originServerTs, redactedBecause
|
, eventId, roomId, sender, originServerTs, redactedBecause
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ module Matrix.Event exposing
|
||||||
|
|
||||||
# Event
|
# Event
|
||||||
|
|
||||||
@docs Event, contentType, content, stateKey
|
@docs Event, eventType, content, stateKey
|
||||||
|
|
||||||
|
|
||||||
## Getting metadata
|
## Getting metadata
|
||||||
|
@ -75,9 +75,9 @@ stateKey =
|
||||||
|
|
||||||
{-| This is the type of the event's content. For example, `m.room.message` indicates that it was a message.
|
{-| This is the type of the event's content. For example, `m.room.message` indicates that it was a message.
|
||||||
-}
|
-}
|
||||||
contentType : Event -> String
|
eventType : Event -> String
|
||||||
contentType =
|
eventType =
|
||||||
Internal.contentType
|
Internal.eventType
|
||||||
|
|
||||||
|
|
||||||
{-| In case the event was redacted, this event will point you to the event that redacted it.
|
{-| In case the event was redacted, this event will point you to the event that redacted it.
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
module Matrix.RoomInvite exposing
|
module Matrix.RoomInvite exposing
|
||||||
( RoomInvite, accept, reject, acceptWithReason, rejectWithReason
|
( RoomInvite, accept, reject, acceptWithReason, rejectWithReason
|
||||||
, roomId, RoomInviteEvent, getEvent, getAllEvents
|
, roomId, RoomInviteEvent, getEvent, getAllEvents
|
||||||
, sender, stateKey, contentType, content
|
, sender, stateKey, eventType, content
|
||||||
)
|
)
|
||||||
|
|
||||||
{-| Sometimes, your user will be invited to a new room!
|
{-| Sometimes, your user will be invited to a new room!
|
||||||
|
@ -26,7 +26,7 @@ want to see.
|
||||||
|
|
||||||
Once you have the event you want, you can explore it with the following functions.
|
Once you have the event you want, you can explore it with the following functions.
|
||||||
|
|
||||||
@docs sender, stateKey, contentType, content
|
@docs sender, stateKey, eventType, content
|
||||||
|
|
||||||
-}
|
-}
|
||||||
|
|
||||||
|
@ -105,9 +105,9 @@ content =
|
||||||
|
|
||||||
{-| Get the event's content type.
|
{-| Get the event's content type.
|
||||||
-}
|
-}
|
||||||
contentType : RoomInviteEvent -> String
|
eventType : RoomInviteEvent -> String
|
||||||
contentType =
|
eventType =
|
||||||
IR.contentType
|
IR.eventType
|
||||||
|
|
||||||
|
|
||||||
{-| Get the event's state key.
|
{-| Get the event's state key.
|
||||||
|
@ -119,7 +119,7 @@ stateKey =
|
||||||
|
|
||||||
{-| Get a specific event with a specific event content type and state key, if it exists.
|
{-| Get a specific event with a specific event content type and state key, if it exists.
|
||||||
-}
|
-}
|
||||||
getEvent : { contentType : String, stateKey : String } -> RoomInvite -> Maybe RoomInviteEvent
|
getEvent : { eventType : String, stateKey : String } -> RoomInvite -> Maybe RoomInviteEvent
|
||||||
getEvent data invite =
|
getEvent data invite =
|
||||||
invite
|
invite
|
||||||
|> Internal.withoutCredentials
|
|> Internal.withoutCredentials
|
||||||
|
|
Loading…
Reference in New Issue