bugzilla-redhat-1.0.1.1: A Haskell interface to the Bugzilla native REST API
Safe HaskellSafe-Inferred
LanguageHaskell2010

Web.RedHatBugzilla

Description

This package is designed to provide an easy-to-use, typesafe interface to querying Bugzilla from Haskell.

A modified version of Web.Bugzilla to support the list fields in Red Hat's modified bugzilla API.

A very simple program using this package might look like this:

  let session = anonymousSession "https://bugzilla.redhat.com"
      user = "me@example.org"
      query = AssignedToField .==. user .&&.
              FlagRequesteeField .==. user .&&.
              (FlagsField `contains` "review" .||. FlagsField `contains` "feedback")
  bugs <- searchBugs session query
  mapM_ (putStrLn . show . bugSummary) bugs

There's a more in-depth demo program included with the source code to this package.

Synopsis

Connecting to Bugzilla

apikeySession :: BugzillaServer -> BugzillaApiKey -> BugzillaSession Source #

Creates a BugzillaSession using the provided api key.

anonymousSession :: BugzillaServer -> BugzillaSession Source #

Creates an anonymous BugzillaSession. Note that some content will be hidden by Bugzilla when you make queries in this state.

type BugzillaServer = Text Source #

data BugzillaSession Source #

A session for Bugzilla queries. Use anonymousSession and loginSession, as appropriate, to create one.

newtype BugzillaApiKey Source #

Constructors

BugzillaApiKey Text 

Querying Bugzilla

searchBugs :: BugzillaSession -> SearchExpression -> IO [Bug] Source #

Searches Bugzilla and returns a list of Bugs. The SearchExpression can be constructed using the operators in Web.Bugzilla.Search.

searchBugsAll :: BugzillaSession -> SearchExpression -> IO [Bug] Source #

Similar to searchBugs, but return _all fields.

searchBugs' :: BugzillaSession -> SearchExpression -> IO [BugId] Source #

Like searchBugs, but returns a list of BugIds. You can retrieve the Bug for each BugId using getBug. The combination of searchBugs' and getBug is much less efficient than searchBugs. searchBugs' is suitable for cases where you won't need to call getBug most of the time - for example, polling to determine whether the set of bugs returned by a query has changed.

searchBugsWithLimit Source #

Arguments

:: BugzillaSession 
-> Int

The maximum number of results to return.

-> Int

The offset from the first result to start from.

-> SearchExpression 
-> IO [Bug] 

Search Bugzilla and returns a limited number of results. You can call this repeatedly and use offset to retrieve the results of a large query incrementally. Note that most Bugzillas won't return all of the results for a very large query by default, but you can request this by calling searchBugsWithLimit with 0 for the limit.

searchBugsAllWithLimit Source #

Arguments

:: BugzillaSession 
-> Int

The maximum number of results to return.

-> Int

The offset from the first result to start from.

-> SearchExpression 
-> IO [Bug] 

Similar to searchBugsWithLimit, but return _all fields.

searchBugsWithLimit' Source #

Arguments

:: BugzillaSession 
-> Int

The maximum number of results to return.

-> Int

The offset from the first result to start from.

-> SearchExpression 
-> IO [BugId] 

Like searchBugsWithLimit, but returns a list of BugIds. See searchBugs' for more discussion.

getBug :: BugzillaSession -> BugId -> IO (Maybe Bug) Source #

Retrieve a bug by bug number.

getBugAll :: BugzillaSession -> BugId -> IO (Maybe Bug) Source #

Retrieve all bug field by bug number

getAttachment :: BugzillaSession -> AttachmentId -> IO (Maybe Attachment) Source #

Retrieve a bug by attachment number.

getAttachments :: BugzillaSession -> BugId -> IO [Attachment] Source #

Get all attachments for a bug.

getComments :: BugzillaSession -> BugId -> IO [Comment] Source #

Get all comments for a bug.

getHistory :: BugzillaSession -> BugId -> IO History Source #

Get the history for a bug.

searchUsers :: BugzillaSession -> Text -> IO [User] Source #

Search user names and emails using a substring search.

getUser :: BugzillaSession -> UserEmail -> IO (Maybe User) Source #

Get a user by email.

getUserById :: BugzillaSession -> UserId -> IO (Maybe User) Source #

Get a user by user ID.

newBzRequest :: BugzillaSession -> [Text] -> QueryText -> Request Source #

sendBzRequest :: FromJSON a => Request -> IO a Source #

intAsText :: Int -> Text Source #

data Request #

Instances

Instances details
Show Request 
Instance details

