Refactor JoinedMembers API endpoint
parent
e8c0345290
commit
293a37c8cd
|
@ -17,7 +17,7 @@ getEvent =
|
||||||
|
|
||||||
{-| Get a list of members who are part of a Matrix room.
|
{-| Get a list of members who are part of a Matrix room.
|
||||||
-}
|
-}
|
||||||
joinedMembers : List String -> JoinedMembers.JoinedMembersInput -> JoinedMembers.JoinedMembersOutput
|
joinedMembers : List String -> Maybe (JoinedMembers.JoinedMembersInput -> JoinedMembers.JoinedMembersOutput)
|
||||||
joinedMembers =
|
joinedMembers =
|
||||||
JoinedMembers.joinedMembers
|
JoinedMembers.joinedMembers
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
module Internal.Api.JoinedMembers.Api exposing (..)
|
module Internal.Api.JoinedMembers.Api exposing (..)
|
||||||
|
|
||||||
|
import Internal.Api.JoinedMembers.V1.SpecObjects as SO1
|
||||||
import Internal.Api.Request as R
|
import Internal.Api.Request as R
|
||||||
import Internal.Tools.Exceptions as X
|
import Internal.Tools.Exceptions as X
|
||||||
import Json.Decode as D
|
|
||||||
import Task exposing (Task)
|
import Task exposing (Task)
|
||||||
|
|
||||||
|
|
||||||
|
@ -13,8 +13,12 @@ type alias JoinedMembersInputV1 =
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
joinedMembersInputV1 : D.Decoder a -> (a -> b) -> JoinedMembersInputV1 -> Task X.Error b
|
type alias JoinedMembersOutputV1 =
|
||||||
joinedMembersInputV1 decoder mapping data =
|
Task X.Error SO1.RoomMemberList
|
||||||
|
|
||||||
|
|
||||||
|
joinedMembersInputV1 : JoinedMembersInputV1 -> JoinedMembersOutputV1
|
||||||
|
joinedMembersInputV1 data =
|
||||||
R.rawApiCall
|
R.rawApiCall
|
||||||
{ headers = R.WithAccessToken data.accessToken
|
{ headers = R.WithAccessToken data.accessToken
|
||||||
, method = "GET"
|
, method = "GET"
|
||||||
|
@ -26,5 +30,5 @@ joinedMembersInputV1 decoder mapping data =
|
||||||
, queryParams = []
|
, queryParams = []
|
||||||
, bodyParams = []
|
, bodyParams = []
|
||||||
, timeout = Nothing
|
, timeout = Nothing
|
||||||
, decoder = \_ -> D.map mapping decoder
|
, decoder = \_ -> SO1.roomMemberListDecoder
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,23 +1,20 @@
|
||||||
module Internal.Api.JoinedMembers.Main exposing (..)
|
module Internal.Api.JoinedMembers.Main exposing (..)
|
||||||
|
|
||||||
import Internal.Api.JoinedMembers.Api as Api
|
import Internal.Api.JoinedMembers.Api as Api
|
||||||
import Internal.Api.JoinedMembers.V1_2.Api as V1_2
|
import Internal.Tools.VersionControl as VC
|
||||||
import Internal.Api.JoinedMembers.V1_3.Api as V1_3
|
|
||||||
import Internal.Api.JoinedMembers.V1_4.Api as V1_4
|
|
||||||
import Internal.Api.JoinedMembers.V1_5.Api as V1_5
|
|
||||||
import Internal.Api.JoinedMembers.V1_5.Objects as O
|
|
||||||
import Internal.Api.VersionControl as V
|
|
||||||
import Internal.Tools.Exceptions as X
|
|
||||||
import Task exposing (Task)
|
|
||||||
|
|
||||||
|
|
||||||
joinedMembers : List String -> JoinedMembersInput -> JoinedMembersOutput
|
joinedMembers : List String -> Maybe (JoinedMembersInput -> JoinedMembersOutput)
|
||||||
joinedMembers =
|
joinedMembers versions =
|
||||||
V.firstVersion V1_2.packet
|
VC.withBottomLayer
|
||||||
|> V.updateWith V1_3.packet
|
{ current = Api.joinedMembersInputV1
|
||||||
|> V.updateWith V1_4.packet
|
, version = "v1.1"
|
||||||
|> V.updateWith V1_5.packet
|
}
|
||||||
|> V.toFunction
|
|> VC.sameForVersion "v1.2"
|
||||||
|
|> VC.sameForVersion "v1.3"
|
||||||
|
|> VC.sameForVersion "v1.4"
|
||||||
|
|> VC.sameForVersion "v1.5"
|
||||||
|
|> VC.mostRecentFromVersionList versions
|
||||||
|
|
||||||
|
|
||||||
type alias JoinedMembersInput =
|
type alias JoinedMembersInput =
|
||||||
|
@ -25,4 +22,4 @@ type alias JoinedMembersInput =
|
||||||
|
|
||||||
|
|
||||||
type alias JoinedMembersOutput =
|
type alias JoinedMembersOutput =
|
||||||
Task X.Error O.RoomMemberList
|
Api.JoinedMembersOutputV1
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module Internal.Api.JoinedMembers.V1_2.SpecObjects exposing
|
module Internal.Api.JoinedMembers.V1.SpecObjects exposing
|
||||||
( RoomMember
|
( RoomMember
|
||||||
, RoomMemberList
|
, RoomMemberList
|
||||||
, encodeRoomMember
|
, encodeRoomMember
|
||||||
|
@ -9,7 +9,7 @@ module Internal.Api.JoinedMembers.V1_2.SpecObjects exposing
|
||||||
|
|
||||||
{-| Automatically generated 'SpecObjects'
|
{-| Automatically generated 'SpecObjects'
|
||||||
|
|
||||||
Last generated at Unix time 1673279712
|
Last generated at Unix time 1676307378
|
||||||
|
|
||||||
-}
|
-}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
version: v1.4
|
version: v1
|
||||||
name: SpecObjects
|
name: SpecObjects
|
||||||
objects:
|
objects:
|
||||||
RoomMemberList:
|
RoomMemberList:
|
|
@ -1,17 +0,0 @@
|
||||||
module Internal.Api.JoinedMembers.V1_2.Api exposing (..)
|
|
||||||
|
|
||||||
import Internal.Api.JoinedMembers.Api as Api
|
|
||||||
import Internal.Api.JoinedMembers.V1_2.Convert as C
|
|
||||||
import Internal.Api.JoinedMembers.V1_2.Objects as O
|
|
||||||
import Internal.Api.JoinedMembers.V1_2.SpecObjects as SO
|
|
||||||
import Internal.Api.JoinedMembers.V1_2.Upcast as U
|
|
||||||
import Internal.Api.VersionControl as V
|
|
||||||
|
|
||||||
|
|
||||||
packet : V.SingleVersion () () Api.JoinedMembersInputV1 O.RoomMemberList
|
|
||||||
packet =
|
|
||||||
{ version = "v1.2"
|
|
||||||
, downcast = \_ -> ()
|
|
||||||
, current = Api.joinedMembersInputV1 SO.roomMemberListDecoder C.convert
|
|
||||||
, upcast = U.upcast
|
|
||||||
}
|
|
|
@ -1,9 +0,0 @@
|
||||||
module Internal.Api.JoinedMembers.V1_2.Convert exposing (..)
|
|
||||||
|
|
||||||
import Internal.Api.JoinedMembers.V1_2.Objects as O
|
|
||||||
import Internal.Api.JoinedMembers.V1_2.SpecObjects as SO
|
|
||||||
|
|
||||||
|
|
||||||
convert : SO.RoomMemberList -> O.RoomMemberList
|
|
||||||
convert =
|
|
||||||
identity
|
|
|
@ -1,69 +0,0 @@
|
||||||
module Internal.Api.JoinedMembers.V1_2.Objects exposing
|
|
||||||
( RoomMember
|
|
||||||
, RoomMemberList
|
|
||||||
, encodeRoomMember
|
|
||||||
, encodeRoomMemberList
|
|
||||||
, roomMemberDecoder
|
|
||||||
, roomMemberListDecoder
|
|
||||||
)
|
|
||||||
|
|
||||||
{-| Automatically generated 'Objects'
|
|
||||||
|
|
||||||
Last generated at Unix time 1673279712
|
|
||||||
|
|
||||||
-}
|
|
||||||
|
|
||||||
import Dict exposing (Dict)
|
|
||||||
import Internal.Tools.DecodeExtra exposing (opField, opFieldWithDefault)
|
|
||||||
import Internal.Tools.EncodeExtra exposing (maybeObject)
|
|
||||||
import Json.Decode as D
|
|
||||||
import Json.Encode as E
|
|
||||||
|
|
||||||
|
|
||||||
{-| User information of joined users.
|
|
||||||
-}
|
|
||||||
type alias RoomMember =
|
|
||||||
{ avatarUrl : Maybe String
|
|
||||||
, displayName : Maybe String
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
encodeRoomMember : RoomMember -> E.Value
|
|
||||||
encodeRoomMember data =
|
|
||||||
maybeObject
|
|
||||||
[ ( "avatar_url", Maybe.map E.string data.avatarUrl )
|
|
||||||
, ( "display_name", Maybe.map E.string data.displayName )
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
roomMemberDecoder : D.Decoder RoomMember
|
|
||||||
roomMemberDecoder =
|
|
||||||
D.map2
|
|
||||||
(\a b ->
|
|
||||||
{ avatarUrl = a, displayName = b }
|
|
||||||
)
|
|
||||||
(opField "avatar_url" D.string)
|
|
||||||
(opField "display_name" D.string)
|
|
||||||
|
|
||||||
|
|
||||||
{-| The dictionary containing all room member data.
|
|
||||||
-}
|
|
||||||
type alias RoomMemberList =
|
|
||||||
{ joined : Dict String RoomMember
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
encodeRoomMemberList : RoomMemberList -> E.Value
|
|
||||||
encodeRoomMemberList data =
|
|
||||||
maybeObject
|
|
||||||
[ ( "joined", Just <| E.dict identity encodeRoomMember data.joined )
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
roomMemberListDecoder : D.Decoder RoomMemberList
|
|
||||||
roomMemberListDecoder =
|
|
||||||
D.map
|
|
||||||
(\a ->
|
|
||||||
{ joined = a }
|
|
||||||
)
|
|
||||||
(opFieldWithDefault "joined" Dict.empty (D.dict roomMemberDecoder))
|
|
|
@ -1,17 +0,0 @@
|
||||||
version: v1.2
|
|
||||||
name: Objects
|
|
||||||
objects:
|
|
||||||
RoomMemberList:
|
|
||||||
description: The dictionary containing all room member data.
|
|
||||||
fields:
|
|
||||||
joined:
|
|
||||||
type: "{RoomMember}"
|
|
||||||
required: false
|
|
||||||
default: Dict.empty
|
|
||||||
RoomMember:
|
|
||||||
description: User information of joined users.
|
|
||||||
fields:
|
|
||||||
avatar_url:
|
|
||||||
type: string
|
|
||||||
display_name:
|
|
||||||
type: string
|
|
|
@ -1,17 +0,0 @@
|
||||||
version: v1.2
|
|
||||||
name: SpecObjects
|
|
||||||
objects:
|
|
||||||
RoomMemberList:
|
|
||||||
description: The dictionary containing all room member data.
|
|
||||||
fields:
|
|
||||||
joined:
|
|
||||||
type: "{RoomMember}"
|
|
||||||
required: false
|
|
||||||
default: Dict.empty
|
|
||||||
RoomMember:
|
|
||||||
description: User information of joined users.
|
|
||||||
fields:
|
|
||||||
avatar_url:
|
|
||||||
type: string
|
|
||||||
display_name:
|
|
||||||
type: string
|
|
|
@ -1,9 +0,0 @@
|
||||||
module Internal.Api.JoinedMembers.V1_2.Upcast exposing (..)
|
|
||||||
|
|
||||||
import Dict
|
|
||||||
import Internal.Api.JoinedMembers.V1_2.Objects as O
|
|
||||||
|
|
||||||
|
|
||||||
upcast : () -> O.RoomMemberList
|
|
||||||
upcast _ =
|
|
||||||
{ joined = Dict.empty }
|
|
|
@ -1,18 +0,0 @@
|
||||||
module Internal.Api.JoinedMembers.V1_3.Api exposing (..)
|
|
||||||
|
|
||||||
import Internal.Api.JoinedMembers.Api as Api
|
|
||||||
import Internal.Api.JoinedMembers.V1_2.Objects as PO
|
|
||||||
import Internal.Api.JoinedMembers.V1_3.Convert as C
|
|
||||||
import Internal.Api.JoinedMembers.V1_3.Objects as O
|
|
||||||
import Internal.Api.JoinedMembers.V1_3.SpecObjects as SO
|
|
||||||
import Internal.Api.JoinedMembers.V1_3.Upcast as U
|
|
||||||
import Internal.Api.VersionControl as V
|
|
||||||
|
|
||||||
|
|
||||||
packet : V.SingleVersion Api.JoinedMembersInputV1 PO.RoomMemberList Api.JoinedMembersInputV1 O.RoomMemberList
|
|
||||||
packet =
|
|
||||||
{ version = "v1.3"
|
|
||||||
, downcast = identity
|
|
||||||
, current = Api.joinedMembersInputV1 SO.roomMemberListDecoder C.convert
|
|
||||||
, upcast = U.upcast
|
|
||||||
}
|
|
|
@ -1,9 +0,0 @@
|
||||||
module Internal.Api.JoinedMembers.V1_3.Convert exposing (..)
|
|
||||||
|
|
||||||
import Internal.Api.JoinedMembers.V1_3.Objects as O
|
|
||||||
import Internal.Api.JoinedMembers.V1_3.SpecObjects as SO
|
|
||||||
|
|
||||||
|
|
||||||
convert : SO.RoomMemberList -> O.RoomMemberList
|
|
||||||
convert =
|
|
||||||
identity
|
|
|
@ -1,69 +0,0 @@
|
||||||
module Internal.Api.JoinedMembers.V1_3.Objects exposing
|
|
||||||
( RoomMember
|
|
||||||
, RoomMemberList
|
|
||||||
, encodeRoomMember
|
|
||||||
, encodeRoomMemberList
|
|
||||||
, roomMemberDecoder
|
|
||||||
, roomMemberListDecoder
|
|
||||||
)
|
|
||||||
|
|
||||||
{-| Automatically generated 'Objects'
|
|
||||||
|
|
||||||
Last generated at Unix time 1673279712
|
|
||||||
|
|
||||||
-}
|
|
||||||
|
|
||||||
import Dict exposing (Dict)
|
|
||||||
import Internal.Tools.DecodeExtra exposing (opField, opFieldWithDefault)
|
|
||||||
import Internal.Tools.EncodeExtra exposing (maybeObject)
|
|
||||||
import Json.Decode as D
|
|
||||||
import Json.Encode as E
|
|
||||||
|
|
||||||
|
|
||||||
{-| User information of joined users.
|
|
||||||
-}
|
|
||||||
type alias RoomMember =
|
|
||||||
{ avatarUrl : Maybe String
|
|
||||||
, displayName : Maybe String
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
encodeRoomMember : RoomMember -> E.Value
|
|
||||||
encodeRoomMember data =
|
|
||||||
maybeObject
|
|
||||||
[ ( "avatar_url", Maybe.map E.string data.avatarUrl )
|
|
||||||
, ( "display_name", Maybe.map E.string data.displayName )
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
roomMemberDecoder : D.Decoder RoomMember
|
|
||||||
roomMemberDecoder =
|
|
||||||
D.map2
|
|
||||||
(\a b ->
|
|
||||||
{ avatarUrl = a, displayName = b }
|
|
||||||
)
|
|
||||||
(opField "avatar_url" D.string)
|
|
||||||
(opField "display_name" D.string)
|
|
||||||
|
|
||||||
|
|
||||||
{-| The dictionary containing all room member data.
|
|
||||||
-}
|
|
||||||
type alias RoomMemberList =
|
|
||||||
{ joined : Dict String RoomMember
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
encodeRoomMemberList : RoomMemberList -> E.Value
|
|
||||||
encodeRoomMemberList data =
|
|
||||||
maybeObject
|
|
||||||
[ ( "joined", Just <| E.dict identity encodeRoomMember data.joined )
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
roomMemberListDecoder : D.Decoder RoomMemberList
|
|
||||||
roomMemberListDecoder =
|
|
||||||
D.map
|
|
||||||
(\a ->
|
|
||||||
{ joined = a }
|
|
||||||
)
|
|
||||||
(opFieldWithDefault "joined" Dict.empty (D.dict roomMemberDecoder))
|
|
|
@ -1,17 +0,0 @@
|
||||||
version: v1.3
|
|
||||||
name: Objects
|
|
||||||
objects:
|
|
||||||
RoomMemberList:
|
|
||||||
description: The dictionary containing all room member data.
|
|
||||||
fields:
|
|
||||||
joined:
|
|
||||||
type: "{RoomMember}"
|
|
||||||
required: false
|
|
||||||
default: Dict.empty
|
|
||||||
RoomMember:
|
|
||||||
description: User information of joined users.
|
|
||||||
fields:
|
|
||||||
avatar_url:
|
|
||||||
type: string
|
|
||||||
display_name:
|
|
||||||
type: string
|
|
|
@ -1,69 +0,0 @@
|
||||||
module Internal.Api.JoinedMembers.V1_3.SpecObjects exposing
|
|
||||||
( RoomMember
|
|
||||||
, RoomMemberList
|
|
||||||
, encodeRoomMember
|
|
||||||
, encodeRoomMemberList
|
|
||||||
, roomMemberDecoder
|
|
||||||
, roomMemberListDecoder
|
|
||||||
)
|
|
||||||
|
|
||||||
{-| Automatically generated 'SpecObjects'
|
|
||||||
|
|
||||||
Last generated at Unix time 1673279712
|
|
||||||
|
|
||||||
-}
|
|
||||||
|
|
||||||
import Dict exposing (Dict)
|
|
||||||
import Internal.Tools.DecodeExtra exposing (opField, opFieldWithDefault)
|
|
||||||
import Internal.Tools.EncodeExtra exposing (maybeObject)
|
|
||||||
import Json.Decode as D
|
|
||||||
import Json.Encode as E
|
|
||||||
|
|
||||||
|
|
||||||
{-| User information of joined users.
|
|
||||||
-}
|
|
||||||
type alias RoomMember =
|
|
||||||
{ avatarUrl : Maybe String
|
|
||||||
, displayName : Maybe String
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
encodeRoomMember : RoomMember -> E.Value
|
|
||||||
encodeRoomMember data =
|
|
||||||
maybeObject
|
|
||||||
[ ( "avatar_url", Maybe.map E.string data.avatarUrl )
|
|
||||||
, ( "display_name", Maybe.map E.string data.displayName )
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
roomMemberDecoder : D.Decoder RoomMember
|
|
||||||
roomMemberDecoder =
|
|
||||||
D.map2
|
|
||||||
(\a b ->
|
|
||||||
{ avatarUrl = a, displayName = b }
|
|
||||||
)
|
|
||||||
(opField "avatar_url" D.string)
|
|
||||||
(opField "display_name" D.string)
|
|
||||||
|
|
||||||
|
|
||||||
{-| The dictionary containing all room member data.
|
|
||||||
-}
|
|
||||||
type alias RoomMemberList =
|
|
||||||
{ joined : Dict String RoomMember
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
encodeRoomMemberList : RoomMemberList -> E.Value
|
|
||||||
encodeRoomMemberList data =
|
|
||||||
maybeObject
|
|
||||||
[ ( "joined", Just <| E.dict identity encodeRoomMember data.joined )
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
roomMemberListDecoder : D.Decoder RoomMemberList
|
|
||||||
roomMemberListDecoder =
|
|
||||||
D.map
|
|
||||||
(\a ->
|
|
||||||
{ joined = a }
|
|
||||||
)
|
|
||||||
(opFieldWithDefault "joined" Dict.empty (D.dict roomMemberDecoder))
|
|
|
@ -1,17 +0,0 @@
|
||||||
version: v1.3
|
|
||||||
name: SpecObjects
|
|
||||||
objects:
|
|
||||||
RoomMemberList:
|
|
||||||
description: The dictionary containing all room member data.
|
|
||||||
fields:
|
|
||||||
joined:
|
|
||||||
type: "{RoomMember}"
|
|
||||||
required: false
|
|
||||||
default: Dict.empty
|
|
||||||
RoomMember:
|
|
||||||
description: User information of joined users.
|
|
||||||
fields:
|
|
||||||
avatar_url:
|
|
||||||
type: string
|
|
||||||
display_name:
|
|
||||||
type: string
|
|
|
@ -1,9 +0,0 @@
|
||||||
module Internal.Api.JoinedMembers.V1_3.Upcast exposing (..)
|
|
||||||
|
|
||||||
import Internal.Api.JoinedMembers.V1_2.Objects as PO
|
|
||||||
import Internal.Api.JoinedMembers.V1_3.Objects as O
|
|
||||||
|
|
||||||
|
|
||||||
upcast : PO.RoomMemberList -> O.RoomMemberList
|
|
||||||
upcast =
|
|
||||||
identity
|
|
|
@ -1,18 +0,0 @@
|
||||||
module Internal.Api.JoinedMembers.V1_4.Api exposing (..)
|
|
||||||
|
|
||||||
import Internal.Api.JoinedMembers.Api as Api
|
|
||||||
import Internal.Api.JoinedMembers.V1_3.Objects as PO
|
|
||||||
import Internal.Api.JoinedMembers.V1_4.Convert as C
|
|
||||||
import Internal.Api.JoinedMembers.V1_4.Objects as O
|
|
||||||
import Internal.Api.JoinedMembers.V1_4.SpecObjects as SO
|
|
||||||
import Internal.Api.JoinedMembers.V1_4.Upcast as U
|
|
||||||
import Internal.Api.VersionControl as V
|
|
||||||
|
|
||||||
|
|
||||||
packet : V.SingleVersion Api.JoinedMembersInputV1 PO.RoomMemberList Api.JoinedMembersInputV1 O.RoomMemberList
|
|
||||||
packet =
|
|
||||||
{ version = "v1.4"
|
|
||||||
, downcast = identity
|
|
||||||
, current = Api.joinedMembersInputV1 SO.roomMemberListDecoder C.convert
|
|
||||||
, upcast = U.upcast
|
|
||||||
}
|
|
|
@ -1,9 +0,0 @@
|
||||||
module Internal.Api.JoinedMembers.V1_4.Convert exposing (..)
|
|
||||||
|
|
||||||
import Internal.Api.JoinedMembers.V1_4.Objects as O
|
|
||||||
import Internal.Api.JoinedMembers.V1_4.SpecObjects as SO
|
|
||||||
|
|
||||||
|
|
||||||
convert : SO.RoomMemberList -> O.RoomMemberList
|
|
||||||
convert =
|
|
||||||
identity
|
|
|
@ -1,69 +0,0 @@
|
||||||
module Internal.Api.JoinedMembers.V1_4.Objects exposing
|
|
||||||
( RoomMember
|
|
||||||
, RoomMemberList
|
|
||||||
, encodeRoomMember
|
|
||||||
, encodeRoomMemberList
|
|
||||||
, roomMemberDecoder
|
|
||||||
, roomMemberListDecoder
|
|
||||||
)
|
|
||||||
|
|
||||||
{-| Automatically generated 'Objects'
|
|
||||||
|
|
||||||
Last generated at Unix time 1673279712
|
|
||||||
|
|
||||||
-}
|
|
||||||
|
|
||||||
import Dict exposing (Dict)
|
|
||||||
import Internal.Tools.DecodeExtra exposing (opField, opFieldWithDefault)
|
|
||||||
import Internal.Tools.EncodeExtra exposing (maybeObject)
|
|
||||||
import Json.Decode as D
|
|
||||||
import Json.Encode as E
|
|
||||||
|
|
||||||
|
|
||||||
{-| User information of joined users.
|
|
||||||
-}
|
|
||||||
type alias RoomMember =
|
|
||||||
{ avatarUrl : Maybe String
|
|
||||||
, displayName : Maybe String
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
encodeRoomMember : RoomMember -> E.Value
|
|
||||||
encodeRoomMember data =
|
|
||||||
maybeObject
|
|
||||||
[ ( "avatar_url", Maybe.map E.string data.avatarUrl )
|
|
||||||
, ( "display_name", Maybe.map E.string data.displayName )
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
roomMemberDecoder : D.Decoder RoomMember
|
|
||||||
roomMemberDecoder =
|
|
||||||
D.map2
|
|
||||||
(\a b ->
|
|
||||||
{ avatarUrl = a, displayName = b }
|
|
||||||
)
|
|
||||||
(opField "avatar_url" D.string)
|
|
||||||
(opField "display_name" D.string)
|
|
||||||
|
|
||||||
|
|
||||||
{-| The dictionary containing all room member data.
|
|
||||||
-}
|
|
||||||
type alias RoomMemberList =
|
|
||||||
{ joined : Dict String RoomMember
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
encodeRoomMemberList : RoomMemberList -> E.Value
|
|
||||||
encodeRoomMemberList data =
|
|
||||||
maybeObject
|
|
||||||
[ ( "joined", Just <| E.dict identity encodeRoomMember data.joined )
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
roomMemberListDecoder : D.Decoder RoomMemberList
|
|
||||||
roomMemberListDecoder =
|
|
||||||
D.map
|
|
||||||
(\a ->
|
|
||||||
{ joined = a }
|
|
||||||
)
|
|
||||||
(opFieldWithDefault "joined" Dict.empty (D.dict roomMemberDecoder))
|
|
|
@ -1,17 +0,0 @@
|
||||||
version: v1.4
|
|
||||||
name: Objects
|
|
||||||
objects:
|
|
||||||
RoomMemberList:
|
|
||||||
description: The dictionary containing all room member data.
|
|
||||||
fields:
|
|
||||||
joined:
|
|
||||||
type: "{RoomMember}"
|
|
||||||
required: false
|
|
||||||
default: Dict.empty
|
|
||||||
RoomMember:
|
|
||||||
description: User information of joined users.
|
|
||||||
fields:
|
|
||||||
avatar_url:
|
|
||||||
type: string
|
|
||||||
display_name:
|
|
||||||
type: string
|
|
|
@ -1,69 +0,0 @@
|
||||||
module Internal.Api.JoinedMembers.V1_4.SpecObjects exposing
|
|
||||||
( RoomMember
|
|
||||||
, RoomMemberList
|
|
||||||
, encodeRoomMember
|
|
||||||
, encodeRoomMemberList
|
|
||||||
, roomMemberDecoder
|
|
||||||
, roomMemberListDecoder
|
|
||||||
)
|
|
||||||
|
|
||||||
{-| Automatically generated 'SpecObjects'
|
|
||||||
|
|
||||||
Last generated at Unix time 1673279712
|
|
||||||
|
|
||||||
-}
|
|
||||||
|
|
||||||
import Dict exposing (Dict)
|
|
||||||
import Internal.Tools.DecodeExtra exposing (opField, opFieldWithDefault)
|
|
||||||
import Internal.Tools.EncodeExtra exposing (maybeObject)
|
|
||||||
import Json.Decode as D
|
|
||||||
import Json.Encode as E
|
|
||||||
|
|
||||||
|
|
||||||
{-| User information of joined users.
|
|
||||||
-}
|
|
||||||
type alias RoomMember =
|
|
||||||
{ avatarUrl : Maybe String
|
|
||||||
, displayName : Maybe String
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
encodeRoomMember : RoomMember -> E.Value
|
|
||||||
encodeRoomMember data =
|
|
||||||
maybeObject
|
|
||||||
[ ( "avatar_url", Maybe.map E.string data.avatarUrl )
|
|
||||||
, ( "display_name", Maybe.map E.string data.displayName )
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
roomMemberDecoder : D.Decoder RoomMember
|
|
||||||
roomMemberDecoder =
|
|
||||||
D.map2
|
|
||||||
(\a b ->
|
|
||||||
{ avatarUrl = a, displayName = b }
|
|
||||||
)
|
|
||||||
(opField "avatar_url" D.string)
|
|
||||||
(opField "display_name" D.string)
|
|
||||||
|
|
||||||
|
|
||||||
{-| The dictionary containing all room member data.
|
|
||||||
-}
|
|
||||||
type alias RoomMemberList =
|
|
||||||
{ joined : Dict String RoomMember
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
encodeRoomMemberList : RoomMemberList -> E.Value
|
|
||||||
encodeRoomMemberList data =
|
|
||||||
maybeObject
|
|
||||||
[ ( "joined", Just <| E.dict identity encodeRoomMember data.joined )
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
roomMemberListDecoder : D.Decoder RoomMemberList
|
|
||||||
roomMemberListDecoder =
|
|
||||||
D.map
|
|
||||||
(\a ->
|
|
||||||
{ joined = a }
|
|
||||||
)
|
|
||||||
(opFieldWithDefault "joined" Dict.empty (D.dict roomMemberDecoder))
|
|
|
@ -1,9 +0,0 @@
|
||||||
module Internal.Api.JoinedMembers.V1_4.Upcast exposing (..)
|
|
||||||
|
|
||||||
import Internal.Api.JoinedMembers.V1_3.Objects as PO
|
|
||||||
import Internal.Api.JoinedMembers.V1_4.Objects as O
|
|
||||||
|
|
||||||
|
|
||||||
upcast : PO.RoomMemberList -> O.RoomMemberList
|
|
||||||
upcast =
|
|
||||||
identity
|
|
|
@ -1,18 +0,0 @@
|
||||||
module Internal.Api.JoinedMembers.V1_5.Api exposing (..)
|
|
||||||
|
|
||||||
import Internal.Api.JoinedMembers.Api as Api
|
|
||||||
import Internal.Api.JoinedMembers.V1_4.Objects as PO
|
|
||||||
import Internal.Api.JoinedMembers.V1_5.Convert as C
|
|
||||||
import Internal.Api.JoinedMembers.V1_5.Objects as O
|
|
||||||
import Internal.Api.JoinedMembers.V1_5.SpecObjects as SO
|
|
||||||
import Internal.Api.JoinedMembers.V1_5.Upcast as U
|
|
||||||
import Internal.Api.VersionControl as V
|
|
||||||
|
|
||||||
|
|
||||||
packet : V.SingleVersion Api.JoinedMembersInputV1 PO.RoomMemberList Api.JoinedMembersInputV1 O.RoomMemberList
|
|
||||||
packet =
|
|
||||||
{ version = "v1.5"
|
|
||||||
, downcast = identity
|
|
||||||
, current = Api.joinedMembersInputV1 SO.roomMemberListDecoder C.convert
|
|
||||||
, upcast = U.upcast
|
|
||||||
}
|
|
|
@ -1,9 +0,0 @@
|
||||||
module Internal.Api.JoinedMembers.V1_5.Convert exposing (..)
|
|
||||||
|
|
||||||
import Internal.Api.JoinedMembers.V1_5.Objects as O
|
|
||||||
import Internal.Api.JoinedMembers.V1_5.SpecObjects as SO
|
|
||||||
|
|
||||||
|
|
||||||
convert : SO.RoomMemberList -> O.RoomMemberList
|
|
||||||
convert =
|
|
||||||
identity
|
|
|
@ -1,69 +0,0 @@
|
||||||
module Internal.Api.JoinedMembers.V1_5.Objects exposing
|
|
||||||
( RoomMember
|
|
||||||
, RoomMemberList
|
|
||||||
, encodeRoomMember
|
|
||||||
, encodeRoomMemberList
|
|
||||||
, roomMemberDecoder
|
|
||||||
, roomMemberListDecoder
|
|
||||||
)
|
|
||||||
|
|
||||||
{-| Automatically generated 'Objects'
|
|
||||||
|
|
||||||
Last generated at Unix time 1673279712
|
|
||||||
|
|
||||||
-}
|
|
||||||
|
|
||||||
import Dict exposing (Dict)
|
|
||||||
import Internal.Tools.DecodeExtra exposing (opField, opFieldWithDefault)
|
|
||||||
import Internal.Tools.EncodeExtra exposing (maybeObject)
|
|
||||||
import Json.Decode as D
|
|
||||||
import Json.Encode as E
|
|
||||||
|
|
||||||
|
|
||||||
{-| User information of joined users.
|
|
||||||
-}
|
|
||||||
type alias RoomMember =
|
|
||||||
{ avatarUrl : Maybe String
|
|
||||||
, displayName : Maybe String
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
encodeRoomMember : RoomMember -> E.Value
|
|
||||||
encodeRoomMember data =
|
|
||||||
maybeObject
|
|
||||||
[ ( "avatar_url", Maybe.map E.string data.avatarUrl )
|
|
||||||
, ( "display_name", Maybe.map E.string data.displayName )
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
roomMemberDecoder : D.Decoder RoomMember
|
|
||||||
roomMemberDecoder =
|
|
||||||
D.map2
|
|
||||||
(\a b ->
|
|
||||||
{ avatarUrl = a, displayName = b }
|
|
||||||
)
|
|
||||||
(opField "avatar_url" D.string)
|
|
||||||
(opField "display_name" D.string)
|
|
||||||
|
|
||||||
|
|
||||||
{-| The dictionary containing all room member data.
|
|
||||||
-}
|
|
||||||
type alias RoomMemberList =
|
|
||||||
{ joined : Dict String RoomMember
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
encodeRoomMemberList : RoomMemberList -> E.Value
|
|
||||||
encodeRoomMemberList data =
|
|
||||||
maybeObject
|
|
||||||
[ ( "joined", Just <| E.dict identity encodeRoomMember data.joined )
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
roomMemberListDecoder : D.Decoder RoomMemberList
|
|
||||||
roomMemberListDecoder =
|
|
||||||
D.map
|
|
||||||
(\a ->
|
|
||||||
{ joined = a }
|
|
||||||
)
|
|
||||||
(opFieldWithDefault "joined" Dict.empty (D.dict roomMemberDecoder))
|
|
|
@ -1,17 +0,0 @@
|
||||||
version: v1.5
|
|
||||||
name: Objects
|
|
||||||
objects:
|
|
||||||
RoomMemberList:
|
|
||||||
description: The dictionary containing all room member data.
|
|
||||||
fields:
|
|
||||||
joined:
|
|
||||||
type: "{RoomMember}"
|
|
||||||
required: false
|
|
||||||
default: Dict.empty
|
|
||||||
RoomMember:
|
|
||||||
description: User information of joined users.
|
|
||||||
fields:
|
|
||||||
avatar_url:
|
|
||||||
type: string
|
|
||||||
display_name:
|
|
||||||
type: string
|
|
|
@ -1,69 +0,0 @@
|
||||||
module Internal.Api.JoinedMembers.V1_5.SpecObjects exposing
|
|
||||||
( RoomMember
|
|
||||||
, RoomMemberList
|
|
||||||
, encodeRoomMember
|
|
||||||
, encodeRoomMemberList
|
|
||||||
, roomMemberDecoder
|
|
||||||
, roomMemberListDecoder
|
|
||||||
)
|
|
||||||
|
|
||||||
{-| Automatically generated 'SpecObjects'
|
|
||||||
|
|
||||||
Last generated at Unix time 1673279712
|
|
||||||
|
|
||||||
-}
|
|
||||||
|
|
||||||
import Dict exposing (Dict)
|
|
||||||
import Internal.Tools.DecodeExtra exposing (opField, opFieldWithDefault)
|
|
||||||
import Internal.Tools.EncodeExtra exposing (maybeObject)
|
|
||||||
import Json.Decode as D
|
|
||||||
import Json.Encode as E
|
|
||||||
|
|
||||||
|
|
||||||
{-| User information of joined users.
|
|
||||||
-}
|
|
||||||
type alias RoomMember =
|
|
||||||
{ avatarUrl : Maybe String
|
|
||||||
, displayName : Maybe String
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
encodeRoomMember : RoomMember -> E.Value
|
|
||||||
encodeRoomMember data =
|
|
||||||
maybeObject
|
|
||||||
[ ( "avatar_url", Maybe.map E.string data.avatarUrl )
|
|
||||||
, ( "display_name", Maybe.map E.string data.displayName )
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
roomMemberDecoder : D.Decoder RoomMember
|
|
||||||
roomMemberDecoder =
|
|
||||||
D.map2
|
|
||||||
(\a b ->
|
|
||||||
{ avatarUrl = a, displayName = b }
|
|
||||||
)
|
|
||||||
(opField "avatar_url" D.string)
|
|
||||||
(opField "display_name" D.string)
|
|
||||||
|
|
||||||
|
|
||||||
{-| The dictionary containing all room member data.
|
|
||||||
-}
|
|
||||||
type alias RoomMemberList =
|
|
||||||
{ joined : Dict String RoomMember
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
encodeRoomMemberList : RoomMemberList -> E.Value
|
|
||||||
encodeRoomMemberList data =
|
|
||||||
maybeObject
|
|
||||||
[ ( "joined", Just <| E.dict identity encodeRoomMember data.joined )
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
roomMemberListDecoder : D.Decoder RoomMemberList
|
|
||||||
roomMemberListDecoder =
|
|
||||||
D.map
|
|
||||||
(\a ->
|
|
||||||
{ joined = a }
|
|
||||||
)
|
|
||||||
(opFieldWithDefault "joined" Dict.empty (D.dict roomMemberDecoder))
|
|
|
@ -1,17 +0,0 @@
|
||||||
version: v1.5
|
|
||||||
name: SpecObjects
|
|
||||||
objects:
|
|
||||||
RoomMemberList:
|
|
||||||
description: The dictionary containing all room member data.
|
|
||||||
fields:
|
|
||||||
joined:
|
|
||||||
type: "{RoomMember}"
|
|
||||||
required: false
|
|
||||||
default: Dict.empty
|
|
||||||
RoomMember:
|
|
||||||
description: User information of joined users.
|
|
||||||
fields:
|
|
||||||
avatar_url:
|
|
||||||
type: string
|
|
||||||
display_name:
|
|
||||||
type: string
|
|
|
@ -1,9 +0,0 @@
|
||||||
module Internal.Api.JoinedMembers.V1_5.Upcast exposing (..)
|
|
||||||
|
|
||||||
import Internal.Api.JoinedMembers.V1_4.Objects as PO
|
|
||||||
import Internal.Api.JoinedMembers.V1_5.Objects as O
|
|
||||||
|
|
||||||
|
|
||||||
upcast : PO.RoomMemberList -> O.RoomMemberList
|
|
||||||
upcast =
|
|
||||||
identity
|
|
Loading…
Reference in New Issue