mirror of
https://github.com/jhillyerd/inbucket.git
synced 2025-12-17 17:47:03 +00:00
Create V2 API for monitor+deletes, revert V1 API (#347)
* Revert socketv1 controller API to maintain V1 contract, introduce V2 controller for Inbucket UI. Signed-off-by: James Hillyerd <james@hillyerd.com> * Introduce MessageID for deletes, instead of recycling header Signed-off-by: James Hillyerd <james@hillyerd.com> * Update UI for monitor V2 API Signed-off-by: James Hillyerd <james@hillyerd.com> --------- Signed-off-by: James Hillyerd <james@hillyerd.com>
This commit is contained in:
@@ -127,7 +127,7 @@ markMessageSeen session msg mailboxName id =
|
||||
|
||||
monitorUri : Session -> String
|
||||
monitorUri session =
|
||||
apiV1Url session [ "monitor", "messages" ]
|
||||
apiV2Url session [ "monitor", "messages" ]
|
||||
|
||||
|
||||
purgeMailbox : Session -> HttpResult msg -> String -> Cmd msg
|
||||
@@ -135,14 +135,24 @@ purgeMailbox session msg mailboxName =
|
||||
HttpUtil.delete msg (apiV1Url session [ "mailbox", mailboxName ])
|
||||
|
||||
|
||||
apiV1Url : Session -> List String -> String
|
||||
apiV1Url =
|
||||
apiUrl "v1"
|
||||
|
||||
|
||||
apiV2Url : Session -> List String -> String
|
||||
apiV2Url =
|
||||
apiUrl "v2"
|
||||
|
||||
|
||||
{-| Builds a public REST API URL (see wiki).
|
||||
-}
|
||||
apiV1Url : Session -> List String -> String
|
||||
apiV1Url session elements =
|
||||
apiUrl : String -> Session -> List String -> String
|
||||
apiUrl version session elements =
|
||||
Url.Builder.absolute
|
||||
(List.concat
|
||||
[ splitBasePath session.config.basePath
|
||||
, [ "api", "v1" ]
|
||||
, [ "api", version ]
|
||||
, elements
|
||||
]
|
||||
)
|
||||
|
||||
@@ -27,7 +27,7 @@ variantDecoder variant =
|
||||
case variant of
|
||||
"message-deleted" ->
|
||||
succeed MessageDeleted
|
||||
|> required "header" messageIdDecoder
|
||||
|> required "identifier" messageIdDecoder
|
||||
|
||||
"message-stored" ->
|
||||
succeed MessageStored
|
||||
|
||||
Reference in New Issue
Block a user