Safe Haskell | None |
---|---|
Language | Haskell2010 |
- send :: (MonadIO m, FromJSON b) => SubDomain -> Auth s -> Manager -> Request a s b -> m (Either Error b)
- sendWith :: (MonadIO m, FromJSON b) => Env s -> Request a s b -> m (Either Error b)
- paginate :: (MonadIO m, Paginate a, FromJSON b) => SubDomain -> Auth s -> Manager -> Request a s b -> Source m (Either Error b)
- paginateWith :: (MonadIO m, Paginate a, FromJSON b) => Env s -> Request a s b -> Source m (Either Error b)
- data Env s
- envDomain :: forall s. Lens' (Env s) SubDomain
- envAuth :: forall s s'. Lens (Env s) (Env s') (Auth s) (Auth s')
- envManager :: forall s. Lens' (Env s) Manager
- envLogger :: forall s. Lens' (Env s) Logger
- data Logger
- debug :: MonadIO m => Logger -> Text -> m ()
- class Paginate a
- data Request a s b
- data Error
- _Internal :: Prism' Error Text
- _Integration :: Prism' Error IntegrationError
- _REST :: Prism' Error RESTError
- class HasMessage s a | s -> a where
- message :: Lens' s a
- class HasErrors s a | s -> a where
- errors :: Lens' s a
- data IntegrationError
- status :: Lens' IntegrationError Text
- data RESTError
- data Code
- code :: Lens' RESTError Code
- description :: Code -> Text
- data Security
- data Auth a where
- AuthBasic :: ByteString -> ByteString -> Auth Basic
- AuthToken :: ByteString -> Auth Token
- data Key a
- mkKey :: Text -> Key a
- type ServiceKey = Key "service"
- type IncidentKey = Key "incident"
- data Id a
- mkId :: Text -> Id a
- type AlertId = Id "alert"
- type ContactId = Id "contact"
- type EmailFilterId = Id "email-filter"
- type EscalationPolicyId = Id "escalation-policy"
- type EscalationRuleId = Id "escalation-rule"
- type IncidentId = Id "incident"
- type LogEntryId = Id "log-entry"
- type NoteId = Id "note"
- type NotificationRuleId = Id "notification-rule"
- type OverrideId = Id "schedule-override"
- type RequesterId = Id "requester"
- type ScheduleId = Id "schedule"
- type ServiceId = Id "service"
- type UserId = Id "user"
- type VendorId = Id "vendor"
- type WebhookId = Id "webhook"
- type WindowId = Id "maintenance-window"
- data SubDomain
- mkSubDomain :: ByteString -> SubDomain
- data Address
- mkAddress :: Text -> Address
- data Empty = Empty
Sending requests
send :: (MonadIO m, FromJSON b) => SubDomain -> Auth s -> Manager -> Request a s b -> m (Either Error b)
See: sendWith
paginate :: (MonadIO m, Paginate a, FromJSON b) => SubDomain -> Auth s -> Manager -> Request a s b -> Source m (Either Error b)
See: paginateWith
paginateWith :: (MonadIO m, Paginate a, FromJSON b) => Env s -> Request a s b -> Source m (Either Error b)
Configuration
Environment
data Env s
The environment containing the parameters required to make PagerDuty requests.
Monad m => MonadReader (Env s) (PagerDutyT s m) |
envManager :: forall s. Lens' (Env s) Manager
Logging
debug :: MonadIO m => Logger -> Text -> m ()
Log a message using the debug logger, or if none is specified noop.
Types
Requests
class Paginate a
Exists primarily to obtain a constraint for the paginate
function.
data Request a s b
ToJSON (Request a s b) | |
(QueryLike a, ToJSON a, HasUserInfo a) => HasUserInfo (Request a s b) | |
(QueryLike a, ToJSON a, HasEmailFilterInfo a) => HasEmailFilterInfo (Request a s b) |
Errors
data Error
Eq Error | |
Show Error | |
FromJSON Error | |
HasMessage Error Text | |
Monad m => MonadError Error (PagerDutyT s m) |
_Integration :: Prism' Error IntegrationError
Messages
class HasMessage s a | s -> a where
message :: Lens' s a
A short human-readable message describing the error.
HasMessage IntegrationError Text | |
HasMessage RESTError Text | |
HasMessage Error Text |
Fields
class HasErrors s a | s -> a where
errors :: Lens' s a
A list of human-readable reasons for the error. These values, and even their format, are subject to change.
HasErrors IntegrationError [Text] | |
HasErrors RESTError [Text] |
Integration
data IntegrationError
Eq IntegrationError | |
Show IntegrationError | |
ToJSON IntegrationError | |
FromJSON IntegrationError | |
HasMessage IntegrationError Text | |
HasErrors IntegrationError [Text] |
status :: Lens' IntegrationError Text
REST
data RESTError
In the case of an error, the PagerDuty error code can give further details on the nature of the error.
See: description
description :: Code -> Text
Authentication
data Auth a where
AuthBasic :: ByteString -> ByteString -> Auth Basic | |
AuthToken :: ByteString -> Auth Token |
Keys
data Key a
HasIncidentKey Trigger IncidentKey | |
HasIncidentKey Generic IncidentKey | |
HasIncidentKey Event IncidentKey | |
HasServiceKey Trigger ServiceKey | |
HasServiceKey Generic ServiceKey | |
HasServiceKey Event ServiceKey | |
Eq (Key a) | |
Show (Key a) | |
IsString (Key a) | |
ToJSON (Key a) | |
FromJSON (Key a) | |
ToByteString (Key a) | |
QueryValueLike (Key a) |
Aliases
type ServiceKey = Key "service"
type IncidentKey = Key "incident"
Identifiers
data Id a
Aliases
type EmailFilterId = Id "email-filter"
type EscalationPolicyId = Id "escalation-policy"
type EscalationRuleId = Id "escalation-rule"
type IncidentId = Id "incident"
type LogEntryId = Id "log-entry"
type NotificationRuleId = Id "notification-rule"
type OverrideId = Id "schedule-override"
type RequesterId = Id "requester"
type ScheduleId = Id "schedule"
SubDomain
mkSubDomain :: ByteString -> SubDomain
Address
data Address