Change VaultUpdate to API Backpack
parent
7a75bffbfb
commit
e6257d8e38
|
@ -0,0 +1,57 @@
|
|||
module Internal.Api.Main exposing
|
||||
( Msg
|
||||
, sendMessageEvent
|
||||
)
|
||||
|
||||
{-|
|
||||
|
||||
|
||||
# Main API module
|
||||
|
||||
This module is used as reference for getting
|
||||
|
||||
|
||||
## VaultUpdate
|
||||
|
||||
@docs Msg
|
||||
|
||||
|
||||
## Actions
|
||||
|
||||
@docs sendMessageEvent
|
||||
|
||||
-}
|
||||
|
||||
import Internal.Api.Task as ITask exposing (Backpack)
|
||||
import Internal.Tools.Json as Json
|
||||
import Internal.Values.Context as Context
|
||||
import Internal.Values.Envelope as E
|
||||
|
||||
|
||||
type alias Msg =
|
||||
Backpack
|
||||
|
||||
|
||||
{-| Send a message event.
|
||||
-}
|
||||
sendMessageEvent :
|
||||
E.Envelope a
|
||||
->
|
||||
{ content : Json.Value
|
||||
, eventType : String
|
||||
, roomId : String
|
||||
, toMsg : Msg -> msg
|
||||
, transactionId : String
|
||||
}
|
||||
-> Cmd msg
|
||||
sendMessageEvent env data =
|
||||
ITask.run
|
||||
data.toMsg
|
||||
(ITask.sendMessageEvent
|
||||
{ content = data.content
|
||||
, eventType = data.eventType
|
||||
, roomId = data.roomId
|
||||
, transactionId = data.transactionId
|
||||
}
|
||||
)
|
||||
(Context.apiFormat env.context)
|
|
@ -1,5 +1,5 @@
|
|||
module Internal.Api.Task exposing
|
||||
( Task, run
|
||||
( Task, run, Backpack
|
||||
, sendMessageEvent
|
||||
)
|
||||
|
||||
|
@ -18,7 +18,7 @@ up-to-date.
|
|||
|
||||
## Use
|
||||
|
||||
@docs Task, run
|
||||
@docs Task, run, Backpack
|
||||
|
||||
|
||||
## Tasks
|
||||
|
|
|
@ -16,6 +16,7 @@ safely access all exposed data types without risking to create circular imports.
|
|||
|
||||
-}
|
||||
|
||||
import Internal.Api.Main as Api
|
||||
import Internal.Values.Envelope as Envelope
|
||||
import Internal.Values.Event as Event
|
||||
import Internal.Values.Room as Room
|
||||
|
@ -50,4 +51,4 @@ type Vault
|
|||
{-| Opaque type for Matrix VaultUpdate
|
||||
-}
|
||||
type VaultUpdate
|
||||
= VaultUpdate (Envelope.EnvelopeUpdate Vault.VaultUpdate)
|
||||
= VaultUpdate Api.Msg
|
||||
|
|
Loading…
Reference in New Issue