elm-format
parent
eaa7bc3444
commit
045b67d77d
|
@ -1,4 +1,4 @@
|
||||||
module Internal.Api.SendMessageEvent.Api exposing (sendMessageEventV1, sendMessageEventV2, SendMessageEventOutputV1, SendMessageEventInputV1)
|
module Internal.Api.SendMessageEvent.Api exposing (SendMessageEventInputV1, SendMessageEventOutputV1, sendMessageEventV1, sendMessageEventV2)
|
||||||
|
|
||||||
import Internal.Api.Request as R
|
import Internal.Api.Request as R
|
||||||
import Internal.Api.SendMessageEvent.V1.SpecObjects as SO1
|
import Internal.Api.SendMessageEvent.V1.SpecObjects as SO1
|
||||||
|
@ -16,7 +16,9 @@ type alias SendMessageEventInputV1 =
|
||||||
, transactionId : String
|
, transactionId : String
|
||||||
}
|
}
|
||||||
|
|
||||||
type alias SendMessageEventOutputV1 = Task X.Error SO1.EventResponse
|
|
||||||
|
type alias SendMessageEventOutputV1 =
|
||||||
|
Task X.Error SO1.EventResponse
|
||||||
|
|
||||||
|
|
||||||
sendMessageEventV1 : SendMessageEventInputV1 -> SendMessageEventOutputV1
|
sendMessageEventV1 : SendMessageEventInputV1 -> SendMessageEventOutputV1
|
||||||
|
|
|
@ -3,31 +3,32 @@ module Internal.Api.SendMessageEvent.Main exposing (..)
|
||||||
import Internal.Api.SendMessageEvent.Api as Api
|
import Internal.Api.SendMessageEvent.Api as Api
|
||||||
import Internal.Tools.VersionControl as VC
|
import Internal.Tools.VersionControl as VC
|
||||||
|
|
||||||
|
|
||||||
sendMessageEvent : List String -> Maybe (SendMessageEventInput -> SendMessageEventOutput)
|
sendMessageEvent : List String -> Maybe (SendMessageEventInput -> SendMessageEventOutput)
|
||||||
sendMessageEvent versions =
|
sendMessageEvent versions =
|
||||||
VC.withBottomLayer
|
VC.withBottomLayer
|
||||||
{ current = Api.sendMessageEventV1
|
{ current = Api.sendMessageEventV1
|
||||||
, version = "r0.0.0"
|
, version = "r0.0.0"
|
||||||
}
|
}
|
||||||
|> VC.sameForVersion "r0.0.1"
|
|> VC.sameForVersion "r0.0.1"
|
||||||
|> VC.sameForVersion "r0.1.0"
|
|> VC.sameForVersion "r0.1.0"
|
||||||
|> VC.sameForVersion "r0.2.0"
|
|> VC.sameForVersion "r0.2.0"
|
||||||
|> VC.sameForVersion "r0.3.0"
|
|> VC.sameForVersion "r0.3.0"
|
||||||
|> VC.sameForVersion "r0.4.0"
|
|> VC.sameForVersion "r0.4.0"
|
||||||
|> VC.sameForVersion "r0.5.0"
|
|> VC.sameForVersion "r0.5.0"
|
||||||
|> VC.sameForVersion "r0.6.0"
|
|> VC.sameForVersion "r0.6.0"
|
||||||
|> VC.sameForVersion "r0.6.1"
|
|> VC.sameForVersion "r0.6.1"
|
||||||
|> VC.addMiddleLayer
|
|> VC.addMiddleLayer
|
||||||
{ downcast = identity
|
{ downcast = identity
|
||||||
, current = Api.sendMessageEventV2
|
, current = Api.sendMessageEventV2
|
||||||
, upcast = identity
|
, upcast = identity
|
||||||
, version = "v1.1"
|
, version = "v1.1"
|
||||||
}
|
}
|
||||||
|> VC.sameForVersion "v1.2"
|
|> 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"
|
||||||
|> VC.mostRecentFromVersionList versions
|
|> VC.mostRecentFromVersionList versions
|
||||||
|
|
||||||
|
|
||||||
type alias SendMessageEventInput =
|
type alias SendMessageEventInput =
|
||||||
|
|
|
@ -92,10 +92,10 @@ type alias MiddleLayer cin cout din dout =
|
||||||
{-| The VersionControl layer is the layer that keeps track of all potential versions.
|
{-| The VersionControl layer is the layer that keeps track of all potential versions.
|
||||||
-}
|
-}
|
||||||
type VersionControl cin cout
|
type VersionControl cin cout
|
||||||
= VersionControl
|
= VersionControl
|
||||||
{ latestVersion : cin -> cout
|
{ latestVersion : cin -> cout
|
||||||
, order : List String
|
, order : List String
|
||||||
, versions : Dict String (cin -> cout)
|
, versions : Dict String (cin -> cout)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -154,6 +154,7 @@ mostRecentFromVersionList versionList ((VersionControl { order }) as vc) =
|
||||||
|> List.filterMap (\v -> fromVersion v vc)
|
|> List.filterMap (\v -> fromVersion v vc)
|
||||||
|> List.head
|
|> List.head
|
||||||
|
|
||||||
|
|
||||||
{-| Sometimes, no changes are needed and a function works just the same as the one in the previous version.
|
{-| Sometimes, no changes are needed and a function works just the same as the one in the previous version.
|
||||||
In that case, you can amend with a `sameForVersion` function to indicate that the spec is
|
In that case, you can amend with a `sameForVersion` function to indicate that the spec is
|
||||||
identical for this version.
|
identical for this version.
|
||||||
|
@ -161,9 +162,9 @@ identical for this version.
|
||||||
sameForVersion : String -> VersionControl a b -> VersionControl a b
|
sameForVersion : String -> VersionControl a b -> VersionControl a b
|
||||||
sameForVersion version (VersionControl data) =
|
sameForVersion version (VersionControl data) =
|
||||||
VersionControl
|
VersionControl
|
||||||
{ data
|
{ data
|
||||||
| order = version :: data.order
|
| order = version :: data.order
|
||||||
, versions = Dict.insert version data.latestVersion data.versions
|
, versions = Dict.insert version data.latestVersion data.versions
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue