groups ::
  Maybe T.Text -- ^ Optional pattern to search for
  -> PagureT [Group]
groups pattern = do
  opts <- pagureWreqOptions
  let opts' = case pattern of
        Nothing -> opts
        Just p -> opts & param "pattern" .~ [p]
  resp <- pagureGetWith opts' "groups"
  return $ resp ^.. responseBody . key "groups" . values . _String

-- | Access the @/user/[username]@ endpoint.
--
-- Example:
--
-- @
-- >>> import Web.Pagure
-- >>> let pc = PagureConfig "https://pagure.io" Nothing
-- >>> runPagureT (userInfo "codeblock") pc
-- @
groups ::
  Maybe T.Text -- ^ Optional pattern to search for
  -> PagureT [Group]
groups pattern = do
  opts <- pagureWreqOptions
  let opts' = case pattern of
        Nothing -> opts
        Just p -> opts & param "pattern" .~ [p]
  resp <- pagureGetWith opts' "groups"
  return $ resp ^.. responseBody . key "groups" . values . _String

-- | Access the @/user/[username]@ endpoint.
--
-- Example:
--
-- @
-- >>> import Web.Pagure
-- >>> let pc = PagureConfig "https://pagure.io" Nothing
-- >>> runPagureT (userInfo "codeblock") pc
-- @
groups pattern = do
  opts <- pagureWreqOptions
  let opts' = case pattern of
        Nothing -> opts
        Just p -> opts & param "pattern" .~ [p]
  resp <- pagureGetWith opts' "groups"
  return $ resp ^.. responseBody . key "groups" . values . _String

-- | Access the @/user/[username]@ endpoint.
--
-- Example:
--
-- @
-- >>> import Web.Pagure
-- >>> let pc = PagureConfig "https://pagure.io" Nothing
-- >>> runPagureT (userInfo "codeblock") pc
-- @