summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGES.md4
-rw-r--r--hledger-api.12
-rw-r--r--hledger-api.cabal12
-rw-r--r--hledger-api.hs79
-rw-r--r--hledger-api.info2
-rw-r--r--hledger-api.txt2
6 files changed, 76 insertions, 25 deletions
diff --git a/CHANGES.md b/CHANGES.md
index d77daa5..502bc64 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -1,6 +1,10 @@
User-visible changes in hledger-api.
See also the hledger changelog.
+# 1.14 2019-03-01
+
+- use hledger 1.14
+
# 1.13 (2019/02/01)
- use hledger 1.13
diff --git a/hledger-api.1 b/hledger-api.1
index 67e5b9e..ea7cdef 100644
--- a/hledger-api.1
+++ b/hledger-api.1
@@ -1,5 +1,5 @@
-.TH "hledger\-api" "1" "February 2019" "hledger\-api 1.13" "hledger User Manuals"
+.TH "hledger\-api" "1" "March 2019" "hledger\-api 1.14" "hledger User Manuals"
diff --git a/hledger-api.cabal b/hledger-api.cabal
index 3fdc1fb..d82e4c7 100644
--- a/hledger-api.cabal
+++ b/hledger-api.cabal
@@ -4,10 +4,10 @@ cabal-version: 1.12
--
-- see: https://github.com/sol/hpack
--
--- hash: d466c16400216144122ec39c234f0b399daffb1a7eb48236b78b63ba59102275
+-- hash: e7c0a6dd7378e0cca56c467d680045884bad0673d1c9e749b2d06484b2a8dd08
name: hledger-api
-version: 1.13
+version: 1.14
synopsis: Web API server for the hledger accounting tool
description: This is a simple web API server for hledger data.
It comes with a series of simple client-side web app examples.
@@ -26,7 +26,7 @@ author: Simon Michael <simon@joyful.com>
maintainer: Simon Michael <simon@joyful.com>
license: GPL-3
license-file: LICENSE
-tested-with: GHC==7.10.3, GHC==8.0.2, GHC==8.2.2, GHC==8.4.3
+tested-with: GHC==7.10.3, GHC==8.0.2, GHC==8.2.2, GHC==8.4.3, GHC==8.6.3
build-type: Simple
extra-source-files:
CHANGES.md
@@ -46,7 +46,7 @@ executable hledger-api
other-modules:
Paths_hledger_api
ghc-options: -threaded
- cpp-options: -DVERSION="1.13"
+ cpp-options: -DVERSION="1.14"
build-depends:
Decimal
, aeson
@@ -56,8 +56,8 @@ executable hledger-api
, data-default >=0.5
, docopt
, either
- , hledger >=1.13 && <1.14
- , hledger-lib >=1.13 && <1.14
+ , hledger >=1.14 && <1.15
+ , hledger-lib >=1.14 && <1.15
, microlens >=0.4
, microlens-platform >=0.2.3.1
, safe
diff --git a/hledger-api.hs b/hledger-api.hs
index a5e45ea..f230794 100644
--- a/hledger-api.hs
+++ b/hledger-api.hs
@@ -37,12 +37,17 @@ import Text.Printf
import Hledger.Query
import Hledger.Cli hiding (Reader, version)
-hledgerApiVersion="1.13"
+#ifdef VERSION
+hledgerApiVersion = VERSION
+#else
+hledgerApiVersion = "dev build"
+#endif
-- https://github.com/docopt/docopt.hs#readme
+-- XXX VERSION is "X.Y" and the quotes appear in the output
doc :: Docopt
doc = [docopt|
-hledger-api 1.13
+hledger-api VERSION
Serves hledger data and reports as a JSON web API.
@@ -161,19 +166,59 @@ hledgerApiApp staticdir j = Servant.serve api server
thisacctq = Acct $ accountNameToAccountRegex a -- includes subs
return $ accountTransactionsReport ropts j q thisacctq
-instance ToJSON Status where toJSON = genericToJSON defaultOptions -- avoiding https://github.com/bos/aeson/issues/290
-instance ToJSON GenericSourcePos where toJSON = genericToJSON defaultOptions
-instance ToJSON Decimal where
- toJSON = toJSON . show
-instance ToJSON Amount where toJSON = genericToJSON defaultOptions
-instance ToJSON AmountStyle where toJSON = genericToJSON defaultOptions
-instance ToJSON Side where toJSON = genericToJSON defaultOptions
-instance ToJSON DigitGroupStyle where toJSON = genericToJSON defaultOptions
-instance ToJSON MixedAmount where toJSON = genericToJSON defaultOptions
-instance ToJSON BalanceAssertion where toJSON = genericToJSON defaultOptions
-instance ToJSON Price where toJSON = genericToJSON defaultOptions
-instance ToJSON MarketPrice where toJSON = genericToJSON defaultOptions
-instance ToJSON PostingType where toJSON = genericToJSON defaultOptions
+-- avoiding https://github.com/bos/aeson/issues/290 - no longer needed ?
+--instance ToJSON Status where toJSON = genericToJSON defaultOptions -- avoiding https://github.com/bos/aeson/issues/290
+--instance ToJSON GenericSourcePos where toJSON = genericToJSON defaultOptions
+--instance ToJSON Decimal where toJSON = toJSON . show
+--instance ToJSON Amount where toJSON = genericToJSON defaultOptions
+--instance ToJSON AmountStyle where toJSON = genericToJSON defaultOptions
+--instance ToJSON Side where toJSON = genericToJSON defaultOptions
+--instance ToJSON DigitGroupStyle where toJSON = genericToJSON defaultOptions
+--instance ToJSON MixedAmount where toJSON = genericToJSON defaultOptions
+--instance ToJSON BalanceAssertion where toJSON = genericToJSON defaultOptions
+--instance ToJSON Price where toJSON = genericToJSON defaultOptions
+--instance ToJSON MarketPrice where toJSON = genericToJSON defaultOptions
+--instance ToJSON PostingType where toJSON = genericToJSON defaultOptions
+--instance ToJSON Posting where
+-- toJSON Posting{..} =
+-- object
+-- ["pdate" .= toJSON pdate
+-- ,"pdate2" .= toJSON pdate2
+-- ,"pstatus" .= toJSON pstatus
+-- ,"paccount" .= toJSON paccount
+-- ,"pamount" .= toJSON pamount
+-- ,"pcomment" .= toJSON pcomment
+-- ,"ptype" .= toJSON ptype
+-- ,"ptags" .= toJSON ptags
+-- ,"pbalanceassertion" .= toJSON pbalanceassertion
+-- ,"ptransactionidx" .= toJSON (maybe "" (show.tindex) ptransaction)
+-- ]
+--instance ToJSON Transaction where toJSON = genericToJSON defaultOptions
+--instance ToJSON Account where
+-- toJSON a =
+-- object
+-- ["aname" .= toJSON (aname a)
+-- ,"aebalance" .= toJSON (aebalance a)
+-- ,"aibalance" .= toJSON (aibalance a)
+-- ,"anumpostings" .= toJSON (anumpostings a)
+-- ,"aboring" .= toJSON (aboring a)
+-- ,"aparentname" .= toJSON (maybe "" aname $ aparent a)
+-- ,"asubs" .= toJSON (map toJSON $ asubs a)
+-- ]
+
+-- Convert things to JSON for serving to clients
+instance ToJSON Status
+instance ToJSON GenericSourcePos
+instance ToJSON Decimal where toJSON = toJSON . show
+instance ToJSON Amount
+instance ToJSON AmountStyle
+instance ToJSON Side
+instance ToJSON DigitGroupStyle
+instance ToJSON MixedAmount
+instance ToJSON BalanceAssertion
+instance ToJSON Price
+instance ToJSON MarketPrice
+instance ToJSON PostingType
instance ToJSON Posting where
toJSON Posting{..} =
object
@@ -188,7 +233,7 @@ instance ToJSON Posting where
,"pbalanceassertion" .= toJSON pbalanceassertion
,"ptransactionidx" .= toJSON (maybe "" (show.tindex) ptransaction)
]
-instance ToJSON Transaction where toJSON = genericToJSON defaultOptions
+instance ToJSON Transaction
instance ToJSON Account where
toJSON a =
object
@@ -200,6 +245,8 @@ instance ToJSON Account where
,"aparentname" .= toJSON (maybe "" aname $ aparent a)
,"asubs" .= toJSON (map toJSON $ asubs a)
]
+
+-- convert things to Schema for swagger API description
instance ToSchema Status
instance ToSchema GenericSourcePos
instance ToSchema Decimal
diff --git a/hledger-api.info b/hledger-api.info
index b781e8c..c5e2916 100644
--- a/hledger-api.info
+++ b/hledger-api.info
@@ -3,7 +3,7 @@ This is hledger-api.info, produced by makeinfo version 6.5 from stdin.

File: hledger-api.info, Node: Top, Next: OPTIONS, Up: (dir)
-hledger-api(1) hledger-api 1.13
+hledger-api(1) hledger-api 1.14
*******************************
hledger-api is a simple web API server, intended to support client-side
diff --git a/hledger-api.txt b/hledger-api.txt
index ea98961..213913b 100644
--- a/hledger-api.txt
+++ b/hledger-api.txt
@@ -117,4 +117,4 @@ SEE ALSO
-hledger-api 1.13 February 2019 hledger-api(1)
+hledger-api 1.14 March 2019 hledger-api(1)