libjenkins-0.8.1: Jenkins API interface

Safe HaskellNone
LanguageHaskell2010

Jenkins.Rest.Method

Contents

Description

Jenkins REST API methods

Synopsis

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"

int :: Int -> Method Complete f Source

Use an integer as an URI segment

>>> pp (int 4)
"4"

(-/-) :: 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

data Formatter g Source

Formatters know how to append the "api/$format" string to the method URL

json :: Formatter Json Source

Append the JSON formatting request to the method URL

>>> format json "foo"
"foo/api/json"

xml :: Formatter Xml Source

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"

plain :: Formatter f Source

The formatter that does exactly nothing

>>> format plain "foo"
"foo"

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"

view :: Text -> Method Complete f Source

View data

>>> format xml (view "name")
"view/name/api/xml"

queue :: Method Complete f Source

Build queue data

>>> format python queue
"queue/api/python"

overallLoad :: Method Complete f Source

Server statistics

>>> format xml overallLoad
"overallLoad/api/xml"

computer :: Method Complete f Source

Nodes data

>>> format python computer
"computer/api/python"

Types

data Method :: Type -> Format -> * Source

Jenkins RESTFul API method encoding

Instances

(~) Type t Complete => Num (Method t f)

Only to support numeric literals

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

data Type Source

Method types

Constructors

Query 
Complete 

Instances

data Format Source

Response formats

Constructors

Json 
Xml 
Python