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.
-}
syncCredentials : List String -> Sync.SyncInput -> Sync.SyncOutput
syncCredentials : List String -> Maybe (Sync.SyncInput -> Sync.SyncOutput)
syncCredentials =
Sync.sync

View File

@ -8,8 +8,12 @@ getEvent : List String -> Maybe (EventInput -> EventOutput)
getEvent versions =
VC.withBottomLayer
{ 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.4"
|> VC.sameForVersion "v1.5"

View File

@ -17,8 +17,25 @@ type alias JoinedMembersOutputV1 =
Task X.Error SO1.RoomMemberList
joinedMembersInputV1 : JoinedMembersInputV1 -> JoinedMembersOutputV1
joinedMembersInputV1 data =
joinedMembersV1 : JoinedMembersInputV1 -> JoinedMembersOutputV1
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
{ headers = R.WithAccessToken data.accessToken
, method = "GET"

View File

@ -7,9 +7,23 @@ import Internal.Tools.VersionControl as VC
joinedMembers : List String -> Maybe (JoinedMembersInput -> JoinedMembersOutput)
joinedMembers versions =
VC.withBottomLayer
{ current = Api.joinedMembersInputV1
, version = "v1.1"
{ 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"
}
|> VC.sameForVersion "v1.2"
|> VC.sameForVersion "v1.3"
|> VC.sameForVersion "v1.4"

View File

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