Defined in Network.HTTP.Client.Types

Methods

showsPrec :: Int -> Request -> ShowS

show :: Request -> String

showList :: [Request] -> ShowS

type BugId = Int Source #

type AttachmentId = Int Source #

type CommentId = Int Source #

type UserId = Int Source #

type EventId = Int Source #

type FlagId = Int Source #

type FlagType = Int Source #

type UserEmail = Text Source #

data Field a where Source #

A field which you can search by using searchBugs or track changes to using getHistory. To get a human-readable name for a field, use fieldName.

Constructors

AliasField :: Field [Text] 
AssignedToField :: Field UserEmail 
AttachmentCreatorField :: Field UserEmail 
AttachmentDataField :: Field Text 
AttachmentDescriptionField :: Field Text 
AttachmentFilenameField :: Field Text 
AttachmentIsObsoleteField :: Field Bool 
AttachmentIsPatchField :: Field Bool 
AttachmentIsPrivateField :: Field Bool 
AttachmentMimetypeField :: Field Text 
BlocksField :: Field Int 
BugIdField :: Field Int 
CcField :: Field UserEmail 
CcListAccessibleField :: Field Bool 
ClassificationField :: Field Text 
CommentField :: Field Text 
CommentIsPrivateField :: Field Text 
CommentTagsField :: Field Text 
CommenterField :: Field UserEmail 
ComponentField :: Field [Text] 
ContentField :: Field Text 
CreationDateField :: Field UTCTime 
DaysElapsedField :: Field Int 
DependsOnField :: Field Int 
EverConfirmedField :: Field Bool 
FlagRequesteeField :: Field UserEmail 
FlagSetterField :: Field UserEmail 
FlagsField :: Field Text 
GroupField :: Field Text 
KeywordsField :: Field [Text] 
ChangedField :: Field UTCTime 
CommentCountField :: Field Int 
OperatingSystemField :: Field Text 
HardwareField :: Field Text 
PriorityField :: Field Text 
ProductField :: Field Text 
QaContactField :: Field UserEmail 
ReporterField :: Field UserEmail 
ReporterAccessibleField :: Field Bool 
ResolutionField :: Field Text 
RestrictCommentsField :: Field Bool 
SeeAlsoField :: Field Text 
SeverityField :: Field Text 
StatusField :: Field Text 
WhiteboardField :: Field Text 
SummaryField :: Field Text 
TagsField :: Field Text 
TargetMilestoneField :: Field Text 
TimeSinceAssigneeTouchedField :: Field Int 
BugURLField :: Field Text 
VersionField :: Field Text 
VotesField :: Field Text 
CustomField :: Text -> Field Text 

Instances

Instances details
Show (Field a) Source # 
Instance details

Defined in Web.RedHatBugzilla.Internal.Types

Methods

showsPrec :: Int -> Field a -> ShowS

show :: Field a -> String

showList :: [Field a] -> ShowS

Eq (Field a) Source # 
Instance details

Defined in Web.RedHatBugzilla.Internal.Types

Methods

(==) :: Field a -> Field a -> Bool

(/=) :: Field a -> Field a -> Bool

data User Source #

A Bugzilla user.

Constructors

User 

Fields

Instances

Instances details
FromJSON User Source # 
Instance details

Defined in Web.RedHatBugzilla.Internal.Types

Methods

parseJSON :: Value -> Parser User

parseJSONList :: Value -> Parser [User]

Show User Source # 
Instance details

Defined in Web.RedHatBugzilla.Internal.Types

Methods

showsPrec :: Int -> User -> ShowS

show :: User -> String

showList :: [User] -> ShowS

Eq User Source # 
Instance details

Defined in Web.RedHatBugzilla.Internal.Types

Methods

(==) :: User -> User -> Bool

(/=) :: User -> User -> Bool

Ord User Source # 
Instance details

Defined in Web.RedHatBugzilla.Internal.Types

Methods

compare :: User -> User -> Ordering

(<) :: User -> User -> Bool

(<=) :: User -> User -> Bool

(>) :: User -> User -> Bool

(>=) :: User -> User -> Bool

max :: User -> User -> User

min :: User -> User -> User

data Flag Source #

Flags, which may be set on an attachment or on a bug directly.

Constructors

Flag 

Fields

Instances

Instances details
FromJSON Flag Source # 
Instance details

Defined in Web.RedHatBugzilla.Internal.Types

Methods

parseJSON :: Value -> Parser Flag

parseJSONList :: Value -> Parser [Flag]

Show Flag Source # 
Instance details

