git.iko.soy/typeable/pagerduty
on 41a528a 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+22
@@ -0,0 +1,22 @@
1+FLAGS := -j --disable-documentation
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) \
11+ --only-dependencies \
12+ --force-reinstalls
13+
14+clean:
15+ cabal clean
16+ rm -rf cabal.sandbox.config .cabal-sandbox
17+
18+doc:
19+ cabal haddock
20+
21+cabal.sandbox.config:
22+ 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+14−18
@@ -1,12 +1,12 @@
1name: pagerduty
1name: pagerduty
2−version: 0.0.8
2+version: 0.0.0
3synopsis: Client library for PagerDuty Integration and REST APIs.
3synopsis: Client library for PagerDuty Integration and REST APIs.
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
10category: Network, PagerDuty, Monitoring
10category: Network, PagerDuty, Monitoring
11build-type: Simple
11build-type: Simple
12cabal-version: >= 1.10
12cabal-version: >= 1.10
@@ -25,8 +25,6 @@ description:
25 .
25 .
26 /Warning:/ This is an experimental preview release which is still under
26 /Warning:/ This is an experimental preview release which is still under
27 heavy development and not intended for public consumption, caveat emptor!
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>.
30
28
31extra-source-files:
29extra-source-files:
32 README.md
30 README.md
@@ -71,27 +69,25 @@ library
71 , Network.PagerDuty.Types
69 , Network.PagerDuty.Types
72
70
73 build-depends:
71 build-depends:
74− aeson >= 2.0
72+ aeson == 0.8.*
75− , base >= 4.7 && < 5
73+ , base >= 4.5 && < 5
76− , bifunctors >= 4.1
74+ , bifunctors >= 4.1 && < 5
77 , bytestring >= 0.9
75 , bytestring >= 0.9
78 , bytestring-conversion >= 0.2.1
76 , bytestring-conversion >= 0.2.1
79− , conduit > 1.1
77+ , conduit > 1.1 && < 1.3
80 , data-default-class >= 0.0.1
78 , data-default-class >= 0.0.1
81 , exceptions >= 0.6
79 , exceptions >= 0.6
82− , generics-sop >= 0.5.0.0
80+ , generics-sop >= 0.1.0.2
83− , http-client >= 0.5 && < 1
81+ , http-client >= 0.4.3 && < 0.5
84 , http-types >= 0.8
82 , http-types >= 0.8
85− , lens >= 4.4
83+ , lens >= 4.4 && < 5
86 , lens-aeson >= 1
84 , lens-aeson >= 1
87− , mmorph >= 1
85+ , mmorph >= 1 && < 2
88− , monad-control >= 1
86+ , monad-control >= 1 && < 2
89− , mtl >= 2.1.3.1
87+ , mtl >= 2.2.1 && < 2.3
90 , template-haskell >= 2.2
88 , template-haskell >= 2.2
91 , text >= 1.1
89 , text >= 1.1
92− , time >= 1.2
90+ , time >= 1.5
93− , time-locale-compat >= 0.1.0.1
94− , transformers >= 0.2
91+ , transformers == 0.4.*
95− , transformers-compat >= 0.3
96 , transformers-base >= 0.4.2
92 , transformers-base >= 0.4.2
97 , unordered-containers >= 0.2.3
93 , 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+2−4
@@ -7,7 +7,7 @@
7{-# LANGUAGE UndecidableInstances #-}
7{-# LANGUAGE UndecidableInstances #-}
8
8
9-- Module : Control.Monad.Trans.PagerDuty
9-- Module : Control.Monad.Trans.PagerDuty
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
@@ -42,14 +42,12 @@ module Control.Monad.Trans.PagerDuty
42 ) where
42 ) where
43
43
44import Control.Applicative
44import Control.Applicative
45−import Control.Monad
46import Control.Monad.Base
45import Control.Monad.Base
47import Control.Monad.Catch
46import Control.Monad.Catch
48−import Control.Monad.Except (MonadError (..))
47+import Control.Monad.Except
49import Control.Monad.Morph
48import Control.Monad.Morph
50import Control.Monad.Reader
49import Control.Monad.Reader
51import Control.Monad.Trans.Control
50import Control.Monad.Trans.Control
52−import Control.Monad.Trans.Except
53import Data.Aeson
51import Data.Aeson
54import Data.Conduit
52import Data.Conduit
55import Network.PagerDuty.Integration (Event, Response)
53import Network.PagerDuty.Integration (Event, Response)
src/Network/PagerDuty/Integration.hs+5−6
@@ -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
@@ -81,7 +81,8 @@ module Network.PagerDuty.Integration
81import Control.Lens
81import Control.Lens
82import Control.Monad.IO.Class
82import Control.Monad.IO.Class
83import Data.Aeson
83import Data.Aeson
84+import Data.Default.Class
84−import qualified Data.Aeson.KeyMap as Map
85+import qualified Data.HashMap.Strict as Map
85import Data.Text (Text)
86import Data.Text (Text)
86import Network.HTTP.Client (Manager)
87import Network.HTTP.Client (Manager)
87import qualified Network.HTTP.Client as Client
88import qualified Network.HTTP.Client as Client
@@ -291,8 +292,6 @@ submitWith :: MonadIO m
291 -> Event
292 -> Event
292 -> m (Either Error Response)
293 -> m (Either Error Response)
293submitWith m l e = request m l e $
294submitWith m l e = request m l e $
294− Client.defaultRequest
295− { Client.host = "events.pagerduty.com"
295+ def { Client.host = "events.pagerduty.com"
296− , Client.path = "/generic/2010-04-15/create_event.json"
296+ , Client.path = "/generic/2010-04-15/create_event.json"
297− , Client.method = "POST"
298 }
297 }
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+16−24
@@ -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,32 @@
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
54
53
55newtype CSV a = CSV [a]
54newtype CSV a = CSV [a]
56− deriving (Eq, Show, Semigroup, Monoid)
55+ deriving (Eq, Show, Monoid)
57
56
58makePrisms ''CSV
57makePrisms ''CSV
59
58
@@ -70,7 +69,7 @@ instance ToByteString a => ToJSON (CSV a) where
70 toJSON = String . Text.decodeUtf8 . toByteString'
69 toJSON = String . Text.decodeUtf8 . toByteString'
71
70
72newtype List a = L [a]
71newtype List a = L [a]
73− deriving (Eq, Show, Semigroup, Monoid)
72+ deriving (Eq, Show, Monoid)
74
73
75deriveJSON ''List
74deriveJSON ''List
76makePrisms ''List
75makePrisms ''List
@@ -106,7 +105,7 @@ instance ToJSON Date where
106
105
107instance ToByteString Date where
106instance ToByteString Date where
108 builder (D d) = builder
107 builder (D d) = builder
109− (formatTime defaultTimeLocale ("%Y-%m-%dT%XZ") d)
108+ (formatTime defaultTimeLocale (iso8601DateFormat $ Just "%XZ") d)
110
109
111instance QueryValues Date
110instance QueryValues Date
112
111
@@ -133,8 +132,8 @@ data Security = Basic | Token
133 deriving (Eq, Show)
132 deriving (Eq, Show)
134
133
135data Auth (a :: Security) where
134data Auth (a :: Security) where
136− AuthBasic :: ByteString -> ByteString -> Auth 'Basic
135+ AuthBasic :: ByteString -> ByteString -> Auth Basic
137− AuthToken :: ByteString -> Auth 'Token
136+ AuthToken :: ByteString -> Auth Token
138
137
139deriving instance Eq (Auth a)
138deriving instance Eq (Auth a)
140deriving instance Show (Auth a)
139deriving instance Show (Auth a)
@@ -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
src/Network/PagerDuty/REST.hs+9−7
@@ -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,6 +13,7 @@
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 , sendWith
@@ -29,6 +30,7 @@ import Control.Monad.IO.Class
29import Control.Monad.Trans
30import Control.Monad.Trans
30import Data.Aeson (FromJSON)
31import Data.Aeson (FromJSON)
31import Data.Conduit
32import Data.Conduit
33+import Data.Default.Class
32import Data.Monoid
34import Data.Monoid
33import Network.HTTP.Client (Manager)
35import Network.HTTP.Client (Manager)
34import qualified Network.HTTP.Client as Client
36import qualified Network.HTTP.Client as Client
@@ -54,7 +56,7 @@ sendWith :: (MonadIO m, FromJSON b)
54 => Env s
56 => Env s
55 -> Request a s b
57 -> Request a s b
56 -> m (Either Error b)
58 -> m (Either Error b)
57−sendWith e = liftM (fmap _pgItem) . http e
59+sendWith e = liftM (fmap fst) . http e
58
60
59-- | /See:/ 'paginateWith'
61-- | /See:/ 'paginateWith'
60paginate :: (MonadIO m, Paginate a, FromJSON b)
62paginate :: (MonadIO m, Paginate a, FromJSON b)
@@ -73,15 +75,15 @@ paginateWith e = go
73 where
75 where
74 go rq = do
76 go rq = do
75 rs <- lift (http e rq)
77 rs <- lift (http e rq)
76− yield (_pgItem <$> rs)
78+ yield (fst <$> rs)
77 either (const (return ()))
79 either (const (return ()))
78− (maybe (return ()) go . next rq . _pgPager)
80+ (maybe (return ()) go . next rq . snd)
79 rs
81 rs
80
82
81http :: (MonadIO m, FromJSON b)
83http :: (MonadIO m, FromJSON b)
82 => Env s
84 => Env s
83 -> Request a s b
85 -> Request a s b
84− -> m (Either Error (Page b))
86+ -> m (Either Error (b, Maybe Pager))
85http e rq = request (e ^. envManager) (e ^. envLogger) rq $ raw
87http e rq = request (e ^. envManager) (e ^. envLogger) rq $ raw
86 { Client.host = domain (e ^. envDomain)
88 { Client.host = domain (e ^. envDomain)
87 , Client.path = renderPath (rq ^. path)
89 , Client.path = renderPath (rq ^. path)
@@ -89,7 +91,7 @@ http e rq = request (e ^. envManager) (e ^. envLogger) rq $ raw
89 }
91 }
90 where
92 where
91 raw = case e ^. envAuth of
93 raw = case e ^. envAuth of
92− AuthBasic u p -> Client.applyBasicAuth u p Client.defaultRequest
94+ AuthBasic u p -> Client.applyBasicAuth u p def
93− AuthToken t -> Client.defaultRequest
95+ AuthToken t -> def
94 { Client.requestHeaders = [("Authorization", "Token token=" <> t)]
96 { Client.requestHeaders = [("Authorization", "Token token=" <> t)]
95 }
97 }
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+4−5
@@ -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)
@@ -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.hs+1−1
@@ -1,5 +1,5 @@
1-- Module : Network.PagerDuty.Types
1-- Module : Network.PagerDuty.Types
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
stack.yamldeleted−7
@@ -1,7 +0,0 @@
1−resolver: lts-19.23
2−
3−packages:
4−- .
5−
6−nix:
7− packages: [zlib]