Resolve issues + fix bugs

main
Bram van den Heuvel 2 months ago
parent 47160224e2
commit 1c49da3033
  1. 124
      src/SpecObjects.elm

@ -128,7 +128,7 @@ audioInfoDecoder =
type AuthData
= AuthData
{ publicKey : String
, signatures : String
, signatures : Dict String String
}
@ -138,7 +138,7 @@ encodeAuthData info =
AuthData data ->
maybeObject
[ ( "public_key", Just <| E.string data.publicKey )
, ( "signatures", Just <| E.string data.signatures )
, ( "signatures", Just <| E.dict identity E.string data.signatures )
]
@ -149,7 +149,7 @@ authDataDecoder =
AuthData { publicKey = a, signatures = b }
)
(D.field "public_key" D.string)
(opFieldWithDefault "signatures" [] D.string)
(opFieldWithDefault "signatures" Dict.empty (D.dict D.string))
{-| Authentication Data.
@ -199,7 +199,7 @@ encodeAuthenticationResponse info =
maybeObject
[ ( "completed", Just <| E.list E.string data.completed )
, ( "flows", Just <| E.list encodeFlowInformation data.flows )
, ( "params", Just <| E.dict identity (E.dict identity) data.params )
, ( "params", Just <| E.dict identity (E.dict identity identity) data.params )
, ( "session", Maybe.map E.string data.session )
]
@ -265,7 +265,7 @@ encodeCapabilities info =
maybeObject
[ ( "m.change_password", Maybe.map encodeChangePasswordCapability data.mChangePassword )
, ( "m.room_versions", Maybe.map encodeRoomVersionsCapability data.mRoomVersions )
, ( "all", Just <| E.dict identity data.all )
, ( "all", Just <| E.dict identity identity data.all )
]
@ -371,8 +371,8 @@ encodeChildRoomsChunk info =
childRoomsChunkDecoder : D.Decoder ChildRoomsChunk
childRoomsChunkDecoder =
D.map11
(\a b c d e f g h i j k ->
D.map8
(\a b c d e ( f, g ) ( h, i ) ( j, k ) ->
ChildRoomsChunk { avatarUrl = a, canonicalAlias = b, childrenState = c, guestCanJoin = d, joinRule = e, name = f, numJoinedMembers = g, roomId = h, roomType = i, topic = j, worldReadable = k }
)
(opField "avatar_url" D.string)
@ -380,12 +380,18 @@ childRoomsChunkDecoder =
(D.field "children_state" (D.list strippedChildStateEventDecoder))
(D.field "guest_can_join" D.bool)
(opFieldWithDefault "join_rule" Enums.Public Enums.joinRulesDecoder)
(opField "name" D.string)
(D.field "num_joined_members" D.int)
(D.field "room_id" D.string)
(opField "room_type" D.string)
(opField "topic" D.string)
(D.field "world_readable" D.bool)
(D.map2 Tuple.pair
(opField "name" D.string)
(D.field "num_joined_members" D.int)
)
(D.map2 Tuple.pair
(D.field "room_id" D.string)
(opField "room_type" D.string)
)
(D.map2 Tuple.pair
(opField "topic" D.string)
(D.field "world_readable" D.bool)
)
{-| A client event.
@ -1004,8 +1010,8 @@ encodeFilter info =
filterDecoder : D.Decoder Filter
filterDecoder =
D.map11
(\a b c d e f g h i j k ->
D.map8
(\a b c d e ( f, g ) ( h, i ) ( j, k ) ->
Filter { containsUrl = a, includeRedundantMembers = b, lazyLoadMembers = c, limit = d, notRooms = e, notSenders = f, notTypes = g, rooms = h, senders = i, types = j, unreadThreadNotifications = k }
)
(opField "contains_url" D.bool)
@ -1013,12 +1019,18 @@ filterDecoder =
(opFieldWithDefault "lazy_load_members" False D.bool)
(opField "limit" D.int)
(opFieldWithDefault "not_rooms" [] (D.list D.string))
(opFieldWithDefault "not_senders" [] (D.list D.string))
(opFieldWithDefault "not_types" [] (D.list D.string))
(opField "rooms" (D.list D.string))
(opField "senders" (D.list D.string))
(opField "types" (D.list D.string))
(opFieldWithDefault "unread_thread_notifications" False D.bool)
(D.map2 Tuple.pair
(opFieldWithDefault "not_senders" [] (D.list D.string))
(opFieldWithDefault "not_types" [] (D.list D.string))
)
(D.map2 Tuple.pair
(opField "rooms" (D.list D.string))
(opField "senders" (D.list D.string))
)
(D.map2 Tuple.pair
(opField "types" (D.list D.string))
(opFieldWithDefault "unread_thread_notifications" False D.bool)
)
{-| Provided flow information.
@ -1642,7 +1654,7 @@ encodeLocation info =
Location data ->
maybeObject
[ ( "alias", Just <| E.string data.alias )
, ( "fields", Just <| E.dict identity data.fields )
, ( "fields", Just <| E.dict identity identity data.fields )
, ( "protocol", Just <| E.string data.protocol )
]
@ -1734,7 +1746,7 @@ encodeNotification info =
case info of
Notification data ->
maybeObject
[ ( "actions", Just <| E.list data.actions )
[ ( "actions", Just <| E.list identity data.actions )
, ( "event", Just <| encodeEvent data.event )
, ( "profile_tag", Maybe.map E.string data.profileTag )
, ( "read", Just <| E.bool data.read )
@ -2073,8 +2085,8 @@ encodePublicRoomsChunk info =
publicRoomsChunkDecoder : D.Decoder PublicRoomsChunk
publicRoomsChunkDecoder =
D.map10
(\a b c d e f g h i j ->
D.map8
(\a b c d e f ( g, h ) ( i, j ) ->
PublicRoomsChunk { avatarUrl = a, canonicalAlias = b, guestCanJoin = c, joinRule = d, name = e, numJoinedMembers = f, roomId = g, roomType = h, topic = i, worldReadable = j }
)
(opField "avatar_url" D.string)
@ -2083,10 +2095,14 @@ publicRoomsChunkDecoder =
(opFieldWithDefault "join_rule" Enums.Public Enums.joinRulesDecoder)
(opField "name" D.string)
(D.field "num_joined_members" D.int)
(D.field "room_id" D.string)
(opField "room_type" D.string)
(opField "topic" D.string)
(D.field "world_readable" D.bool)
(D.map2 Tuple.pair
(D.field "room_id" D.string)
(opField "room_type" D.string)
)
(D.map2 Tuple.pair
(opField "topic" D.string)
(D.field "world_readable" D.bool)
)
{-| A condition that must hold true for an event in order for a rule to be applied to an event.
@ -2142,7 +2158,7 @@ encodePushRule info =
case info of
PushRule data ->
maybeObject
[ ( "actions", Just <| E.list data.actions )
[ ( "actions", Just <| E.list identity data.actions )
, ( "conditions", Maybe.map (E.list encodePushCondition) data.conditions )
, ( "default", Just <| E.bool data.default )
, ( "enabled", Just <| E.bool data.enabled )
@ -2527,8 +2543,8 @@ encodeRoomEventFilter info =
roomEventFilterDecoder : D.Decoder RoomEventFilter
roomEventFilterDecoder =
D.map11
(\a b c d e f g h i j k ->
D.map8
(\a b c d e (f, g) (h, i) (j, k) ->
RoomEventFilter { containsUrl = a, includeRedundantMembers = b, lazyLoadMembers = c, limit = d, notRooms = e, notSenders = f, notTypes = g, rooms = h, senders = i, types = j, unreadThreadNotifications = k }
)
(opField "contains_url" D.bool)
@ -2536,12 +2552,18 @@ roomEventFilterDecoder =
(opFieldWithDefault "lazy_load_members" False D.bool)
(opField "limit" D.int)
(opFieldWithDefault "not_rooms" [] (D.list D.string))
(opFieldWithDefault "not_senders" [] (D.list D.string))
(opFieldWithDefault "not_types" [] (D.list D.string))
(opField "rooms" (D.list D.string))
(opField "senders" (D.list D.string))
(opField "types" (D.list D.string))
(opFieldWithDefault "unread_thread_notifications" False D.bool)
(D.map2 Tuple.pair
(opFieldWithDefault "not_senders" [] (D.list D.string))
(opFieldWithDefault "not_types" [] (D.list D.string))
)
(D.map2 Tuple.pair
(opField "rooms" (D.list D.string))
(opField "senders" (D.list D.string))
)
(D.map2 Tuple.pair
(opField "types" (D.list D.string))
(opFieldWithDefault "unread_thread_notifications" False D.bool)
)
{-| Mapping of category name to search criteria.
@ -2689,7 +2711,7 @@ encodeRoomKeyBackup info =
case info of
RoomKeyBackup data ->
maybeObject
[ ( "sessions", Just <| E.dict identity data.sessions )
[ ( "sessions", Just <| E.dict identity identity data.sessions )
]
@ -3055,8 +3077,8 @@ encodeStateFilter info =
stateFilterDecoder : D.Decoder StateFilter
stateFilterDecoder =
D.map11
(\a b c d e f g h i j k ->
D.map8
(\a b c d e (f, g) (h, i) (j, k) ->
StateFilter { containsUrl = a, includeRedundantMembers = b, lazyLoadMembers = c, limit = d, notRooms = e, notSenders = f, notTypes = g, rooms = h, senders = i, types = j, unreadThreadNotifications = k }
)
(opField "contains_url" D.bool)
@ -3064,12 +3086,18 @@ stateFilterDecoder =
(opFieldWithDefault "lazy_load_members" False D.bool)
(opField "limit" D.int)
(opFieldWithDefault "not_rooms" [] (D.list D.string))
(opFieldWithDefault "not_senders" [] (D.list D.string))
(opFieldWithDefault "not_types" [] (D.list D.string))
(opField "rooms" (D.list D.string))
(opField "senders" (D.list D.string))
(opField "types" (D.list D.string))
(opFieldWithDefault "unread_thread_notifications" False D.bool)
(D.map2 Tuple.pair
(opFieldWithDefault "not_senders" [] (D.list D.string))
(opFieldWithDefault "not_types" [] (D.list D.string))
)
(D.map2 Tuple.pair
(opField "rooms" (D.list D.string))
(opField "senders" (D.list D.string))
)
(D.map2 Tuple.pair
(opField "types" (D.list D.string))
(opFieldWithDefault "unread_thread_notifications" False D.bool)
)
{-| Stripped version of a state event.
@ -3432,7 +3460,7 @@ unsignedDataDecoder =
)
(opField "age" D.int)
(opField "prev_content" eventContentDecoder)
(opField "redacted_because" clientEventDecoder)
(opField "redacted_because" (D.lazy (\_ -> clientEventDecoder)))
(opField "transaction_id" D.string)

Loading…
Cancel
Save