couchdb-conduit-0.1.0.1: Couch DB client library using http-conduit and aeson

Database.CouchDB.Conduit.LowLevel

Description

Low-level method and tools of accessing CouchDB.

Synopsis

Documentation

couchSource

Arguments

:: MonadCouch m 
=> Method

Method

-> Path

Path

-> RequestHeaders

Headers

-> Query

Query args

-> RequestBody m

Request body

-> (CouchResponse m -> ResourceT m (CouchResponse m))

Protect function. See protect

-> ResourceT m (CouchResponse m) 

The most general method of accessing CouchDB. This is a very thin wrapper around http. Most of the time you should use one of the other access functions, but this function is needed for example to write and read attachments that are not in JSON format.

protectSource

Arguments

:: MonadCouch m 
=> [Int]

Good codes

-> CouchResponse m

Response

-> ResourceT m (CouchResponse m) 

Protect Response from bad status codes. If status code in list of status codes - just return response. Otherwise - throw CouchError.

Instead checkStatus, protect parses CouchDB response body JSON and extract "reason" message.

To protect from typical errors use protect'.

protect'Source

Arguments

:: MonadCouch m 
=> CouchResponse m

Response

-> ResourceT m (CouchResponse m) 

Protect from typical status codes: 200, 201, 202 and 304. See protect fo details.