Safe Haskell | None |
---|---|
Language | Haskell2010 |
Jenkins REST API methods
- text :: Text -> Method Complete f
- int :: Int -> Method Complete f
- (-/-) :: Method Complete f -> Method Complete f -> Method Complete f
- (-=-) :: Text -> Text -> Method Query f
- (-&-) :: Method Query f -> Method Query f -> Method Query f
- query :: [(Text, Maybe Text)] -> Method Query f
- (-?-) :: Method Complete f -> Method Query f -> Method Complete f
- data Formatter g
- json :: Formatter Json
- xml :: Formatter Xml
- python :: Formatter Python
- plain :: Formatter f
- job :: Text -> Method Complete f
- build :: Text -> Int -> Method Complete f
- view :: Text -> Method Complete f
- queue :: Method Complete f
- overallLoad :: Method Complete f
- computer :: Method Complete f
- data Method :: Type -> Format -> *
- data Type
- data Format
Construct URLs
Path
text :: Text -> Method Complete f Source
Use a string as an URI segment
>>>
pp (text "foo")
"foo"
Note: with -XOverloadedStrings
extension enabled it's possible to use string
literals as segments of the Jenkins API method URL
>>>
pp' "foo"
"foo"
Note: don't put /
in the string literal unless you want it URL-encoded,
use (-/-)
instead
>>>
pp' "foo/bar"
"foo%2Fbar"
(-/-) :: Method Complete f -> Method Complete f -> Method Complete f infixr 5 Source
Combine two paths
>>>
pp ("foo" -/- "bar" -/- "baz")
"foo/bar/baz"
Query
(-=-) :: Text -> Text -> Method Query f infix 7 Source
Make a key-value pair
>>>
pp ("foo" -=- "bar")
"foo=bar"
(-&-) :: Method Query f -> Method Query f -> Method Query f infixr 5 Source
Create the union of two queries
>>>
pp ("foo" -=- "bar" -&- "baz")
"foo=bar&baz"
query :: [(Text, Maybe Text)] -> Method Query f Source
Take a list of key-value pairs and render them as a query
>>>
pp (query [("foo", Nothing), ("bar", Just "baz"), ("quux", Nothing)])
"foo&bar=baz&quux"
>>>
pp (query [])
""
Put together the segments and the query
(-?-) :: Method Complete f -> Method Query f -> Method Complete f infix 1 Source
Put path and query together
>>>
pp ("qux" -/- "quux" -?- "foo" -=- "bar" -&- "baz")
"qux/quux?foo=bar&baz"
Format
Append the JSON formatting request to the method URL
>>>
format json "foo"
"foo/api/json"
Append the XML formatting request to the method URL
>>>
format xml "foo"
"foo/api/xml"
python :: Formatter Python Source
Append the Python formatting request to the method URL
>>>
format python "foo"
"foo/api/python"
Shortcuts
job :: Text -> Method Complete f Source
Job data
>>>
format json (job "name")
"job/name/api/json"
>>>
pp (job "name" -/- "config.xml")
"job/name/config.xml"
build :: Text -> Int -> Method Complete f Source
Job build data
>>>
format json (build "name" 4)
"job/name/4/api/json"
overallLoad :: Method Complete f Source
Server statistics
>>>
format xml overallLoad
"overallLoad/api/xml"