hs-json-rpc-0.0.0.1: JSON-RPC client library

Safe HaskellSafe-Infered

Network.JsonRpc.Client

Description

This module contains the client functionality of JSON-RPC, whose specification may be read here (http://json-rpc.org/wiki/specification) for version 1 and here (http://www.jsonrpc.org/spec.html) for version 2.

By convention, a notification is represented Haskell-side by a function returning a IO (), given it doesn't care about the server's response.

Note that the functions returned by remote, notify, detailledRemote and detailledNotify need not have parameters.

Synopsis

Documentation

remoteSource

Arguments

:: JsonRpcCall c 
=> String

Server URI. May contain username and password on the format username:password@ before the hostname.

-> String

Method name.

-> c

A function (ToJSON x1...ToJSON xn, FromJSON y) => x1 -> ... -> xn -> IO y

Call a remote function via JSON-RPC, using version 2 of the protocol and HTTP POST as its transport

detailledRemoteSource

Arguments

:: JsonRpcCall c 
=> JsonRpcVersion

Protocol's version.

-> [Pair]

Custom JSON elements to add to the request

-> String

Server URI. May contain username and password on the format username:password@ before the hostname.

-> String

Method name.

-> c

A function (ToJSON x1...ToJSON xn, FromJSON y) => x1 -> ... -> xn -> IO y

Call a remote function via JSON-RPC, specifying the protocol's version to use and customs elements to add to the request

notifySource

Arguments

:: JsonRpcNotification n 
=> String

Server URI. May contain username and password on the format username:password@ before the hostname.

-> String

Notification name.

-> n

A function (ToJSON x1...ToJSON xn) => x1 -> ... -> xn -> IO ()

Call a remote notification on a JSON-RPC server, using version 2 of the protocol and HTTP POST as its transport

detailledNotifySource

Arguments

:: JsonRpcNotification n 
=> JsonRpcVersion

Protocol's version.

-> [Pair]

Custom JSON elements to add to the request

-> String

Server URI. May contain username and password on the format username:password@ before the hostname.

-> String

Notification name.

-> n

A function (ToJSON x1...ToJSON xn, FromJSON y) => x1 -> ... -> xn -> IO y

Call a remote notification on a JSON-RPC server, specifying the protocol's version to use and customs elements to add to the request

class JsonRpcCall a Source

Type of functions representable in JSON-RPC

Instances

FromJSON a => JsonRpcCall (IO a) 
(ToJSON a, JsonRpcCall b) => JsonRpcCall (a -> b) 

data JsonRpcVersion Source

Datatype representing the protocol's version in use during a call or notification.

Constructors

Version1 
Version2 

class JsonRpcNotification a Source

Type of notifications representable in JSON-RPC

data JsonRpcException Source

The exception type returned by Network.JsonRpc.Client's functions when an error appens