Defined in Web.RedHatBugzilla.Internal.Types

Methods

showsPrec :: Int -> Flag -> ShowS

show :: Flag -> String

showList :: [Flag] -> ShowS

Eq Flag Source # 
Instance details

Defined in Web.RedHatBugzilla.Internal.Types

Methods

(==) :: Flag -> Flag -> Bool

(/=) :: Flag -> Flag -> Bool

Ord Flag Source # 
Instance details

Defined in Web.RedHatBugzilla.Internal.Types

Methods

compare :: Flag -> Flag -> Ordering

(<) :: Flag -> Flag -> Bool

(<=) :: Flag -> Flag -> Bool

(>) :: Flag -> Flag -> Bool

(>=) :: Flag -> Flag -> Bool

max :: Flag -> Flag -> Flag

min :: Flag -> Flag -> Flag

data Bug Source #

A Bugzilla bug.

Constructors

Bug 

Fields

Instances

Instances details
FromJSON Bug Source # 
Instance details

Defined in Web.RedHatBugzilla.Internal.Types

Methods

parseJSON :: Value -> Parser Bug

parseJSONList :: Value -> Parser [Bug]

Show Bug Source # 
Instance details

Defined in Web.RedHatBugzilla.Internal.Types

Methods

showsPrec :: Int -> Bug -> ShowS

show :: Bug -> String

showList :: [Bug] -> ShowS

Eq Bug Source # 
Instance details

Defined in Web.RedHatBugzilla.Internal.Types

Methods

(==) :: Bug -> Bug -> Bool

(/=) :: Bug -> Bug -> Bool

data ExternalBug Source #

An external bug.

Constructors

ExternalBug 

Instances

Instances details
FromJSON ExternalBug Source # 
Instance details

Defined in Web.RedHatBugzilla.Internal.Types

Methods

parseJSON :: Value -> Parser ExternalBug

parseJSONList :: Value -> Parser [ExternalBug]

Show ExternalBug Source # 
Instance details

Defined in Web.RedHatBugzilla.Internal.Types

Methods

showsPrec :: Int -> ExternalBug -> ShowS

show :: ExternalBug -> String

showList :: [ExternalBug] -> ShowS

Eq ExternalBug Source # 
Instance details

Defined in Web.RedHatBugzilla.Internal.Types

Methods

(==) :: ExternalBug -> ExternalBug -> Bool

(/=) :: ExternalBug -> ExternalBug -> Bool

Ord ExternalBug Source # 
Instance details

Defined in Web.RedHatBugzilla.Internal.Types

data ExternalType Source #

An external bug type

Constructors

ExternalType 

Instances

Instances details
FromJSON ExternalType Source # 
Instance details

Defined in Web.RedHatBugzilla.Internal.Types

Methods

parseJSON :: Value -> Parser ExternalType

parseJSONList :: Value -> Parser [ExternalType]

Show ExternalType Source # 
Instance details

Defined in Web.RedHatBugzilla.Internal.Types

Methods

showsPrec :: Int -> ExternalType -> ShowS

show :: ExternalType -> String

showList :: [ExternalType] -> ShowS

Eq ExternalType Source # 
Instance details

Defined in Web.RedHatBugzilla.Internal.Types

Methods

(==) :: ExternalType -> ExternalType -> Bool

(/=) :: ExternalType -> ExternalType -> Bool

Ord ExternalType Source # 
Instance details

Defined in Web.RedHatBugzilla.Internal.Types

data Attachment Source #

An attachment to a bug.

Instances

Instances details
FromJSON Attachment Source # 
Instance details

Defined in Web.RedHatBugzilla.Internal.Types

Methods

parseJSON :: Value -> Parser Attachment

parseJSONList :: Value -> Parser [Attachment]

Show Attachment Source # 
Instance details

Defined in Web.RedHatBugzilla.Internal.Types

Methods

showsPrec :: Int -> Attachment -> ShowS

show :: Attachment -> String

showList :: [Attachment] -> ShowS

Eq Attachment Source # 
Instance details

Defined in Web.RedHatBugzilla.Internal.Types

Methods

(==) :: Attachment -> Attachment -> Bool

(/=) :: Attachment -> Attachment -> Bool

data Comment Source #

A bug comment. To display these the way Bugzilla does, you'll need to call getUser and use the userRealName for each user.

Instances

Instances details
FromJSON Comment Source # 
Instance details

Defined in Web.RedHatBugzilla.Internal.Types

Methods

parseJSON :: Value -> Parser Comment

parseJSONList :: Value -> Parser [Comment]

