mellon-web 0.7.1.1 → 0.8.0.2
raw patch · 7 files changed
+59/−436 lines, 7 filesdep ~aeson-prettydep ~hlintdep ~lensPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: aeson-pretty, hlint, lens, mellon-core, mellon-gpio, servant, servant-client, servant-docs, servant-lucid, servant-server, servant-swagger, servant-swagger-ui, swagger2
API changes (from Hackage documentation)
Files
- README.md +0/−3
- changelog.md +16/−0
- examples/ScheduleUnlock.hs +1/−1
- mellon-web.cabal +27/−28
- mellon-web.paw +0/−387
- src/Mellon/Web/Server/API.hs +11/−13
- swagger.json +4/−4
README.md view
@@ -35,9 +35,6 @@ described in [API.md](API.md). The server is will run on the `localhost` loopback interface on port 8081. -Also included is a [Paw](https://luckymarmot.com/paw) file with a-pre-defined `localhost` environment for use with the example server.- This particular example server uses a "mock lock" device which only internally logs lock and unlock events without depending on any actual hardware, so it will run anywhere.
changelog.md view
@@ -1,3 +1,19 @@+## 0.8.0.2 (2017-09-04)++- Fix .cabal file for now-removed Paw file.++## 0.8.0.1 (2017-09-04)++- Hackage compliance fix.++## 0.8.0.0 (2017-09-04)++- Remove out-of-date Paw file.++- Port to Servant 0.11. Due to Servant 0.11 API changes, our API+ has changed, as well (just the Haskell bits; the web API remains+ the same).+ ## 0.7.1.1 (2017-05-24) No changes; copyright has been assigned to Quixoftic, LLC.
examples/ScheduleUnlock.hs view
@@ -111,7 +111,7 @@ do putStrLn $ "Mellon service error: " ++ prettyServantError e exitWith $ ExitFailure 1 prettyServantError :: ServantError -> String- prettyServantError (FailureResponse status _ _) =+ prettyServantError (FailureResponse _ status _ _) = show (statusCode status) ++ " " ++ (C8.unpack $ statusMessage status) prettyServantError (DecodeFailure _ _ _) = "decode failure"
mellon-web.cabal view
@@ -1,6 +1,6 @@ Name: mellon-web-Version: 0.7.1.1-Cabal-Version: >= 1.10+Version: 0.8.0.2+Cabal-Version: >= 1.18 Build-Type: Simple Author: Drew Hess <dhess-src@quixoftic.com> Maintainer: Drew Hess <dhess-src@quixoftic.com>@@ -43,7 +43,6 @@ , swagger.json Extra-Source-Files: changelog.md , examples/*.hs- , mellon-web.paw -- Build doctests Flag test-doctests@@ -85,28 +84,28 @@ , MultiParamTypeClasses , OverloadedStrings , TypeOperators- Build-Depends: base >= 4.8 && < 5- , aeson >= 0.11 && < 1.3- , aeson-pretty- , bytestring == 0.10.*- , http-client >= 0.4 && < 0.6- , http-types == 0.9.*- , lens- , lucid == 2.9.*- , mellon-core == 0.7.*- , servant >= 0.9 && < 0.10- , servant-client >= 0.9 && < 0.10- , servant-docs >= 0.9 && < 0.10- , servant-lucid >= 0.7.1 && < 0.10- , servant-server >= 0.9 && < 0.10- , servant-swagger- , servant-swagger-ui- , swagger2- , text == 1.2.*- , time >= 1.5 && < 2- , transformers >= 0.4.2 && < 0.6- , wai == 3.2.*- , warp == 3.2.*+ Build-Depends: base >= 4.8 && < 5+ , aeson >= 0.11 && < 1.3+ , aeson-pretty == 0.8.*+ , bytestring == 0.10.*+ , http-client >= 0.4 && < 0.6+ , http-types == 0.9.*+ , lens >= 4 && < 5+ , lucid == 2.9.*+ , mellon-core == 0.8.*+ , servant == 0.11.*+ , servant-client == 0.11.*+ , servant-docs >= 0.10 && < 0.12+ , servant-lucid == 0.7.*+ , servant-server == 0.11.*+ , servant-swagger == 1.1.*+ , servant-swagger-ui == 0.2.*+ , swagger2 == 2.1.*+ , text == 1.2.*+ , time >= 1.5 && < 2+ , transformers >= 0.4.2 && < 0.6+ , wai == 3.2.*+ , warp == 3.2.* Executable mock-mellon-server Main-Is: MockServer.hs@@ -138,7 +137,7 @@ , exceptions >= 0.8.0 && < 1 , hpio >= 0.8 && < 1 , mellon-core- , mellon-gpio == 0.7.*+ , mellon-gpio == 0.8.* , mellon-web , mtl , network == 2.6.*@@ -184,7 +183,7 @@ Buildable: False Else Build-Depends: base- , hlint == 1.9.*+ , hlint >= 1.9 && < 2.1 Test-Suite doctest Type: exitcode-stdio-1.0@@ -252,4 +251,4 @@ Source-Repository this Type: git Location: git://github.com/quixoftic/mellon.git- Tag: v0.7.1.1+ Tag: v0.8.0.2
− mellon-web.paw
@@ -1,387 +0,0 @@-<?xml version="1.0" standalone="no"?>-<!DOCTYPE database SYSTEM "file:///System/Library/DTDs/CoreData.dtd">--<database>- <databaseInfo>- <version>134481920</version>- <UUID>1E1D451C-4E87-4F1C-8A5D-6A76267CA5ED</UUID>- <nextObjectID>132</nextObjectID>- <metadata>- <plist version="1.0">- <dict>- <key>NSPersistenceFrameworkVersion</key>- <integer>640</integer>- <key>NSStoreModelVersionHashes</key>- <dict>- <key>LMCookieJar</key>- <data>- Fttmf2L4PrGvKUF496+nqgVVGek45TjOe7sUMtjNg8I=- </data>- <key>LMEnvironment</key>- <data>- uzBoVFcO4YvR9/3ej4AJ1UOOsA/u5DKY2aemusoIseU=- </data>- <key>LMEnvironmentDomain</key>- <data>- yM1GPGHdquS8IWLtuczlNoqKhIhD9FW6IReSfFffJgs=- </data>- <key>LMEnvironmentVariable</key>- <data>- P8e0lYd5JZKRabS/eXVSOJ4oitilz67xtv+pLqW1Jqg=- </data>- <key>LMEnvironmentVariableValue</key>- <data>- my5hNPJ51oDCSa8EgdNxWAnRcDLcERUGjtuXnzhSxQ0=- </data>- <key>LMKeyValue</key>- <data>- bIXXbyYF2xAv2MXg8JTVFsslmMKuvsfnR86QdUcFkdM=- </data>- <key>LMRequest</key>- <data>- kYB6By9dZHqmH3YNw3h9tYPoxeG5ZWHPfhLXXp7OLFs=- </data>- <key>LMRequestGroup</key>- <data>- N3ml+gYVWc4m0LSGLnBDJ37p9isOc41y+TtaM0Eacrc=- </data>- <key>LMRequestTreeItem</key>- <data>- ak+hYb/lDeG55U0kgGvU5ej7HUltUj0RTrX5z/izNrs=- </data>- </dict>- <key>NSStoreModelVersionHashesVersion</key>- <integer>3</integer>- <key>NSStoreModelVersionIdentifiers</key>- <array>- <string>LMDocumentVersion3</string>- </array>- </dict>- </plist>- </metadata>- </databaseInfo>- <object type="LMREQUEST" id="z102">- <attribute name="uuid" type="string">48D5A84F-CA3A-4E31-B9A2-3E90E65179F5</attribute>- <attribute name="url" type="string">[{"data":{"environmentVariable":"CF638FE7-0A86-4129-B488-AF6225D53392"},"identifier":"com.luckymarmot.EnvironmentVariableDynamicValue"},":\\/\\/",{"data":{"environmentVariable":"0F7D7E4D-E5E5-430F-90EB-E4617541F817"},"identifier":"com.luckymarmot.EnvironmentVariableDynamicValue"},":",{"data":{"environmentVariable":"7CB28DDF-2140-4675-A9FC-6DF2570EE218"},"identifier":"com.luckymarmot.EnvironmentVariableDynamicValue"},"\\/state"]</attribute>- <attribute name="storecookies" type="bool">1</attribute>- <attribute name="sendcookies" type="bool">1</attribute>- <attribute name="redirectmethod" type="bool">0</attribute>- <attribute name="redirectauthorization" type="bool">0</attribute>- <attribute name="method" type="string">PUT</attribute>- <attribute name="followredirects" type="bool">0</attribute>- <attribute name="body" type="string">[{"data":{"json":"{\\"state\\":\\"Unlocked\\",\\"until\\":\\"[{\\\\\\"data\\\\\\":{\\\\\\"format\\\\\\":3,\\\\\\"customFormat\\\\\\":[],\\\\\\"now\\\\\\":true,\\\\\\"useTSeparator\\\\\\":1,\\\\\\"date\\\\\\":1443060019.378293,\\\\\\"delta\\\\\\":10,\\\\\\"useZForUTC\\\\\\":1},\\\\\\"identifier\\\\\\":\\\\\\"com.luckymarmot.TimestampDynamicValue\\\\\\"}]\\"}"},"identifier":"com.luckymarmot.JSONDynamicValue"}]</attribute>- <attribute name="order" type="int64">3</attribute>- <attribute name="name" type="string">Unlock for 10s</attribute>- <relationship name="parent" type="0/1" destination="LMREQUESTTREEITEM"></relationship>- <relationship name="children" type="0/0" destination="LMREQUESTTREEITEM"></relationship>- <relationship name="headers" type="0/0" destination="LMKEYVALUE" idrefs="z110"></relationship>- </object>- <object type="LMCOOKIEJAR" id="z103">- <attribute name="uuid" type="string">46D05D33-1307-4DE8-A337-54150C4D82D4</attribute>- <attribute name="order" type="int64">1</attribute>- <attribute name="name" type="string">Default Jar</attribute>- </object>- <object type="LMENVIRONMENTDOMAIN" id="z104">- <attribute name="uuid" type="string">1BC02327-3607-4075-A036-96A3F21EB896</attribute>- <attribute name="order" type="int64">0</attribute>- <attribute name="name" type="string">Default Domain</attribute>- <relationship name="environments" type="0/0" destination="LMENVIRONMENT" idrefs="z108"></relationship>- <relationship name="variables" type="0/0" destination="LMENVIRONMENTVARIABLE" idrefs="z129 z131 z105"></relationship>- </object>- <object type="LMENVIRONMENTVARIABLE" id="z105">- <attribute name="uuid" type="string">0F7D7E4D-E5E5-430F-90EB-E4617541F817</attribute>- <attribute name="order" type="int64">0</attribute>- <attribute name="name" type="string">host</attribute>- <relationship name="domain" type="0/1" destination="LMENVIRONMENTDOMAIN" idrefs="z104"></relationship>- <relationship name="values" type="0/0" destination="LMENVIRONMENTVARIABLEVALUE" idrefs="z106"></relationship>- </object>- <object type="LMENVIRONMENTVARIABLEVALUE" id="z106">- <attribute name="value" type="string">localhost</attribute>- <relationship name="environment" type="1/1" destination="LMENVIRONMENT" idrefs="z108"></relationship>- <relationship name="variable" type="1/1" destination="LMENVIRONMENTVARIABLE" idrefs="z105"></relationship>- </object>- <object type="LMREQUEST" id="z107">- <attribute name="uuid" type="string">08E692C2-8C79-4BF5-95E1-C7CBC9627D79</attribute>- <attribute name="url" type="string">[{"data":{"environmentVariable":"CF638FE7-0A86-4129-B488-AF6225D53392"},"identifier":"com.luckymarmot.EnvironmentVariableDynamicValue"},":\\/\\/",{"data":{"environmentVariable":"0F7D7E4D-E5E5-430F-90EB-E4617541F817"},"identifier":"com.luckymarmot.EnvironmentVariableDynamicValue"},":",{"data":{"environmentVariable":"7CB28DDF-2140-4675-A9FC-6DF2570EE218"},"identifier":"com.luckymarmot.EnvironmentVariableDynamicValue"},"\\/time"]</attribute>- <attribute name="storecookies" type="bool">1</attribute>- <attribute name="sendcookies" type="bool">1</attribute>- <attribute name="redirectmethod" type="bool">0</attribute>- <attribute name="redirectauthorization" type="bool">0</attribute>- <attribute name="method" type="string">GET</attribute>- <attribute name="followredirects" type="bool">0</attribute>- <attribute name="order" type="int64">5</attribute>- <attribute name="name" type="string">Get time</attribute>- <relationship name="parent" type="0/1" destination="LMREQUESTTREEITEM"></relationship>- <relationship name="children" type="0/0" destination="LMREQUESTTREEITEM"></relationship>- <relationship name="headers" type="0/0" destination="LMKEYVALUE" idrefs="z111"></relationship>- </object>- <object type="LMENVIRONMENT" id="z108">- <attribute name="uuid" type="string">806883AB-58E3-4D72-9C0B-FFF62CB0E228</attribute>- <attribute name="order" type="int64">0</attribute>- <attribute name="name" type="string">localhost</attribute>- <relationship name="domain" type="0/1" destination="LMENVIRONMENTDOMAIN" idrefs="z104"></relationship>- <relationship name="variablesvalues" type="0/0" destination="LMENVIRONMENTVARIABLEVALUE" idrefs="z130 z106 z132"></relationship>- </object>- <object type="LMKEYVALUE" id="z109">- <attribute name="value" type="string"></attribute>- <attribute name="order" type="int64">0</attribute>- <attribute name="name" type="string"></attribute>- <attribute name="enabled" type="bool">1</attribute>- <relationship name="groupforbodyparameters" type="0/1" destination="LMREQUESTGROUP"></relationship>- <relationship name="groupforheaders" type="0/1" destination="LMREQUESTGROUP"></relationship>- <relationship name="groupforurlparameters" type="0/1" destination="LMREQUESTGROUP"></relationship>- <relationship name="request" type="0/1" destination="LMREQUEST" idrefs="z112"></relationship>- </object>- <object type="LMKEYVALUE" id="z110">- <attribute name="value" type="string"></attribute>- <attribute name="order" type="int64">0</attribute>- <attribute name="name" type="string"></attribute>- <attribute name="enabled" type="bool">1</attribute>- <relationship name="groupforbodyparameters" type="0/1" destination="LMREQUESTGROUP"></relationship>- <relationship name="groupforheaders" type="0/1" destination="LMREQUESTGROUP"></relationship>- <relationship name="groupforurlparameters" type="0/1" destination="LMREQUESTGROUP"></relationship>- <relationship name="request" type="0/1" destination="LMREQUEST" idrefs="z102"></relationship>- </object>- <object type="LMKEYVALUE" id="z111">- <attribute name="value" type="string"></attribute>- <attribute name="order" type="int64">0</attribute>- <attribute name="name" type="string"></attribute>- <attribute name="enabled" type="bool">1</attribute>- <relationship name="groupforbodyparameters" type="0/1" destination="LMREQUESTGROUP"></relationship>- <relationship name="groupforheaders" type="0/1" destination="LMREQUESTGROUP"></relationship>- <relationship name="groupforurlparameters" type="0/1" destination="LMREQUESTGROUP"></relationship>- <relationship name="request" type="0/1" destination="LMREQUEST" idrefs="z107"></relationship>- </object>- <object type="LMREQUEST" id="z112">- <attribute name="uuid" type="string">949BC3B1-EE2E-40AB-A805-C59ACFA37E5A</attribute>- <attribute name="url" type="string">[{"data":{"environmentVariable":"CF638FE7-0A86-4129-B488-AF6225D53392"},"identifier":"com.luckymarmot.EnvironmentVariableDynamicValue"},":\\/\\/",{"data":{"environmentVariable":"0F7D7E4D-E5E5-430F-90EB-E4617541F817"},"identifier":"com.luckymarmot.EnvironmentVariableDynamicValue"},":",{"data":{"environmentVariable":"7CB28DDF-2140-4675-A9FC-6DF2570EE218"},"identifier":"com.luckymarmot.EnvironmentVariableDynamicValue"},"\\/state"]</attribute>- <attribute name="storecookies" type="bool">1</attribute>- <attribute name="sendcookies" type="bool">1</attribute>- <attribute name="redirectmethod" type="bool">0</attribute>- <attribute name="redirectauthorization" type="bool">0</attribute>- <attribute name="method" type="string">GET</attribute>- <attribute name="followredirects" type="bool">0</attribute>- <attribute name="order" type="int64">0</attribute>- <attribute name="name" type="string">Get state</attribute>- <relationship name="parent" type="0/1" destination="LMREQUESTTREEITEM"></relationship>- <relationship name="children" type="0/0" destination="LMREQUESTTREEITEM"></relationship>- <relationship name="headers" type="0/0" destination="LMKEYVALUE" idrefs="z109"></relationship>- </object>- <object type="LMREQUEST" id="z113">- <attribute name="uuid" type="string">296FB78E-5DF8-427F-B0B3-87F36566B5AE</attribute>- <attribute name="url" type="string">[{"data":{"environmentVariable":"CF638FE7-0A86-4129-B488-AF6225D53392"},"identifier":"com.luckymarmot.EnvironmentVariableDynamicValue"},":\\/\\/",{"data":{"environmentVariable":"0F7D7E4D-E5E5-430F-90EB-E4617541F817"},"identifier":"com.luckymarmot.EnvironmentVariableDynamicValue"},":",{"data":{"environmentVariable":"7CB28DDF-2140-4675-A9FC-6DF2570EE218"},"identifier":"com.luckymarmot.EnvironmentVariableDynamicValue"},"\\/state"]</attribute>- <attribute name="storecookies" type="bool">1</attribute>- <attribute name="sendcookies" type="bool">1</attribute>- <attribute name="redirectmethod" type="bool">0</attribute>- <attribute name="redirectauthorization" type="bool">0</attribute>- <attribute name="method" type="string">PUT</attribute>- <attribute name="followredirects" type="bool">0</attribute>- <attribute name="body" type="string">[{"data":{"json":"{\\"state\\":\\"Locked\\",\\"until\\":[]}"},"identifier":"com.luckymarmot.JSONDynamicValue"}]</attribute>- <attribute name="order" type="int64">4</attribute>- <attribute name="name" type="string">Lock now</attribute>- <relationship name="parent" type="0/1" destination="LMREQUESTTREEITEM"></relationship>- <relationship name="children" type="0/0" destination="LMREQUESTTREEITEM"></relationship>- <relationship name="headers" type="0/0" destination="LMKEYVALUE" idrefs="z114"></relationship>- </object>- <object type="LMKEYVALUE" id="z114">- <attribute name="value" type="string"></attribute>- <attribute name="order" type="int64">0</attribute>- <attribute name="name" type="string"></attribute>- <attribute name="enabled" type="bool">1</attribute>- <relationship name="groupforbodyparameters" type="0/1" destination="LMREQUESTGROUP"></relationship>- <relationship name="groupforheaders" type="0/1" destination="LMREQUESTGROUP"></relationship>- <relationship name="groupforurlparameters" type="0/1" destination="LMREQUESTGROUP"></relationship>- <relationship name="request" type="0/1" destination="LMREQUEST" idrefs="z113"></relationship>- </object>- <object type="LMREQUEST" id="z115">- <attribute name="uuid" type="string">63AA61F1-3718-458E-9ED7-BF94700EFE50</attribute>- <attribute name="url" type="string">[{"data":{"environmentVariable":"CF638FE7-0A86-4129-B488-AF6225D53392"},"identifier":"com.luckymarmot.EnvironmentVariableDynamicValue"},":\\/\\/",{"data":{"environmentVariable":"0F7D7E4D-E5E5-430F-90EB-E4617541F817"},"identifier":"com.luckymarmot.EnvironmentVariableDynamicValue"},":",{"data":{"environmentVariable":"7CB28DDF-2140-4675-A9FC-6DF2570EE218"},"identifier":"com.luckymarmot.EnvironmentVariableDynamicValue"},"\\/state"]</attribute>- <attribute name="storecookies" type="bool">1</attribute>- <attribute name="sendcookies" type="bool">1</attribute>- <attribute name="redirectmethod" type="bool">0</attribute>- <attribute name="redirectauthorization" type="bool">0</attribute>- <attribute name="method" type="string">GET</attribute>- <attribute name="followredirects" type="bool">0</attribute>- <attribute name="body" type="string"></attribute>- <attribute name="order" type="int64">1</attribute>- <attribute name="name" type="string">Get state (accept JSON)</attribute>- <relationship name="parent" type="0/1" destination="LMREQUESTTREEITEM"></relationship>- <relationship name="children" type="0/0" destination="LMREQUESTTREEITEM"></relationship>- <relationship name="headers" type="0/0" destination="LMKEYVALUE" idrefs="z116 z119"></relationship>- </object>- <object type="LMKEYVALUE" id="z116">- <attribute name="value" type="string">application/json</attribute>- <attribute name="order" type="int64">0</attribute>- <attribute name="name" type="string">Accept</attribute>- <attribute name="enabled" type="bool">1</attribute>- <relationship name="groupforbodyparameters" type="0/1" destination="LMREQUESTGROUP"></relationship>- <relationship name="groupforheaders" type="0/1" destination="LMREQUESTGROUP"></relationship>- <relationship name="groupforurlparameters" type="0/1" destination="LMREQUESTGROUP"></relationship>- <relationship name="request" type="0/1" destination="LMREQUEST" idrefs="z115"></relationship>- </object>- <object type="LMKEYVALUE" id="z117">- <attribute name="value" type="string"></attribute>- <attribute name="order" type="int64">1</attribute>- <attribute name="name" type="string"></attribute>- <attribute name="enabled" type="bool">1</attribute>- <relationship name="groupforbodyparameters" type="0/1" destination="LMREQUESTGROUP"></relationship>- <relationship name="groupforheaders" type="0/1" destination="LMREQUESTGROUP"></relationship>- <relationship name="groupforurlparameters" type="0/1" destination="LMREQUESTGROUP"></relationship>- <relationship name="request" type="0/1" destination="LMREQUEST" idrefs="z118"></relationship>- </object>- <object type="LMREQUEST" id="z118">- <attribute name="uuid" type="string">18CAAEEC-FC1F-40A9-B000-71EF7965A35D</attribute>- <attribute name="url" type="string">[{"data":{"environmentVariable":"CF638FE7-0A86-4129-B488-AF6225D53392"},"identifier":"com.luckymarmot.EnvironmentVariableDynamicValue"},":\\/\\/",{"data":{"environmentVariable":"0F7D7E4D-E5E5-430F-90EB-E4617541F817"},"identifier":"com.luckymarmot.EnvironmentVariableDynamicValue"},":",{"data":{"environmentVariable":"7CB28DDF-2140-4675-A9FC-6DF2570EE218"},"identifier":"com.luckymarmot.EnvironmentVariableDynamicValue"},"\\/state"]</attribute>- <attribute name="storecookies" type="bool">1</attribute>- <attribute name="sendcookies" type="bool">1</attribute>- <attribute name="redirectmethod" type="bool">0</attribute>- <attribute name="redirectauthorization" type="bool">0</attribute>- <attribute name="method" type="string">GET</attribute>- <attribute name="followredirects" type="bool">0</attribute>- <attribute name="body" type="string"></attribute>- <attribute name="order" type="int64">2</attribute>- <attribute name="name" type="string">Get state (accept HTML)</attribute>- <relationship name="parent" type="0/1" destination="LMREQUESTTREEITEM"></relationship>- <relationship name="children" type="0/0" destination="LMREQUESTTREEITEM"></relationship>- <relationship name="headers" type="0/0" destination="LMKEYVALUE" idrefs="z120 z117"></relationship>- </object>- <object type="LMKEYVALUE" id="z119">- <attribute name="value" type="string"></attribute>- <attribute name="order" type="int64">1</attribute>- <attribute name="name" type="string"></attribute>- <attribute name="enabled" type="bool">1</attribute>- <relationship name="groupforbodyparameters" type="0/1" destination="LMREQUESTGROUP"></relationship>- <relationship name="groupforheaders" type="0/1" destination="LMREQUESTGROUP"></relationship>- <relationship name="groupforurlparameters" type="0/1" destination="LMREQUESTGROUP"></relationship>- <relationship name="request" type="0/1" destination="LMREQUEST" idrefs="z115"></relationship>- </object>- <object type="LMKEYVALUE" id="z120">- <attribute name="value" type="string">text/html</attribute>- <attribute name="order" type="int64">0</attribute>- <attribute name="name" type="string">Accept</attribute>- <attribute name="enabled" type="bool">1</attribute>- <relationship name="groupforbodyparameters" type="0/1" destination="LMREQUESTGROUP"></relationship>- <relationship name="groupforheaders" type="0/1" destination="LMREQUESTGROUP"></relationship>- <relationship name="groupforurlparameters" type="0/1" destination="LMREQUESTGROUP"></relationship>- <relationship name="request" type="0/1" destination="LMREQUEST" idrefs="z118"></relationship>- </object>- <object type="LMKEYVALUE" id="z121">- <attribute name="value" type="string"></attribute>- <attribute name="order" type="int64">1</attribute>- <attribute name="name" type="string"></attribute>- <attribute name="enabled" type="bool">1</attribute>- <relationship name="groupforbodyparameters" type="0/1" destination="LMREQUESTGROUP"></relationship>- <relationship name="groupforheaders" type="0/1" destination="LMREQUESTGROUP"></relationship>- <relationship name="groupforurlparameters" type="0/1" destination="LMREQUESTGROUP"></relationship>- <relationship name="request" type="0/1" destination="LMREQUEST" idrefs="z126"></relationship>- </object>- <object type="LMKEYVALUE" id="z122">- <attribute name="value" type="string">text/html</attribute>- <attribute name="order" type="int64">0</attribute>- <attribute name="name" type="string">Accept</attribute>- <attribute name="enabled" type="bool">1</attribute>- <relationship name="groupforbodyparameters" type="0/1" destination="LMREQUESTGROUP"></relationship>- <relationship name="groupforheaders" type="0/1" destination="LMREQUESTGROUP"></relationship>- <relationship name="groupforurlparameters" type="0/1" destination="LMREQUESTGROUP"></relationship>- <relationship name="request" type="0/1" destination="LMREQUEST" idrefs="z123"></relationship>- </object>- <object type="LMREQUEST" id="z123">- <attribute name="uuid" type="string">F4DDFE27-4F2E-4E50-8CD1-05C666C5B1A5</attribute>- <attribute name="url" type="string">[{"data":{"environmentVariable":"CF638FE7-0A86-4129-B488-AF6225D53392"},"identifier":"com.luckymarmot.EnvironmentVariableDynamicValue"},":\\/\\/",{"data":{"environmentVariable":"0F7D7E4D-E5E5-430F-90EB-E4617541F817"},"identifier":"com.luckymarmot.EnvironmentVariableDynamicValue"},":",{"data":{"environmentVariable":"7CB28DDF-2140-4675-A9FC-6DF2570EE218"},"identifier":"com.luckymarmot.EnvironmentVariableDynamicValue"},"\\/time"]</attribute>- <attribute name="storecookies" type="bool">1</attribute>- <attribute name="sendcookies" type="bool">1</attribute>- <attribute name="redirectmethod" type="bool">0</attribute>- <attribute name="redirectauthorization" type="bool">0</attribute>- <attribute name="method" type="string">GET</attribute>- <attribute name="followredirects" type="bool">0</attribute>- <attribute name="order" type="int64">7</attribute>- <attribute name="name" type="string">Get time (accept HTML)</attribute>- <relationship name="parent" type="0/1" destination="LMREQUESTTREEITEM"></relationship>- <relationship name="children" type="0/0" destination="LMREQUESTTREEITEM"></relationship>- <relationship name="headers" type="0/0" destination="LMKEYVALUE" idrefs="z122 z124"></relationship>- </object>- <object type="LMKEYVALUE" id="z124">- <attribute name="value" type="string"></attribute>- <attribute name="order" type="int64">1</attribute>- <attribute name="name" type="string"></attribute>- <attribute name="enabled" type="bool">1</attribute>- <relationship name="groupforbodyparameters" type="0/1" destination="LMREQUESTGROUP"></relationship>- <relationship name="groupforheaders" type="0/1" destination="LMREQUESTGROUP"></relationship>- <relationship name="groupforurlparameters" type="0/1" destination="LMREQUESTGROUP"></relationship>- <relationship name="request" type="0/1" destination="LMREQUEST" idrefs="z123"></relationship>- </object>- <object type="LMKEYVALUE" id="z125">- <attribute name="value" type="string">application/json</attribute>- <attribute name="order" type="int64">0</attribute>- <attribute name="name" type="string">Accept</attribute>- <attribute name="enabled" type="bool">1</attribute>- <relationship name="groupforbodyparameters" type="0/1" destination="LMREQUESTGROUP"></relationship>- <relationship name="groupforheaders" type="0/1" destination="LMREQUESTGROUP"></relationship>- <relationship name="groupforurlparameters" type="0/1" destination="LMREQUESTGROUP"></relationship>- <relationship name="request" type="0/1" destination="LMREQUEST" idrefs="z126"></relationship>- </object>- <object type="LMREQUEST" id="z126">- <attribute name="uuid" type="string">62F86462-ED46-4738-9877-86AD97E3535A</attribute>- <attribute name="url" type="string">[{"data":{"environmentVariable":"CF638FE7-0A86-4129-B488-AF6225D53392"},"identifier":"com.luckymarmot.EnvironmentVariableDynamicValue"},":\\/\\/",{"data":{"environmentVariable":"0F7D7E4D-E5E5-430F-90EB-E4617541F817"},"identifier":"com.luckymarmot.EnvironmentVariableDynamicValue"},":",{"data":{"environmentVariable":"7CB28DDF-2140-4675-A9FC-6DF2570EE218"},"identifier":"com.luckymarmot.EnvironmentVariableDynamicValue"},"\\/time"]</attribute>- <attribute name="storecookies" type="bool">1</attribute>- <attribute name="sendcookies" type="bool">1</attribute>- <attribute name="redirectmethod" type="bool">0</attribute>- <attribute name="redirectauthorization" type="bool">0</attribute>- <attribute name="method" type="string">GET</attribute>- <attribute name="followredirects" type="bool">0</attribute>- <attribute name="order" type="int64">6</attribute>- <attribute name="name" type="string">Get time (accept JSON)</attribute>- <relationship name="parent" type="0/1" destination="LMREQUESTTREEITEM"></relationship>- <relationship name="children" type="0/0" destination="LMREQUESTTREEITEM"></relationship>- <relationship name="headers" type="0/0" destination="LMKEYVALUE" idrefs="z125 z121"></relationship>- </object>- <object type="LMREQUEST" id="z127">- <attribute name="uuid" type="string">A0AE2FB5-7F43-4C52-BFF7-0E922225030D</attribute>- <attribute name="url" type="string">[{"data":{"environmentVariable":"CF638FE7-0A86-4129-B488-AF6225D53392"},"identifier":"com.luckymarmot.EnvironmentVariableDynamicValue"},":\\/\\/",{"data":{"environmentVariable":"0F7D7E4D-E5E5-430F-90EB-E4617541F817"},"identifier":"com.luckymarmot.EnvironmentVariableDynamicValue"},":",{"data":{"environmentVariable":"7CB28DDF-2140-4675-A9FC-6DF2570EE218"},"identifier":"com.luckymarmot.EnvironmentVariableDynamicValue"},"\\/docs"]</attribute>- <attribute name="storecookies" type="bool">1</attribute>- <attribute name="sendcookies" type="bool">1</attribute>- <attribute name="redirectmethod" type="bool">0</attribute>- <attribute name="redirectauthorization" type="bool">0</attribute>- <attribute name="method" type="string">GET</attribute>- <attribute name="followredirects" type="bool">0</attribute>- <attribute name="order" type="int64">8</attribute>- <attribute name="name" type="string">Get docs</attribute>- <relationship name="parent" type="0/1" destination="LMREQUESTTREEITEM"></relationship>- <relationship name="children" type="0/0" destination="LMREQUESTTREEITEM"></relationship>- <relationship name="headers" type="0/0" destination="LMKEYVALUE" idrefs="z128"></relationship>- </object>- <object type="LMKEYVALUE" id="z128">- <attribute name="value" type="string"></attribute>- <attribute name="order" type="int64">0</attribute>- <attribute name="name" type="string"></attribute>- <attribute name="enabled" type="bool">1</attribute>- <relationship name="groupforbodyparameters" type="0/1" destination="LMREQUESTGROUP"></relationship>- <relationship name="groupforheaders" type="0/1" destination="LMREQUESTGROUP"></relationship>- <relationship name="groupforurlparameters" type="0/1" destination="LMREQUESTGROUP"></relationship>- <relationship name="request" type="0/1" destination="LMREQUEST" idrefs="z127"></relationship>- </object>- <object type="LMENVIRONMENTVARIABLE" id="z129">- <attribute name="uuid" type="string">7CB28DDF-2140-4675-A9FC-6DF2570EE218</attribute>- <attribute name="order" type="int64">2</attribute>- <attribute name="name" type="string">port</attribute>- <relationship name="domain" type="0/1" destination="LMENVIRONMENTDOMAIN" idrefs="z104"></relationship>- <relationship name="values" type="0/0" destination="LMENVIRONMENTVARIABLEVALUE" idrefs="z130"></relationship>- </object>- <object type="LMENVIRONMENTVARIABLEVALUE" id="z130">- <attribute name="value" type="string">8081</attribute>- <relationship name="environment" type="1/1" destination="LMENVIRONMENT" idrefs="z108"></relationship>- <relationship name="variable" type="1/1" destination="LMENVIRONMENTVARIABLE" idrefs="z129"></relationship>- </object>- <object type="LMENVIRONMENTVARIABLE" id="z131">- <attribute name="uuid" type="string">CF638FE7-0A86-4129-B488-AF6225D53392</attribute>- <attribute name="order" type="int64">1</attribute>- <attribute name="name" type="string">protocol</attribute>- <relationship name="domain" type="0/1" destination="LMENVIRONMENTDOMAIN" idrefs="z104"></relationship>- <relationship name="values" type="0/0" destination="LMENVIRONMENTVARIABLEVALUE" idrefs="z132"></relationship>- </object>- <object type="LMENVIRONMENTVARIABLEVALUE" id="z132">- <attribute name="value" type="string">http</attribute>- <relationship name="environment" type="1/1" destination="LMENVIRONMENT" idrefs="z108"></relationship>- <relationship name="variable" type="1/1" destination="LMENVIRONMENTVARIABLE" idrefs="z131"></relationship>- </object>-</database>
src/Mellon/Web/Server/API.hs view
@@ -19,7 +19,6 @@ {-# LANGUAGE DataKinds #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveGeneric #-}-{-# LANGUAGE GeneralizedNewtypeDeriving #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE OverloadedLists #-}@@ -40,8 +39,7 @@ import Control.Lens ((&), (.~), (?~), mapped) import Control.Monad.Trans.Reader (ReaderT, runReaderT, ask)-import Control.Monad.Trans.Except (ExceptT)-import Control.Monad.IO.Class (MonadIO, liftIO)+import Control.Monad.IO.Class (liftIO) import qualified Data.Aeson.Types as Aeson (Value(String)) import Data.Aeson.Types ((.=), (.:), (.:?), FromJSON(..), Pair, Series, ToJSON(..),@@ -66,8 +64,8 @@ import qualified Mellon.Controller as Controller (State(..)) import Network.Wai (Application) import Servant- ((:>), (:<|>)(..), (:~>)(..), JSON, Get, ReqBody, Put, Proxy(..),- ServerT, Server, ServantErr, enter, serve)+ ((:<|>)(..), (:>), (:~>)(..), Get, Handler, JSON, Proxy(..), Put,+ ReqBody, Server, ServerT, enter, serve) import Servant.Docs (ToSample(..)) import Servant.HTML.Lucid (HTML) @@ -249,25 +247,25 @@ "state" :> Get '[JSON, HTML] State :<|> "state" :> ReqBody '[JSON] State :> Put '[JSON, HTML] State -type AppM d m = ReaderT (Controller d) (ExceptT ServantErr m)+type AppM d = ReaderT (Controller d) Handler -serverT :: (MonadIO m) => ServerT MellonAPI (AppM d m)+serverT :: ServerT MellonAPI (AppM d) serverT = getTime :<|> getState :<|> putState where- getTime :: (MonadIO m) => AppM d m Time+ getTime :: AppM d Time getTime = do now <- liftIO getCurrentTime return $ Time now - getState :: (MonadIO m) => AppM d m State+ getState :: AppM d State getState = do cc <- ask fmap stateToState (queryController cc) - putState :: (MonadIO m) => State -> AppM d m State+ putState :: State -> AppM d State putState Locked = do cc <- ask fmap stateToState (lockController cc)@@ -280,8 +278,8 @@ mellonAPI :: Proxy MellonAPI mellonAPI = Proxy -serverToEither :: (MonadIO m) => Controller d -> AppM d m :~> ExceptT ServantErr m-serverToEither cc = Nat $ \m -> runReaderT m cc+appToHandler :: Controller d -> AppM d :~> Handler+appToHandler cc = NT $ \m -> runReaderT m cc -- | A Servant 'Server' which serves the 'MellonAPI' on the given -- 'Controller'.@@ -289,7 +287,7 @@ -- Normally you will just use 'app', but this function is exported so -- that you can extend/wrap 'MellonAPI'. server :: Controller d -> Server MellonAPI-server cc = enter (serverToEither cc) serverT+server cc = enter (appToHandler cc) serverT -- | A WAI 'Network.Wai.Application' which runs the service, using the -- given 'Controller'.
swagger.json view
@@ -57,13 +57,13 @@ } }, "produces": [- "application/json",+ "application/json;charset=utf-8", "text/html;charset=utf-8" ] }, "put": { "consumes": [- "application/json"+ "application/json;charset=utf-8" ], "responses": { "400": {@@ -77,7 +77,7 @@ } }, "produces": [- "application/json",+ "application/json;charset=utf-8", "text/html;charset=utf-8" ], "parameters": [@@ -103,7 +103,7 @@ } }, "produces": [- "application/json",+ "application/json;charset=utf-8", "text/html;charset=utf-8" ] }