-
-
Notifications
You must be signed in to change notification settings - Fork 71
Expand file tree
/
Copy pathEvent.hs
More file actions
87 lines (82 loc) · 2.77 KB
/
Copy pathEvent.hs
File metadata and controls
87 lines (82 loc) · 2.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE TypeFamilies #-}
-------------------------------------------
-- |
-- Module : Web.Stripe.Event
-- Copyright : (c) David Johnson, 2014
-- Maintainer : djohnson.m@gmail.com
-- Stability : experimental
-- Portability : POSIX
--
-- < https:/\/\stripe.com/docs/api#events >
--
-- @
-- {-\# LANGUAGE OverloadedStrings \#-}
-- import Web.Stripe
-- import Web.Stripe.Event
--
-- main :: IO ()
-- main = do
-- let config = StripeConfig (StripeKey "secret_key")
-- result <- stripe config $ getEvents
-- case result of
-- Right events -> print events
-- Left stripeError -> print stripeError
-- @
module Web.Stripe.Event
( -- * API
GetEvent
, getEvent
, GetEvents
, getEvents
-- * Types
, Created (..)
, EndingBefore (..)
, EventId (..)
, Event (..)
, EventData (..)
, EventType (..)
, StripeList (..)
, Limit (..)
, StartingAfter (..)
) where
import Web.Stripe.StripeRequest (Method (GET),
StripeHasParam, StripeRequest (..),
StripeReturn,
mkStripeRequest)
import Web.Stripe.Util ((</>))
import Web.Stripe.Types (Created(..), Event (..),
EventId (..), Limit,
EventData(..),
EventType(..), StripeList (..),
Limit(..), StartingAfter(..),
EndingBefore(..))
------------------------------------------------------------------------------
-- | `Event` to retrieve by `EventId`
getEvent
:: EventId -- ^ The ID of the Event to retrieve
-> StripeRequest GetEvent
getEvent (EventId eventid) = request
where request = mkStripeRequest GET url params
url = "events" </> eventid
params = []
data GetEvent
type instance StripeReturn GetEvent = Event
------------------------------------------------------------------------------
-- | `StripeList` of `Event`s to retrieve
getEvents
:: StripeRequest GetEvents
getEvents
= request
where request = mkStripeRequest GET url params
url = "events"
params = []
data GetEvents
type instance StripeReturn GetEvents = (StripeList Event)
instance StripeHasParam GetEvents Created
instance StripeHasParam GetEvents (EndingBefore EventId)
instance StripeHasParam GetEvents Limit
instance StripeHasParam GetEvents (StartingAfter EventId)
instance StripeHasParam GetEvents EventType