git.iko.soy/typeable/pagerduty
on develop help sign in
37 files changed+586−416
since splitsnapshots
unifiedsplit
.gitignore+1 .travis.yml+30 Makefile−20 README.md+14 pagerduty.cabal+32−21 script/generate-pages−25 script/travis-lifecycle-before_install+11 script/travis-lifecycle-install+13 script/travis-lifecycle-script+9 script/travis-timeout+15 script/upload-documentation−37 src/Control/Monad/Trans/PagerDuty.hs+28−31 src/Network/PagerDuty/Integration.hs+12−6 src/Network/PagerDuty/Internal/IO.hs+7−6 src/Network/PagerDuty/Internal/Options.hs+4−4 src/Network/PagerDuty/Internal/Query.hs+14−12 src/Network/PagerDuty/Internal/TH.hs+6−6 src/Network/PagerDuty/Internal/Types.hs+86−31 src/Network/PagerDuty/REST.hs+17−26 src/Network/PagerDuty/REST/Alerts.hs+7−7 src/Network/PagerDuty/REST/EscalationPolicies.hs+14−14 src/Network/PagerDuty/REST/EscalationPolicies/EscalationRules.hs+10−10 src/Network/PagerDuty/REST/Incidents.hs+20−24 src/Network/PagerDuty/REST/Incidents/Notes.hs+12−12 src/Network/PagerDuty/REST/LogEntries.hs+6−7 src/Network/PagerDuty/REST/MaintenanceWindows.hs+10−10 src/Network/PagerDuty/REST/Reports.hs+11−11 src/Network/PagerDuty/REST/Schedules.hs+14−14 src/Network/PagerDuty/REST/Schedules/Overrides.hs+12−12 src/Network/PagerDuty/REST/Services.hs+16−16 src/Network/PagerDuty/REST/Services/EmailFilters.hs+14−14 src/Network/PagerDuty/REST/Users.hs+17−17 src/Network/PagerDuty/REST/Users/ContactMethods.hs+10−10 src/Network/PagerDuty/REST/Users/NotificationRules.hs+10−10 src/Network/PagerDuty/REST/Webhooks.hs+4−3 src/Network/PagerDuty/Types.hs+93 stack.yaml+7
.gitignore+1
@@ -9,6 +9,7 @@
99cabal.sandbox.config
1010
1111# Dirs
12+.stack-work
1213cabal-dev
1314bin
1415dist
.travis.ymlnew file+30
@@ -0,0 +1,30 @@
1+sudo: false
2+
3+cache:
4+ apt: true
5+ directories:
6+ - ~/.stack
7+
8+branches:
9+ only:
10+ - master
11+ - develop
12+
13+before_install:
14+ - export PATH=/opt/ghc/$GHCVER/bin:$PATH
15+ - export PATH=~/.local/bin:$PATH
16+ - ./script/travis-lifecycle-before_install
17+
18+install:
19+ - ./script/travis-lifecycle-install
20+
21+script:
22+ - ./script/travis-lifecycle-script
23+
24+matrix:
25+ fast_finish: true
26+ include:
27+ - env: GHCVER=8.0.1
28+ addons: { apt: { packages: [ghc-8.0.1], sources: [hvr-ghc] } }
29+ - env: GHCVER=7.10.3
30+ addons: { apt: { packages: [ghc-7.10.3], sources: [hvr-ghc] } }
Makefiledeleted−20
@@ -1,20 +0,0 @@
1−FLAGS := -j --disable-documentation --disable-library-coverage
2−
3−build:
4− cabal build $(addprefix -,$(findstring j,$(MAKEFLAGS)))
5−
6−all:
7− make clean; make install && make build
8−
9−install: cabal.sandbox.config
10− cabal install $(FLAGS) --only-dependencies
11−
12−clean:
13− cabal clean
14− rm -rf cabal.sandbox.config .cabal-sandbox
15−
16−doc:
17− cabal haddock
18−
19−cabal.sandbox.config:
20− cabal sandbox init
README.md+14
@@ -0,0 +1,14 @@
1+# PagerDuty
2+
3+[![Build Status](https://travis-ci.org/brendanhay/amazonka.svg?branch=develop)](https://travis-ci.org/brendanhay/pagerduty)
4+
5+* [Contribute](#contribute)
6+* [Licence](#licence)
7+
8+## Contribute
9+
10+For any problems, comments, or feedback please create an issue [here on GitHub](https://github.com/brendanhay/pagerduty/issues).
11+
12+## Licence
13+
14+PagerDuty is released under the [Mozilla Public License Version 2.0](http://www.mozilla.org/MPL/).
pagerduty.cabal+32−21
@@ -1,23 +1,32 @@
11name: pagerduty
2−version: 0.0.0
3−synopsis: Pager Duty API Client
2+version: 0.0.8
3+synopsis: Client library for PagerDuty Integration and REST APIs.
44homepage: http://github.com/brendanhay/pagerduty
55license: OtherLicense
66license-file: LICENSE
77author: Brendan Hay
88maintainer: Brendan Hay <brendan.g.hay@gmail.com>
9−copyright: Copyright (c) 2013-2014 Brendan Hay, 2014 Kim Altintop
10−category: Network, Monitoring, Alerting
9+copyright: Copyright (c) 2013-2015 Brendan Hay, 2014 Kim Altintop
10+category: Network, PagerDuty, Monitoring
1111build-type: Simple
1212cabal-version: >= 1.10
1313
1414description:
15− Client library for the the PagerDuty REST APIs documented here:
15+ PagerDuty is an alerting system for IT professionals. PagerDuty connects
16+ with a variety of systems (including monitoring tools and ticketing
17+ systems) and dispatches alerts via automated phone call, SMS and email.
18+
19+ This library implements the full PagerDuty Integration and REST APIs which
20+ are documented here:
1621 .
1722 * Integration API - <http://developer.pagerduty.com/documentation/integration>
23+ .
1824 * REST API - <http://developer.pagerduty.com/documentation/rest>
1925 .
20− /Warning:/ This is a /highly/ experimental preview release, caveat emptor!
26+ /Warning:/ This is an experimental preview release which is still under
27+ heavy development and not intended for public consumption, caveat emptor!
28+ .
29+ /Note:/ An alternative source for Haddock documentation can be found <http://brendanhay.nz/pagerduty here>.
2130
2231extra-source-files:
2332 README.md
@@ -59,28 +68,30 @@ library
5968 , Network.PagerDuty.Internal.Query
6069 , Network.PagerDuty.Internal.TH
6170 , Network.PagerDuty.Internal.Types
71+ , Network.PagerDuty.Types
6272
6373 build-depends:
64− aeson > 0.7 && <= 0.8
65− , base >= 4.5 && < 5.0
66− , bifunctors >= 4
74+ aeson >= 2.0
75+ , base >= 4.7 && < 5
76+ , bifunctors >= 4.1
6777 , bytestring >= 0.9
6878 , bytestring-conversion >= 0.2.1
69− , conduit >= 0.5.5
79+ , conduit > 1.1
7080 , data-default-class >= 0.0.1
7181 , exceptions >= 0.6
72− , generics-sop >= 0.1.0.2
73− , http-client >= 0.3.6
82+ , generics-sop >= 0.5.0.0
83+ , http-client >= 0.5 && < 1
7484 , http-types >= 0.8
75− , lens >= 4.0
76− , lens-aeson >= 1.0
77− , mmorph >= 1.0
78− , monad-control >= 0.3.2
79− , mtl >= 2.2.1
80− , old-locale >= 1.0.0.5
85+ , lens >= 4.4
86+ , lens-aeson >= 1
87+ , mmorph >= 1
88+ , monad-control >= 1
89+ , mtl >= 2.1.3.1
8190 , template-haskell >= 2.2
8291 , text >= 1.1
83− , time == 1.4.*
84− , transformers >= 0.4.1
85− , transformers-base >= 0.4.1
92+ , time >= 1.2
93+ , time-locale-compat >= 0.1.0.1
94+ , transformers >= 0.2
95+ , transformers-compat >= 0.3
96+ , transformers-base >= 0.4.2
8697 , unordered-containers >= 0.2.3
script/generate-pagesdeleted−25
@@ -1,25 +0,0 @@
1−#!/usr/bin/env bash
2−
3−set -e
4−set -x
5−set -o errexit
6−
7−branch=$(git symbolic-ref -q HEAD)
8−branch=${branch##refs/heads/}
9−branch=${branch:-HEAD}
10−
11−cabal configure --disable-tests
12−
13−DOCDIR=`mktemp -d -t pages.XXXXXX`
14−cabal haddock --haddock-option=-o$DOCDIR
15−
16−HEAD=`git rev-parse HEAD`
17−
18−git checkout gh-pages
19−
20−mv $DOCDIR/* .
21−
22−git add *.html *.js *.css *.gif *.png
23−git commit -m "Generated documentation from $HEAD on $branch"
24−git push origin gh-pages
25−git checkout $branch
script/travis-lifecycle-before_installnew file+11
@@ -0,0 +1,11 @@
1+#!/usr/bin/env bash
2+
3+set -e
4+
5+mkdir -p ~/.local/bin
6+
7+curl -L https://www.stackage.org/stack/linux-x86_64 | \
8+ tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack'
9+
10+ghc --version
11+stack --version
script/travis-lifecycle-installnew file+13
@@ -0,0 +1,13 @@
1+#!/usr/bin/env bash
2+
3+set -e
4+
5+GHCVER=${GHCVER?"GHCVER needs to be set."}
6+
7+path=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)
8+
9+$path/travis-timeout \
10+ stack --no-terminal --skip-ghc-check --stack-yaml stack-$GHCVER.yaml setup
11+
12+$path/travis-timeout \
13+ stack --no-terminal --skip-ghc-check --stack-yaml stack-$GHCVER.yaml test pagerduty --only-snapshot
script/travis-lifecycle-scriptnew file+9
@@ -0,0 +1,9 @@
1+#!/usr/bin/env bash
2+
3+set -e
4+
5+GHCVER=${GHCVER?"GHCVER needs to be set."}
6+
7+path=$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)
8+
9+stack --no-terminal --skip-ghc-check --stack-yaml stack-$GHCVER.yaml test pagerduty
script/travis-timeoutnew file+15
@@ -0,0 +1,15 @@
1+#!/usr/bin/env bash
2+
3+$* &
4+pidA=$!
5+minutes=0
6+
7+while true; do sleep 60; ((minutes++)); echo -e "\033[0;32m$minutes minute(s) elapsed running '$*'\033[0m."; done &
8+pidB=$!
9+wait $pidA
10+resA=$?
11+
12+echo -e "\033[0;32m'$*' exited with status ${resA}.\033[0m"
13+kill -9 $pidB
14+
15+exit $resA
script/upload-documentationdeleted−37
@@ -1,37 +0,0 @@
1−#!/usr/bin/env bash
2−
3−set -e
4−
5−package=${PWD##*/}
6−
7−echo "Package: ${package}"
8−read -p "Version: " version
9−read -p "Hackage user: " user
10−read -sp "Hackage password (not echoed): " password
11−
12−echo
13−echo "BUILDING"
14−echo
15−
16−cabal configure
17−cabal build
18−cabal haddock \
19− --hyperlink-source \
20− --html-location='/package/$pkg-$version/docs' \
21− --contents-location='/package/$pkg'
22−
23−echo
24−echo "ARCHIVING"
25−echo
26−
27−cd dist/doc/html
28−DDIR="${package}-${version}-docs"
29−cp -r "${package}" "${DDIR}" && gtar -c -v -z -Hustar -f "${DDIR}.tar.gz" "${DDIR}"
30−
31−echo
32−echo "UPLOADING"
33−echo
34−
35−curl -X PUT -H 'Content-Type: application/x-tar' \
36− -H 'Content-Encoding: gzip' --data-binary "@${DDIR}.tar.gz" \
37− "http://${user}:${password}@hackage.haskell.org/package/${package}-${version}/docs"
src/Control/Monad/Trans/PagerDuty.hs+28−31
@@ -2,15 +2,12 @@
22{-# LANGUAGE FlexibleContexts #-}
33{-# LANGUAGE FlexibleInstances #-}
44{-# LANGUAGE GeneralizedNewtypeDeriving #-}
5−{-# LANGUAGE KindSignatures #-}
65{-# LANGUAGE MultiParamTypeClasses #-}
7−{-# LANGUAGE RecordWildCards #-}
8−{-# LANGUAGE TemplateHaskell #-}
96{-# LANGUAGE TypeFamilies #-}
107{-# LANGUAGE UndecidableInstances #-}
118
129-- Module : Control.Monad.Trans.PagerDuty
13−-- Copyright : (c) 2013-2014 Brendan Hay <brendan.g.hay@gmail.com>
10+-- Copyright : (c) 2013-2015 Brendan Hay <brendan.g.hay@gmail.com>
1411-- License : This Source Code Form is subject to the terms of
1512-- the Mozilla Public License, v. 2.0.
1613-- A copy of the MPL can be found in the LICENSE file or
@@ -25,37 +22,41 @@ module Control.Monad.Trans.PagerDuty
2522 PagerDuty
2623 , PagerDutyT
2724
28− -- * Run
25+ -- * Running
2926 , runPagerDutyT
3027
31− -- * Environment
32− , Env
33− , envDomain
34− , envAuth
35− , envManager
36− , envLogger
37−
38− -- * Integration API
28+ -- * Integration events
3929 , submit
30+ , submitCatch
4031
41− -- * REST API
32+ -- * REST requests
4233 , send
34+ , sendCatch
4335 , paginate
36+ , paginateCatch
37+
38+ -- ** Lifting errors
39+ , hoistError
40+
41+ , module Network.PagerDuty.Types
4442 ) where
4543
4644import Control.Applicative
45+import Control.Monad
4746import Control.Monad.Base
4847import Control.Monad.Catch
49−import Control.Monad.Except
48+import Control.Monad.Except (MonadError (..))
5049import Control.Monad.Morph
5150import Control.Monad.Reader
5251import Control.Monad.Trans.Control
52+import Control.Monad.Trans.Except
5353import Data.Aeson
5454import Data.Conduit
5555import Network.PagerDuty.Integration (Event, Response)
5656import qualified Network.PagerDuty.Integration as Int
5757import Network.PagerDuty.Internal.Types
5858import qualified Network.PagerDuty.REST as REST
59+import Network.PagerDuty.Types
5960
6061-- | A convenient alias for 'PagerDutyT' 'IO'.
6162type PagerDuty s = PagerDutyT s IO
@@ -82,28 +83,24 @@ instance MonadBase b m => MonadBase b (PagerDutyT s m) where
8283 {-# INLINE liftBase #-}
8384
8485instance MonadTransControl (PagerDutyT s) where
85− newtype StT (PagerDutyT s) a = StTPDT
86− { unStT :: StT (ExceptT Error) (StT (ReaderT (Env s)) a)
87− }
86+ type StT (PagerDutyT s) a = StT (ExceptT Error) (StT (ReaderT (Env s)) a)
8887
8988 liftWith f = PagerDutyT $
9089 liftWith $ \g ->
91− liftWith $ \h ->
92− f (liftM StTPDT . h . g . unPagerDutyT)
90+ liftWith $ \h ->
91+ f (h . g . unPagerDutyT)
9392 {-# INLINE liftWith #-}
9493
95− restoreT = PagerDutyT . restoreT . restoreT . liftM unStT
94+ restoreT = PagerDutyT . restoreT . restoreT
9695 {-# INLINE restoreT #-}
9796
9897instance MonadBaseControl b m => MonadBaseControl b (PagerDutyT s m) where
99− newtype StM (PagerDutyT s m) a = StMPDT
100− { unStMPDT :: ComposeSt (PagerDutyT s) m a
101− }
98+ type StM (PagerDutyT s m) a = ComposeSt (PagerDutyT s) m a
10299
103− liftBaseWith = defaultLiftBaseWith StMPDT
100+ liftBaseWith = defaultLiftBaseWith
104101 {-# INLINE liftBaseWith #-}
105102
106− restoreM = defaultRestoreM unStMPDT
103+ restoreM = defaultRestoreM
107104 {-# INLINE restoreM #-}
108105
109106instance MFunctor (PagerDutyT s) where
@@ -117,8 +114,8 @@ instance MMonad (PagerDutyT s) where
117114runPagerDutyT :: PagerDutyT s m a -> Env s -> m (Either Error a)
118115runPagerDutyT (PagerDutyT k) = runExceptT . runReaderT k
119116
120−hoistEither :: (MonadError Error m) => Either Error a -> m a
121−hoistEither = either throwError return
117+hoistError :: (MonadError Error m) => Either Error a -> m a
118+hoistError = either throwError return
122119
123120scoped :: MonadReader (Env s) m => (Env s -> m a) -> m a
124121scoped f = ask >>= f
@@ -129,7 +126,7 @@ submit :: ( MonadIO m
129126 )
130127 => Event
131128 -> m Response
132−submit = submitCatch >=> hoistEither
129+submit = submitCatch >=> hoistError
133130
134131submitCatch :: ( MonadIO m
135132 , MonadReader (Env s) m
@@ -145,7 +142,7 @@ send :: ( MonadIO m
145142 )
146143 => Request a s b
147144 -> m b
148−send = sendCatch >=> hoistEither
145+send = sendCatch >=> hoistError
149146
150147sendCatch :: ( MonadIO m
151148 , MonadReader (Env s) m
@@ -163,7 +160,7 @@ paginate :: ( MonadIO m
163160 )
164161 => Request a s b
165162 -> Source m b
166−paginate x = paginateCatch x $= awaitForever (hoistEither >=> yield)
163+paginate x = paginateCatch x $= awaitForever (hoistError >=> yield)
167164
168165paginateCatch :: ( MonadIO m
169166 , MonadReader (Env s) m
src/Network/PagerDuty/Integration.hs+12−6
@@ -6,7 +6,7 @@
66{-# LANGUAGE TemplateHaskell #-}
77
88-- Module : Network.PagerDuty.Integration
9−-- Copyright : (c) 2013-2014 Brendan Hay <brendan.g.hay@gmail.com>
9+-- Copyright : (c) 2013-2015 Brendan Hay <brendan.g.hay@gmail.com>
1010-- License : This Source Code Form is subject to the terms of
1111-- the Mozilla Public License, v. 2.0.
1212-- A copy of the MPL can be found in the LICENSE file or
@@ -38,7 +38,7 @@
3838-- /See:/ <http://developer.pagerduty.com/documentation/integration/events>
3939module Network.PagerDuty.Integration
4040 (
41− -- * Events
41+ -- * Sending events
4242 submit
4343 , submitWith
4444
@@ -72,19 +72,23 @@ module Network.PagerDuty.Integration
7272 , rsStatus
7373 , rsMessage
7474 , rsIncidentKey
75+
76+ , Generic
77+
78+ , module Network.PagerDuty.Types
7579 ) where
7680
7781import Control.Lens
7882import Control.Monad.IO.Class
7983import Data.Aeson
80−import Data.Default.Class
81−import qualified Data.HashMap.Strict as Map
84+import qualified Data.Aeson.KeyMap as Map
8285import Data.Text (Text)
8386import Network.HTTP.Client (Manager)
8487import qualified Network.HTTP.Client as Client
8588import Network.PagerDuty.Internal.IO
8689import Network.PagerDuty.Internal.TH
8790import Network.PagerDuty.Internal.Types
91+import Network.PagerDuty.Types hiding (description, message)
8892
8993data Response = Response
9094 { _rsStatus :: Text
@@ -287,6 +291,8 @@ submitWith :: MonadIO m
287291 -> Event
288292 -> m (Either Error Response)
289293submitWith m l e = request m l e $
290− def { Client.host = "events.pagerduty.com"
291− , Client.path = "/generic/2010-04-15/create_event.json"
294+ Client.defaultRequest
295+ { Client.host = "events.pagerduty.com"
296+ , Client.path = "/generic/2010-04-15/create_event.json"
297+ , Client.method = "POST"
292298 }
src/Network/PagerDuty/Internal/IO.hs+7−6
@@ -2,7 +2,7 @@
22{-# LANGUAGE ScopedTypeVariables #-}
33
44-- Module : Network.PagerDuty.Internal.IO
5−-- Copyright : (c) 2013-2014 Brendan Hay <brendan.g.hay@gmail.com>
5+-- Copyright : (c) 2013-2015 Brendan Hay <brendan.g.hay@gmail.com>
66-- License : This Source Code Form is subject to the terms of
77-- the Mozilla Public License, v. 2.0.
88-- A copy of the MPL can be found in the LICENSE file or
@@ -60,12 +60,13 @@ response l rs = case statusCode (Client.responseStatus rs) of
6060 success = maybe (Left unknown) Right `liftM` parse
6161 failure = maybe (Left unknown) Left `liftM` parse
6262
63− unhandled n = Internal
64− $ "PagerDuty returned unhandled status code: " ++ show n
63+ unhandled n = Internal $
64+ "PagerDuty returned unhandled status code: "
65+ <> Text.pack (show n)
6566
66− unknown = Internal
67− $ "Unable to parse response into a PagerDuty API compatible type: "
68− ++ show body
67+ unknown = Internal $
68+ "Unable to parse response into a PagerDuty API compatible type: "
69+ <> Text.pack (show body)
6970
7071 parse :: FromJSON a => m (Maybe a)
7172 parse = msg >> return (decode body)
src/Network/PagerDuty/Internal/Options.hs+4−4
@@ -1,5 +1,5 @@
11-- Module : Network.PagerDuty.Internal.Options
2−-- Copyright : (c) 2013-2014 Brendan Hay <brendan.g.hay@gmail.com>
2+-- Copyright : (c) 2013-2015 Brendan Hay <brendan.g.hay@gmail.com>
33-- License : This Source Code Form is subject to the terms of
44-- the Mozilla Public License, v. 2.0.
55-- A copy of the MPL can be found in the LICENSE file or
@@ -14,9 +14,9 @@ module Network.PagerDuty.Internal.Options
1414 , underscored
1515 ) where
1616
17−import Data.Aeson.Types
18−import Data.Char
19−import Data.List
17+import Data.Aeson.Types
18+import Data.Char
19+import Data.List
2020
2121dropped :: Int -> Options -> Options
2222dropped n o = o
src/Network/PagerDuty/Internal/Query.hs+14−12
@@ -1,12 +1,13 @@
11{-# LANGUAGE ConstraintKinds #-}
22{-# LANGUAGE DefaultSignatures #-}
3+{-# LANGUAGE FlexibleContexts #-}
34{-# LANGUAGE GADTs #-}
45{-# LANGUAGE OverloadedStrings #-}
56{-# LANGUAGE ScopedTypeVariables #-}
67{-# LANGUAGE TupleSections #-}
78
89-- Module : Network.PagerDuty.Internal.Query
9−-- Copyright : (c) 2013-2014 Brendan Hay <brendan.g.hay@gmail.com>
10+-- Copyright : (c) 2013-2015 Brendan Hay <brendan.g.hay@gmail.com>
1011-- License : This Source Code Form is subject to the terms of
1112-- the Mozilla Public License, v. 2.0.
1213-- A copy of the MPL can be found in the LICENSE file or
@@ -23,14 +24,14 @@ module Network.PagerDuty.Internal.Query
2324
2425import Data.Aeson.Types
2526import Data.Bifunctor
26−import Data.ByteString (ByteString)
27−import qualified Data.ByteString.Char8 as BS
27+import Data.ByteString (ByteString)
28+import qualified Data.ByteString.Char8 as BS
2829import Data.ByteString.Conversion
29−import Data.Function (on)
30−import Data.List (groupBy)
31−import Data.Monoid ((<>))
32−import Data.Text (Text)
33−import qualified Data.Text.Encoding as Text
30+import Data.Function (on)
31+import Data.List (groupBy)
32+import Data.Monoid ((<>))
33+import Data.Text (Text)
34+import qualified Data.Text.Encoding as Text
3435import Generics.SOP
3536import Network.HTTP.Types
3637import Network.PagerDuty.Internal.Options
@@ -58,14 +59,15 @@ gqueryWith :: forall a. (Generic a, HasDatatypeInfo a, All2 QueryValues (Code a)
5859 -> a
5960 -> Query
6061gqueryWith o a = case datatypeInfo (Proxy :: Proxy a) of
61− ADT _ _ cs -> go cs (from a)
62− Newtype _ _ c -> go (c :* Nil) (from a)
62+ ADT _ _ cs _ -> go cs (from a)
63+ Newtype _ _ c -> go (c :* Nil) (from a)
6364 where
64− go :: (All2 QueryValues xss, SingI xss)
65+ go :: (All2 QueryValues xss, SListI xss)
6566 => NP ConstructorInfo xss
6667 -> SOP I xss
6768 -> Query
68− go cs (SOP sop) = group . unI . hcollapse $ hcliftA2' p (gctor o) cs sop
69+ go cs (SOP sop) =
70+ group . hcollapse $ hcliftA2' p (gctor o) cs sop
6971
7072 group :: [(ByteString, ByteString)] -> Query
7173 group = concatMap f . groupBy ((==) `on` fst)
src/Network/PagerDuty/Internal/TH.hs+6−6
@@ -1,7 +1,7 @@
11{-# LANGUAGE TemplateHaskell #-}
22
33-- Module : Network.PagerDuty.Internal.TH
4−-- Copyright : (c) 2013-2014 Brendan Hay <brendan.g.hay@gmail.com>
4+-- Copyright : (c) 2013-2015 Brendan Hay <brendan.g.hay@gmail.com>
55-- License : This Source Code Form is subject to the terms of
66-- the Mozilla Public License, v. 2.0.
77-- A copy of the MPL can be found in the LICENSE file or
@@ -40,15 +40,15 @@ module Network.PagerDuty.Internal.TH
4040
4141import Control.Applicative
4242import Control.Lens
43−import qualified Data.Aeson.TH as Aeson
43+import qualified Data.Aeson.TH as Aeson
4444import Data.Aeson.Types
45−import Data.ByteString (ByteString)
46−import qualified Data.Text.Encoding as Text
45+import Data.ByteString (ByteString)
46+import qualified Data.Text.Encoding as Text
4747import Generics.SOP.TH
4848import Language.Haskell.TH
4949import Network.HTTP.Types.QueryLike
50−import Network.PagerDuty.Internal.Query
5150import Network.PagerDuty.Internal.Options
51+import Network.PagerDuty.Internal.Query
5252
5353jsonRequest :: Name -> Q [Dec]
5454jsonRequest n = concat <$> sequence
@@ -61,7 +61,7 @@ queryRequest :: Name -> Q [Dec]
6161queryRequest n = concat <$> sequence
6262 [ deriveGeneric n
6363 , makeLenses n
64− , [d|instance ToJSON $(conT n) where toJSON = const (toJSON (object []))|]
64+ , [d|instance ToJSON $(conT n) where toJSON = const emptyObject|]
6565 , [d|instance QueryLike $(conT n) where toQuery = gquery|]
6666 ]
6767
src/Network/PagerDuty/Internal/Types.hs+86−31
@@ -1,9 +1,11 @@
11{-# LANGUAGE BangPatterns #-}
22{-# LANGUAGE DataKinds #-}
33{-# LANGUAGE FlexibleInstances #-}
4+{-# LANGUAGE FunctionalDependencies #-}
45{-# LANGUAGE GADTs #-}
56{-# LANGUAGE GeneralizedNewtypeDeriving #-}
67{-# LANGUAGE KindSignatures #-}
8+{-# LANGUAGE MultiParamTypeClasses #-}
79{-# LANGUAGE OverloadedStrings #-}
810{-# LANGUAGE PatternSynonyms #-}
911{-# LANGUAGE RankNTypes #-}
@@ -13,7 +15,7 @@
1315{-# LANGUAGE ViewPatterns #-}
1416
1517-- Module : Network.PagerDuty.Internal.Types
16−-- Copyright : (c) 2013-2014 Brendan Hay <brendan.g.hay@gmail.com>
18+-- Copyright : (c) 2013-2015 Brendan Hay <brendan.g.hay@gmail.com>
1719-- License : This Source Code Form is subject to the terms of
1820-- the Mozilla Public License, v. 2.0.
1921-- A copy of the MPL can be found in the LICENSE file or
@@ -25,35 +27,33 @@
2527module Network.PagerDuty.Internal.Types where
2628
2729import Control.Applicative
28−import Control.Lens hiding ((.=))
30+import Control.Lens hiding ((.=), Empty)
2931import Control.Monad.IO.Class
30−import Data.Aeson hiding (Error)
32+import Data.Aeson hiding (Error, Key)
33+import qualified Data.Aeson.KeyMap as Map
3134import Data.Aeson.Types (Parser)
3235import Data.ByteString (ByteString)
3336import qualified Data.ByteString.Char8 as BS
3437import Data.ByteString.Conversion hiding (List)
3538import Data.Default.Class
3639import Data.Function (on)
37−import qualified Data.HashMap.Strict as Map
3840import Data.List (deleteBy, intersperse)
3941import Data.Monoid
4042import Data.String
4143import Data.Text (Text)
4244import qualified Data.Text as Text
4345import qualified Data.Text.Encoding as Text
44−import Data.Time
46+import Data.Time (UTCTime, TimeZone, formatTime, utc, timeZoneName)
4547import GHC.TypeLits
4648import Network.HTTP.Client (Manager)
4749import Network.HTTP.Types
4850import Network.HTTP.Types.QueryLike
4951import Network.PagerDuty.Internal.Query
5052import Network.PagerDuty.Internal.TH
51−import System.Locale
52−
53−-- FIXME: Verify IncidentId/IncidentKey .. *Id/*Key are actually different or needed
53+import Data.Time.Locale.Compat
5454
5555newtype CSV a = CSV [a]
56− deriving (Eq, Show, Monoid)
56+ deriving (Eq, Show, Semigroup, Monoid)
5757
5858makePrisms ''CSV
5959
@@ -70,7 +70,7 @@ instance ToByteString a => ToJSON (CSV a) where
7070 toJSON = String . Text.decodeUtf8 . toByteString'
7171
7272newtype List a = L [a]
73− deriving (Eq, Show, Monoid)
73+ deriving (Eq, Show, Semigroup, Monoid)
7474
7575deriveJSON ''List
7676makePrisms ''List
@@ -106,7 +106,7 @@ instance ToJSON Date where
106106
107107instance ToByteString Date where
108108 builder (D d) = builder
109− (formatTime defaultTimeLocale (iso8601DateFormat $ Just "%XZ") d)
109+ (formatTime defaultTimeLocale ("%Y-%m-%dT%XZ") d)
110110
111111instance QueryValues Date
112112
@@ -133,14 +133,17 @@ data Security = Basic | Token
133133 deriving (Eq, Show)
134134
135135data Auth (a :: Security) where
136− AuthBasic :: ByteString -> ByteString -> Auth Basic
137− AuthToken :: ByteString -> Auth Token
136+ AuthBasic :: ByteString -> ByteString -> Auth 'Basic
137+ AuthToken :: ByteString -> Auth 'Token
138138
139139deriving instance Eq (Auth a)
140140deriving instance Show (Auth a)
141141
142142newtype SubDomain = SubDomain { subDomain :: ByteString }
143− deriving (Eq, Show, IsString)
143+ deriving (Eq, Show, IsString, ToByteString)
144+
145+mkSubDomain :: ByteString -> SubDomain
146+mkSubDomain = SubDomain
144147
145148domain :: SubDomain -> ByteString
146149domain (SubDomain s)
@@ -177,7 +180,7 @@ prod :: SubDomain -> Auth s -> Manager -> Env s
177180prod d a m = Env d a m None
178181
179182newtype Code = Code Integer
180− deriving (Eq, Show)
183+ deriving (Eq, Show, Num)
181184
182185deriveJSON ''Code
183186
@@ -199,6 +202,15 @@ description (Code c) =
199202 2012 -> "Your account is expired and cannot use the API"
200203 _ -> "Unrecognised error code"
201204
205+class HasMessage s a | s -> a where
206+ -- | A short human-readable message describing the error.
207+ message :: Lens' s a
208+
209+class HasErrors s a | s -> a where
210+ -- | A list of human-readable reasons for the error. These values,
211+ -- and even their format, are subject to change.
212+ errors :: Lens' s a
213+
202214data IntegrationError = IntegrationError
203215 { _ieStatus :: Text
204216 , _ieMessage :: Text
@@ -207,26 +219,53 @@ data IntegrationError = IntegrationError
207219
208220deriveRecord ''IntegrationError
209221
210−data RestError = RestError
222+instance HasMessage IntegrationError Text where message = ieMessage
223+instance HasErrors IntegrationError [Text] where errors = ieErrors
224+
225+status :: Lens' IntegrationError Text
226+status = ieStatus
227+
228+data RESTError = RESTError
211229 { _reCode :: Code
212230 , _reMessage :: Text
213231 , _reErrors :: [Text]
214232 } deriving (Eq, Show)
215233
216−deriveRecord ''RestError
234+deriveRecord ''RESTError
235+
236+instance HasMessage RESTError Text where message = reMessage
237+instance HasErrors RESTError [Text] where errors = reErrors
238+
239+-- | In the case of an error, the PagerDuty error code can give further details
240+-- on the nature of the error.
241+--
242+-- /See:/ 'description'
243+code :: Lens' RESTError Code
244+code = reCode
217245
218246data Error
219− = Internal String
247+ = Internal Text
220248 | Integration IntegrationError
221− | Rest RestError
249+ | REST RESTError
222250 deriving (Eq, Show)
223251
224252instance FromJSON Error where
225− parseJSON o = (Rest <$> parseJSON o)
253+ parseJSON o = (REST <$> parseJSON o)
226254 <|> (Integration <$> parseJSON o)
227255
228256makePrisms ''Error
229257
258+instance HasMessage Error Text where
259+ message = lens f g
260+ where
261+ f (Internal x) = x
262+ f (Integration s) = _ieMessage s
263+ f (REST s) = _reMessage s
264+
265+ g (Internal _) x = Internal x
266+ g (Integration s) x = Integration $ s { _ieMessage = x }
267+ g (REST s) x = REST $ s { _reMessage = x }
268+
230269data Pager = Pager
231270 { _pgOffset :: !Int
232271 -- ^ The offset used in the execution of the query.
@@ -240,8 +279,13 @@ data Pager = Pager
240279
241280makeLenses ''Pager
242281
243−instance FromJSON a => FromJSON (a, Maybe Pager) where
244− parseJSON = withObject "paginated" $ \o -> (,)
282+data Page a = Page
283+ { _pgItem :: a
284+ , _pgPager :: Maybe Pager
285+ }
286+
287+instance FromJSON a => FromJSON (Page a) where
288+ parseJSON = withObject "paginated" $ \o -> Page
245289 <$> parseJSON (Object o)
246290 <*> optional (parse o)
247291 where
@@ -266,11 +310,13 @@ data Path where
266310 Path :: Path
267311 Seg :: ToByteString a => a -> Path
268312
313+instance Semigroup Path where
314+ x <> Path = x
315+ Path <> y = y
316+ Seg x <> Seg y = Seg (builder x <> "/" <> builder y)
317+
269318instance Monoid Path where
270− mempty = Path
271− mappend x Path = x
272− mappend Path y = y
273− mappend (Seg x) (Seg y) = Seg (builder x <> "/" <> builder y)
319+ mempty = Path
274320
275321instance IsString Path where
276322 fromString = Seg
@@ -347,13 +393,13 @@ class Paginate a where
347393 next :: Request a s b -> Maybe Pager -> Maybe (Request a s b)
348394 next rq = maybe Nothing go
349395 where
350− go x | x^.pgTotal == 0 = Nothing
351− | otherwise = Just $
352− rq & pager ?~ (x & pgOffset +~ x^.pgTotal)
396+ go x | x ^. pgTotal == 0 = Nothing
397+ | otherwise = Just $
398+ rq & pager ?~ (x & pgOffset +~ x ^. pgTotal)
353399 & query %~ (add . clear)
354400 where
355401 add :: Query -> Query
356− add = maybe id ((:) . (k,) . Just . Text.encodeUtf8) (x^.pgQuery)
402+ add = maybe id ((:) . (k,) . Just . Text.encodeUtf8) (x ^. pgQuery)
357403
358404 clear :: Query -> Query
359405 clear = deleteBy ((==) `on` fst) (k, Nothing)
@@ -364,6 +410,9 @@ class Paginate a where
364410newtype Key (a :: Symbol) = Key Text
365411 deriving (Eq, Show, IsString)
366412
413+mkKey :: Text -> Key a
414+mkKey = Key
415+
367416instance FromJSON (Key a) where
368417 parseJSON = withText "key" (return . Key)
369418
@@ -384,6 +433,9 @@ type IncidentKey = Key "incident"
384433newtype Id (a :: Symbol) = Id Text
385434 deriving (Eq, Show, IsString)
386435
436+mkId :: Text -> Id a
437+mkId = Id
438+
387439instance FromJSON (Id a) where
388440 parseJSON = withText "id" (return . Id)
389441
@@ -431,7 +483,10 @@ instance QueryLike Empty where
431483 toQuery = const []
432484
433485newtype Address = Address Text
434− deriving (Eq, Show)
486+ deriving (Eq, Show, IsString)
487+
488+mkAddress :: Text -> Address
489+mkAddress = Address
435490
436491deriveJSON ''Address
437492makePrisms ''Address
src/Network/PagerDuty/REST.hs+17−26
@@ -2,7 +2,7 @@
22{-# LANGUAGE OverloadedStrings #-}
33
44-- Module : Network.PagerDuty.REST
5−-- Copyright : (c) 2013-2014 Brendan Hay <brendan.g.hay@gmail.com>
5+-- Copyright : (c) 2013-2015 Brendan Hay <brendan.g.hay@gmail.com>
66-- License : This Source Code Form is subject to the terms of
77-- the Mozilla Public License, v. 2.0.
88-- A copy of the MPL can be found in the LICENSE file or
@@ -13,22 +13,13 @@
1313
1414module Network.PagerDuty.REST
1515 (
16−
1716 -- * Sending requests
1817 send
19− , paginate
20−
21− -- * Configuration
22− -- ** Environment
23− , Env
24− , envDomain
25− , envAuth
26− , envManager
27− , envLogger
28−
29− -- ** Requests
3018 , sendWith
19+ , paginate
3120 , paginateWith
21+
22+ , module Network.PagerDuty.Types
3223 ) where
3324
3425import Control.Applicative
@@ -36,20 +27,21 @@ import Control.Lens
3627import Control.Monad
3728import Control.Monad.IO.Class
3829import Control.Monad.Trans
39−import Data.Aeson (FromJSON)
30+import Data.Aeson (FromJSON)
4031import Data.Conduit
41−import Data.Default.Class
4232import Data.Monoid
43−import Network.HTTP.Client (Manager)
44−import qualified Network.HTTP.Client as Client
33+import Network.HTTP.Client (Manager)
34+import qualified Network.HTTP.Client as Client
4535import Network.HTTP.Types
4636import Network.PagerDuty.Internal.IO
4737import Network.PagerDuty.Internal.Types
38+import Network.PagerDuty.Types
4839
4940-- FIXME: verify correct actions are all paginated
5041-- FIXME: Ensure RequesterId parameter is always most significant param
5142-- FIXME: add smart constructors for all types, for testing purposes
5243
44+-- | /See:/ 'sendWith'
5345send :: (MonadIO m, FromJSON b)
5446 => SubDomain
5547 -> Auth s
@@ -58,13 +50,13 @@ send :: (MonadIO m, FromJSON b)
5850 -> m (Either Error b)
5951send d a m = sendWith (prod d a m)
6052
61−-- | /See:/ 'sendWith'
6253sendWith :: (MonadIO m, FromJSON b)
6354 => Env s
6455 -> Request a s b
6556 -> m (Either Error b)
66−sendWith e = liftM (fmap fst) . http e
57+sendWith e = liftM (fmap _pgItem) . http e
6758
59+-- | /See:/ 'paginateWith'
6860paginate :: (MonadIO m, Paginate a, FromJSON b)
6961 => SubDomain
7062 -> Auth s
@@ -73,7 +65,6 @@ paginate :: (MonadIO m, Paginate a, FromJSON b)
7365 -> Source m (Either Error b)
7466paginate d a m = paginateWith (prod d a m)
7567
76−-- | /See:/ 'paginateWith'
7768paginateWith :: (MonadIO m, Paginate a, FromJSON b)
7869 => Env s
7970 -> Request a s b
@@ -82,23 +73,23 @@ paginateWith e = go
8273 where
8374 go rq = do
8475 rs <- lift (http e rq)
85− yield (fst <$> rs)
76+ yield (_pgItem <$> rs)
8677 either (const (return ()))
87− (maybe (return ()) go . next rq . snd)
78+ (maybe (return ()) go . next rq . _pgPager)
8879 rs
8980
9081http :: (MonadIO m, FromJSON b)
9182 => Env s
9283 -> Request a s b
93− -> m (Either Error (b, Maybe Pager))
84+ -> m (Either Error (Page b))
9485http e rq = request (e ^. envManager) (e ^. envLogger) rq $ raw
9586 { Client.host = domain (e ^. envDomain)
9687 , Client.path = renderPath (rq ^. path)
9788 , Client.queryString = renderQuery False (rq ^. query)
9889 }
9990 where
100− raw = case (e ^. envAuth) of
101− AuthBasic u p -> Client.applyBasicAuth u p def
102− AuthToken t -> def
91+ raw = case e ^. envAuth of
92+ AuthBasic u p -> Client.applyBasicAuth u p Client.defaultRequest
93+ AuthToken t -> Client.defaultRequest
10394 { Client.requestHeaders = [("Authorization", "Token token=" <> t)]
10495 }
src/Network/PagerDuty/REST/Alerts.hs+7−7
@@ -4,7 +4,7 @@
44{-# LANGUAGE TypeFamilies #-}
55
66-- Module : Network.PagerDuty.REST.Alerts
7−-- Copyright : (c) 2013-2014 Brendan Hay <brendan.g.hay@gmail.com>
7+-- Copyright : (c) 2013-2015 Brendan Hay <brendan.g.hay@gmail.com>
88-- License : This Source Code Form is subject to the terms of
99-- the Mozilla Public License, v. 2.0.
1010-- A copy of the MPL can be found in the LICENSE file or
@@ -43,12 +43,12 @@ module Network.PagerDuty.REST.Alerts
4343 , alertAddress
4444 ) where
4545
46−import Control.Lens
47−import Data.Aeson.Lens
48−import Data.Time
49−import Network.PagerDuty.REST.Users (User)
50−import Network.PagerDuty.Internal.TH
51−import Network.PagerDuty.Internal.Types
46+import Control.Lens hiding (Empty)
47+import Data.Aeson.Lens
48+import Data.Time
49+import Network.PagerDuty.Internal.TH
50+import Network.PagerDuty.Internal.Types
51+import Network.PagerDuty.REST.Users (User)
5252
5353alerts :: Path
5454alerts = "alerts"
src/Network/PagerDuty/REST/EscalationPolicies.hs+14−14
@@ -1,13 +1,13 @@
1−{-# LANGUAGE ExtendedDefaultRules #-}
2−{-# LANGUAGE DataKinds #-}
3−{-# LANGUAGE OverloadedStrings #-}
4−{-# LANGUAGE TemplateHaskell #-}
5−{-# LANGUAGE TypeFamilies #-}
1+{-# LANGUAGE DataKinds #-}
2+{-# LANGUAGE ExtendedDefaultRules #-}
3+{-# LANGUAGE OverloadedStrings #-}
4+{-# LANGUAGE TemplateHaskell #-}
5+{-# LANGUAGE TypeFamilies #-}
66
77{-# OPTIONS_GHC -fno-warn-type-defaults #-}
88
99-- Module : Network.PagerDuty.REST.EscalationPolicies
10−-- Copyright : (c) 2013-2014 Brendan Hay <brendan.g.hay@gmail.com>
10+-- Copyright : (c) 2013-2015 Brendan Hay <brendan.g.hay@gmail.com>
1111-- License : This Source Code Form is subject to the terms of
1212-- the Mozilla Public License, v. 2.0.
1313-- A copy of the MPL can be found in the LICENSE file or
@@ -60,15 +60,15 @@ module Network.PagerDuty.REST.EscalationPolicies
6060 , pServices
6161 ) where
6262
63−import Control.Lens
64−import Data.Aeson.Lens
65−import Data.Text (Text)
66−import Network.HTTP.Types
67−import Network.PagerDuty.REST.Services (Service)
68−import Network.PagerDuty.Internal.TH
69−import Network.PagerDuty.Internal.Types
63+import Control.Lens hiding (Empty)
64+import Data.Aeson.Lens
65+import Data.Text (Text)
66+import Network.HTTP.Types
67+import Network.PagerDuty.Internal.TH
68+import Network.PagerDuty.Internal.Types
69+import Network.PagerDuty.REST.Services (Service)
7070
71−import Network.PagerDuty.REST.EscalationPolicies.EscalationRules
71+import Network.PagerDuty.REST.EscalationPolicies.EscalationRules
7272
7373default (Path)
7474
src/Network/PagerDuty/REST/EscalationPolicies/EscalationRules.hs+10−10
@@ -1,12 +1,12 @@
1−{-# LANGUAGE ExtendedDefaultRules #-}
2−{-# LANGUAGE FlexibleInstances #-}
3−{-# LANGUAGE OverloadedStrings #-}
4−{-# LANGUAGE TemplateHaskell #-}
1+{-# LANGUAGE ExtendedDefaultRules #-}
2+{-# LANGUAGE FlexibleInstances #-}
3+{-# LANGUAGE OverloadedStrings #-}
4+{-# LANGUAGE TemplateHaskell #-}
55
66{-# OPTIONS_GHC -fno-warn-type-defaults #-}
77
88-- Module : Network.PagerDuty.REST.EscalationPolicies.EscalationRules
9−-- Copyright : (c) 2013-2014 Brendan Hay <brendan.g.hay@gmail.com>
9+-- Copyright : (c) 2013-2015 Brendan Hay <brendan.g.hay@gmail.com>
1010-- License : This Source Code Form is subject to the terms of
1111-- the Mozilla Public License, v. 2.0.
1212-- A copy of the MPL can be found in the LICENSE file or
@@ -64,15 +64,15 @@ module Network.PagerDuty.REST.EscalationPolicies.EscalationRules
6464 , rTargets
6565 ) where
6666
67−import Control.Applicative ((<$>))
68−import Control.Lens hiding ((.=))
67+import Control.Applicative ((<$>))
68+import Control.Lens hiding ((.=))
6969import Data.Aeson
70−import qualified Data.HashMap.Strict as Map
71−import Data.Text (Text)
70+import qualified Data.Aeson.KeyMap as Map
71+import Data.Text (Text)
7272import Network.HTTP.Types
73−import Network.PagerDuty.REST.Users
7473import Network.PagerDuty.Internal.TH
7574import Network.PagerDuty.Internal.Types
75+import Network.PagerDuty.REST.Users
7676
7777default (Path)
7878
src/Network/PagerDuty/REST/Incidents.hs+20−24
@@ -10,7 +10,7 @@
1010{-# OPTIONS_GHC -fno-warn-type-defaults #-}
1111
1212-- Module : Network.PagerDuty.REST.Incidents
13−-- Copyright : (c) 2013-2014 Brendan Hay <brendan.g.hay@gmail.com>
13+-- Copyright : (c) 2013-2015 Brendan Hay <brendan.g.hay@gmail.com>
1414-- License : This Source Code Form is subject to the terms of
1515-- the Mozilla Public License, v. 2.0.
1616-- A copy of the MPL can be found in the LICENSE file or
@@ -129,14 +129,16 @@ module Network.PagerDuty.REST.Incidents
129129 , Incident
130130 ) where
131131
132−import Control.Applicative hiding (empty)
133−import Control.Lens
132+import Control.Applicative hiding (empty)
133+import Control.Lens hiding (Empty)
134134import Data.Aeson
135−import Data.ByteString.Conversion (ToByteString(..), toByteString')
135+import Data.ByteString.Conversion (ToByteString (..),
136+ toByteString')
136137import Data.Default.Class
137−import Data.Monoid hiding (All)
138−import Data.Text (Text)
139−import qualified Data.Text.Encoding as Text
138+import Data.Maybe
139+import Data.Monoid hiding (All)
140+import Data.Text (Text)
141+import qualified Data.Text.Encoding as Text
140142import Data.Time
141143import Network.HTTP.Types
142144import Network.PagerDuty.Internal.Query
@@ -345,13 +347,10 @@ lsUntil = upd.lsUntil'.mapping _D
345347-- | When set, the since and until parameters and defaults are
346348-- ignored. Use this to get all incidents since the account was created.
347349lsDateRange :: Lens' (Request ListIncidents s b) Bool
348−lsDateRange = upd . lens get_ set_
350+lsDateRange = upd.lens get_ (flip set_)
349351 where
350− get_ x
351− | Just All <- _lsDateRange' x = True
352− | otherwise = False
353−
354− set_ l x = l { _lsDateRange' = if x then Just All else Nothing }
352+ get_ = (Just All ==) . view lsDateRange'
353+ set_ x = lsDateRange' .~ listToMaybe [All | x]
355354
356355-- | Returns only the incidents currently in the passed status(es).
357356lsStatus :: Lens' (Request ListIncidents s b) (Maybe [IncidentStatus])
@@ -438,12 +437,12 @@ cSince = upd.cSince'.mapping _D
438437
439438-- | The end of the date range over which you want to search.
440439--
441−-- /Note: If you leave off either since or until, a 30 day default range is
440+-- /Note:/ If you leave off either since or until, a 30 day default range is
442441-- applied to your open ended range. Not including the since parameter will set
443−-- the date range to until - 30 days. Likewise, if you leave off until,
444−-- it is set to since + 30 days.
442+-- the date range to until @-30@ days. Likewise, if you leave off until,
443+-- it is set to since @+30@ days.
445444--
446−-- Defaults to the last 30 days if you leave off both. The size of the date
445+-- /Default:/ The last 30 days if you leave off both. The size of the date
447446-- range must be less than 180 days.
448447cUntil :: Lens' (Request CountIncidents s b) (Maybe UTCTime)
449448cUntil = upd.cUntil'.mapping _D
@@ -451,13 +450,10 @@ cUntil = upd.cUntil'.mapping _D
451450-- | When set, the since and until parameters and defaults are
452451-- ignored. Use this to get all counts since the account was created.
453452cDateRange :: Lens' (Request CountIncidents s b) Bool
454−cDateRange = upd . lens get_ set_
453+cDateRange = upd.lens get_ (flip set_)
455454 where
456− get_ x
457− | Just All <- _cDateRange' x = True
458− | otherwise = False
459−
460− set_ l x = l { _cDateRange' = if x then Just All else Nothing }
455+ get_ = (Just All ==) . view cDateRange'
456+ set_ x = cDateRange' .~ listToMaybe [All | x]
461457
462458-- | Only counts the incidents currently in the passed status(es).
463459cStatus :: Lens' (Request CountIncidents s b) (Maybe [IncidentStatus])
@@ -571,7 +567,7 @@ updateIncidents r = auth updateIncidentsBasic & query .~ [("requester_id", r)]
571567
572568-- | A version of 'updateIncidents' which uses HTTP Basic authentication and
573569-- doesn't require a 'RequesterId'.
574−updateIncidentsBasic :: Request UpdateIncidents Basic [UpdatedIncidents]
570+updateIncidentsBasic :: Request UpdateIncidents 'Basic [UpdatedIncidents]
575571updateIncidentsBasic =
576572 mk UpdateIncidents
577573 { _uiIncidents' = []
src/Network/PagerDuty/REST/Incidents/Notes.hs+12−12
@@ -1,11 +1,11 @@
1−{-# LANGUAGE ExtendedDefaultRules #-}
2−{-# LANGUAGE OverloadedStrings #-}
3−{-# LANGUAGE TemplateHaskell #-}
1+{-# LANGUAGE ExtendedDefaultRules #-}
2+{-# LANGUAGE OverloadedStrings #-}
3+{-# LANGUAGE TemplateHaskell #-}
44
55{-# OPTIONS_GHC -fno-warn-type-defaults #-}
66
77-- Module : Network.PagerDuty.REST.Incidents.Notes
8−-- Copyright : (c) 2013-2014 Brendan Hay <brendan.g.hay@gmail.com>
8+-- Copyright : (c) 2013-2015 Brendan Hay <brendan.g.hay@gmail.com>
99-- License : This Source Code Form is subject to the terms of
1010-- the Mozilla Public License, v. 2.0.
1111-- A copy of the MPL can be found in the LICENSE file or
@@ -36,14 +36,14 @@ module Network.PagerDuty.REST.Incidents.Notes
3636 , nContent
3737 ) where
3838
39−import Control.Lens hiding ((.=))
40−import Data.Aeson
41−import Data.Text (Text)
42−import Data.Time
43−import Network.HTTP.Types
44−import Network.PagerDuty.REST.Users
45−import Network.PagerDuty.Internal.TH
46−import Network.PagerDuty.Internal.Types
39+import Control.Lens hiding ((.=))
40+import Data.Aeson
41+import Data.Text (Text)
42+import Data.Time
43+import Network.HTTP.Types
44+import Network.PagerDuty.Internal.TH
45+import Network.PagerDuty.Internal.Types
46+import Network.PagerDuty.REST.Users
4747
4848default (Path)
4949
src/Network/PagerDuty/REST/LogEntries.hs+6−7
@@ -5,7 +5,7 @@
55{-# LANGUAGE TypeFamilies #-}
66
77-- Module : Network.PagerDuty.REST.LogEntries
8−-- Copyright : (c) 2013-2014 Brendan Hay <brendan.g.hay@gmail.com>
8+-- Copyright : (c) 2013-2015 Brendan Hay <brendan.g.hay@gmail.com>
99-- License : This Source Code Form is subject to the terms of
1010-- the Mozilla Public License, v. 2.0.
1111-- A copy of the MPL can be found in the LICENSE file or
@@ -111,19 +111,18 @@ module Network.PagerDuty.REST.LogEntries
111111 , nAddress
112112 ) where
113113
114−import Control.Applicative
115−import Control.Lens
114+import Control.Lens hiding (Empty)
116115import Data.Aeson
117116import Data.Aeson.Lens
117+import qualified Data.Aeson.KeyMap as Map
118118import Data.Default.Class
119−import qualified Data.HashMap.Strict as Map
120−import Data.Text (Text)
121−import qualified Data.Text as Text
119+import Data.Text (Text)
120+import qualified Data.Text as Text
122121import Data.Time
123122import Network.HTTP.Types
124−import Network.PagerDuty.REST.Users (User)
125123import Network.PagerDuty.Internal.TH
126124import Network.PagerDuty.Internal.Types
125+import Network.PagerDuty.REST.Users (User)
127126
128127logs :: Path
129128logs = "log_entries"
src/Network/PagerDuty/REST/MaintenanceWindows.hs+10−10
@@ -4,7 +4,7 @@
44{-# LANGUAGE TypeFamilies #-}
55
66-- Module : Network.PagerDuty.REST.MaintenanceWindows
7−-- Copyright : (c) 2013-2014 Brendan Hay <brendan.g.hay@gmail.com>
7+-- Copyright : (c) 2013-2015 Brendan Hay <brendan.g.hay@gmail.com>
88-- License : This Source Code Form is subject to the terms of
99-- the Mozilla Public License, v. 2.0.
1010-- A copy of the MPL can be found in the LICENSE file or
@@ -74,14 +74,14 @@ module Network.PagerDuty.REST.MaintenanceWindows
7474 , mwServices
7575 ) where
7676
77−import Control.Lens
78−import Data.Monoid
79−import Data.Text (Text)
80−import Data.Time
81−import Network.HTTP.Types
82−import Network.PagerDuty.REST.Users (User)
83−import Network.PagerDuty.Internal.TH
84−import Network.PagerDuty.Internal.Types
77+import Control.Lens hiding (Empty)
78+import Data.Monoid
79+import Data.Text (Text)
80+import Data.Time
81+import Network.HTTP.Types
82+import Network.PagerDuty.Internal.TH
83+import Network.PagerDuty.Internal.Types
84+import Network.PagerDuty.REST.Users (User)
8585
8686windows :: Path
8787windows = "maintenance_windows"
@@ -214,7 +214,7 @@ createWindow r s e xs =
214214createWindowBasic :: UTCTime -- ^ 'cwStartTime'
215215 -> UTCTime -- ^ 'cwEndTime'
216216 -> [ServiceId] -- ^ 'cwServiceIds'
217− -> Request CreateWindow Basic MaintenanceWindow
217+ -> Request CreateWindow 'Basic MaintenanceWindow
218218createWindowBasic s e xs =
219219 mk CreateWindow
220220 { _cwRequesterId' = Nothing
src/Network/PagerDuty/REST/Reports.hs+11−11
@@ -1,13 +1,13 @@
1−{-# LANGUAGE DataKinds #-}
2−{-# LANGUAGE ExtendedDefaultRules #-}
3−{-# LANGUAGE OverloadedStrings #-}
4−{-# LANGUAGE TemplateHaskell #-}
5−{-# LANGUAGE TypeFamilies #-}
1+{-# LANGUAGE DataKinds #-}
2+{-# LANGUAGE ExtendedDefaultRules #-}
3+{-# LANGUAGE OverloadedStrings #-}
4+{-# LANGUAGE TemplateHaskell #-}
5+{-# LANGUAGE TypeFamilies #-}
66
77{-# OPTIONS_GHC -fno-warn-type-defaults #-}
88
99-- Module : Network.PagerDuty.REST.Reports
10−-- Copyright : (c) 2013-2014 Brendan Hay <brendan.g.hay@gmail.com>
10+-- Copyright : (c) 2013-2015 Brendan Hay <brendan.g.hay@gmail.com>
1111-- License : This Source Code Form is subject to the terms of
1212-- the Mozilla Public License, v. 2.0.
1313-- A copy of the MPL can be found in the LICENSE file or
@@ -58,11 +58,11 @@ module Network.PagerDuty.REST.Reports
5858 , irNumberOfIncidents
5959 ) where
6060
61−import Control.Lens
62−import Data.Aeson.Lens
63−import Data.Time
64−import Network.PagerDuty.Internal.TH
65−import Network.PagerDuty.Internal.Types
61+import Control.Lens hiding (Empty)
62+import Data.Aeson.Lens
63+import Data.Time
64+import Network.PagerDuty.Internal.TH
65+import Network.PagerDuty.Internal.Types
6666
6767default (Path)
6868
src/Network/PagerDuty/REST/Schedules.hs+14−14
@@ -1,13 +1,13 @@
1−{-# LANGUAGE DataKinds #-}
2−{-# LANGUAGE ExtendedDefaultRules #-}
3−{-# LANGUAGE OverloadedStrings #-}
4−{-# LANGUAGE TemplateHaskell #-}
5−{-# LANGUAGE TypeFamilies #-}
1+{-# LANGUAGE DataKinds #-}
2+{-# LANGUAGE ExtendedDefaultRules #-}
3+{-# LANGUAGE OverloadedStrings #-}
4+{-# LANGUAGE TemplateHaskell #-}
5+{-# LANGUAGE TypeFamilies #-}
66
77{-# OPTIONS_GHC -fno-warn-type-defaults #-}
88
99-- Module : Network.PagerDuty.REST.Schedules
10−-- Copyright : (c) 2013-2014 Brendan Hay <brendan.g.hay@gmail.com>
10+-- Copyright : (c) 2013-2015 Brendan Hay <brendan.g.hay@gmail.com>
1111-- License : This Source Code Form is subject to the terms of
1212-- the Mozilla Public License, v. 2.0.
1313-- A copy of the MPL can be found in the LICENSE file or
@@ -110,14 +110,14 @@ module Network.PagerDuty.REST.Schedules
110110 , sFinalSchedule
111111 ) where
112112
113−import Control.Lens hiding ((.=))
114−import Data.Aeson
115−import Data.Text (Text)
116−import Data.Time
117−import Network.HTTP.Types
118−import Network.PagerDuty.REST.Users (User)
119−import Network.PagerDuty.Internal.TH
120−import Network.PagerDuty.Internal.Types
113+import Control.Lens hiding (Empty, (.=))
114+import Data.Aeson
115+import Data.Text (Text)
116+import Data.Time
117+import Network.HTTP.Types
118+import Network.PagerDuty.Internal.TH
119+import Network.PagerDuty.Internal.Types
120+import Network.PagerDuty.REST.Users (User)
121121
122122default (Path)
123123
src/Network/PagerDuty/REST/Schedules/Overrides.hs+12−12
@@ -1,13 +1,13 @@
1−{-# LANGUAGE DataKinds #-}
2−{-# LANGUAGE ExtendedDefaultRules #-}
3−{-# LANGUAGE OverloadedStrings #-}
4−{-# LANGUAGE TemplateHaskell #-}
5−{-# LANGUAGE TypeFamilies #-}
1+{-# LANGUAGE DataKinds #-}
2+{-# LANGUAGE ExtendedDefaultRules #-}
3+{-# LANGUAGE OverloadedStrings #-}
4+{-# LANGUAGE TemplateHaskell #-}
5+{-# LANGUAGE TypeFamilies #-}
66
77{-# OPTIONS_GHC -fno-warn-type-defaults #-}
88
99-- Module : Network.PagerDuty.REST.Schedules
10−-- Copyright : (c) 2013-2014 Brendan Hay <brendan.g.hay@gmail.com>
10+-- Copyright : (c) 2013-2015 Brendan Hay <brendan.g.hay@gmail.com>
1111-- License : This Source Code Form is subject to the terms of
1212-- the Mozilla Public License, v. 2.0.
1313-- A copy of the MPL can be found in the LICENSE file or
@@ -50,12 +50,12 @@ module Network.PagerDuty.REST.Schedules.Overrides
5050 , oUser
5151 ) where
5252
53−import Control.Lens
54−import Data.Time
55−import Network.HTTP.Types
56−import Network.PagerDuty.REST.Users
57−import Network.PagerDuty.Internal.TH
58−import Network.PagerDuty.Internal.Types
53+import Control.Lens
54+import Data.Time
55+import Network.HTTP.Types
56+import Network.PagerDuty.Internal.TH
57+import Network.PagerDuty.Internal.Types
58+import Network.PagerDuty.REST.Users
5959
6060overrides :: ScheduleId -> Path
6161overrides i = "schedules" % i % "overrides"
src/Network/PagerDuty/REST/Services.hs+16−16
@@ -1,13 +1,13 @@
1−{-# LANGUAGE DataKinds #-}
2−{-# LANGUAGE ExtendedDefaultRules #-}
3−{-# LANGUAGE OverloadedStrings #-}
4−{-# LANGUAGE TemplateHaskell #-}
5−{-# LANGUAGE TypeFamilies #-}
1+{-# LANGUAGE DataKinds #-}
2+{-# LANGUAGE ExtendedDefaultRules #-}
3+{-# LANGUAGE OverloadedStrings #-}
4+{-# LANGUAGE TemplateHaskell #-}
5+{-# LANGUAGE TypeFamilies #-}
66
77{-# OPTIONS_GHC -fno-warn-type-defaults #-}
88
99-- Module : Network.PagerDuty.REST.Services
10−-- Copyright : (c) 2013-2014 Brendan Hay <brendan.g.hay@gmail.com>
10+-- Copyright : (c) 2013-2015 Brendan Hay <brendan.g.hay@gmail.com>
1111-- License : This Source Code Form is subject to the terms of
1212-- the Mozilla Public License, v. 2.0.
1313-- A copy of the MPL can be found in the LICENSE file or
@@ -106,14 +106,14 @@ module Network.PagerDuty.REST.Services
106106 , svcSeverityFilter
107107 ) where
108108
109−import Control.Lens
110−import Data.Aeson.Lens
111−import Data.Text (Text)
112−import Data.Time
113−import Network.HTTP.Types
114−import Network.PagerDuty.REST.Services.EmailFilters
115−import Network.PagerDuty.Internal.TH
116−import Network.PagerDuty.Internal.Types
109+import Control.Lens hiding (Empty)
110+import Data.Aeson.Lens
111+import Data.Text (Text)
112+import Data.Time
113+import Network.HTTP.Types
114+import Network.PagerDuty.Internal.TH
115+import Network.PagerDuty.Internal.Types
116+import Network.PagerDuty.REST.Services.EmailFilters
117117
118118default (Path)
119119
@@ -483,7 +483,7 @@ enableService r i =
483483
484484-- | A version of 'enableService' which uses HTTP Basic authentication and
485485-- doesn't require a 'RequesterId'.
486−enableServiceBasic :: ServiceId -> Request Empty Basic Empty
486+enableServiceBasic :: ServiceId -> Request Empty 'Basic Empty
487487enableServiceBasic i = empty & meth .~ PUT & path .~ services % i % "enable"
488488
489489-- | Disable a service. Once a service is disabled, it will not be able to
@@ -498,7 +498,7 @@ disableService r i =
498498
499499-- | A version of 'disableService' which uses HTTP Basic authentication and
500500-- doesn't require a 'RequesterId'.
501−disableServiceBasic :: ServiceId -> Request Empty Basic Empty
501+disableServiceBasic :: ServiceId -> Request Empty 'Basic Empty
502502disableServiceBasic i = empty & meth .~ PUT & path .~ services % i % "disable"
503503
504504-- | Regenerate a new service key for an existing service.
src/Network/PagerDuty/REST/Services/EmailFilters.hs+14−14
@@ -1,11 +1,11 @@
1−{-# LANGUAGE ExtendedDefaultRules #-}
2−{-# LANGUAGE OverloadedStrings #-}
3−{-# LANGUAGE TemplateHaskell #-}
1+{-# LANGUAGE ExtendedDefaultRules #-}
2+{-# LANGUAGE OverloadedStrings #-}
3+{-# LANGUAGE TemplateHaskell #-}
44
55{-# OPTIONS_GHC -fno-warn-type-defaults #-}
66
77-- Module : Network.PagerDuty.REST.Services.EmailFilters
8−-- Copyright : (c) 2013-2014 Brendan Hay <brendan.g.hay@gmail.com>
8+-- Copyright : (c) 2013-2015 Brendan Hay <brendan.g.hay@gmail.com>
99-- License : This Source Code Form is subject to the terms of
1010-- the Mozilla Public License, v. 2.0.
1111-- A copy of the MPL can be found in the LICENSE file or
@@ -39,15 +39,15 @@ module Network.PagerDuty.REST.Services.EmailFilters
3939 , efId
4040 ) where
4141
42−import Control.Applicative hiding (empty)
43−import Control.Lens hiding ((.=))
44−import Data.Aeson
45−import Data.Default.Class
46−import Data.Monoid
47−import Data.Text (Text)
48−import Network.HTTP.Types
49−import Network.PagerDuty.Internal.TH
50−import Network.PagerDuty.Internal.Types
42+import Control.Applicative hiding (empty)
43+import Control.Lens hiding ((.=))
44+import Data.Aeson
45+import Data.Default.Class
46+import Data.Monoid
47+import Data.Text (Text)
48+import Network.HTTP.Types
49+import Network.PagerDuty.Internal.TH
50+import Network.PagerDuty.Internal.Types
5151
5252default (Path)
5353
@@ -65,7 +65,7 @@ deriveNullaryWith hyphenated ''MatchMode
6565-- FIXME: Tighten up this type! Make the regex required for match/no-match and
6666-- encode the conditional invariants.
6767data EmailFilterInfo = EmailFilterInfo
68− { _efSubjectMode' :: Maybe MatchMode
68+ { _efSubjectMode' :: Maybe MatchMode
6969 , _efSubjectRegex' :: Maybe Text
7070 , _efBodyMode' :: Maybe MatchMode
7171 , _efBodyRegex' :: Maybe Text
src/Network/PagerDuty/REST/Users.hs+17−17
@@ -1,13 +1,13 @@
1−{-# LANGUAGE DataKinds #-}
2−{-# LANGUAGE ExtendedDefaultRules #-}
3−{-# LANGUAGE OverloadedStrings #-}
4−{-# LANGUAGE TemplateHaskell #-}
5−{-# LANGUAGE TypeFamilies #-}
1+{-# LANGUAGE DataKinds #-}
2+{-# LANGUAGE ExtendedDefaultRules #-}
3+{-# LANGUAGE OverloadedStrings #-}
4+{-# LANGUAGE TemplateHaskell #-}
5+{-# LANGUAGE TypeFamilies #-}
66
77{-# OPTIONS_GHC -fno-warn-type-defaults #-}
88
99-- Module : Network.PagerDuty.REST.Users
10−-- Copyright : (c) 2013-2014 Brendan Hay <brendan.g.hay@gmail.com>
10+-- Copyright : (c) 2013-2015 Brendan Hay <brendan.g.hay@gmail.com>
1111-- License : This Source Code Form is subject to the terms of
1212-- the Mozilla Public License, v. 2.0.
1313-- A copy of the MPL can be found in the LICENSE file or
@@ -81,16 +81,16 @@ module Network.PagerDuty.REST.Users
8181 , uJobTitle
8282 ) where
8383
84−import Control.Applicative hiding (empty)
85−import Control.Lens hiding ((.=))
86−import Data.Aeson
87−import Data.Default.Class
88−import Data.Monoid
89−import Data.Text (Text)
90−import Data.Time
91−import Network.HTTP.Types
92−import Network.PagerDuty.Internal.TH
93−import Network.PagerDuty.Internal.Types
84+import Control.Applicative hiding (empty)
85+import Control.Lens hiding (Empty, (.=))
86+import Data.Aeson
87+import Data.Default.Class
88+import Data.Monoid
89+import Data.Text (Text)
90+import Data.Time
91+import Network.HTTP.Types
92+import Network.PagerDuty.Internal.TH
93+import Network.PagerDuty.Internal.Types
9494
9595default (Path)
9696
@@ -315,7 +315,7 @@ createUser r n e = auth (createUserBasic n e) & query .~ [("requester_id", r)]
315315-- doesn't require a 'RequesterId'.
316316createUserBasic :: Text -- ^ 'cuName'
317317 -> Address -- ^ 'cuEmail'
318− -> Request CreateUser Basic User
318+ -> Request CreateUser 'Basic User
319319createUserBasic n e =
320320 mk CreateUser
321321 { _cuName' = n
src/Network/PagerDuty/REST/Users/ContactMethods.hs+10−10
@@ -1,11 +1,11 @@
1−{-# LANGUAGE ExtendedDefaultRules #-}
2−{-# LANGUAGE OverloadedStrings #-}
3−{-# LANGUAGE TemplateHaskell #-}
1+{-# LANGUAGE ExtendedDefaultRules #-}
2+{-# LANGUAGE OverloadedStrings #-}
3+{-# LANGUAGE TemplateHaskell #-}
44
55{-# OPTIONS_GHC -fno-warn-type-defaults #-}
66
77-- Module : Network.PagerDuty.REST.Users.ContactMethods
8−-- Copyright : (c) 2013-2014 Brendan Hay <brendan.g.hay@gmail.com>
8+-- Copyright : (c) 2013-2015 Brendan Hay <brendan.g.hay@gmail.com>
99-- License : This Source Code Form is subject to the terms of
1010-- the Mozilla Public License, v. 2.0.
1111-- A copy of the MPL can be found in the LICENSE file or
@@ -56,12 +56,12 @@ module Network.PagerDuty.REST.Users.ContactMethods
5656 , Contact
5757 ) where
5858
59−import Control.Lens
60−import Data.Aeson.Lens
61−import Data.Text (Text)
62−import Network.HTTP.Types
63−import Network.PagerDuty.Internal.TH
64−import Network.PagerDuty.Internal.Types
59+import Control.Lens
60+import Data.Aeson.Lens
61+import Data.Text (Text)
62+import Network.HTTP.Types
63+import Network.PagerDuty.Internal.TH
64+import Network.PagerDuty.Internal.Types
6565
6666default (Path)
6767
src/Network/PagerDuty/REST/Users/NotificationRules.hs+10−10
@@ -1,11 +1,11 @@
1−{-# LANGUAGE ExtendedDefaultRules #-}
2−{-# LANGUAGE OverloadedStrings #-}
3−{-# LANGUAGE TemplateHaskell #-}
1+{-# LANGUAGE ExtendedDefaultRules #-}
2+{-# LANGUAGE OverloadedStrings #-}
3+{-# LANGUAGE TemplateHaskell #-}
44
55{-# OPTIONS_GHC -fno-warn-type-defaults #-}
66
77-- Module : Network.PagerDuty.REST.Users.NotificationRules
8−-- Copyright : (c) 2013-2014 Brendan Hay <brendan.g.hay@gmail.com>
8+-- Copyright : (c) 2013-2015 Brendan Hay <brendan.g.hay@gmail.com>
99-- License : This Source Code Form is subject to the terms of
1010-- the Mozilla Public License, v. 2.0.
1111-- A copy of the MPL can be found in the LICENSE file or
@@ -51,12 +51,12 @@ module Network.PagerDuty.REST.Users.NotificationRules
5151 , rContactMethod
5252 ) where
5353
54−import Control.Lens
55−import Data.Aeson.Lens
56−import Network.HTTP.Types
57−import Network.PagerDuty.REST.Users.ContactMethods
58−import Network.PagerDuty.Internal.TH
59−import Network.PagerDuty.Internal.Types
54+import Control.Lens
55+import Data.Aeson.Lens
56+import Network.HTTP.Types
57+import Network.PagerDuty.Internal.TH
58+import Network.PagerDuty.Internal.Types
59+import Network.PagerDuty.REST.Users.ContactMethods
6060
6161default (Path)
6262
src/Network/PagerDuty/REST/Webhooks.hs+4−3
@@ -3,7 +3,7 @@
33{-# LANGUAGE TemplateHaskell #-}
44
55-- Module : Network.PagerDuty.REST.Webhooks
6−-- Copyright : (c) 2013-2014 Brendan Hay <brendan.g.hay@gmail.com>
6+-- Copyright : (c) 2013-2015 Brendan Hay <brendan.g.hay@gmail.com>
77-- License : This Source Code Form is subject to the terms of
88-- the Mozilla Public License, v. 2.0.
99-- A copy of the MPL can be found in the LICENSE file or
@@ -35,13 +35,14 @@ module Network.PagerDuty.REST.Webhooks
3535import Control.Applicative hiding (empty)
3636import Control.Lens
3737import Data.Aeson
38−import Data.ByteString.Conversion (ToByteString(..), toByteString')
38+import Data.ByteString.Conversion (ToByteString (..),
39+ toByteString')
3940import Data.Text (Text)
4041import qualified Data.Text.Encoding as Text
4142import Data.Time
42−import Network.PagerDuty.REST.Incidents
4343import Network.PagerDuty.Internal.TH
4444import Network.PagerDuty.Internal.Types
45+import Network.PagerDuty.REST.Incidents
4546
4647data WebhookType
4748 = WTrigger
src/Network/PagerDuty/Types.hsnew file+93
@@ -0,0 +1,93 @@
1+-- Module : Network.PagerDuty.Types
2+-- Copyright : (c) 2013-2015 Brendan Hay <brendan.g.hay@gmail.com>
3+-- License : This Source Code Form is subject to the terms of
4+-- the Mozilla Public License, v. 2.0.
5+-- A copy of the MPL can be found in the LICENSE file or
6+-- you can obtain it at http://mozilla.org/MPL/2.0/.
7+-- Maintainer : Brendan Hay <brendan.g.hay@gmail.com>
8+-- Stability : experimental
9+-- Portability : non-portable (GHC extensions)
10+
11+module Network.PagerDuty.Types
12+ (
13+ -- * Configuration
14+ -- ** Environment
15+ Env
16+ , envDomain
17+ , envAuth
18+ , envManager
19+ , envLogger
20+
21+ -- ** Logging
22+ , Logger (..)
23+ , debug
24+
25+ -- * Types
26+ -- ** Requests
27+ , Paginate
28+ , Request
29+
30+ -- ** Errors
31+ , Error
32+ , _Internal
33+ , _Integration
34+ , _REST
35+ -- *** Messages
36+ , HasMessage (..)
37+ -- *** Fields
38+ , HasErrors (..)
39+ -- *** Integration
40+ , IntegrationError
41+ , status
42+ -- *** REST
43+ , RESTError
44+ , Code
45+ , code
46+ , description
47+
48+ -- ** Authentication
49+ , Security (..)
50+ , Auth (..)
51+
52+ -- ** Keys
53+ , Key
54+ , mkKey
55+ -- *** Aliases
56+ , ServiceKey
57+ , IncidentKey
58+
59+ -- ** Identifiers
60+ , Id
61+ , mkId
62+ -- *** Aliases
63+ , AlertId
64+ , ContactId
65+ , EmailFilterId
66+ , EscalationPolicyId
67+ , EscalationRuleId
68+ , IncidentId
69+ , LogEntryId
70+ , NoteId
71+ , NotificationRuleId
72+ , OverrideId
73+ , RequesterId
74+ , ScheduleId
75+ , ServiceId
76+ , UserId
77+ , VendorId
78+ , WebhookId
79+ , WindowId
80+
81+ -- ** SubDomain
82+ , SubDomain
83+ , mkSubDomain
84+
85+ -- ** Address
86+ , Address
87+ , mkAddress
88+
89+ -- ** Miscellaneous
90+ , Empty (..)
91+ ) where
92+
93+import Network.PagerDuty.Internal.Types
stack.yamlnew file+7
@@ -0,0 +1,7 @@
1+resolver: lts-19.23
2+
3+packages:
4+- .
5+
6+nix:
7+ packages: [zlib]