libjenkins-0.3.0.0: Jenkins API interface

Safe HaskellNone

Jenkins.Rest.Method

Contents

Description

Jenkins REST API method construction

Synopsis

Types

data Method Source

Jenkins RESTFul API method encoding

Instances

~ Type t Complete => Pythony (Method t) 
~ Type t Complete => XMLy (Method t) 
~ Type t Complete => JSONy (Method t) 
~ Type t Complete => Num (Method t f)

Only to support number literals

Show (As f) => Show (Method t f) 
IsString (Method Complete f) 
IsString (Method Query f) 

data Type Source

Method types

Constructors

Query 
Complete 

data Format Source

Response formats

data As Source

Response format singleton type

Instances

Pythony As 
XMLy As 
JSONy As 
Eq (As f) 
Show (As f) 

Method construction

(-?-) :: Method Complete f -> Method Query f -> Method Complete fSource

Combine path and query

(-/-) :: Method Complete f -> Method Complete f -> Method Complete fSource

Combine 2 paths

(-=-) :: Text -> Text -> Method Query fSource

Make a field-value pair

(-&-) :: Method Query f -> Method Query f -> Method Query fSource

Combine 2 queries

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 [])
""

as :: Method Complete f -> As f -> Method Complete fSource

Choose response format

class JSONy t whereSource

JSON response format

Methods

json :: t JSONSource

Instances

class XMLy t whereSource

XML response format

Methods

xml :: t XMLSource

Instances

XMLy As 
~ Type t Complete => XMLy (Method t) 

class Pythony t whereSource

Python response format

Methods

python :: t PythonSource

Instances

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"

queue :: Method Complete fSource

Queue API method

>>> render (queue `as` python)
"queue/api/python"

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"

slash :: (IsString m, Monoid m) => m -> m -> mSource

Insert "/" between two String-like things and concatenate everything.