From 293a37c8cd392324855f72d55fb85591f5d65a02 Mon Sep 17 00:00:00 2001 From: Bram van den Heuvel Date: Mon, 13 Feb 2023 18:05:05 +0100 Subject: [PATCH] Refactor JoinedMembers API endpoint --- src/Internal/Api/All.elm | 2 +- src/Internal/Api/JoinedMembers/Api.elm | 12 ++-- src/Internal/Api/JoinedMembers/Main.elm | 29 ++++---- .../{V1_2 => V1}/SpecObjects.elm | 4 +- .../{V1_4 => V1}/SpecObjects.yaml | 2 +- src/Internal/Api/JoinedMembers/V1_2/Api.elm | 17 ----- .../Api/JoinedMembers/V1_2/Convert.elm | 9 --- .../Api/JoinedMembers/V1_2/Objects.elm | 69 ------------------- .../Api/JoinedMembers/V1_2/Objects.yaml | 17 ----- .../Api/JoinedMembers/V1_2/SpecObjects.yaml | 17 ----- .../Api/JoinedMembers/V1_2/Upcast.elm | 9 --- src/Internal/Api/JoinedMembers/V1_3/Api.elm | 18 ----- .../Api/JoinedMembers/V1_3/Convert.elm | 9 --- .../Api/JoinedMembers/V1_3/Objects.elm | 69 ------------------- .../Api/JoinedMembers/V1_3/Objects.yaml | 17 ----- .../Api/JoinedMembers/V1_3/SpecObjects.elm | 69 ------------------- .../Api/JoinedMembers/V1_3/SpecObjects.yaml | 17 ----- .../Api/JoinedMembers/V1_3/Upcast.elm | 9 --- src/Internal/Api/JoinedMembers/V1_4/Api.elm | 18 ----- .../Api/JoinedMembers/V1_4/Convert.elm | 9 --- .../Api/JoinedMembers/V1_4/Objects.elm | 69 ------------------- .../Api/JoinedMembers/V1_4/Objects.yaml | 17 ----- .../Api/JoinedMembers/V1_4/SpecObjects.elm | 69 ------------------- .../Api/JoinedMembers/V1_4/Upcast.elm | 9 --- src/Internal/Api/JoinedMembers/V1_5/Api.elm | 18 ----- .../Api/JoinedMembers/V1_5/Convert.elm | 9 --- .../Api/JoinedMembers/V1_5/Objects.elm | 69 ------------------- .../Api/JoinedMembers/V1_5/Objects.yaml | 17 ----- .../Api/JoinedMembers/V1_5/SpecObjects.elm | 69 ------------------- .../Api/JoinedMembers/V1_5/SpecObjects.yaml | 17 ----- .../Api/JoinedMembers/V1_5/Upcast.elm | 9 --- 31 files changed, 25 insertions(+), 769 deletions(-) rename src/Internal/Api/JoinedMembers/{V1_2 => V1}/SpecObjects.elm (93%) rename src/Internal/Api/JoinedMembers/{V1_4 => V1}/SpecObjects.yaml (96%) delete mode 100644 src/Internal/Api/JoinedMembers/V1_2/Api.elm delete mode 100644 src/Internal/Api/JoinedMembers/V1_2/Convert.elm delete mode 100644 src/Internal/Api/JoinedMembers/V1_2/Objects.elm delete mode 100644 src/Internal/Api/JoinedMembers/V1_2/Objects.yaml delete mode 100644 src/Internal/Api/JoinedMembers/V1_2/SpecObjects.yaml delete mode 100644 src/Internal/Api/JoinedMembers/V1_2/Upcast.elm delete mode 100644 src/Internal/Api/JoinedMembers/V1_3/Api.elm delete mode 100644 src/Internal/Api/JoinedMembers/V1_3/Convert.elm delete mode 100644 src/Internal/Api/JoinedMembers/V1_3/Objects.elm delete mode 100644 src/Internal/Api/JoinedMembers/V1_3/Objects.yaml delete mode 100644 src/Internal/Api/JoinedMembers/V1_3/SpecObjects.elm delete mode 100644 src/Internal/Api/JoinedMembers/V1_3/SpecObjects.yaml delete mode 100644 src/Internal/Api/JoinedMembers/V1_3/Upcast.elm delete mode 100644 src/Internal/Api/JoinedMembers/V1_4/Api.elm delete mode 100644 src/Internal/Api/JoinedMembers/V1_4/Convert.elm delete mode 100644 src/Internal/Api/JoinedMembers/V1_4/Objects.elm delete mode 100644 src/Internal/Api/JoinedMembers/V1_4/Objects.yaml delete mode 100644 src/Internal/Api/JoinedMembers/V1_4/SpecObjects.elm delete mode 100644 src/Internal/Api/JoinedMembers/V1_4/Upcast.elm delete mode 100644 src/Internal/Api/JoinedMembers/V1_5/Api.elm delete mode 100644 src/Internal/Api/JoinedMembers/V1_5/Convert.elm delete mode 100644 src/Internal/Api/JoinedMembers/V1_5/Objects.elm delete mode 100644 src/Internal/Api/JoinedMembers/V1_5/Objects.yaml delete mode 100644 src/Internal/Api/JoinedMembers/V1_5/SpecObjects.elm delete mode 100644 src/Internal/Api/JoinedMembers/V1_5/SpecObjects.yaml delete mode 100644 src/Internal/Api/JoinedMembers/V1_5/Upcast.elm diff --git a/src/Internal/Api/All.elm b/src/Internal/Api/All.elm index 0c97add..bc2f369 100644 --- a/src/Internal/Api/All.elm +++ b/src/Internal/Api/All.elm @@ -17,7 +17,7 @@ getEvent = {-| 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 diff --git a/src/Internal/Api/JoinedMembers/Api.elm b/src/Internal/Api/JoinedMembers/Api.elm index cf961aa..ef22cd6 100644 --- a/src/Internal/Api/JoinedMembers/Api.elm +++ b/src/Internal/Api/JoinedMembers/Api.elm @@ -1,8 +1,8 @@ module Internal.Api.JoinedMembers.Api exposing (..) +import Internal.Api.JoinedMembers.V1.SpecObjects as SO1 import Internal.Api.Request as R import Internal.Tools.Exceptions as X -import Json.Decode as D import Task exposing (Task) @@ -13,8 +13,12 @@ type alias JoinedMembersInputV1 = } -joinedMembersInputV1 : D.Decoder a -> (a -> b) -> JoinedMembersInputV1 -> Task X.Error b -joinedMembersInputV1 decoder mapping data = +type alias JoinedMembersOutputV1 = + Task X.Error SO1.RoomMemberList + + +joinedMembersInputV1 : JoinedMembersInputV1 -> JoinedMembersOutputV1 +joinedMembersInputV1 data = R.rawApiCall { headers = R.WithAccessToken data.accessToken , method = "GET" @@ -26,5 +30,5 @@ joinedMembersInputV1 decoder mapping data = , queryParams = [] , bodyParams = [] , timeout = Nothing - , decoder = \_ -> D.map mapping decoder + , decoder = \_ -> SO1.roomMemberListDecoder } diff --git a/src/Internal/Api/JoinedMembers/Main.elm b/src/Internal/Api/JoinedMembers/Main.elm index df68bea..e341c2a 100644 --- a/src/Internal/Api/JoinedMembers/Main.elm +++ b/src/Internal/Api/JoinedMembers/Main.elm @@ -1,23 +1,20 @@ module Internal.Api.JoinedMembers.Main exposing (..) import Internal.Api.JoinedMembers.Api as Api -import Internal.Api.JoinedMembers.V1_2.Api as V1_2 -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) +import Internal.Tools.VersionControl as VC -joinedMembers : List String -> JoinedMembersInput -> JoinedMembersOutput -joinedMembers = - V.firstVersion V1_2.packet - |> V.updateWith V1_3.packet - |> V.updateWith V1_4.packet - |> V.updateWith V1_5.packet - |> V.toFunction +joinedMembers : List String -> Maybe (JoinedMembersInput -> JoinedMembersOutput) +joinedMembers versions = + VC.withBottomLayer + { current = Api.joinedMembersInputV1 + , version = "v1.1" + } + |> VC.sameForVersion "v1.2" + |> VC.sameForVersion "v1.3" + |> VC.sameForVersion "v1.4" + |> VC.sameForVersion "v1.5" + |> VC.mostRecentFromVersionList versions type alias JoinedMembersInput = @@ -25,4 +22,4 @@ type alias JoinedMembersInput = type alias JoinedMembersOutput = - Task X.Error O.RoomMemberList + Api.JoinedMembersOutputV1 diff --git a/src/Internal/Api/JoinedMembers/V1_2/SpecObjects.elm b/src/Internal/Api/JoinedMembers/V1/SpecObjects.elm similarity index 93% rename from src/Internal/Api/JoinedMembers/V1_2/SpecObjects.elm rename to src/Internal/Api/JoinedMembers/V1/SpecObjects.elm index 5e339b5..fe093f1 100644 --- a/src/Internal/Api/JoinedMembers/V1_2/SpecObjects.elm +++ b/src/Internal/Api/JoinedMembers/V1/SpecObjects.elm @@ -1,4 +1,4 @@ -module Internal.Api.JoinedMembers.V1_2.SpecObjects exposing +module Internal.Api.JoinedMembers.V1.SpecObjects exposing ( RoomMember , RoomMemberList , encodeRoomMember @@ -9,7 +9,7 @@ module Internal.Api.JoinedMembers.V1_2.SpecObjects exposing {-| Automatically generated 'SpecObjects' -Last generated at Unix time 1673279712 +Last generated at Unix time 1676307378 -} diff --git a/src/Internal/Api/JoinedMembers/V1_4/SpecObjects.yaml b/src/Internal/Api/JoinedMembers/V1/SpecObjects.yaml similarity index 96% rename from src/Internal/Api/JoinedMembers/V1_4/SpecObjects.yaml rename to src/Internal/Api/JoinedMembers/V1/SpecObjects.yaml index 0f3c6a1..c562a6c 100644 --- a/src/Internal/Api/JoinedMembers/V1_4/SpecObjects.yaml +++ b/src/Internal/Api/JoinedMembers/V1/SpecObjects.yaml @@ -1,4 +1,4 @@ -version: v1.4 +version: v1 name: SpecObjects objects: RoomMemberList: diff --git a/src/Internal/Api/JoinedMembers/V1_2/Api.elm b/src/Internal/Api/JoinedMembers/V1_2/Api.elm deleted file mode 100644 index e6477d9..0000000 --- a/src/Internal/Api/JoinedMembers/V1_2/Api.elm +++ /dev/null @@ -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 - } diff --git a/src/Internal/Api/JoinedMembers/V1_2/Convert.elm b/src/Internal/Api/JoinedMembers/V1_2/Convert.elm deleted file mode 100644 index 248216e..0000000 --- a/src/Internal/Api/JoinedMembers/V1_2/Convert.elm +++ /dev/null @@ -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 diff --git a/src/Internal/Api/JoinedMembers/V1_2/Objects.elm b/src/Internal/Api/JoinedMembers/V1_2/Objects.elm deleted file mode 100644 index 55d0b4c..0000000 --- a/src/Internal/Api/JoinedMembers/V1_2/Objects.elm +++ /dev/null @@ -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)) diff --git a/src/Internal/Api/JoinedMembers/V1_2/Objects.yaml b/src/Internal/Api/JoinedMembers/V1_2/Objects.yaml deleted file mode 100644 index 61d6109..0000000 --- a/src/Internal/Api/JoinedMembers/V1_2/Objects.yaml +++ /dev/null @@ -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 diff --git a/src/Internal/Api/JoinedMembers/V1_2/SpecObjects.yaml b/src/Internal/Api/JoinedMembers/V1_2/SpecObjects.yaml deleted file mode 100644 index cd9b3a4..0000000 --- a/src/Internal/Api/JoinedMembers/V1_2/SpecObjects.yaml +++ /dev/null @@ -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 diff --git a/src/Internal/Api/JoinedMembers/V1_2/Upcast.elm b/src/Internal/Api/JoinedMembers/V1_2/Upcast.elm deleted file mode 100644 index 70d4eee..0000000 --- a/src/Internal/Api/JoinedMembers/V1_2/Upcast.elm +++ /dev/null @@ -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 } diff --git a/src/Internal/Api/JoinedMembers/V1_3/Api.elm b/src/Internal/Api/JoinedMembers/V1_3/Api.elm deleted file mode 100644 index bfe1ccb..0000000 --- a/src/Internal/Api/JoinedMembers/V1_3/Api.elm +++ /dev/null @@ -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 - } diff --git a/src/Internal/Api/JoinedMembers/V1_3/Convert.elm b/src/Internal/Api/JoinedMembers/V1_3/Convert.elm deleted file mode 100644 index 7c86004..0000000 --- a/src/Internal/Api/JoinedMembers/V1_3/Convert.elm +++ /dev/null @@ -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 diff --git a/src/Internal/Api/JoinedMembers/V1_3/Objects.elm b/src/Internal/Api/JoinedMembers/V1_3/Objects.elm deleted file mode 100644 index cac7445..0000000 --- a/src/Internal/Api/JoinedMembers/V1_3/Objects.elm +++ /dev/null @@ -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)) diff --git a/src/Internal/Api/JoinedMembers/V1_3/Objects.yaml b/src/Internal/Api/JoinedMembers/V1_3/Objects.yaml deleted file mode 100644 index b6f839c..0000000 --- a/src/Internal/Api/JoinedMembers/V1_3/Objects.yaml +++ /dev/null @@ -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 diff --git a/src/Internal/Api/JoinedMembers/V1_3/SpecObjects.elm b/src/Internal/Api/JoinedMembers/V1_3/SpecObjects.elm deleted file mode 100644 index 3d2d5e9..0000000 --- a/src/Internal/Api/JoinedMembers/V1_3/SpecObjects.elm +++ /dev/null @@ -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)) diff --git a/src/Internal/Api/JoinedMembers/V1_3/SpecObjects.yaml b/src/Internal/Api/JoinedMembers/V1_3/SpecObjects.yaml deleted file mode 100644 index 01800ab..0000000 --- a/src/Internal/Api/JoinedMembers/V1_3/SpecObjects.yaml +++ /dev/null @@ -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 diff --git a/src/Internal/Api/JoinedMembers/V1_3/Upcast.elm b/src/Internal/Api/JoinedMembers/V1_3/Upcast.elm deleted file mode 100644 index 153a236..0000000 --- a/src/Internal/Api/JoinedMembers/V1_3/Upcast.elm +++ /dev/null @@ -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 diff --git a/src/Internal/Api/JoinedMembers/V1_4/Api.elm b/src/Internal/Api/JoinedMembers/V1_4/Api.elm deleted file mode 100644 index f999577..0000000 --- a/src/Internal/Api/JoinedMembers/V1_4/Api.elm +++ /dev/null @@ -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 - } diff --git a/src/Internal/Api/JoinedMembers/V1_4/Convert.elm b/src/Internal/Api/JoinedMembers/V1_4/Convert.elm deleted file mode 100644 index eb133ef..0000000 --- a/src/Internal/Api/JoinedMembers/V1_4/Convert.elm +++ /dev/null @@ -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 diff --git a/src/Internal/Api/JoinedMembers/V1_4/Objects.elm b/src/Internal/Api/JoinedMembers/V1_4/Objects.elm deleted file mode 100644 index 8fd5b3d..0000000 --- a/src/Internal/Api/JoinedMembers/V1_4/Objects.elm +++ /dev/null @@ -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)) diff --git a/src/Internal/Api/JoinedMembers/V1_4/Objects.yaml b/src/Internal/Api/JoinedMembers/V1_4/Objects.yaml deleted file mode 100644 index cb0d543..0000000 --- a/src/Internal/Api/JoinedMembers/V1_4/Objects.yaml +++ /dev/null @@ -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 diff --git a/src/Internal/Api/JoinedMembers/V1_4/SpecObjects.elm b/src/Internal/Api/JoinedMembers/V1_4/SpecObjects.elm deleted file mode 100644 index 5a580c7..0000000 --- a/src/Internal/Api/JoinedMembers/V1_4/SpecObjects.elm +++ /dev/null @@ -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)) diff --git a/src/Internal/Api/JoinedMembers/V1_4/Upcast.elm b/src/Internal/Api/JoinedMembers/V1_4/Upcast.elm deleted file mode 100644 index f8690fe..0000000 --- a/src/Internal/Api/JoinedMembers/V1_4/Upcast.elm +++ /dev/null @@ -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 diff --git a/src/Internal/Api/JoinedMembers/V1_5/Api.elm b/src/Internal/Api/JoinedMembers/V1_5/Api.elm deleted file mode 100644 index 9a2237e..0000000 --- a/src/Internal/Api/JoinedMembers/V1_5/Api.elm +++ /dev/null @@ -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 - } diff --git a/src/Internal/Api/JoinedMembers/V1_5/Convert.elm b/src/Internal/Api/JoinedMembers/V1_5/Convert.elm deleted file mode 100644 index 47792f9..0000000 --- a/src/Internal/Api/JoinedMembers/V1_5/Convert.elm +++ /dev/null @@ -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 diff --git a/src/Internal/Api/JoinedMembers/V1_5/Objects.elm b/src/Internal/Api/JoinedMembers/V1_5/Objects.elm deleted file mode 100644 index 4dbae53..0000000 --- a/src/Internal/Api/JoinedMembers/V1_5/Objects.elm +++ /dev/null @@ -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)) diff --git a/src/Internal/Api/JoinedMembers/V1_5/Objects.yaml b/src/Internal/Api/JoinedMembers/V1_5/Objects.yaml deleted file mode 100644 index bfac3f6..0000000 --- a/src/Internal/Api/JoinedMembers/V1_5/Objects.yaml +++ /dev/null @@ -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 diff --git a/src/Internal/Api/JoinedMembers/V1_5/SpecObjects.elm b/src/Internal/Api/JoinedMembers/V1_5/SpecObjects.elm deleted file mode 100644 index a9b5697..0000000 --- a/src/Internal/Api/JoinedMembers/V1_5/SpecObjects.elm +++ /dev/null @@ -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)) diff --git a/src/Internal/Api/JoinedMembers/V1_5/SpecObjects.yaml b/src/Internal/Api/JoinedMembers/V1_5/SpecObjects.yaml deleted file mode 100644 index 2e913eb..0000000 --- a/src/Internal/Api/JoinedMembers/V1_5/SpecObjects.yaml +++ /dev/null @@ -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 diff --git a/src/Internal/Api/JoinedMembers/V1_5/Upcast.elm b/src/Internal/Api/JoinedMembers/V1_5/Upcast.elm deleted file mode 100644 index ddfe1a0..0000000 --- a/src/Internal/Api/JoinedMembers/V1_5/Upcast.elm +++ /dev/null @@ -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