ICouch v0.2.1 ICouch.Server View Source
Holds information about CouchDB server connections and encapsulates API calls.
Link to this section Summary
Functions
Encodes CouchDB style query options together with an endpoint and returns the resulting relative URI
Invokes an arbitrary CouchDB API call which may or may not be implementation specific
Invokes an arbitrary CouchDB API call which may or may not be implementation specific
Link to this section Types
body :: nil | binary | (() -> {:ok, binary} | :eof) | (state :: term -> {:ok, binary, new_state :: term} | :eof)
method :: :get | :post | :head | :options | :put | :patch | :delete | :trace | :mkcol | :propfind | :proppatch | :lock | :unlock | :move | :copy
option :: {:max_sessions, integer} | {:max_pipeline_size, integer} | {:ssl_options, [any]} | {:pool_name, atom} | {:proxy_host, String.t} | {:proxy_port, integer} | {:proxy_user, String.t} | {:proxy_password, String.t} | {:basic_auth, {username :: String.t, password :: String.t}} | {:cookie, String.t} | {:http_vsn, {major :: integer, minor :: integer}} | {:host_header, String.t} | {:timeout, integer} | {:inactivity_timeout, integer} | {:connect_timeout, integer} | {:max_attempts, integer} | {:socket_options, [any]} | {:worker_process_options, [any]} | {:direct_conn_pid, pid}
t() :: %ICouch.Server{direct: nil, ib_options: [], timeout: nil, uri: URI.t}
Link to this section Functions
Encodes CouchDB style query options together with an endpoint and returns the resulting relative URI.
Invokes an arbitrary CouchDB API call which may or may not be implementation specific.
This expects the request body to be sent as binary (or function yielding binary chunks) and returns the raw response headers and the body as binary. There are no checks made if the request method actually allows a request body.
To use transparent JSON encoding and decoding for the requests use send_req/4
.
send_req(server :: t, endpoint, method, body) :: {:ok, body :: term} | {:error, ICouch.RequestError.well_known_error | term}
Invokes an arbitrary CouchDB API call which may or may not be implementation specific.
Many functions of the main module make use of this function. It is exposed publicly so you can call arbitrary API functions yourself.
Note that there is transparent JSON encoding and decoding for the requests and
the response headers are discarded; if you need raw data or the headers, use
send_raw_req/6
. Also checks are made if the request method actually allows
a request body and discards it if needed.