Safe Haskell | None |
---|
Jenkins REST API method construction
- data Method
- data Type
- data Format
- data As
- text :: Text -> Method Complete f
- int :: Integer -> Method Complete f
- (-?-) :: Method Complete f -> Method Query f -> 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
- as :: Method Complete f -> As f -> Method Complete f
- class JSONy t where
- json :: t JSON
- class XMLy t where
- xml :: t XML
- class Pythony t where
- python :: t Python
- job :: Text -> Method Complete f
- build :: Integral a => Text -> a -> Method Complete f
- view :: Text -> Method Complete f
- queue :: Method Complete f
- overallLoad :: Method Complete f
- computer :: Method Complete f
- render :: Method t f -> ByteString
- slash :: (IsString m, Monoid m) => m -> m -> m
Types
Jenkins RESTFul API method encoding
Method construction
query :: [(Text, Maybe Text)] -> Method Query fSource
List-to-query convenience combinator
>>>
render (query [("foo", Nothing), ("bar", Just "baz"), ("quux", Nothing)])
"foo&bar=baz&quux"
>>>
render (query [])
""
JSON response format
XML response format
Python response format
Shortcuts
job :: Text -> Method Complete fSource
Job API method
>>>
render (job "name" `as` json)
"job/name/api/json"
build :: Integral a => Text -> a -> Method Complete fSource
Job build API method
>>>
render (build "name" 4 `as` json)
"job/name/4/api/json"
view :: Text -> Method Complete fSource
View API method
>>>
render (view "name" `as` xml)
"view/name/api/xml"
overallLoad :: Method Complete fSource
Statistics API method
>>>
render (overallLoad `as` xml)
"overallLoad/api/xml"
computer :: Method Complete fSource
Node API method
>>>
render (computer `as` python)
"computer/api/python"
Rendering
render :: Method t f -> ByteStringSource
Render Method
to something that can be sent over the wire
>>>
render ("" `as` xml)
"api/xml"
>>>
render xml
"api/xml"
>>>
render ("job" -/- 7 `as` xml)
"job/7/api/xml"
>>>
render ("job" -/- 7 `as` xml)
"job/7/api/xml"
>>>
render ("job" -/- 7 `as` json)
"job/7/api/json"
>>>
render (text "restart")
"restart"
>>>
render ("job" -?- "name" -=- "foo" -&- "title" -=- "bar")
"job?name=foo&title=bar"
>>>
render ("job" -?- "name" -&- "title" -=- "bar")
"job?name&title=bar"
>>>
render ("job" -/- 7 `as` json -?- "name" -&- "title" -=- "bar")
"job/7/api/json?name&title=bar"
>>>
render ("job" -/- "ДМИТРИЙ" `as` xml)
"job/%D0%94%D0%9C%D0%98%D0%A2%D0%A0%D0%98%D0%99/api/xml"