stripe-wreq 1.0.0.0 → 1.0.1.0
raw patch · 4 files changed
+44/−13 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Stripe.Wreq: delete' :: Session -> ApiSecretKey -> RequestApiVersion -> Delete -> IO WreqResponse
+ Stripe.Wreq: get' :: Session -> ApiSecretKey -> RequestApiVersion -> Get -> IO WreqResponse
+ Stripe.Wreq: post' :: Session -> ApiSecretKey -> RequestApiVersion -> Post -> IO WreqResponse
Files
- changelog.md +6/−0
- library/Stripe/Wreq.hs +34/−9
- license.txt +1/−1
- stripe-wreq.cabal +3/−3
changelog.md view
@@ -10,3 +10,9 @@ ## 1.0.0.0 - 2018-12-20 - Initial release++## 1.0.1.0 - 2019-09-30++New:++ - Functions `get'`, `post'`, `delete'` with a new `RequestApiVersion` parameter.
library/Stripe/Wreq.hs view
@@ -1,4 +1,4 @@-{-# OPTIONS_GHC -Wall #-}+{-# OPTIONS_GHC -Wall -fno-warn-missing-signatures #-} {- | Typical use of this module: @@ -11,11 +11,11 @@ ( -- * Request -- ** GET- get, Get (..)+ get, get', Get (..) -- ** POST- , post, Post (..)+ , post, post', Post (..) -- ** DELETE- , delete, Delete (..)+ , delete, delete', Delete (..) -- * Response , WreqResponse, Response (..)@@ -47,6 +47,7 @@ import Control.Monad ((>=>)) import qualified Data.Bifunctor import qualified Data.Semigroup+import Data.String (fromString) import Prelude hiding (userError) -- bytestring@@ -54,10 +55,10 @@ import qualified Data.ByteString.Lazy -- lens-import Control.Lens ((&), (.~), (?~), (^.))+import Control.Lens ((&), (.~), (?~), (^.), (<>~)) -- stripe-concepts-import Stripe.Concepts (ApiSecretKey (..))+import Stripe.Concepts (ApiSecretKey (..), RequestApiVersion (..), ApiVersion (..)) -- text import Data.Text (Text)@@ -182,25 +183,37 @@ } get :: Session -> ApiSecretKey -> Get -> IO WreqResponse-get session key x = Network.Wreq.Session.getWith opts session url+get session key x = get' session key DefaultApiVersion x++get' :: Session -> ApiSecretKey -> RequestApiVersion -> Get -> IO WreqResponse+get' session key v x = Network.Wreq.Session.getWith opts session url where url = makeUrl (getPath x) opts = wreqDefaults & Network.Wreq.auth ?~ auth key & Network.Wreq.params .~ (getParams x)+ & Network.Wreq.headers <>~ (requestApiVersionHeaders v) post :: Session -> ApiSecretKey -> Post -> IO WreqResponse-post session key x = Network.Wreq.Session.postWith opts session url params+post session key x = post' session key DefaultApiVersion x++post' :: Session -> ApiSecretKey -> RequestApiVersion -> Post -> IO WreqResponse+post' session key v x = Network.Wreq.Session.postWith opts session url params where url = makeUrl (postPath x) params = postParams x opts = wreqDefaults & Network.Wreq.auth ?~ auth key+ & Network.Wreq.headers <>~ (requestApiVersionHeaders v) delete :: Session -> ApiSecretKey -> Delete -> IO WreqResponse-delete session key x = Network.Wreq.Session.deleteWith opts session url+delete session key x = delete' session key DefaultApiVersion x++delete' :: Session -> ApiSecretKey -> RequestApiVersion -> Delete -> IO WreqResponse+delete' session key v x = Network.Wreq.Session.deleteWith opts session url where url = makeUrl (deletePath x) opts = wreqDefaults & Network.Wreq.auth ?~ auth key & Network.Wreq.params .~ (deleteParams x)+ & Network.Wreq.headers <>~ (requestApiVersionHeaders v) urlBase :: Text urlBase = Data.Text.pack "https://api.stripe.com/v1"@@ -213,6 +226,18 @@ wreqDefaults :: Network.Wreq.Options wreqDefaults = Network.Wreq.defaults & noCheckResponse++-- When using the default API version, no header is required.+requestApiVersionHeaders DefaultApiVersion = []++-- Overriding with a specific API version requires one header field.+requestApiVersionHeaders (OverrideApiVersion v) = [apiVersionHeader v]++-- The header field for specifying the API version.+apiVersionHeader (ApiVersion v) = (name, value)+ where+ name = fromString "Stripe-Version"+ value = fromString (Data.Text.unpack v) {- | Set a "response checker" that overrides Wreq's default one which causes exceptions to be thrown for non-2xx HTTP status codes -}
license.txt view
@@ -1,4 +1,4 @@-Copyright 2018 Typeclass Consulting, LLC+Copyright 2019 Typeclass Consulting, LLC Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in
stripe-wreq.cabal view
@@ -1,5 +1,5 @@ name: stripe-wreq-version: 1.0.0.0+version: 1.0.1.0 synopsis: Use the Stripe API via Wreq category: Web@@ -19,13 +19,13 @@ author: Chris Martin maintainer: Chris Martin, Julie Moronuki -copyright: 2018 Typeclass Consulting, LLC+copyright: 2019 Typeclass Consulting, LLC license: MIT license-file: license.txt build-type: Simple cabal-version: >=1.10-tested-with: GHC==8.2.2, GHC==8.4.3, GHC==8.6.1+tested-with: GHC==8.2.2, GHC==8.4.4, GHC==8.6.3 extra-source-files: changelog.md