Rewrite send message library
This should make the modules a lot more flexible when it comes to modular version control.pull/1/head
parent
d20bc4ae36
commit
dbbd009a58
|
@ -24,7 +24,7 @@ joinedMembers =
|
||||||
|
|
||||||
{-| Send a message event into a Matrix room.
|
{-| Send a message event into a Matrix room.
|
||||||
-}
|
-}
|
||||||
sendMessageEvent : List String -> SendMessageEvent.SendMessageEventInput -> SendMessageEvent.SendMessageEventOutput
|
sendMessageEvent : List String -> Maybe (SendMessageEvent.SendMessageEventInput -> SendMessageEvent.SendMessageEventOutput)
|
||||||
sendMessageEvent =
|
sendMessageEvent =
|
||||||
SendMessageEvent.sendMessageEvent
|
SendMessageEvent.sendMessageEvent
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
module Internal.Api.SendMessageEvent.Api exposing (..)
|
module Internal.Api.SendMessageEvent.V1.Api exposing (sendMessageEventV1, sendMessageEventV2, SendMessageEventOutputV1, SendMessageEventInputV1)
|
||||||
|
|
||||||
import Internal.Api.Request as R
|
import Internal.Api.Request as R
|
||||||
|
import Internal.Api.SendMessageEvent.V1.SpecObjects as SO1
|
||||||
import Internal.Tools.Exceptions as X
|
import Internal.Tools.Exceptions as X
|
||||||
import Json.Decode as D
|
import Json.Decode as D
|
||||||
import Task exposing (Task)
|
import Task exposing (Task)
|
||||||
|
@ -15,9 +16,30 @@ type alias SendMessageEventInputV1 =
|
||||||
, transactionId : String
|
, transactionId : String
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type alias SendMessageEventOutputV1 = Task X.Error SO1.EventResponse
|
||||||
|
|
||||||
sendMessageEventV1 : D.Decoder a -> (a -> b) -> SendMessageEventInputV1 -> Task X.Error b
|
|
||||||
sendMessageEventV1 decoder mapping data =
|
sendMessageEventV1 : SendMessageEventInputV1 -> SendMessageEventOutputV1
|
||||||
|
sendMessageEventV1 data =
|
||||||
|
R.rawApiCall
|
||||||
|
{ headers = R.WithAccessToken data.accessToken
|
||||||
|
, method = "PUT"
|
||||||
|
, baseUrl = data.baseUrl
|
||||||
|
, path = "/_matrix/client/r0/rooms/{roomId}/send/{eventType}/{txnId}"
|
||||||
|
, pathParams =
|
||||||
|
[ ( "eventType", data.eventType )
|
||||||
|
, ( "roomId", data.roomId )
|
||||||
|
, ( "txnId", data.transactionId )
|
||||||
|
]
|
||||||
|
, queryParams = []
|
||||||
|
, bodyParams = [ R.RequiredValue "*" data.content ]
|
||||||
|
, timeout = Nothing
|
||||||
|
, decoder = \_ -> SO1.eventResponseDecoder
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
sendMessageEventV2 : SendMessageEventInputV1 -> SendMessageEventOutputV1
|
||||||
|
sendMessageEventV2 data =
|
||||||
R.rawApiCall
|
R.rawApiCall
|
||||||
{ headers = R.WithAccessToken data.accessToken
|
{ headers = R.WithAccessToken data.accessToken
|
||||||
, method = "PUT"
|
, method = "PUT"
|
||||||
|
@ -31,5 +53,5 @@ sendMessageEventV1 decoder mapping data =
|
||||||
, queryParams = []
|
, queryParams = []
|
||||||
, bodyParams = [ R.RequiredValue "*" data.content ]
|
, bodyParams = [ R.RequiredValue "*" data.content ]
|
||||||
, timeout = Nothing
|
, timeout = Nothing
|
||||||
, decoder = \_ -> D.map mapping decoder
|
, decoder = \_ -> SO1.eventResponseDecoder
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,23 +1,90 @@
|
||||||
module Internal.Api.SendMessageEvent.Main exposing (..)
|
module Internal.Api.SendMessageEvent.Main exposing (..)
|
||||||
|
|
||||||
import Internal.Api.SendMessageEvent.Api as Api
|
import Internal.Api.SendMessageEvent.Api as Api
|
||||||
import Internal.Api.SendMessageEvent.V1_2.Api as V1_2
|
import Internal.Tools.VersionControl as VC
|
||||||
import Internal.Api.SendMessageEvent.V1_3.Api as V1_3
|
|
||||||
import Internal.Api.SendMessageEvent.V1_4.Api as V1_4
|
|
||||||
import Internal.Api.SendMessageEvent.V1_5.Api as V1_5
|
|
||||||
import Internal.Api.SendMessageEvent.V1_5.Objects as O
|
|
||||||
import Internal.Api.VersionControl as V
|
|
||||||
import Internal.Tools.Exceptions as X
|
import Internal.Tools.Exceptions as X
|
||||||
import Task exposing (Task)
|
import Task exposing (Task)
|
||||||
|
|
||||||
|
|
||||||
sendMessageEvent : List String -> SendMessageEventInput -> SendMessageEventOutput
|
sendMessageEvent : List String -> Maybe (SendMessageEventInput -> SendMessageEventOutput)
|
||||||
sendMessageEvent =
|
sendMessageEvent versions =
|
||||||
V.firstVersion V1_2.packet
|
VC.withBottomLayer
|
||||||
|> V.updateWith V1_3.packet
|
{ current = Api.sendMessageEventV1
|
||||||
|> V.updateWith V1_4.packet
|
, version = "r0.0.0"
|
||||||
|> V.updateWith V1_5.packet
|
}
|
||||||
|> V.toFunction
|
|> VC.addMiddleLayer
|
||||||
|
{ downcast = identity
|
||||||
|
, current = Api.sendMessageEventV1
|
||||||
|
, upcast = identity
|
||||||
|
, version = "r0.0.1"
|
||||||
|
}
|
||||||
|
|> VC.addMiddleLayer
|
||||||
|
{ downcast = identity
|
||||||
|
, current = Api.sendMessageEventV1
|
||||||
|
, upcast = identity
|
||||||
|
, version = "r0.1.0"
|
||||||
|
}
|
||||||
|
|> VC.addMiddleLayer
|
||||||
|
{ downcast = identity
|
||||||
|
, current = Api.sendMessageEventV1
|
||||||
|
, upcast = identity
|
||||||
|
, version = "r0.2.0"
|
||||||
|
}
|
||||||
|
|> VC.addMiddleLayer
|
||||||
|
{ downcast = identity
|
||||||
|
, current = Api.sendMessageEventV1
|
||||||
|
, upcast = identity
|
||||||
|
, version = "r0.3.0"
|
||||||
|
}
|
||||||
|
|> VC.addMiddleLayer
|
||||||
|
{ downcast = identity
|
||||||
|
, current = Api.sendMessageEventV1
|
||||||
|
, upcast = identity
|
||||||
|
, version = "r0.5.0"
|
||||||
|
}
|
||||||
|
|> VC.addMiddleLayer
|
||||||
|
{ downcast = identity
|
||||||
|
, current = Api.sendMessageEventV1
|
||||||
|
, upcast = identity
|
||||||
|
, version = "r0.6.0"
|
||||||
|
}
|
||||||
|
|> VC.addMiddleLayer
|
||||||
|
{ downcast = identity
|
||||||
|
, current = Api.sendMessageEventV1
|
||||||
|
, upcast = identity
|
||||||
|
, version = "r0.6.1"
|
||||||
|
}
|
||||||
|
|> VC.addMiddleLayer
|
||||||
|
{ downcast = identity
|
||||||
|
, current = Api.sendMessageEventV2
|
||||||
|
, upcast = identity
|
||||||
|
, version = "v1.1"
|
||||||
|
}
|
||||||
|
|> VC.addMiddleLayer
|
||||||
|
{ downcast = identity
|
||||||
|
, current = Api.sendMessageEventV2
|
||||||
|
, upcast = identity
|
||||||
|
, version = "v1.2"
|
||||||
|
}
|
||||||
|
|> VC.addMiddleLayer
|
||||||
|
{ downcast = identity
|
||||||
|
, current = Api.sendMessageEventV2
|
||||||
|
, upcast = identity
|
||||||
|
, version = "v1.3"
|
||||||
|
}
|
||||||
|
|> VC.addMiddleLayer
|
||||||
|
{ downcast = identity
|
||||||
|
, current = Api.sendMessageEventV2
|
||||||
|
, upcast = identity
|
||||||
|
, version = "v1.4"
|
||||||
|
}
|
||||||
|
|> VC.addMiddleLayer
|
||||||
|
{ downcast = identity
|
||||||
|
, current = Api.sendMessageEventV2
|
||||||
|
, upcast = identity
|
||||||
|
, version = "v1.5"
|
||||||
|
}
|
||||||
|
|> VC.mostRecentFromVersionList versions
|
||||||
|
|
||||||
|
|
||||||
type alias SendMessageEventInput =
|
type alias SendMessageEventInput =
|
||||||
|
@ -25,4 +92,4 @@ type alias SendMessageEventInput =
|
||||||
|
|
||||||
|
|
||||||
type alias SendMessageEventOutput =
|
type alias SendMessageEventOutput =
|
||||||
Task X.Error O.EventResponse
|
Api.SendMessageEventOutputV1
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module Internal.Api.SendMessageEvent.V1_4.SpecObjects exposing
|
module Internal.Api.SendMessageEvent.V1.SpecObjects exposing
|
||||||
( EventResponse
|
( EventResponse
|
||||||
, encodeEventResponse
|
, encodeEventResponse
|
||||||
, eventResponseDecoder
|
, eventResponseDecoder
|
||||||
|
@ -6,7 +6,7 @@ module Internal.Api.SendMessageEvent.V1_4.SpecObjects exposing
|
||||||
|
|
||||||
{-| Automatically generated 'SpecObjects'
|
{-| Automatically generated 'SpecObjects'
|
||||||
|
|
||||||
Last generated at Unix time 1673279712
|
Last generated at Unix time 1675952679
|
||||||
|
|
||||||
-}
|
-}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
version: v1.2
|
version: v1
|
||||||
name: SpecObjects
|
name: SpecObjects
|
||||||
objects:
|
objects:
|
||||||
EventResponse:
|
EventResponse:
|
|
@ -1,16 +0,0 @@
|
||||||
module Internal.Api.SendMessageEvent.V1_2.Api exposing (..)
|
|
||||||
|
|
||||||
import Internal.Api.SendMessageEvent.Api as Api
|
|
||||||
import Internal.Api.SendMessageEvent.V1_2.Convert as C
|
|
||||||
import Internal.Api.SendMessageEvent.V1_2.Objects as O
|
|
||||||
import Internal.Api.SendMessageEvent.V1_2.Upcast as U
|
|
||||||
import Internal.Api.VersionControl as V
|
|
||||||
|
|
||||||
|
|
||||||
packet : V.SingleVersion () () Api.SendMessageEventInputV1 O.EventResponse
|
|
||||||
packet =
|
|
||||||
{ version = "v1.2"
|
|
||||||
, downcast = \_ -> ()
|
|
||||||
, current = Api.sendMessageEventV1 O.eventResponseDecoder C.convert
|
|
||||||
, upcast = U.upcast
|
|
||||||
}
|
|
|
@ -1,9 +0,0 @@
|
||||||
module Internal.Api.SendMessageEvent.V1_2.Convert exposing (..)
|
|
||||||
|
|
||||||
import Internal.Api.SendMessageEvent.V1_2.Objects as O
|
|
||||||
import Internal.Api.SendMessageEvent.V1_2.SpecObjects as SO
|
|
||||||
|
|
||||||
|
|
||||||
convert : SO.EventResponse -> O.EventResponse
|
|
||||||
convert =
|
|
||||||
identity
|
|
|
@ -1,38 +0,0 @@
|
||||||
module Internal.Api.SendMessageEvent.V1_2.Objects exposing
|
|
||||||
( EventResponse
|
|
||||||
, encodeEventResponse
|
|
||||||
, eventResponseDecoder
|
|
||||||
)
|
|
||||||
|
|
||||||
{-| Automatically generated 'Objects'
|
|
||||||
|
|
||||||
Last generated at Unix time 1673279712
|
|
||||||
|
|
||||||
-}
|
|
||||||
|
|
||||||
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
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
encodeEventResponse : EventResponse -> E.Value
|
|
||||||
encodeEventResponse data =
|
|
||||||
maybeObject
|
|
||||||
[ ( "event_id", Just <| E.string data.eventId )
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
eventResponseDecoder : D.Decoder EventResponse
|
|
||||||
eventResponseDecoder =
|
|
||||||
D.map
|
|
||||||
(\a ->
|
|
||||||
{ eventId = a }
|
|
||||||
)
|
|
||||||
(D.field "event_id" D.string)
|
|
|
@ -1,9 +0,0 @@
|
||||||
version: v1.2
|
|
||||||
name: Objects
|
|
||||||
objects:
|
|
||||||
EventResponse:
|
|
||||||
description: A response confirming that an event has been sent.
|
|
||||||
fields:
|
|
||||||
event_id:
|
|
||||||
type: string
|
|
||||||
required: true
|
|
|
@ -1,38 +0,0 @@
|
||||||
module Internal.Api.SendMessageEvent.V1_2.SpecObjects exposing
|
|
||||||
( EventResponse
|
|
||||||
, encodeEventResponse
|
|
||||||
, eventResponseDecoder
|
|
||||||
)
|
|
||||||
|
|
||||||
{-| Automatically generated 'SpecObjects'
|
|
||||||
|
|
||||||
Last generated at Unix time 1673279712
|
|
||||||
|
|
||||||
-}
|
|
||||||
|
|
||||||
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
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
encodeEventResponse : EventResponse -> E.Value
|
|
||||||
encodeEventResponse data =
|
|
||||||
maybeObject
|
|
||||||
[ ( "event_id", Just <| E.string data.eventId )
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
eventResponseDecoder : D.Decoder EventResponse
|
|
||||||
eventResponseDecoder =
|
|
||||||
D.map
|
|
||||||
(\a ->
|
|
||||||
{ eventId = a }
|
|
||||||
)
|
|
||||||
(D.field "event_id" D.string)
|
|
|
@ -1,9 +0,0 @@
|
||||||
module Internal.Api.SendMessageEvent.V1_2.Upcast exposing (..)
|
|
||||||
|
|
||||||
import Internal.Api.SendMessageEvent.V1_2.Objects as O
|
|
||||||
import Internal.Config.Leaking as L
|
|
||||||
|
|
||||||
|
|
||||||
upcast : () -> O.EventResponse
|
|
||||||
upcast _ =
|
|
||||||
{ eventId = L.eventId }
|
|
|
@ -1,17 +0,0 @@
|
||||||
module Internal.Api.SendMessageEvent.V1_3.Api exposing (..)
|
|
||||||
|
|
||||||
import Internal.Api.SendMessageEvent.Api as Api
|
|
||||||
import Internal.Api.SendMessageEvent.V1_2.Objects as PO
|
|
||||||
import Internal.Api.SendMessageEvent.V1_3.Convert as C
|
|
||||||
import Internal.Api.SendMessageEvent.V1_3.Objects as O
|
|
||||||
import Internal.Api.SendMessageEvent.V1_3.Upcast as U
|
|
||||||
import Internal.Api.VersionControl as V
|
|
||||||
|
|
||||||
|
|
||||||
packet : V.SingleVersion Api.SendMessageEventInputV1 PO.EventResponse Api.SendMessageEventInputV1 O.EventResponse
|
|
||||||
packet =
|
|
||||||
{ version = "v1.3"
|
|
||||||
, downcast = identity
|
|
||||||
, current = Api.sendMessageEventV1 O.eventResponseDecoder C.convert
|
|
||||||
, upcast = U.upcast
|
|
||||||
}
|
|
|
@ -1,9 +0,0 @@
|
||||||
module Internal.Api.SendMessageEvent.V1_3.Convert exposing (..)
|
|
||||||
|
|
||||||
import Internal.Api.SendMessageEvent.V1_3.Objects as O
|
|
||||||
import Internal.Api.SendMessageEvent.V1_3.SpecObjects as SO
|
|
||||||
|
|
||||||
|
|
||||||
convert : SO.EventResponse -> O.EventResponse
|
|
||||||
convert =
|
|
||||||
identity
|
|
|
@ -1,38 +0,0 @@
|
||||||
module Internal.Api.SendMessageEvent.V1_3.Objects exposing
|
|
||||||
( EventResponse
|
|
||||||
, encodeEventResponse
|
|
||||||
, eventResponseDecoder
|
|
||||||
)
|
|
||||||
|
|
||||||
{-| Automatically generated 'Objects'
|
|
||||||
|
|
||||||
Last generated at Unix time 1673279712
|
|
||||||
|
|
||||||
-}
|
|
||||||
|
|
||||||
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
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
encodeEventResponse : EventResponse -> E.Value
|
|
||||||
encodeEventResponse data =
|
|
||||||
maybeObject
|
|
||||||
[ ( "event_id", Just <| E.string data.eventId )
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
eventResponseDecoder : D.Decoder EventResponse
|
|
||||||
eventResponseDecoder =
|
|
||||||
D.map
|
|
||||||
(\a ->
|
|
||||||
{ eventId = a }
|
|
||||||
)
|
|
||||||
(D.field "event_id" D.string)
|
|
|
@ -1,9 +0,0 @@
|
||||||
version: v1.3
|
|
||||||
name: Objects
|
|
||||||
objects:
|
|
||||||
EventResponse:
|
|
||||||
description: A response confirming that an event has been sent.
|
|
||||||
fields:
|
|
||||||
event_id:
|
|
||||||
type: string
|
|
||||||
required: true
|
|
|
@ -1,38 +0,0 @@
|
||||||
module Internal.Api.SendMessageEvent.V1_3.SpecObjects exposing
|
|
||||||
( EventResponse
|
|
||||||
, encodeEventResponse
|
|
||||||
, eventResponseDecoder
|
|
||||||
)
|
|
||||||
|
|
||||||
{-| Automatically generated 'SpecObjects'
|
|
||||||
|
|
||||||
Last generated at Unix time 1673279712
|
|
||||||
|
|
||||||
-}
|
|
||||||
|
|
||||||
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
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
encodeEventResponse : EventResponse -> E.Value
|
|
||||||
encodeEventResponse data =
|
|
||||||
maybeObject
|
|
||||||
[ ( "event_id", Just <| E.string data.eventId )
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
eventResponseDecoder : D.Decoder EventResponse
|
|
||||||
eventResponseDecoder =
|
|
||||||
D.map
|
|
||||||
(\a ->
|
|
||||||
{ eventId = a }
|
|
||||||
)
|
|
||||||
(D.field "event_id" D.string)
|
|
|
@ -1,9 +0,0 @@
|
||||||
version: v1.3
|
|
||||||
name: SpecObjects
|
|
||||||
objects:
|
|
||||||
EventResponse:
|
|
||||||
description: A response confirming that an event has been sent.
|
|
||||||
fields:
|
|
||||||
event_id:
|
|
||||||
type: string
|
|
||||||
required: true
|
|
|
@ -1,9 +0,0 @@
|
||||||
module Internal.Api.SendMessageEvent.V1_3.Upcast exposing (..)
|
|
||||||
|
|
||||||
import Internal.Api.SendMessageEvent.V1_2.Objects as PO
|
|
||||||
import Internal.Api.SendMessageEvent.V1_3.Objects as O
|
|
||||||
|
|
||||||
|
|
||||||
upcast : PO.EventResponse -> O.EventResponse
|
|
||||||
upcast =
|
|
||||||
identity
|
|
|
@ -1,17 +0,0 @@
|
||||||
module Internal.Api.SendMessageEvent.V1_4.Api exposing (..)
|
|
||||||
|
|
||||||
import Internal.Api.SendMessageEvent.Api as Api
|
|
||||||
import Internal.Api.SendMessageEvent.V1_3.Objects as PO
|
|
||||||
import Internal.Api.SendMessageEvent.V1_4.Convert as C
|
|
||||||
import Internal.Api.SendMessageEvent.V1_4.Objects as O
|
|
||||||
import Internal.Api.SendMessageEvent.V1_4.Upcast as U
|
|
||||||
import Internal.Api.VersionControl as V
|
|
||||||
|
|
||||||
|
|
||||||
packet : V.SingleVersion Api.SendMessageEventInputV1 PO.EventResponse Api.SendMessageEventInputV1 O.EventResponse
|
|
||||||
packet =
|
|
||||||
{ version = "v1.4"
|
|
||||||
, downcast = identity
|
|
||||||
, current = Api.sendMessageEventV1 O.eventResponseDecoder C.convert
|
|
||||||
, upcast = U.upcast
|
|
||||||
}
|
|
|
@ -1,9 +0,0 @@
|
||||||
module Internal.Api.SendMessageEvent.V1_4.Convert exposing (..)
|
|
||||||
|
|
||||||
import Internal.Api.SendMessageEvent.V1_4.Objects as O
|
|
||||||
import Internal.Api.SendMessageEvent.V1_4.SpecObjects as SO
|
|
||||||
|
|
||||||
|
|
||||||
convert : SO.EventResponse -> O.EventResponse
|
|
||||||
convert =
|
|
||||||
identity
|
|
|
@ -1,38 +0,0 @@
|
||||||
module Internal.Api.SendMessageEvent.V1_4.Objects exposing
|
|
||||||
( EventResponse
|
|
||||||
, encodeEventResponse
|
|
||||||
, eventResponseDecoder
|
|
||||||
)
|
|
||||||
|
|
||||||
{-| Automatically generated 'Objects'
|
|
||||||
|
|
||||||
Last generated at Unix time 1673279712
|
|
||||||
|
|
||||||
-}
|
|
||||||
|
|
||||||
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
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
encodeEventResponse : EventResponse -> E.Value
|
|
||||||
encodeEventResponse data =
|
|
||||||
maybeObject
|
|
||||||
[ ( "event_id", Just <| E.string data.eventId )
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
eventResponseDecoder : D.Decoder EventResponse
|
|
||||||
eventResponseDecoder =
|
|
||||||
D.map
|
|
||||||
(\a ->
|
|
||||||
{ eventId = a }
|
|
||||||
)
|
|
||||||
(D.field "event_id" D.string)
|
|
|
@ -1,9 +0,0 @@
|
||||||
version: v1.4
|
|
||||||
name: Objects
|
|
||||||
objects:
|
|
||||||
EventResponse:
|
|
||||||
description: A response confirming that an event has been sent.
|
|
||||||
fields:
|
|
||||||
event_id:
|
|
||||||
type: string
|
|
||||||
required: true
|
|
|
@ -1,9 +0,0 @@
|
||||||
version: v1.4
|
|
||||||
name: SpecObjects
|
|
||||||
objects:
|
|
||||||
EventResponse:
|
|
||||||
description: A response confirming that an event has been sent.
|
|
||||||
fields:
|
|
||||||
event_id:
|
|
||||||
type: string
|
|
||||||
required: true
|
|
|
@ -1,9 +0,0 @@
|
||||||
module Internal.Api.SendMessageEvent.V1_4.Upcast exposing (..)
|
|
||||||
|
|
||||||
import Internal.Api.SendMessageEvent.V1_3.Objects as PO
|
|
||||||
import Internal.Api.SendMessageEvent.V1_4.Objects as O
|
|
||||||
|
|
||||||
|
|
||||||
upcast : PO.EventResponse -> O.EventResponse
|
|
||||||
upcast =
|
|
||||||
identity
|
|
|
@ -1,17 +0,0 @@
|
||||||
module Internal.Api.SendMessageEvent.V1_5.Api exposing (..)
|
|
||||||
|
|
||||||
import Internal.Api.SendMessageEvent.Api as Api
|
|
||||||
import Internal.Api.SendMessageEvent.V1_4.Objects as PO
|
|
||||||
import Internal.Api.SendMessageEvent.V1_5.Convert as C
|
|
||||||
import Internal.Api.SendMessageEvent.V1_5.Objects as O
|
|
||||||
import Internal.Api.SendMessageEvent.V1_5.Upcast as U
|
|
||||||
import Internal.Api.VersionControl as V
|
|
||||||
|
|
||||||
|
|
||||||
packet : V.SingleVersion Api.SendMessageEventInputV1 PO.EventResponse Api.SendMessageEventInputV1 O.EventResponse
|
|
||||||
packet =
|
|
||||||
{ version = "v1.5"
|
|
||||||
, downcast = identity
|
|
||||||
, current = Api.sendMessageEventV1 O.eventResponseDecoder C.convert
|
|
||||||
, upcast = U.upcast
|
|
||||||
}
|
|
|
@ -1,9 +0,0 @@
|
||||||
module Internal.Api.SendMessageEvent.V1_5.Convert exposing (..)
|
|
||||||
|
|
||||||
import Internal.Api.SendMessageEvent.V1_5.Objects as O
|
|
||||||
import Internal.Api.SendMessageEvent.V1_5.SpecObjects as SO
|
|
||||||
|
|
||||||
|
|
||||||
convert : SO.EventResponse -> O.EventResponse
|
|
||||||
convert =
|
|
||||||
identity
|
|
|
@ -1,38 +0,0 @@
|
||||||
module Internal.Api.SendMessageEvent.V1_5.Objects exposing
|
|
||||||
( EventResponse
|
|
||||||
, encodeEventResponse
|
|
||||||
, eventResponseDecoder
|
|
||||||
)
|
|
||||||
|
|
||||||
{-| Automatically generated 'Objects'
|
|
||||||
|
|
||||||
Last generated at Unix time 1673279712
|
|
||||||
|
|
||||||
-}
|
|
||||||
|
|
||||||
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
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
encodeEventResponse : EventResponse -> E.Value
|
|
||||||
encodeEventResponse data =
|
|
||||||
maybeObject
|
|
||||||
[ ( "event_id", Just <| E.string data.eventId )
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
eventResponseDecoder : D.Decoder EventResponse
|
|
||||||
eventResponseDecoder =
|
|
||||||
D.map
|
|
||||||
(\a ->
|
|
||||||
{ eventId = a }
|
|
||||||
)
|
|
||||||
(D.field "event_id" D.string)
|
|
|
@ -1,9 +0,0 @@
|
||||||
version: v1.5
|
|
||||||
name: Objects
|
|
||||||
objects:
|
|
||||||
EventResponse:
|
|
||||||
description: A response confirming that an event has been sent.
|
|
||||||
fields:
|
|
||||||
event_id:
|
|
||||||
type: string
|
|
||||||
required: true
|
|
|
@ -1,38 +0,0 @@
|
||||||
module Internal.Api.SendMessageEvent.V1_5.SpecObjects exposing
|
|
||||||
( EventResponse
|
|
||||||
, encodeEventResponse
|
|
||||||
, eventResponseDecoder
|
|
||||||
)
|
|
||||||
|
|
||||||
{-| Automatically generated 'SpecObjects'
|
|
||||||
|
|
||||||
Last generated at Unix time 1673279712
|
|
||||||
|
|
||||||
-}
|
|
||||||
|
|
||||||
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
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
encodeEventResponse : EventResponse -> E.Value
|
|
||||||
encodeEventResponse data =
|
|
||||||
maybeObject
|
|
||||||
[ ( "event_id", Just <| E.string data.eventId )
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
eventResponseDecoder : D.Decoder EventResponse
|
|
||||||
eventResponseDecoder =
|
|
||||||
D.map
|
|
||||||
(\a ->
|
|
||||||
{ eventId = a }
|
|
||||||
)
|
|
||||||
(D.field "event_id" D.string)
|
|
|
@ -1,9 +0,0 @@
|
||||||
version: v1.5
|
|
||||||
name: SpecObjects
|
|
||||||
objects:
|
|
||||||
EventResponse:
|
|
||||||
description: A response confirming that an event has been sent.
|
|
||||||
fields:
|
|
||||||
event_id:
|
|
||||||
type: string
|
|
||||||
required: true
|
|
|
@ -1,9 +0,0 @@
|
||||||
module Internal.Api.SendMessageEvent.V1_5.Upcast exposing (..)
|
|
||||||
|
|
||||||
import Internal.Api.SendMessageEvent.V1_4.Objects as PO
|
|
||||||
import Internal.Api.SendMessageEvent.V1_5.Objects as O
|
|
||||||
|
|
||||||
|
|
||||||
upcast : PO.EventResponse -> O.EventResponse
|
|
||||||
upcast =
|
|
||||||
identity
|
|
Loading…
Reference in New Issue