Show Comment Source # 
Instance details

Defined in Web.RedHatBugzilla.Internal.Types

Methods

showsPrec :: Int -> Comment -> ShowS

show :: Comment -> String

showList :: [Comment] -> ShowS

Eq Comment Source # 
Instance details

Defined in Web.RedHatBugzilla.Internal.Types

Methods

(==) :: Comment -> Comment -> Bool

(/=) :: Comment -> Comment -> Bool

data History Source #

History information for a bug.

Constructors

History 

Instances

Instances details
FromJSON History Source # 
Instance details

Defined in Web.RedHatBugzilla.Internal.Types

Methods

parseJSON :: Value -> Parser History

parseJSONList :: Value -> Parser [History]

Show History Source # 
Instance details

Defined in Web.RedHatBugzilla.Internal.Types

Methods

showsPrec :: Int -> History -> ShowS

show :: History -> String

showList :: [History] -> ShowS

Eq History Source # 
Instance details

Defined in Web.RedHatBugzilla.Internal.Types

Methods

(==) :: History -> History -> Bool

(/=) :: History -> History -> Bool

data HistoryEvent Source #

An event in a bug's history.

Constructors

HistoryEvent 

Fields

Instances

Instances details
FromJSON HistoryEvent Source # 
Instance details

Defined in Web.RedHatBugzilla.Internal.Types

Methods

parseJSON :: Value -> Parser HistoryEvent

parseJSONList :: Value -> Parser [HistoryEvent]

Show HistoryEvent Source # 
Instance details

Defined in Web.RedHatBugzilla.Internal.Types

Methods

showsPrec :: Int -> HistoryEvent -> ShowS

show :: HistoryEvent -> String

showList :: [HistoryEvent] -> ShowS

Eq HistoryEvent Source # 
Instance details

Defined in Web.RedHatBugzilla.Internal.Types

Methods

(==) :: HistoryEvent -> HistoryEvent -> Bool

(/=) :: HistoryEvent -> HistoryEvent -> Bool

data Change Source #

A single change which is part of an event. Different constructors are used according to the type of the field. The Modification describes the value of the field before and after the change.

Constructors

TextFieldChange (Field Text) (Modification Text) 
ListFieldChange (Field [Text]) (Modification [Text]) 
IntFieldChange (Field Int) (Modification Int) 
TimeFieldChange (Field UTCTime) (Modification UTCTime) 
BoolFieldChange (Field Bool) (Modification Bool) 

Instances

Instances details
FromJSON Change Source # 
Instance details

Defined in Web.RedHatBugzilla.Internal.Types

Methods

parseJSON :: Value -> Parser Change

parseJSONList :: Value -> Parser [Change]

Show Change Source # 
Instance details

Defined in Web.RedHatBugzilla.Internal.Types

Methods

showsPrec :: Int -> Change -> ShowS

show :: Change -> String

showList :: [Change] -> ShowS

Eq Change Source # 
Instance details

Defined in Web.RedHatBugzilla.Internal.Types

Methods

(==) :: Change -> Change -> Bool

(/=) :: Change -> Change -> Bool

data (Eq a, Show a) => Modification a Source #

A description of how a field changed during a HistoryEvent.

Constructors

Modification 

Fields

Instances

Instances details
(Eq a, Show a) => Show (Modification a) Source # 
Instance details

Defined in Web.RedHatBugzilla.Internal.Types

Methods

showsPrec :: Int -> Modification a -> ShowS

show :: Modification a -> String

showList :: [Modification a] -> ShowS

(Eq a, Show a) => Eq (Modification a) Source # 
Instance details

Defined in Web.RedHatBugzilla.Internal.Types

Methods

(==) :: Modification a -> Modification a -> Bool

(/=) :: Modification a -> Modification a -> Bool

fieldName :: Field a -> Text Source #

Provides a human-readable name for a Field.

data BugzillaException Source #

Constructors

BugzillaJSONParseError String 
BugzillaAPIError Int String 
BugzillaUnexpectedValue String 

Instances

Instances details
Exception BugzillaException Source # 
Instance details

Defined in Web.RedHatBugzilla.Internal.Network

Methods

toException :: BugzillaException -> SomeException

fromException :: SomeException -> Maybe BugzillaException

displayException :: BugzillaException -> String

Show BugzillaException Source # 
Instance details

Defined in Web.RedHatBugzilla.Internal.Network

Methods

showsPrec :: Int -> BugzillaException -> ShowS

show :: BugzillaException -> String

showList :: [BugzillaException] -> ShowS