Added client for payouts endpoint.

[?]
Jan 15, 2015, 5:37 AM
4IQVQL4TS35GL2GYZJG254TKJLL5EHMRSFT77Z4VTRZIG2TMBM3QC

Dependencies

  • [2] W35DDBFY Factor common JSON conversions up into client lib module.
  • [3] 64C6AWH6 Rename Ananke -> Quixotic, project reboot.
  • [4] WZUHEZSB Start of migration back toward snap.
  • [*] 5W5M56VJ Move library code to 'lib'
  • [*] OBFPJS2G Project successfully builds and tests under nix.
  • [*] TCOAKCGG Completed conversion to snap.
  • [*] WO2MINIF Auctions now compile!

Change contents

  • file addition: Client.hs (----------)
    [6.18]
    {-# LANGUAGE ScopedTypeVariables, OverloadedStrings, NoImplicitPrelude #-}
    module Quixotic.Client where
    import ClassyPrelude
    import Control.Lens
    import Network.Wreq
    import Quixotic.Json
    import Quixotic.TimeLog
    data QCConfig = QCConfig
    { quixoticHost :: String
    , quixoticPort :: Int
    }
    currentPayouts :: QCConfig -> IO Payouts
    currentPayouts cfg = do
    resp <- get (quixoticHost cfg <> "/payouts")
    payoutsResponse <- asJSON resp
    pure . runPayoutsResponse $ payoutsResponse ^. responseBody
  • replacement in lib/Quixotic/Json.hs at line 15
    [2.273][2.273:323]()
    newtype PayoutsResponse = PayoutsResponse Payouts
    [2.273]
    [2.323]
    newtype PayoutsResponse = PayoutsResponse { runPayoutsResponse :: Payouts }
  • replacement in lib/Quixotic/Json.hs at line 18
    [2.362][2.362:484]()
    toJSON (PayoutsResponse p) = toJSON m where
    m :: Map Text Double
    m = fmap fromRational $ mapKeys (^. address) p
    [2.362]
    [2.484]
    toJSON (PayoutsResponse p) =
    toJSON $ mapKeys (^. address) p
  • edit in lib/Quixotic/Json.hs at line 21
    [2.485]
    [2.485]
    instance FromJSON PayoutsResponse where
    parseJSON v =
    fmap (PayoutsResponse . mapKeys BtcAddr) $ parseJSON v
  • edit in payouts/Main.hs at line 11
    [7.1745]
    [7.1745]
    import Quixotic.Client
  • replacement in quixotic.cabal at line 4
    [3.96][3.96:262]()
    Description: A service to enable groups of trusted contributors to be paid for their efforts
    in collaboratively developing commercial applications.
    [3.96]
    [3.262]
    Description: A time logging and payment distribution service to enable groups of trusted contributors
    to collaboratively develop commercial applications.
  • edit in quixotic.cabal at line 20
    [8.40]
    [3.585]
    Quixotic.Client
  • edit in quixotic.cabal at line 42
    [9.2111]
    [3.1311]
    , network-bitcoin
    , wreq