git.iko.soy/typeable/pagerduty
on 5f7c6fa help sign in
.gitignore−1
since splitsnapshots
unifiedsplit
@@ -9,7 +9,6 @@
9cabal.sandbox.config
9cabal.sandbox.config
10
10
11# Dirs
11# Dirs
12−.stack-work
13cabal-dev
12cabal-dev
14bin
13bin
15dist
14dist
.travis.ymldeleted−30
@@ -1,30 +0,0 @@
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] } }
Makefilenew file+20
@@ -0,0 +1,20 @@
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
@@ -1,14 +0,0 @@
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+20−30
@@ -1,32 +1,24 @@
1name: pagerduty
1name: pagerduty
2−version: 0.0.8
2+version: 0.0.0
3−synopsis: Client library for PagerDuty Integration and REST APIs.
3+synopsis: Pager Duty API Client
4homepage: http://github.com/brendanhay/pagerduty
4homepage: http://github.com/brendanhay/pagerduty
5license: OtherLicense
5license: OtherLicense
6license-file: LICENSE
6license-file: LICENSE
7author: Brendan Hay
7author: Brendan Hay
8maintainer: Brendan Hay <brendan.g.hay@gmail.com>
8maintainer: Brendan Hay <brendan.g.hay@gmail.com>
9−copyright: Copyright (c) 2013-2015 Brendan Hay, 2014 Kim Altintop
9+copyright: Copyright (c) 2013-2014 Brendan Hay, 2014 Kim Altintop
10−category: Network, PagerDuty, Monitoring
10+category: Network, Monitoring, Alerting
11build-type: Simple
11build-type: Simple
12cabal-version: >= 1.10
12cabal-version: >= 1.10
13
13
14description:
14description:
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:
15+ Client library for the the PagerDuty REST APIs documented here:
21 .
16 .
22 * Integration API - <http://developer.pagerduty.com/documentation/integration>
17 * Integration API - <http://developer.pagerduty.com/documentation/integration>
23− .
24 * REST API - <http://developer.pagerduty.com/documentation/rest>
18 * REST API - <http://developer.pagerduty.com/documentation/rest>
25 .
19 .
26 /Warning:/ This is an experimental preview release which is still under
20 /Warning:/ This is an experimental preview release which is still under
27 heavy development and not intended for public consumption, caveat emptor!
21 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>.
30
22
31extra-source-files:
23extra-source-files:
32 README.md
24 README.md
@@ -68,30 +60,28 @@ library
68 , Network.PagerDuty.Internal.Query
60 , Network.PagerDuty.Internal.Query
69 , Network.PagerDuty.Internal.TH
61 , Network.PagerDuty.Internal.TH
70 , Network.PagerDuty.Internal.Types
62 , Network.PagerDuty.Internal.Types
71− , Network.PagerDuty.Types
72
63
73 build-depends:
64 build-depends:
74− aeson >= 2.0
65+ aeson > 0.7 && <= 0.8
75− , base >= 4.7 && < 5
66+ , base >= 4.5 && < 5.0
76− , bifunctors >= 4.1
67+ , bifunctors >= 4
77 , bytestring >= 0.9
68 , bytestring >= 0.9
78 , bytestring-conversion >= 0.2.1
69 , bytestring-conversion >= 0.2.1
79− , conduit > 1.1
70+ , conduit >= 0.5.5
80 , data-default-class >= 0.0.1
71 , data-default-class >= 0.0.1
81 , exceptions >= 0.6
72 , exceptions >= 0.6
82− , generics-sop >= 0.5.0.0
73+ , generics-sop >= 0.1.0.2
83− , http-client >= 0.5 && < 1
74+ , http-client >= 0.3.6
84 , http-types >= 0.8
75 , http-types >= 0.8
85− , lens >= 4.4
76+ , lens >= 4.0
86− , lens-aeson >= 1
77+ , lens-aeson >= 1.0
87− , mmorph >= 1
78+ , mmorph >= 1.0
88− , monad-control >= 1
79+ , monad-control >= 0.3.2
89− , mtl >= 2.1.3.1
80+ , mtl >= 2.2.1
81+ , old-locale >= 1.0.0.5
90 , template-haskell >= 2.2
82 , template-haskell >= 2.2
91 , text >= 1.1
83 , text >= 1.1
92− , time >= 1.2
84+ , time == 1.4.*
93− , time-locale-compat >= 0.1.0.1
94− , transformers >= 0.2
85+ , transformers >= 0.4.1
95− , transformers-compat >= 0.3
96− , transformers-base >= 0.4.2
86+ , transformers-base >= 0.4.1
97 , unordered-containers >= 0.2.3
87 , unordered-containers >= 0.2.3
script/generate-pagesnew file+25
@@ -0,0 +1,25 @@
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_installdeleted−11
@@ -1,11 +0,0 @@
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-installdeleted−13
@@ -1,13 +0,0 @@
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-scriptdeleted−9
@@ -1,9 +0,0 @@
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-timeoutdeleted−15
@@ -1,15 +0,0 @@
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-documentationnew file+37
@@ -0,0 +1,37 @@
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+53−19
@@ -3,11 +3,12 @@
3{-# LANGUAGE FlexibleInstances #-}
3{-# LANGUAGE FlexibleInstances #-}
4{-# LANGUAGE GeneralizedNewtypeDeriving #-}
4{-# LANGUAGE GeneralizedNewtypeDeriving #-}
5{-# LANGUAGE MultiParamTypeClasses #-}
5{-# LANGUAGE MultiParamTypeClasses #-}
6+{-# LANGUAGE TemplateHaskell #-}
6{-# LANGUAGE TypeFamilies #-}
7{-# LANGUAGE TypeFamilies #-}
7{-# LANGUAGE UndecidableInstances #-}
8{-# LANGUAGE UndecidableInstances #-}
8
9
9-- Module : Control.Monad.Trans.PagerDuty
10-- Module : Control.Monad.Trans.PagerDuty
10−-- Copyright : (c) 2013-2015 Brendan Hay <brendan.g.hay@gmail.com>
11+-- Copyright : (c) 2013-2014 Brendan Hay <brendan.g.hay@gmail.com>
11-- License : This Source Code Form is subject to the terms of
12-- License : This Source Code Form is subject to the terms of
12-- the Mozilla Public License, v. 2.0.
13-- the Mozilla Public License, v. 2.0.
13-- A copy of the MPL can be found in the LICENSE file or
14-- A copy of the MPL can be found in the LICENSE file or
@@ -25,38 +26,67 @@ module Control.Monad.Trans.PagerDuty
25 -- * Running
26 -- * Running
26 , runPagerDutyT
27 , runPagerDutyT
27
28
29+ -- * Environment
30+ , Env
31+ , envDomain
32+ , envAuth
33+ , envManager
34+ , envLogger
35+ , scoped
36+
37+ -- ** Logging
38+ , Logger (..)
39+ , debug
40+
41+ -- * Errors
42+ , Error(..)
43+ , _Internal
44+ , _Integration
45+ , _REST
46+
28− -- * Integration events
47+ -- ** Integration
48+ , IntegrationError
49+ , status
50+
51+ -- ** REST
52+ , RESTError
53+ , code
54+
55+ -- ** Code
56+ , Code (..)
57+ , description
58+
59+ -- ** Fields
60+ , message
61+ , errors
62+
63+ -- ** Lifting
64+ , hoistError
65+
66+ -- * Integration API
29 , submit
67 , submit
30 , submitCatch
68 , submitCatch
31
69
32− -- * REST requests
70+ -- * REST API
33 , send
71 , send
34 , sendCatch
72 , sendCatch
35 , paginate
73 , paginate
36 , paginateCatch
74 , paginateCatch
37−
38− -- ** Lifting errors
39− , hoistError
40−
41− , module Network.PagerDuty.Types
42 ) where
75 ) where
43
76
44import Control.Applicative
77import Control.Applicative
45−import Control.Monad
46import Control.Monad.Base
78import Control.Monad.Base
47import Control.Monad.Catch
79import Control.Monad.Catch
48−import Control.Monad.Except (MonadError (..))
80+import Control.Monad.Except
49import Control.Monad.Morph
81import Control.Monad.Morph
50import Control.Monad.Reader
82import Control.Monad.Reader
51import Control.Monad.Trans.Control
83import Control.Monad.Trans.Control
52−import Control.Monad.Trans.Except
53import Data.Aeson
84import Data.Aeson
54import Data.Conduit
85import Data.Conduit
55import Network.PagerDuty.Integration (Event, Response)
86import Network.PagerDuty.Integration (Event, Response)
56import qualified Network.PagerDuty.Integration as Int
87import qualified Network.PagerDuty.Integration as Int
57import Network.PagerDuty.Internal.Types
88import Network.PagerDuty.Internal.Types
58import qualified Network.PagerDuty.REST as REST
89import qualified Network.PagerDuty.REST as REST
59−import Network.PagerDuty.Types
60
90
61-- | A convenient alias for 'PagerDutyT' 'IO'.
91-- | A convenient alias for 'PagerDutyT' 'IO'.
62type PagerDuty s = PagerDutyT s IO
92type PagerDuty s = PagerDutyT s IO
@@ -83,24 +113,28 @@ instance MonadBase b m => MonadBase b (PagerDutyT s m) where
83 {-# INLINE liftBase #-}
113 {-# INLINE liftBase #-}
84
114
85instance MonadTransControl (PagerDutyT s) where
115instance MonadTransControl (PagerDutyT s) where
116+ newtype StT (PagerDutyT s) a = StTPDT
86− type StT (PagerDutyT s) a = StT (ExceptT Error) (StT (ReaderT (Env s)) a)
117+ { unStT :: StT (ExceptT Error) (StT (ReaderT (Env s)) a)
118+ }
87
119
88 liftWith f = PagerDutyT $
120 liftWith f = PagerDutyT $
89 liftWith $ \g ->
121 liftWith $ \g ->
90− liftWith $ \h ->
122+ liftWith $ \h ->
91− f (h . g . unPagerDutyT)
123+ f (liftM StTPDT . h . g . unPagerDutyT)
92 {-# INLINE liftWith #-}
124 {-# INLINE liftWith #-}
93
125
94− restoreT = PagerDutyT . restoreT . restoreT
126+ restoreT = PagerDutyT . restoreT . restoreT . liftM unStT
95 {-# INLINE restoreT #-}
127 {-# INLINE restoreT #-}
96
128
97instance MonadBaseControl b m => MonadBaseControl b (PagerDutyT s m) where
129instance MonadBaseControl b m => MonadBaseControl b (PagerDutyT s m) where
130+ newtype StM (PagerDutyT s m) a = StMPDT
98− type StM (PagerDutyT s m) a = ComposeSt (PagerDutyT s) m a
131+ { unStMPDT :: ComposeSt (PagerDutyT s) m a
132+ }
99
133
100− liftBaseWith = defaultLiftBaseWith
134+ liftBaseWith = defaultLiftBaseWith StMPDT
101 {-# INLINE liftBaseWith #-}
135 {-# INLINE liftBaseWith #-}
102
136
103− restoreM = defaultRestoreM
137+ restoreM = defaultRestoreM unStMPDT
104 {-# INLINE restoreM #-}
138 {-# INLINE restoreM #-}
105
139
106instance MFunctor (PagerDutyT s) where
140instance MFunctor (PagerDutyT s) where
src/Network/PagerDuty/Integration.hs+6−12
@@ -6,7 +6,7 @@
6{-# LANGUAGE TemplateHaskell #-}
6{-# LANGUAGE TemplateHaskell #-}
7
7
8-- Module : Network.PagerDuty.Integration
8-- Module : Network.PagerDuty.Integration
9−-- Copyright : (c) 2013-2015 Brendan Hay <brendan.g.hay@gmail.com>
9+-- Copyright : (c) 2013-2014 Brendan Hay <brendan.g.hay@gmail.com>
10-- License : This Source Code Form is subject to the terms of
10-- License : This Source Code Form is subject to the terms of
11-- the Mozilla Public License, v. 2.0.
11-- the Mozilla Public License, v. 2.0.
12-- A copy of the MPL can be found in the LICENSE file or
12-- A copy of the MPL can be found in the LICENSE file or
@@ -56,7 +56,7 @@ module Network.PagerDuty.Integration
56 , Resolve
56 , Resolve
57 , resolve
57 , resolve
58
58
59− -- * Fields
59+ -- * Event fields
60 , HasServiceKey (..)
60 , HasServiceKey (..)
61 , HasIncidentKey (..)
61 , HasIncidentKey (..)
62 , HasDescription (..)
62 , HasDescription (..)
@@ -72,23 +72,19 @@ module Network.PagerDuty.Integration
72 , rsStatus
72 , rsStatus
73 , rsMessage
73 , rsMessage
74 , rsIncidentKey
74 , rsIncidentKey
75−
76− , Generic
77−
78− , module Network.PagerDuty.Types
79 ) where
75 ) where
80
76
81import Control.Lens
77import Control.Lens
82import Control.Monad.IO.Class
78import Control.Monad.IO.Class
83import Data.Aeson
79import Data.Aeson
80+import Data.Default.Class
84−import qualified Data.Aeson.KeyMap as Map
81+import qualified Data.HashMap.Strict as Map
85import Data.Text (Text)
82import Data.Text (Text)
86import Network.HTTP.Client (Manager)
83import Network.HTTP.Client (Manager)
87import qualified Network.HTTP.Client as Client
84import qualified Network.HTTP.Client as Client
88import Network.PagerDuty.Internal.IO
85import Network.PagerDuty.Internal.IO
89import Network.PagerDuty.Internal.TH
86import Network.PagerDuty.Internal.TH
90import Network.PagerDuty.Internal.Types
87import Network.PagerDuty.Internal.Types
91−import Network.PagerDuty.Types hiding (description, message)
92
88
93data Response = Response
89data Response = Response
94 { _rsStatus :: Text
90 { _rsStatus :: Text
@@ -291,8 +287,6 @@ submitWith :: MonadIO m
291 -> Event
287 -> Event
292 -> m (Either Error Response)
288 -> m (Either Error Response)
293submitWith m l e = request m l e $
289submitWith m l e = request m l e $
294− Client.defaultRequest
295− { Client.host = "events.pagerduty.com"
290+ def { Client.host = "events.pagerduty.com"
296− , Client.path = "/generic/2010-04-15/create_event.json"
291+ , Client.path = "/generic/2010-04-15/create_event.json"
297− , Client.method = "POST"
298 }
292 }
src/Network/PagerDuty/Internal/IO.hs+1−1
@@ -2,7 +2,7 @@
2{-# LANGUAGE ScopedTypeVariables #-}
2{-# LANGUAGE ScopedTypeVariables #-}
3
3
4-- Module : Network.PagerDuty.Internal.IO
4-- Module : Network.PagerDuty.Internal.IO
5−-- Copyright : (c) 2013-2015 Brendan Hay <brendan.g.hay@gmail.com>
5+-- Copyright : (c) 2013-2014 Brendan Hay <brendan.g.hay@gmail.com>
6-- License : This Source Code Form is subject to the terms of
6-- License : This Source Code Form is subject to the terms of
7-- the Mozilla Public License, v. 2.0.
7-- the Mozilla Public License, v. 2.0.
8-- A copy of the MPL can be found in the LICENSE file or
8-- A copy of the MPL can be found in the LICENSE file or
src/Network/PagerDuty/Internal/Options.hs+4−4
@@ -1,5 +1,5 @@
1-- Module : Network.PagerDuty.Internal.Options
1-- Module : Network.PagerDuty.Internal.Options
2−-- Copyright : (c) 2013-2015 Brendan Hay <brendan.g.hay@gmail.com>
2+-- Copyright : (c) 2013-2014 Brendan Hay <brendan.g.hay@gmail.com>
3-- License : This Source Code Form is subject to the terms of
3-- License : This Source Code Form is subject to the terms of
4-- the Mozilla Public License, v. 2.0.
4-- the Mozilla Public License, v. 2.0.
5-- A copy of the MPL can be found in the LICENSE file or
5-- A copy of the MPL can be found in the LICENSE file or
@@ -14,9 +14,9 @@ module Network.PagerDuty.Internal.Options
14 , underscored
14 , underscored
15 ) where
15 ) where
16
16
17−import Data.Aeson.Types
17+import Data.Aeson.Types
18−import Data.Char
18+import Data.Char
19−import Data.List
19+import Data.List
20
20
21dropped :: Int -> Options -> Options
21dropped :: Int -> Options -> Options
22dropped n o = o
22dropped n o = o
src/Network/PagerDuty/Internal/Query.hs+12−14
@@ -1,13 +1,12 @@
1{-# LANGUAGE ConstraintKinds #-}
1{-# LANGUAGE ConstraintKinds #-}
2{-# LANGUAGE DefaultSignatures #-}
2{-# LANGUAGE DefaultSignatures #-}
3−{-# LANGUAGE FlexibleContexts #-}
4{-# LANGUAGE GADTs #-}
3{-# LANGUAGE GADTs #-}
5{-# LANGUAGE OverloadedStrings #-}
4{-# LANGUAGE OverloadedStrings #-}
6{-# LANGUAGE ScopedTypeVariables #-}
5{-# LANGUAGE ScopedTypeVariables #-}
7{-# LANGUAGE TupleSections #-}
6{-# LANGUAGE TupleSections #-}
8
7
9-- Module : Network.PagerDuty.Internal.Query
8-- Module : Network.PagerDuty.Internal.Query
10−-- Copyright : (c) 2013-2015 Brendan Hay <brendan.g.hay@gmail.com>
9+-- Copyright : (c) 2013-2014 Brendan Hay <brendan.g.hay@gmail.com>
11-- License : This Source Code Form is subject to the terms of
10-- License : This Source Code Form is subject to the terms of
12-- the Mozilla Public License, v. 2.0.
11-- the Mozilla Public License, v. 2.0.
13-- A copy of the MPL can be found in the LICENSE file or
12-- A copy of the MPL can be found in the LICENSE file or
@@ -24,14 +23,14 @@ module Network.PagerDuty.Internal.Query
24
23
25import Data.Aeson.Types
24import Data.Aeson.Types
26import Data.Bifunctor
25import Data.Bifunctor
27−import Data.ByteString (ByteString)
26+import Data.ByteString (ByteString)
28−import qualified Data.ByteString.Char8 as BS
27+import qualified Data.ByteString.Char8 as BS
29import Data.ByteString.Conversion
28import Data.ByteString.Conversion
30−import Data.Function (on)
29+import Data.Function (on)
31−import Data.List (groupBy)
30+import Data.List (groupBy)
32−import Data.Monoid ((<>))
31+import Data.Monoid ((<>))
33−import Data.Text (Text)
32+import Data.Text (Text)
34−import qualified Data.Text.Encoding as Text
33+import qualified Data.Text.Encoding as Text
35import Generics.SOP
34import Generics.SOP
36import Network.HTTP.Types
35import Network.HTTP.Types
37import Network.PagerDuty.Internal.Options
36import Network.PagerDuty.Internal.Options
@@ -59,15 +58,14 @@ gqueryWith :: forall a. (Generic a, HasDatatypeInfo a, All2 QueryValues (Code a)
59 -> a
58 -> a
60 -> Query
59 -> Query
61gqueryWith o a = case datatypeInfo (Proxy :: Proxy a) of
60gqueryWith o a = case datatypeInfo (Proxy :: Proxy a) of
62− ADT _ _ cs _ -> go cs (from a)
61+ ADT _ _ cs -> go cs (from a)
63− Newtype _ _ c -> go (c :* Nil) (from a)
62+ Newtype _ _ c -> go (c :* Nil) (from a)
64 where
63 where
65− go :: (All2 QueryValues xss, SListI xss)
64+ go :: (All2 QueryValues xss, SingI xss)
66 => NP ConstructorInfo xss
65 => NP ConstructorInfo xss
67 -> SOP I xss
66 -> SOP I xss
68 -> Query
67 -> Query
69− go cs (SOP sop) =
70− group . hcollapse $ hcliftA2' p (gctor o) cs sop
68+ go cs (SOP sop) = group . unI . hcollapse $ hcliftA2' p (gctor o) cs sop
71
69
72 group :: [(ByteString, ByteString)] -> Query
70 group :: [(ByteString, ByteString)] -> Query
73 group = concatMap f . groupBy ((==) `on` fst)
71 group = concatMap f . groupBy ((==) `on` fst)
src/Network/PagerDuty/Internal/TH.hs+6−6
@@ -1,7 +1,7 @@
1{-# LANGUAGE TemplateHaskell #-}
1{-# LANGUAGE TemplateHaskell #-}
2
2
3-- Module : Network.PagerDuty.Internal.TH
3-- Module : Network.PagerDuty.Internal.TH
4−-- Copyright : (c) 2013-2015 Brendan Hay <brendan.g.hay@gmail.com>
4+-- Copyright : (c) 2013-2014 Brendan Hay <brendan.g.hay@gmail.com>
5-- License : This Source Code Form is subject to the terms of
5-- License : This Source Code Form is subject to the terms of
6-- the Mozilla Public License, v. 2.0.
6-- the Mozilla Public License, v. 2.0.
7-- A copy of the MPL can be found in the LICENSE file or
7-- A copy of the MPL can be found in the LICENSE file or
@@ -40,15 +40,15 @@ module Network.PagerDuty.Internal.TH
40
40
41import Control.Applicative
41import Control.Applicative
42import Control.Lens
42import Control.Lens
43−import qualified Data.Aeson.TH as Aeson
43+import qualified Data.Aeson.TH as Aeson
44import Data.Aeson.Types
44import Data.Aeson.Types
45−import Data.ByteString (ByteString)
45+import Data.ByteString (ByteString)
46−import qualified Data.Text.Encoding as Text
46+import qualified Data.Text.Encoding as Text
47import Generics.SOP.TH
47import Generics.SOP.TH
48import Language.Haskell.TH
48import Language.Haskell.TH
49import Network.HTTP.Types.QueryLike
49import Network.HTTP.Types.QueryLike
50−import Network.PagerDuty.Internal.Options
51import Network.PagerDuty.Internal.Query
50import Network.PagerDuty.Internal.Query
51+import Network.PagerDuty.Internal.Options
52
52
53jsonRequest :: Name -> Q [Dec]
53jsonRequest :: Name -> Q [Dec]
54jsonRequest n = concat <$> sequence
54jsonRequest n = concat <$> sequence
@@ -61,7 +61,7 @@ queryRequest :: Name -> Q [Dec]
61queryRequest n = concat <$> sequence
61queryRequest n = concat <$> sequence
62 [ deriveGeneric n
62 [ deriveGeneric n
63 , makeLenses n
63 , makeLenses n
64− , [d|instance ToJSON $(conT n) where toJSON = const emptyObject|]
64+ , [d|instance ToJSON $(conT n) where toJSON = const (toJSON (object []))|]
65 , [d|instance QueryLike $(conT n) where toQuery = gquery|]
65 , [d|instance QueryLike $(conT n) where toQuery = gquery|]
66 ]
66 ]
67
67
src/Network/PagerDuty/Internal/Types.hs+26−43
@@ -15,7 +15,7 @@
15{-# LANGUAGE ViewPatterns #-}
15{-# LANGUAGE ViewPatterns #-}
16
16
17-- Module : Network.PagerDuty.Internal.Types
17-- Module : Network.PagerDuty.Internal.Types
18−-- Copyright : (c) 2013-2015 Brendan Hay <brendan.g.hay@gmail.com>
18+-- Copyright : (c) 2013-2014 Brendan Hay <brendan.g.hay@gmail.com>
19-- License : This Source Code Form is subject to the terms of
19-- License : This Source Code Form is subject to the terms of
20-- the Mozilla Public License, v. 2.0.
20-- the Mozilla Public License, v. 2.0.
21-- A copy of the MPL can be found in the LICENSE file or
21-- A copy of the MPL can be found in the LICENSE file or
@@ -27,33 +27,35 @@
27module Network.PagerDuty.Internal.Types where
27module Network.PagerDuty.Internal.Types where
28
28
29import Control.Applicative
29import Control.Applicative
30−import Control.Lens hiding ((.=), Empty)
30+import Control.Lens hiding ((.=))
31import Control.Monad.IO.Class
31import Control.Monad.IO.Class
32−import Data.Aeson hiding (Error, Key)
32+import Data.Aeson hiding (Error)
33−import qualified Data.Aeson.KeyMap as Map
34import Data.Aeson.Types (Parser)
33import Data.Aeson.Types (Parser)
35import Data.ByteString (ByteString)
34import Data.ByteString (ByteString)
36import qualified Data.ByteString.Char8 as BS
35import qualified Data.ByteString.Char8 as BS
37import Data.ByteString.Conversion hiding (List)
36import Data.ByteString.Conversion hiding (List)
38import Data.Default.Class
37import Data.Default.Class
39import Data.Function (on)
38import Data.Function (on)
39+import qualified Data.HashMap.Strict as Map
40import Data.List (deleteBy, intersperse)
40import Data.List (deleteBy, intersperse)
41import Data.Monoid
41import Data.Monoid
42import Data.String
42import Data.String
43import Data.Text (Text)
43import Data.Text (Text)
44import qualified Data.Text as Text
44import qualified Data.Text as Text
45import qualified Data.Text.Encoding as Text
45import qualified Data.Text.Encoding as Text
46−import Data.Time (UTCTime, TimeZone, formatTime, utc, timeZoneName)
46+import Data.Time
47import GHC.TypeLits
47import GHC.TypeLits
48import Network.HTTP.Client (Manager)
48import Network.HTTP.Client (Manager)
49import Network.HTTP.Types
49import Network.HTTP.Types
50import Network.HTTP.Types.QueryLike
50import Network.HTTP.Types.QueryLike
51import Network.PagerDuty.Internal.Query
51import Network.PagerDuty.Internal.Query
52import Network.PagerDuty.Internal.TH
52import Network.PagerDuty.Internal.TH
53−import Data.Time.Locale.Compat
53+import System.Locale
54+
55+-- FIXME: Verify IncidentId/IncidentKey .. *Id/*Key are actually different or needed
54
56
55newtype CSV a = CSV [a]
57newtype CSV a = CSV [a]
56− deriving (Eq, Show, Semigroup, Monoid)
58+ deriving (Eq, Show, Monoid)
57
59
58makePrisms ''CSV
60makePrisms ''CSV
59
61
@@ -70,7 +72,7 @@ instance ToByteString a => ToJSON (CSV a) where
70 toJSON = String . Text.decodeUtf8 . toByteString'
72 toJSON = String . Text.decodeUtf8 . toByteString'
71
73
72newtype List a = L [a]
74newtype List a = L [a]
73− deriving (Eq, Show, Semigroup, Monoid)
75+ deriving (Eq, Show, Monoid)
74
76
75deriveJSON ''List
77deriveJSON ''List
76makePrisms ''List
78makePrisms ''List
@@ -106,7 +108,7 @@ instance ToJSON Date where
106
108
107instance ToByteString Date where
109instance ToByteString Date where
108 builder (D d) = builder
110 builder (D d) = builder
109− (formatTime defaultTimeLocale ("%Y-%m-%dT%XZ") d)
111+ (formatTime defaultTimeLocale (iso8601DateFormat $ Just "%XZ") d)
110
112
111instance QueryValues Date
113instance QueryValues Date
112
114
@@ -133,17 +135,14 @@ data Security = Basic | Token
133 deriving (Eq, Show)
135 deriving (Eq, Show)
134
136
135data Auth (a :: Security) where
137data Auth (a :: Security) where
136− AuthBasic :: ByteString -> ByteString -> Auth 'Basic
138+ AuthBasic :: ByteString -> ByteString -> Auth Basic
137− AuthToken :: ByteString -> Auth 'Token
139+ AuthToken :: ByteString -> Auth Token
138
140
139deriving instance Eq (Auth a)
141deriving instance Eq (Auth a)
140deriving instance Show (Auth a)
142deriving instance Show (Auth a)
141
143
142newtype SubDomain = SubDomain { subDomain :: ByteString }
144newtype SubDomain = SubDomain { subDomain :: ByteString }
143− deriving (Eq, Show, IsString, ToByteString)
145+ deriving (Eq, Show, IsString)
144−
145−mkSubDomain :: ByteString -> SubDomain
146−mkSubDomain = SubDomain
147
146
148domain :: SubDomain -> ByteString
147domain :: SubDomain -> ByteString
149domain (SubDomain s)
148domain (SubDomain s)
@@ -180,7 +179,7 @@ prod :: SubDomain -> Auth s -> Manager -> Env s
180prod d a m = Env d a m None
179prod d a m = Env d a m None
181
180
182newtype Code = Code Integer
181newtype Code = Code Integer
183− deriving (Eq, Show, Num)
182+ deriving (Eq, Show)
184
183
185deriveJSON ''Code
184deriveJSON ''Code
186
185
@@ -279,13 +278,8 @@ data Pager = Pager
279
278
280makeLenses ''Pager
279makeLenses ''Pager
281
280
282−data Page a = Page
281+instance FromJSON a => FromJSON (a, Maybe Pager) where
283− { _pgItem :: a
284− , _pgPager :: Maybe Pager
285− }
286−
287−instance FromJSON a => FromJSON (Page a) where
288− parseJSON = withObject "paginated" $ \o -> Page
282+ parseJSON = withObject "paginated" $ \o -> (,)
289 <$> parseJSON (Object o)
283 <$> parseJSON (Object o)
290 <*> optional (parse o)
284 <*> optional (parse o)
291 where
285 where
@@ -310,13 +304,11 @@ data Path where
310 Path :: Path
304 Path :: Path
311 Seg :: ToByteString a => a -> Path
305 Seg :: ToByteString a => a -> Path
312
306
313−instance Semigroup Path where
314− x <> Path = x
315− Path <> y = y
316− Seg x <> Seg y = Seg (builder x <> "/" <> builder y)
317−
318instance Monoid Path where
307instance Monoid Path where
319− mempty = Path
308+ mempty = Path
309+ mappend x Path = x
310+ mappend Path y = y
311+ mappend (Seg x) (Seg y) = Seg (builder x <> "/" <> builder y)
320
312
321instance IsString Path where
313instance IsString Path where
322 fromString = Seg
314 fromString = Seg
@@ -393,13 +385,13 @@ class Paginate a where
393 next :: Request a s b -> Maybe Pager -> Maybe (Request a s b)
385 next :: Request a s b -> Maybe Pager -> Maybe (Request a s b)
394 next rq = maybe Nothing go
386 next rq = maybe Nothing go
395 where
387 where
396− go x | x ^. pgTotal == 0 = Nothing
388+ go x | x^.pgTotal == 0 = Nothing
397− | otherwise = Just $
389+ | otherwise = Just $
398− rq & pager ?~ (x & pgOffset +~ x ^. pgTotal)
390+ rq & pager ?~ (x & pgOffset +~ x^.pgTotal)
399 & query %~ (add . clear)
391 & query %~ (add . clear)
400 where
392 where
401 add :: Query -> Query
393 add :: Query -> Query
402− add = maybe id ((:) . (k,) . Just . Text.encodeUtf8) (x ^. pgQuery)
394+ add = maybe id ((:) . (k,) . Just . Text.encodeUtf8) (x^.pgQuery)
403
395
404 clear :: Query -> Query
396 clear :: Query -> Query
405 clear = deleteBy ((==) `on` fst) (k, Nothing)
397 clear = deleteBy ((==) `on` fst) (k, Nothing)
@@ -410,9 +402,6 @@ class Paginate a where
410newtype Key (a :: Symbol) = Key Text
402newtype Key (a :: Symbol) = Key Text
411 deriving (Eq, Show, IsString)
403 deriving (Eq, Show, IsString)
412
404
413−mkKey :: Text -> Key a
414−mkKey = Key
415−
416instance FromJSON (Key a) where
405instance FromJSON (Key a) where
417 parseJSON = withText "key" (return . Key)
406 parseJSON = withText "key" (return . Key)
418
407
@@ -433,9 +422,6 @@ type IncidentKey = Key "incident"
433newtype Id (a :: Symbol) = Id Text
422newtype Id (a :: Symbol) = Id Text
434 deriving (Eq, Show, IsString)
423 deriving (Eq, Show, IsString)
435
424
436−mkId :: Text -> Id a
437−mkId = Id
438−
439instance FromJSON (Id a) where
425instance FromJSON (Id a) where
440 parseJSON = withText "id" (return . Id)
426 parseJSON = withText "id" (return . Id)
441
427
@@ -483,10 +469,7 @@ instance QueryLike Empty where
483 toQuery = const []
469 toQuery = const []
484
470
485newtype Address = Address Text
471newtype Address = Address Text
486− deriving (Eq, Show, IsString)
472+ deriving (Eq, Show)
487−
488−mkAddress :: Text -> Address
489−mkAddress = Address
490
473
491deriveJSON ''Address
474deriveJSON ''Address
492makePrisms ''Address
475makePrisms ''Address
src/Network/PagerDuty/REST.hs+25−16
@@ -2,7 +2,7 @@
2{-# LANGUAGE OverloadedStrings #-}
2{-# LANGUAGE OverloadedStrings #-}
3
3
4-- Module : Network.PagerDuty.REST
4-- Module : Network.PagerDuty.REST
5−-- Copyright : (c) 2013-2015 Brendan Hay <brendan.g.hay@gmail.com>
5+-- Copyright : (c) 2013-2014 Brendan Hay <brendan.g.hay@gmail.com>
6-- License : This Source Code Form is subject to the terms of
6-- License : This Source Code Form is subject to the terms of
7-- the Mozilla Public License, v. 2.0.
7-- the Mozilla Public License, v. 2.0.
8-- A copy of the MPL can be found in the LICENSE file or
8-- A copy of the MPL can be found in the LICENSE file or
@@ -13,13 +13,22 @@
13
13
14module Network.PagerDuty.REST
14module Network.PagerDuty.REST
15 (
15 (
16+
16 -- * Sending requests
17 -- * Sending requests
17 send
18 send
18− , sendWith
19 , paginate
19 , paginate
20− , paginateWith
21
20
22− , module Network.PagerDuty.Types
21+ -- * Configuration
22+ -- ** Environment
23+ , Env
24+ , envDomain
25+ , envAuth
26+ , envManager
27+ , envLogger
28+
29+ -- ** Requests
30+ , sendWith
31+ , paginateWith
23 ) where
32 ) where
24
33
25import Control.Applicative
34import Control.Applicative
@@ -27,21 +36,20 @@ import Control.Lens
27import Control.Monad
36import Control.Monad
28import Control.Monad.IO.Class
37import Control.Monad.IO.Class
29import Control.Monad.Trans
38import Control.Monad.Trans
30−import Data.Aeson (FromJSON)
39+import Data.Aeson (FromJSON)
31import Data.Conduit
40import Data.Conduit
41+import Data.Default.Class
32import Data.Monoid
42import Data.Monoid
33−import Network.HTTP.Client (Manager)
43+import Network.HTTP.Client (Manager)
34−import qualified Network.HTTP.Client as Client
44+import qualified Network.HTTP.Client as Client
35import Network.HTTP.Types
45import Network.HTTP.Types
36import Network.PagerDuty.Internal.IO
46import Network.PagerDuty.Internal.IO
37import Network.PagerDuty.Internal.Types
47import Network.PagerDuty.Internal.Types
38−import Network.PagerDuty.Types
39
48
40-- FIXME: verify correct actions are all paginated
49-- FIXME: verify correct actions are all paginated
41-- FIXME: Ensure RequesterId parameter is always most significant param
50-- FIXME: Ensure RequesterId parameter is always most significant param
42-- FIXME: add smart constructors for all types, for testing purposes
51-- FIXME: add smart constructors for all types, for testing purposes
43
52
44−-- | /See:/ 'sendWith'
45send :: (MonadIO m, FromJSON b)
53send :: (MonadIO m, FromJSON b)
46 => SubDomain
54 => SubDomain
47 -> Auth s
55 -> Auth s
@@ -50,13 +58,13 @@ send :: (MonadIO m, FromJSON b)
50 -> m (Either Error b)
58 -> m (Either Error b)
51send d a m = sendWith (prod d a m)
59send d a m = sendWith (prod d a m)
52
60
61+-- | /See:/ 'sendWith'
53sendWith :: (MonadIO m, FromJSON b)
62sendWith :: (MonadIO m, FromJSON b)
54 => Env s
63 => Env s
55 -> Request a s b
64 -> Request a s b
56 -> m (Either Error b)
65 -> m (Either Error b)
57−sendWith e = liftM (fmap _pgItem) . http e
66+sendWith e = liftM (fmap fst) . http e
58
67
59−-- | /See:/ 'paginateWith'
60paginate :: (MonadIO m, Paginate a, FromJSON b)
68paginate :: (MonadIO m, Paginate a, FromJSON b)
61 => SubDomain
69 => SubDomain
62 -> Auth s
70 -> Auth s
@@ -65,6 +73,7 @@ paginate :: (MonadIO m, Paginate a, FromJSON b)
65 -> Source m (Either Error b)
73 -> Source m (Either Error b)
66paginate d a m = paginateWith (prod d a m)
74paginate d a m = paginateWith (prod d a m)
67
75
76+-- | /See:/ 'paginateWith'
68paginateWith :: (MonadIO m, Paginate a, FromJSON b)
77paginateWith :: (MonadIO m, Paginate a, FromJSON b)
69 => Env s
78 => Env s
70 -> Request a s b
79 -> Request a s b
@@ -73,15 +82,15 @@ paginateWith e = go
73 where
82 where
74 go rq = do
83 go rq = do
75 rs <- lift (http e rq)
84 rs <- lift (http e rq)
76− yield (_pgItem <$> rs)
85+ yield (fst <$> rs)
77 either (const (return ()))
86 either (const (return ()))
78− (maybe (return ()) go . next rq . _pgPager)
87+ (maybe (return ()) go . next rq . snd)
79 rs
88 rs
80
89
81http :: (MonadIO m, FromJSON b)
90http :: (MonadIO m, FromJSON b)
82 => Env s
91 => Env s
83 -> Request a s b
92 -> Request a s b
84− -> m (Either Error (Page b))
93+ -> m (Either Error (b, Maybe Pager))
85http e rq = request (e ^. envManager) (e ^. envLogger) rq $ raw
94http e rq = request (e ^. envManager) (e ^. envLogger) rq $ raw
86 { Client.host = domain (e ^. envDomain)
95 { Client.host = domain (e ^. envDomain)
87 , Client.path = renderPath (rq ^. path)
96 , Client.path = renderPath (rq ^. path)
@@ -89,7 +98,7 @@ http e rq = request (e ^. envManager) (e ^. envLogger) rq $ raw
89 }
98 }
90 where
99 where
91 raw = case e ^. envAuth of
100 raw = case e ^. envAuth of
92− AuthBasic u p -> Client.applyBasicAuth u p Client.defaultRequest
101+ AuthBasic u p -> Client.applyBasicAuth u p def
93− AuthToken t -> Client.defaultRequest
102+ AuthToken t -> def
94 { Client.requestHeaders = [("Authorization", "Token token=" <> t)]
103 { Client.requestHeaders = [("Authorization", "Token token=" <> t)]
95 }
104 }
src/Network/PagerDuty/REST/Alerts.hs+7−7
@@ -4,7 +4,7 @@
4{-# LANGUAGE TypeFamilies #-}
4{-# LANGUAGE TypeFamilies #-}
5
5
6-- Module : Network.PagerDuty.REST.Alerts
6-- Module : Network.PagerDuty.REST.Alerts
7−-- Copyright : (c) 2013-2015 Brendan Hay <brendan.g.hay@gmail.com>
7+-- Copyright : (c) 2013-2014 Brendan Hay <brendan.g.hay@gmail.com>
8-- License : This Source Code Form is subject to the terms of
8-- License : This Source Code Form is subject to the terms of
9-- the Mozilla Public License, v. 2.0.
9-- the Mozilla Public License, v. 2.0.
10-- A copy of the MPL can be found in the LICENSE file or
10-- A copy of the MPL can be found in the LICENSE file or
@@ -43,12 +43,12 @@ module Network.PagerDuty.REST.Alerts
43 , alertAddress
43 , alertAddress
44 ) where
44 ) where
45
45
46−import Control.Lens hiding (Empty)
46+import Control.Lens
47−import Data.Aeson.Lens
47+import Data.Aeson.Lens
48−import Data.Time
48+import Data.Time
49−import Network.PagerDuty.Internal.TH
50−import Network.PagerDuty.Internal.Types
51−import Network.PagerDuty.REST.Users (User)
49+import Network.PagerDuty.REST.Users (User)
50+import Network.PagerDuty.Internal.TH
51+import Network.PagerDuty.Internal.Types
52
52
53alerts :: Path
53alerts :: Path
54alerts = "alerts"
54alerts = "alerts"
src/Network/PagerDuty/REST/EscalationPolicies.hs+14−14
@@ -1,13 +1,13 @@
1+{-# LANGUAGE ExtendedDefaultRules #-}
1−{-# LANGUAGE DataKinds #-}
2+{-# LANGUAGE DataKinds #-}
2−{-# LANGUAGE ExtendedDefaultRules #-}
3−{-# LANGUAGE OverloadedStrings #-}
3+{-# LANGUAGE OverloadedStrings #-}
4−{-# LANGUAGE TemplateHaskell #-}
4+{-# LANGUAGE TemplateHaskell #-}
5−{-# LANGUAGE TypeFamilies #-}
5+{-# LANGUAGE TypeFamilies #-}
6
6
7{-# OPTIONS_GHC -fno-warn-type-defaults #-}
7{-# OPTIONS_GHC -fno-warn-type-defaults #-}
8
8
9-- Module : Network.PagerDuty.REST.EscalationPolicies
9-- Module : Network.PagerDuty.REST.EscalationPolicies
10−-- Copyright : (c) 2013-2015 Brendan Hay <brendan.g.hay@gmail.com>
10+-- Copyright : (c) 2013-2014 Brendan Hay <brendan.g.hay@gmail.com>
11-- License : This Source Code Form is subject to the terms of
11-- License : This Source Code Form is subject to the terms of
12-- the Mozilla Public License, v. 2.0.
12-- the Mozilla Public License, v. 2.0.
13-- A copy of the MPL can be found in the LICENSE file or
13-- A copy of the MPL can be found in the LICENSE file or
@@ -60,15 +60,15 @@ module Network.PagerDuty.REST.EscalationPolicies
60 , pServices
60 , pServices
61 ) where
61 ) where
62
62
63−import Control.Lens hiding (Empty)
63+import Control.Lens
64−import Data.Aeson.Lens
64+import Data.Aeson.Lens
65−import Data.Text (Text)
65+import Data.Text (Text)
66−import Network.HTTP.Types
66+import Network.HTTP.Types
67−import Network.PagerDuty.Internal.TH
68−import Network.PagerDuty.Internal.Types
69−import Network.PagerDuty.REST.Services (Service)
67+import Network.PagerDuty.REST.Services (Service)
68+import Network.PagerDuty.Internal.TH
69+import Network.PagerDuty.Internal.Types
70
70
71−import Network.PagerDuty.REST.EscalationPolicies.EscalationRules
71+import Network.PagerDuty.REST.EscalationPolicies.EscalationRules
72
72
73default (Path)
73default (Path)
74
74
src/Network/PagerDuty/REST/EscalationPolicies/EscalationRules.hs+10−10
@@ -1,12 +1,12 @@
1−{-# LANGUAGE ExtendedDefaultRules #-}
1+{-# LANGUAGE ExtendedDefaultRules #-}
2−{-# LANGUAGE FlexibleInstances #-}
2+{-# LANGUAGE FlexibleInstances #-}
3−{-# LANGUAGE OverloadedStrings #-}
3+{-# LANGUAGE OverloadedStrings #-}
4−{-# LANGUAGE TemplateHaskell #-}
4+{-# LANGUAGE TemplateHaskell #-}
5
5
6{-# OPTIONS_GHC -fno-warn-type-defaults #-}
6{-# OPTIONS_GHC -fno-warn-type-defaults #-}
7
7
8-- Module : Network.PagerDuty.REST.EscalationPolicies.EscalationRules
8-- Module : Network.PagerDuty.REST.EscalationPolicies.EscalationRules
9−-- Copyright : (c) 2013-2015 Brendan Hay <brendan.g.hay@gmail.com>
9+-- Copyright : (c) 2013-2014 Brendan Hay <brendan.g.hay@gmail.com>
10-- License : This Source Code Form is subject to the terms of
10-- License : This Source Code Form is subject to the terms of
11-- the Mozilla Public License, v. 2.0.
11-- the Mozilla Public License, v. 2.0.
12-- A copy of the MPL can be found in the LICENSE file or
12-- A copy of the MPL can be found in the LICENSE file or
@@ -64,15 +64,15 @@ module Network.PagerDuty.REST.EscalationPolicies.EscalationRules
64 , rTargets
64 , rTargets
65 ) where
65 ) where
66
66
67−import Control.Applicative ((<$>))
67+import Control.Applicative ((<$>))
68−import Control.Lens hiding ((.=))
68+import Control.Lens hiding ((.=))
69import Data.Aeson
69import Data.Aeson
70−import qualified Data.Aeson.KeyMap as Map
70+import qualified Data.HashMap.Strict as Map
71−import Data.Text (Text)
71+import Data.Text (Text)
72import Network.HTTP.Types
72import Network.HTTP.Types
73+import Network.PagerDuty.REST.Users
73import Network.PagerDuty.Internal.TH
74import Network.PagerDuty.Internal.TH
74import Network.PagerDuty.Internal.Types
75import Network.PagerDuty.Internal.Types
75−import Network.PagerDuty.REST.Users
76
76
77default (Path)
77default (Path)
78
78
src/Network/PagerDuty/REST/Incidents.hs+8−9
@@ -10,7 +10,7 @@
10{-# OPTIONS_GHC -fno-warn-type-defaults #-}
10{-# OPTIONS_GHC -fno-warn-type-defaults #-}
11
11
12-- Module : Network.PagerDuty.REST.Incidents
12-- Module : Network.PagerDuty.REST.Incidents
13−-- Copyright : (c) 2013-2015 Brendan Hay <brendan.g.hay@gmail.com>
13+-- Copyright : (c) 2013-2014 Brendan Hay <brendan.g.hay@gmail.com>
14-- License : This Source Code Form is subject to the terms of
14-- License : This Source Code Form is subject to the terms of
15-- the Mozilla Public License, v. 2.0.
15-- the Mozilla Public License, v. 2.0.
16-- A copy of the MPL can be found in the LICENSE file or
16-- A copy of the MPL can be found in the LICENSE file or
@@ -130,10 +130,9 @@ module Network.PagerDuty.REST.Incidents
130 ) where
130 ) where
131
131
132import Control.Applicative hiding (empty)
132import Control.Applicative hiding (empty)
133−import Control.Lens hiding (Empty)
133+import Control.Lens
134import Data.Aeson
134import Data.Aeson
135−import Data.ByteString.Conversion (ToByteString (..),
135+import Data.ByteString.Conversion (ToByteString(..), toByteString')
136− toByteString')
137import Data.Default.Class
136import Data.Default.Class
138import Data.Maybe
137import Data.Maybe
139import Data.Monoid hiding (All)
138import Data.Monoid hiding (All)
@@ -437,12 +436,12 @@ cSince = upd.cSince'.mapping _D
437
436
438-- | The end of the date range over which you want to search.
437-- | The end of the date range over which you want to search.
439--
438--
440−-- /Note:/ If you leave off either since or until, a 30 day default range is
439+-- /Note: If you leave off either since or until, a 30 day default range is
441-- applied to your open ended range. Not including the since parameter will set
440-- applied to your open ended range. Not including the since parameter will set
442−-- the date range to until @-30@ days. Likewise, if you leave off until,
441+-- the date range to until - 30 days. Likewise, if you leave off until,
443−-- it is set to since @+30@ days.
442+-- it is set to since + 30 days.
444--
443--
445−-- /Default:/ The last 30 days if you leave off both. The size of the date
444+-- Defaults to the last 30 days if you leave off both. The size of the date
446-- range must be less than 180 days.
445-- range must be less than 180 days.
447cUntil :: Lens' (Request CountIncidents s b) (Maybe UTCTime)
446cUntil :: Lens' (Request CountIncidents s b) (Maybe UTCTime)
448cUntil = upd.cUntil'.mapping _D
447cUntil = upd.cUntil'.mapping _D
@@ -567,7 +566,7 @@ updateIncidents r = auth updateIncidentsBasic & query .~ [("requester_id", r)]
567
566
568-- | A version of 'updateIncidents' which uses HTTP Basic authentication and
567-- | A version of 'updateIncidents' which uses HTTP Basic authentication and
569-- doesn't require a 'RequesterId'.
568-- doesn't require a 'RequesterId'.
570−updateIncidentsBasic :: Request UpdateIncidents 'Basic [UpdatedIncidents]
569+updateIncidentsBasic :: Request UpdateIncidents Basic [UpdatedIncidents]
571updateIncidentsBasic =
570updateIncidentsBasic =
572 mk UpdateIncidents
571 mk UpdateIncidents
573 { _uiIncidents' = []
572 { _uiIncidents' = []
src/Network/PagerDuty/REST/Incidents/Notes.hs+12−12
@@ -1,11 +1,11 @@
1−{-# LANGUAGE ExtendedDefaultRules #-}
1+{-# LANGUAGE ExtendedDefaultRules #-}
2−{-# LANGUAGE OverloadedStrings #-}
2+{-# LANGUAGE OverloadedStrings #-}
3−{-# LANGUAGE TemplateHaskell #-}
3+{-# LANGUAGE TemplateHaskell #-}
4
4
5{-# OPTIONS_GHC -fno-warn-type-defaults #-}
5{-# OPTIONS_GHC -fno-warn-type-defaults #-}
6
6
7-- Module : Network.PagerDuty.REST.Incidents.Notes
7-- Module : Network.PagerDuty.REST.Incidents.Notes
8−-- Copyright : (c) 2013-2015 Brendan Hay <brendan.g.hay@gmail.com>
8+-- Copyright : (c) 2013-2014 Brendan Hay <brendan.g.hay@gmail.com>
9-- License : This Source Code Form is subject to the terms of
9-- License : This Source Code Form is subject to the terms of
10-- the Mozilla Public License, v. 2.0.
10-- the Mozilla Public License, v. 2.0.
11-- A copy of the MPL can be found in the LICENSE file or
11-- A copy of the MPL can be found in the LICENSE file or
@@ -36,14 +36,14 @@ module Network.PagerDuty.REST.Incidents.Notes
36 , nContent
36 , nContent
37 ) where
37 ) where
38
38
39−import Control.Lens hiding ((.=))
39+import Control.Lens hiding ((.=))
40−import Data.Aeson
40+import Data.Aeson
41−import Data.Text (Text)
41+import Data.Text (Text)
42−import Data.Time
42+import Data.Time
43−import Network.HTTP.Types
43+import Network.HTTP.Types
44−import Network.PagerDuty.Internal.TH
45−import Network.PagerDuty.Internal.Types
46−import Network.PagerDuty.REST.Users
44+import Network.PagerDuty.REST.Users
45+import Network.PagerDuty.Internal.TH
46+import Network.PagerDuty.Internal.Types
47
47
48default (Path)
48default (Path)
49
49
src/Network/PagerDuty/REST/LogEntries.hs+7−6
@@ -5,7 +5,7 @@
5{-# LANGUAGE TypeFamilies #-}
5{-# LANGUAGE TypeFamilies #-}
6
6
7-- Module : Network.PagerDuty.REST.LogEntries
7-- Module : Network.PagerDuty.REST.LogEntries
8−-- Copyright : (c) 2013-2015 Brendan Hay <brendan.g.hay@gmail.com>
8+-- Copyright : (c) 2013-2014 Brendan Hay <brendan.g.hay@gmail.com>
9-- License : This Source Code Form is subject to the terms of
9-- License : This Source Code Form is subject to the terms of
10-- the Mozilla Public License, v. 2.0.
10-- the Mozilla Public License, v. 2.0.
11-- A copy of the MPL can be found in the LICENSE file or
11-- A copy of the MPL can be found in the LICENSE file or
@@ -111,18 +111,19 @@ module Network.PagerDuty.REST.LogEntries
111 , nAddress
111 , nAddress
112 ) where
112 ) where
113
113
114−import Control.Lens hiding (Empty)
114+import Control.Applicative
115+import Control.Lens
115import Data.Aeson
116import Data.Aeson
116import Data.Aeson.Lens
117import Data.Aeson.Lens
117−import qualified Data.Aeson.KeyMap as Map
118import Data.Default.Class
118import Data.Default.Class
119+import qualified Data.HashMap.Strict as Map
119−import Data.Text (Text)
120+import Data.Text (Text)
120−import qualified Data.Text as Text
121+import qualified Data.Text as Text
121import Data.Time
122import Data.Time
122import Network.HTTP.Types
123import Network.HTTP.Types
124+import Network.PagerDuty.REST.Users (User)
123import Network.PagerDuty.Internal.TH
125import Network.PagerDuty.Internal.TH
124import Network.PagerDuty.Internal.Types
126import Network.PagerDuty.Internal.Types
125−import Network.PagerDuty.REST.Users (User)
126
127
127logs :: Path
128logs :: Path
128logs = "log_entries"
129logs = "log_entries"
src/Network/PagerDuty/REST/MaintenanceWindows.hs+10−10
@@ -4,7 +4,7 @@
4{-# LANGUAGE TypeFamilies #-}
4{-# LANGUAGE TypeFamilies #-}
5
5
6-- Module : Network.PagerDuty.REST.MaintenanceWindows
6-- Module : Network.PagerDuty.REST.MaintenanceWindows
7−-- Copyright : (c) 2013-2015 Brendan Hay <brendan.g.hay@gmail.com>
7+-- Copyright : (c) 2013-2014 Brendan Hay <brendan.g.hay@gmail.com>
8-- License : This Source Code Form is subject to the terms of
8-- License : This Source Code Form is subject to the terms of
9-- the Mozilla Public License, v. 2.0.
9-- the Mozilla Public License, v. 2.0.
10-- A copy of the MPL can be found in the LICENSE file or
10-- A copy of the MPL can be found in the LICENSE file or
@@ -74,14 +74,14 @@ module Network.PagerDuty.REST.MaintenanceWindows
74 , mwServices
74 , mwServices
75 ) where
75 ) where
76
76
77−import Control.Lens hiding (Empty)
77+import Control.Lens
78−import Data.Monoid
78+import Data.Monoid
79−import Data.Text (Text)
79+import Data.Text (Text)
80−import Data.Time
80+import Data.Time
81−import Network.HTTP.Types
81+import Network.HTTP.Types
82−import Network.PagerDuty.Internal.TH
83−import Network.PagerDuty.Internal.Types
84−import Network.PagerDuty.REST.Users (User)
82+import Network.PagerDuty.REST.Users (User)
83+import Network.PagerDuty.Internal.TH
84+import Network.PagerDuty.Internal.Types
85
85
86windows :: Path
86windows :: Path
87windows = "maintenance_windows"
87windows = "maintenance_windows"
@@ -214,7 +214,7 @@ createWindow r s e xs =
214createWindowBasic :: UTCTime -- ^ 'cwStartTime'
214createWindowBasic :: UTCTime -- ^ 'cwStartTime'
215 -> UTCTime -- ^ 'cwEndTime'
215 -> UTCTime -- ^ 'cwEndTime'
216 -> [ServiceId] -- ^ 'cwServiceIds'
216 -> [ServiceId] -- ^ 'cwServiceIds'
217− -> Request CreateWindow 'Basic MaintenanceWindow
217+ -> Request CreateWindow Basic MaintenanceWindow
218createWindowBasic s e xs =
218createWindowBasic s e xs =
219 mk CreateWindow
219 mk CreateWindow
220 { _cwRequesterId' = Nothing
220 { _cwRequesterId' = Nothing
src/Network/PagerDuty/REST/Reports.hs+11−11
@@ -1,13 +1,13 @@
1−{-# LANGUAGE DataKinds #-}
1+{-# LANGUAGE DataKinds #-}
2−{-# LANGUAGE ExtendedDefaultRules #-}
2+{-# LANGUAGE ExtendedDefaultRules #-}
3−{-# LANGUAGE OverloadedStrings #-}
3+{-# LANGUAGE OverloadedStrings #-}
4−{-# LANGUAGE TemplateHaskell #-}
4+{-# LANGUAGE TemplateHaskell #-}
5−{-# LANGUAGE TypeFamilies #-}
5+{-# LANGUAGE TypeFamilies #-}
6
6
7{-# OPTIONS_GHC -fno-warn-type-defaults #-}
7{-# OPTIONS_GHC -fno-warn-type-defaults #-}
8
8
9-- Module : Network.PagerDuty.REST.Reports
9-- Module : Network.PagerDuty.REST.Reports
10−-- Copyright : (c) 2013-2015 Brendan Hay <brendan.g.hay@gmail.com>
10+-- Copyright : (c) 2013-2014 Brendan Hay <brendan.g.hay@gmail.com>
11-- License : This Source Code Form is subject to the terms of
11-- License : This Source Code Form is subject to the terms of
12-- the Mozilla Public License, v. 2.0.
12-- the Mozilla Public License, v. 2.0.
13-- A copy of the MPL can be found in the LICENSE file or
13-- A copy of the MPL can be found in the LICENSE file or
@@ -58,11 +58,11 @@ module Network.PagerDuty.REST.Reports
58 , irNumberOfIncidents
58 , irNumberOfIncidents
59 ) where
59 ) where
60
60
61−import Control.Lens hiding (Empty)
61+import Control.Lens
62−import Data.Aeson.Lens
62+import Data.Aeson.Lens
63−import Data.Time
63+import Data.Time
64−import Network.PagerDuty.Internal.TH
64+import Network.PagerDuty.Internal.TH
65−import Network.PagerDuty.Internal.Types
65+import Network.PagerDuty.Internal.Types
66
66
67default (Path)
67default (Path)
68
68
src/Network/PagerDuty/REST/Schedules.hs+14−14
@@ -1,13 +1,13 @@
1−{-# LANGUAGE DataKinds #-}
1+{-# LANGUAGE DataKinds #-}
2−{-# LANGUAGE ExtendedDefaultRules #-}
2+{-# LANGUAGE ExtendedDefaultRules #-}
3−{-# LANGUAGE OverloadedStrings #-}
3+{-# LANGUAGE OverloadedStrings #-}
4−{-# LANGUAGE TemplateHaskell #-}
4+{-# LANGUAGE TemplateHaskell #-}
5−{-# LANGUAGE TypeFamilies #-}
5+{-# LANGUAGE TypeFamilies #-}
6
6
7{-# OPTIONS_GHC -fno-warn-type-defaults #-}
7{-# OPTIONS_GHC -fno-warn-type-defaults #-}
8
8
9-- Module : Network.PagerDuty.REST.Schedules
9-- Module : Network.PagerDuty.REST.Schedules
10−-- Copyright : (c) 2013-2015 Brendan Hay <brendan.g.hay@gmail.com>
10+-- Copyright : (c) 2013-2014 Brendan Hay <brendan.g.hay@gmail.com>
11-- License : This Source Code Form is subject to the terms of
11-- License : This Source Code Form is subject to the terms of
12-- the Mozilla Public License, v. 2.0.
12-- the Mozilla Public License, v. 2.0.
13-- A copy of the MPL can be found in the LICENSE file or
13-- A copy of the MPL can be found in the LICENSE file or
@@ -110,14 +110,14 @@ module Network.PagerDuty.REST.Schedules
110 , sFinalSchedule
110 , sFinalSchedule
111 ) where
111 ) where
112
112
113−import Control.Lens hiding (Empty, (.=))
113+import Control.Lens hiding ((.=))
114−import Data.Aeson
114+import Data.Aeson
115−import Data.Text (Text)
115+import Data.Text (Text)
116−import Data.Time
116+import Data.Time
117−import Network.HTTP.Types
117+import Network.HTTP.Types
118−import Network.PagerDuty.Internal.TH
119−import Network.PagerDuty.Internal.Types
120−import Network.PagerDuty.REST.Users (User)
118+import Network.PagerDuty.REST.Users (User)
119+import Network.PagerDuty.Internal.TH
120+import Network.PagerDuty.Internal.Types
121
121
122default (Path)
122default (Path)
123
123
src/Network/PagerDuty/REST/Schedules/Overrides.hs+12−12
@@ -1,13 +1,13 @@
1−{-# LANGUAGE DataKinds #-}
1+{-# LANGUAGE DataKinds #-}
2−{-# LANGUAGE ExtendedDefaultRules #-}
2+{-# LANGUAGE ExtendedDefaultRules #-}
3−{-# LANGUAGE OverloadedStrings #-}
3+{-# LANGUAGE OverloadedStrings #-}
4−{-# LANGUAGE TemplateHaskell #-}
4+{-# LANGUAGE TemplateHaskell #-}
5−{-# LANGUAGE TypeFamilies #-}
5+{-# LANGUAGE TypeFamilies #-}
6
6
7{-# OPTIONS_GHC -fno-warn-type-defaults #-}
7{-# OPTIONS_GHC -fno-warn-type-defaults #-}
8
8
9-- Module : Network.PagerDuty.REST.Schedules
9-- Module : Network.PagerDuty.REST.Schedules
10−-- Copyright : (c) 2013-2015 Brendan Hay <brendan.g.hay@gmail.com>
10+-- Copyright : (c) 2013-2014 Brendan Hay <brendan.g.hay@gmail.com>
11-- License : This Source Code Form is subject to the terms of
11-- License : This Source Code Form is subject to the terms of
12-- the Mozilla Public License, v. 2.0.
12-- the Mozilla Public License, v. 2.0.
13-- A copy of the MPL can be found in the LICENSE file or
13-- A copy of the MPL can be found in the LICENSE file or
@@ -50,12 +50,12 @@ module Network.PagerDuty.REST.Schedules.Overrides
50 , oUser
50 , oUser
51 ) where
51 ) where
52
52
53−import Control.Lens
53+import Control.Lens
54−import Data.Time
54+import Data.Time
55−import Network.HTTP.Types
55+import Network.HTTP.Types
56−import Network.PagerDuty.Internal.TH
57−import Network.PagerDuty.Internal.Types
58−import Network.PagerDuty.REST.Users
56+import Network.PagerDuty.REST.Users
57+import Network.PagerDuty.Internal.TH
58+import Network.PagerDuty.Internal.Types
59
59
60overrides :: ScheduleId -> Path
60overrides :: ScheduleId -> Path
61overrides i = "schedules" % i % "overrides"
61overrides i = "schedules" % i % "overrides"
src/Network/PagerDuty/REST/Services.hs+16−16
@@ -1,13 +1,13 @@
1−{-# LANGUAGE DataKinds #-}
1+{-# LANGUAGE DataKinds #-}
2−{-# LANGUAGE ExtendedDefaultRules #-}
2+{-# LANGUAGE ExtendedDefaultRules #-}
3−{-# LANGUAGE OverloadedStrings #-}
3+{-# LANGUAGE OverloadedStrings #-}
4−{-# LANGUAGE TemplateHaskell #-}
4+{-# LANGUAGE TemplateHaskell #-}
5−{-# LANGUAGE TypeFamilies #-}
5+{-# LANGUAGE TypeFamilies #-}
6
6
7{-# OPTIONS_GHC -fno-warn-type-defaults #-}
7{-# OPTIONS_GHC -fno-warn-type-defaults #-}
8
8
9-- Module : Network.PagerDuty.REST.Services
9-- Module : Network.PagerDuty.REST.Services
10−-- Copyright : (c) 2013-2015 Brendan Hay <brendan.g.hay@gmail.com>
10+-- Copyright : (c) 2013-2014 Brendan Hay <brendan.g.hay@gmail.com>
11-- License : This Source Code Form is subject to the terms of
11-- License : This Source Code Form is subject to the terms of
12-- the Mozilla Public License, v. 2.0.
12-- the Mozilla Public License, v. 2.0.
13-- A copy of the MPL can be found in the LICENSE file or
13-- A copy of the MPL can be found in the LICENSE file or
@@ -106,14 +106,14 @@ module Network.PagerDuty.REST.Services
106 , svcSeverityFilter
106 , svcSeverityFilter
107 ) where
107 ) where
108
108
109−import Control.Lens hiding (Empty)
109+import Control.Lens
110−import Data.Aeson.Lens
110+import Data.Aeson.Lens
111−import Data.Text (Text)
111+import Data.Text (Text)
112−import Data.Time
112+import Data.Time
113−import Network.HTTP.Types
113+import Network.HTTP.Types
114−import Network.PagerDuty.Internal.TH
115−import Network.PagerDuty.Internal.Types
116−import Network.PagerDuty.REST.Services.EmailFilters
114+import Network.PagerDuty.REST.Services.EmailFilters
115+import Network.PagerDuty.Internal.TH
116+import Network.PagerDuty.Internal.Types
117
117
118default (Path)
118default (Path)
119
119
@@ -483,7 +483,7 @@ enableService r i =
483
483
484-- | A version of 'enableService' which uses HTTP Basic authentication and
484-- | A version of 'enableService' which uses HTTP Basic authentication and
485-- doesn't require a 'RequesterId'.
485-- doesn't require a 'RequesterId'.
486−enableServiceBasic :: ServiceId -> Request Empty 'Basic Empty
486+enableServiceBasic :: ServiceId -> Request Empty Basic Empty
487enableServiceBasic i = empty & meth .~ PUT & path .~ services % i % "enable"
487enableServiceBasic i = empty & meth .~ PUT & path .~ services % i % "enable"
488
488
489-- | Disable a service. Once a service is disabled, it will not be able to
489-- | Disable a service. Once a service is disabled, it will not be able to
@@ -498,7 +498,7 @@ disableService r i =
498
498
499-- | A version of 'disableService' which uses HTTP Basic authentication and
499-- | A version of 'disableService' which uses HTTP Basic authentication and
500-- doesn't require a 'RequesterId'.
500-- doesn't require a 'RequesterId'.
501−disableServiceBasic :: ServiceId -> Request Empty 'Basic Empty
501+disableServiceBasic :: ServiceId -> Request Empty Basic Empty
502disableServiceBasic i = empty & meth .~ PUT & path .~ services % i % "disable"
502disableServiceBasic i = empty & meth .~ PUT & path .~ services % i % "disable"
503
503
504-- | Regenerate a new service key for an existing service.
504-- | 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 #-}
1+{-# LANGUAGE ExtendedDefaultRules #-}
2−{-# LANGUAGE OverloadedStrings #-}
2+{-# LANGUAGE OverloadedStrings #-}
3−{-# LANGUAGE TemplateHaskell #-}
3+{-# LANGUAGE TemplateHaskell #-}
4
4
5{-# OPTIONS_GHC -fno-warn-type-defaults #-}
5{-# OPTIONS_GHC -fno-warn-type-defaults #-}
6
6
7-- Module : Network.PagerDuty.REST.Services.EmailFilters
7-- Module : Network.PagerDuty.REST.Services.EmailFilters
8−-- Copyright : (c) 2013-2015 Brendan Hay <brendan.g.hay@gmail.com>
8+-- Copyright : (c) 2013-2014 Brendan Hay <brendan.g.hay@gmail.com>
9-- License : This Source Code Form is subject to the terms of
9-- License : This Source Code Form is subject to the terms of
10-- the Mozilla Public License, v. 2.0.
10-- the Mozilla Public License, v. 2.0.
11-- A copy of the MPL can be found in the LICENSE file or
11-- A copy of the MPL can be found in the LICENSE file or
@@ -39,15 +39,15 @@ module Network.PagerDuty.REST.Services.EmailFilters
39 , efId
39 , efId
40 ) where
40 ) where
41
41
42−import Control.Applicative hiding (empty)
42+import Control.Applicative hiding (empty)
43−import Control.Lens hiding ((.=))
43+import Control.Lens hiding ((.=))
44−import Data.Aeson
44+import Data.Aeson
45−import Data.Default.Class
45+import Data.Default.Class
46−import Data.Monoid
46+import Data.Monoid
47−import Data.Text (Text)
47+import Data.Text (Text)
48−import Network.HTTP.Types
48+import Network.HTTP.Types
49−import Network.PagerDuty.Internal.TH
49+import Network.PagerDuty.Internal.TH
50−import Network.PagerDuty.Internal.Types
50+import Network.PagerDuty.Internal.Types
51
51
52default (Path)
52default (Path)
53
53
@@ -65,7 +65,7 @@ deriveNullaryWith hyphenated ''MatchMode
65-- FIXME: Tighten up this type! Make the regex required for match/no-match and
65-- FIXME: Tighten up this type! Make the regex required for match/no-match and
66-- encode the conditional invariants.
66-- encode the conditional invariants.
67data EmailFilterInfo = EmailFilterInfo
67data EmailFilterInfo = EmailFilterInfo
68− { _efSubjectMode' :: Maybe MatchMode
68+ { _efSubjectMode' :: Maybe MatchMode
69 , _efSubjectRegex' :: Maybe Text
69 , _efSubjectRegex' :: Maybe Text
70 , _efBodyMode' :: Maybe MatchMode
70 , _efBodyMode' :: Maybe MatchMode
71 , _efBodyRegex' :: Maybe Text
71 , _efBodyRegex' :: Maybe Text
src/Network/PagerDuty/REST/Users.hs+17−17
@@ -1,13 +1,13 @@
1−{-# LANGUAGE DataKinds #-}
1+{-# LANGUAGE DataKinds #-}
2−{-# LANGUAGE ExtendedDefaultRules #-}
2+{-# LANGUAGE ExtendedDefaultRules #-}
3−{-# LANGUAGE OverloadedStrings #-}
3+{-# LANGUAGE OverloadedStrings #-}
4−{-# LANGUAGE TemplateHaskell #-}
4+{-# LANGUAGE TemplateHaskell #-}
5−{-# LANGUAGE TypeFamilies #-}
5+{-# LANGUAGE TypeFamilies #-}
6
6
7{-# OPTIONS_GHC -fno-warn-type-defaults #-}
7{-# OPTIONS_GHC -fno-warn-type-defaults #-}
8
8
9-- Module : Network.PagerDuty.REST.Users
9-- Module : Network.PagerDuty.REST.Users
10−-- Copyright : (c) 2013-2015 Brendan Hay <brendan.g.hay@gmail.com>
10+-- Copyright : (c) 2013-2014 Brendan Hay <brendan.g.hay@gmail.com>
11-- License : This Source Code Form is subject to the terms of
11-- License : This Source Code Form is subject to the terms of
12-- the Mozilla Public License, v. 2.0.
12-- the Mozilla Public License, v. 2.0.
13-- A copy of the MPL can be found in the LICENSE file or
13-- A copy of the MPL can be found in the LICENSE file or
@@ -81,16 +81,16 @@ module Network.PagerDuty.REST.Users
81 , uJobTitle
81 , uJobTitle
82 ) where
82 ) where
83
83
84−import Control.Applicative hiding (empty)
84+import Control.Applicative hiding (empty)
85−import Control.Lens hiding (Empty, (.=))
85+import Control.Lens hiding ((.=))
86−import Data.Aeson
86+import Data.Aeson
87−import Data.Default.Class
87+import Data.Default.Class
88−import Data.Monoid
88+import Data.Monoid
89−import Data.Text (Text)
89+import Data.Text (Text)
90−import Data.Time
90+import Data.Time
91−import Network.HTTP.Types
91+import Network.HTTP.Types
92−import Network.PagerDuty.Internal.TH
92+import Network.PagerDuty.Internal.TH
93−import Network.PagerDuty.Internal.Types
93+import Network.PagerDuty.Internal.Types
94
94
95default (Path)
95default (Path)
96
96
@@ -315,7 +315,7 @@ createUser r n e = auth (createUserBasic n e) & query .~ [("requester_id", r)]
315-- doesn't require a 'RequesterId'.
315-- doesn't require a 'RequesterId'.
316createUserBasic :: Text -- ^ 'cuName'
316createUserBasic :: Text -- ^ 'cuName'
317 -> Address -- ^ 'cuEmail'
317 -> Address -- ^ 'cuEmail'
318− -> Request CreateUser 'Basic User
318+ -> Request CreateUser Basic User
319createUserBasic n e =
319createUserBasic n e =
320 mk CreateUser
320 mk CreateUser
321 { _cuName' = n
321 { _cuName' = n
src/Network/PagerDuty/REST/Users/ContactMethods.hs+10−10
@@ -1,11 +1,11 @@
1−{-# LANGUAGE ExtendedDefaultRules #-}
1+{-# LANGUAGE ExtendedDefaultRules #-}
2−{-# LANGUAGE OverloadedStrings #-}
2+{-# LANGUAGE OverloadedStrings #-}
3−{-# LANGUAGE TemplateHaskell #-}
3+{-# LANGUAGE TemplateHaskell #-}
4
4
5{-# OPTIONS_GHC -fno-warn-type-defaults #-}
5{-# OPTIONS_GHC -fno-warn-type-defaults #-}
6
6
7-- Module : Network.PagerDuty.REST.Users.ContactMethods
7-- Module : Network.PagerDuty.REST.Users.ContactMethods
8−-- Copyright : (c) 2013-2015 Brendan Hay <brendan.g.hay@gmail.com>
8+-- Copyright : (c) 2013-2014 Brendan Hay <brendan.g.hay@gmail.com>
9-- License : This Source Code Form is subject to the terms of
9-- License : This Source Code Form is subject to the terms of
10-- the Mozilla Public License, v. 2.0.
10-- the Mozilla Public License, v. 2.0.
11-- A copy of the MPL can be found in the LICENSE file or
11-- A copy of the MPL can be found in the LICENSE file or
@@ -56,12 +56,12 @@ module Network.PagerDuty.REST.Users.ContactMethods
56 , Contact
56 , Contact
57 ) where
57 ) where
58
58
59−import Control.Lens
59+import Control.Lens
60−import Data.Aeson.Lens
60+import Data.Aeson.Lens
61−import Data.Text (Text)
61+import Data.Text (Text)
62−import Network.HTTP.Types
62+import Network.HTTP.Types
63−import Network.PagerDuty.Internal.TH
63+import Network.PagerDuty.Internal.TH
64−import Network.PagerDuty.Internal.Types
64+import Network.PagerDuty.Internal.Types
65
65
66default (Path)
66default (Path)
67
67
src/Network/PagerDuty/REST/Users/NotificationRules.hs+10−10
@@ -1,11 +1,11 @@
1−{-# LANGUAGE ExtendedDefaultRules #-}
1+{-# LANGUAGE ExtendedDefaultRules #-}
2−{-# LANGUAGE OverloadedStrings #-}
2+{-# LANGUAGE OverloadedStrings #-}
3−{-# LANGUAGE TemplateHaskell #-}
3+{-# LANGUAGE TemplateHaskell #-}
4
4
5{-# OPTIONS_GHC -fno-warn-type-defaults #-}
5{-# OPTIONS_GHC -fno-warn-type-defaults #-}
6
6
7-- Module : Network.PagerDuty.REST.Users.NotificationRules
7-- Module : Network.PagerDuty.REST.Users.NotificationRules
8−-- Copyright : (c) 2013-2015 Brendan Hay <brendan.g.hay@gmail.com>
8+-- Copyright : (c) 2013-2014 Brendan Hay <brendan.g.hay@gmail.com>
9-- License : This Source Code Form is subject to the terms of
9-- License : This Source Code Form is subject to the terms of
10-- the Mozilla Public License, v. 2.0.
10-- the Mozilla Public License, v. 2.0.
11-- A copy of the MPL can be found in the LICENSE file or
11-- A copy of the MPL can be found in the LICENSE file or
@@ -51,12 +51,12 @@ module Network.PagerDuty.REST.Users.NotificationRules
51 , rContactMethod
51 , rContactMethod
52 ) where
52 ) where
53
53
54−import Control.Lens
54+import Control.Lens
55−import Data.Aeson.Lens
55+import Data.Aeson.Lens
56−import Network.HTTP.Types
56+import Network.HTTP.Types
57−import Network.PagerDuty.Internal.TH
58−import Network.PagerDuty.Internal.Types
59−import Network.PagerDuty.REST.Users.ContactMethods
57+import Network.PagerDuty.REST.Users.ContactMethods
58+import Network.PagerDuty.Internal.TH
59+import Network.PagerDuty.Internal.Types
60
60
61default (Path)
61default (Path)
62
62
src/Network/PagerDuty/REST/Webhooks.hs+3−4
@@ -3,7 +3,7 @@
3{-# LANGUAGE TemplateHaskell #-}
3{-# LANGUAGE TemplateHaskell #-}
4
4
5-- Module : Network.PagerDuty.REST.Webhooks
5-- Module : Network.PagerDuty.REST.Webhooks
6−-- Copyright : (c) 2013-2015 Brendan Hay <brendan.g.hay@gmail.com>
6+-- Copyright : (c) 2013-2014 Brendan Hay <brendan.g.hay@gmail.com>
7-- License : This Source Code Form is subject to the terms of
7-- License : This Source Code Form is subject to the terms of
8-- the Mozilla Public License, v. 2.0.
8-- the Mozilla Public License, v. 2.0.
9-- A copy of the MPL can be found in the LICENSE file or
9-- A copy of the MPL can be found in the LICENSE file or
@@ -35,14 +35,13 @@ module Network.PagerDuty.REST.Webhooks
35import Control.Applicative hiding (empty)
35import Control.Applicative hiding (empty)
36import Control.Lens
36import Control.Lens
37import Data.Aeson
37import Data.Aeson
38−import Data.ByteString.Conversion (ToByteString (..),
38+import Data.ByteString.Conversion (ToByteString(..), toByteString')
39− toByteString')
40import Data.Text (Text)
39import Data.Text (Text)
41import qualified Data.Text.Encoding as Text
40import qualified Data.Text.Encoding as Text
42import Data.Time
41import Data.Time
42+import Network.PagerDuty.REST.Incidents
43import Network.PagerDuty.Internal.TH
43import Network.PagerDuty.Internal.TH
44import Network.PagerDuty.Internal.Types
44import Network.PagerDuty.Internal.Types
45−import Network.PagerDuty.REST.Incidents
46
45
47data WebhookType
46data WebhookType
48 = WTrigger
47 = WTrigger
src/Network/PagerDuty/Types.hsdeleted−93
@@ -1,93 +0,0 @@
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.yamldeleted−7
@@ -1,7 +0,0 @@
1−resolver: lts-19.23
2−
3−packages:
4−- .
5−
6−nix:
7− packages: [zlib]