Edit spec versions on endpoints

pull/1/head
Bram van den Heuvel 2023-02-17 11:16:11 +01:00
parent 045b67d77d
commit 885da04383
5 changed files with 56 additions and 20 deletions

View File

@ -38,7 +38,7 @@ sendStateEvent =
{-| Get the latest sync from the Matrix API. {-| Get the latest sync from the Matrix API.
-} -}
syncCredentials : List String -> Sync.SyncInput -> Sync.SyncOutput syncCredentials : List String -> Maybe (Sync.SyncInput -> Sync.SyncOutput)
syncCredentials = syncCredentials =
Sync.sync Sync.sync

View File

@ -8,8 +8,12 @@ getEvent : List String -> Maybe (EventInput -> EventOutput)
getEvent versions = getEvent versions =
VC.withBottomLayer VC.withBottomLayer
{ current = Api.getEventInputV1 { current = Api.getEventInputV1
, version = "v1.2" , version = "r0.5.0"
} }
|> VC.sameForVersion "r0.6.0"
|> VC.sameForVersion "r0.6.1"
|> VC.sameForVersion "v1.1"
|> VC.sameForVersion "v1.2"
|> VC.sameForVersion "v1.3" |> VC.sameForVersion "v1.3"
|> VC.sameForVersion "v1.4" |> VC.sameForVersion "v1.4"
|> VC.sameForVersion "v1.5" |> VC.sameForVersion "v1.5"

View File

@ -17,8 +17,25 @@ type alias JoinedMembersOutputV1 =
Task X.Error SO1.RoomMemberList Task X.Error SO1.RoomMemberList
joinedMembersInputV1 : JoinedMembersInputV1 -> JoinedMembersOutputV1 joinedMembersV1 : JoinedMembersInputV1 -> JoinedMembersOutputV1
joinedMembersInputV1 data = joinedMembersV1 data =
R.rawApiCall
{ headers = R.WithAccessToken data.accessToken
, method = "GET"
, baseUrl = data.baseUrl
, path = "/_matrix/client/r0/rooms/{roomId}/joined_members"
, pathParams =
[ ( "roomId", data.roomId )
]
, queryParams = []
, bodyParams = []
, timeout = Nothing
, decoder = \_ -> SO1.roomMemberListDecoder
}
joinedMembersV2 : JoinedMembersInputV1 -> JoinedMembersOutputV1
joinedMembersV2 data =
R.rawApiCall R.rawApiCall
{ headers = R.WithAccessToken data.accessToken { headers = R.WithAccessToken data.accessToken
, method = "GET" , method = "GET"

View File

@ -7,7 +7,21 @@ import Internal.Tools.VersionControl as VC
joinedMembers : List String -> Maybe (JoinedMembersInput -> JoinedMembersOutput) joinedMembers : List String -> Maybe (JoinedMembersInput -> JoinedMembersOutput)
joinedMembers versions = joinedMembers versions =
VC.withBottomLayer VC.withBottomLayer
{ current = Api.joinedMembersInputV1 { current = Api.joinedMembersV1
, version = "r0.0.0"
}
|> VC.sameForVersion "r0.0.1"
|> VC.sameForVersion "r0.1.0"
|> VC.sameForVersion "r0.2.0"
|> VC.sameForVersion "r0.3.0"
|> VC.sameForVersion "r0.4.0"
|> VC.sameForVersion "r0.5.0"
|> VC.sameForVersion "r0.6.0"
|> VC.sameForVersion "r0.6.1"
|> VC.addMiddleLayer
{ downcast = identity
, current = Api.joinedMembersV2
, upcast = identity
, version = "v1.1" , version = "v1.1"
} }
|> VC.sameForVersion "v1.2" |> VC.sameForVersion "v1.2"

View File

@ -1,29 +1,31 @@
module Internal.Api.SendStateKey.V1.SpecObjects exposing ( module Internal.Api.SendStateKey.V1.SpecObjects exposing
EventResponse ( EventResponse
, encodeEventResponse , encodeEventResponse
, eventResponseDecoder , eventResponseDecoder
) )
{-| Automatically generated 'SpecObjects' {-| Automatically generated 'SpecObjects'
Last generated at Unix time 1675965633 Last generated at Unix time 1676625734
-} -}
import Internal.Tools.EncodeExtra exposing (maybeObject) import Internal.Tools.EncodeExtra exposing (maybeObject)
import Json.Decode as D import Json.Decode as D
import Json.Encode as E import Json.Encode as E
{-| A response confirming that an event has been sent. {-| A response confirming that an event has been sent.
-} -}
type alias EventResponse = { type alias EventResponse =
eventId : String { eventId : String
} }
encodeEventResponse : EventResponse -> E.Value encodeEventResponse : EventResponse -> E.Value
encodeEventResponse data = encodeEventResponse data =
maybeObject [ maybeObject
("event_id", Just <| E.string data.eventId) [ ( "event_id", Just <| E.string data.eventId )
] ]
@ -31,7 +33,6 @@ eventResponseDecoder : D.Decoder EventResponse
eventResponseDecoder = eventResponseDecoder =
D.map D.map
(\a -> (\a ->
{ eventId=a}) { eventId = a }
)
(D.field "event_id" D.string) (D.field "event_id" D.string)