Liking cljdoc? Tell your friends :D

ninja.response

A Clojure(Script) library for the unified responses.

A Clojure(Script) library for the unified responses.
raw docstring

*anomaliesclj/s

Registry of anomalies.

Registry of anomalies.
sourceraw docstring

add-anomaly!clj/s

(add-anomaly! anomaly)

Adds a new anomaly to the anomalies registry.

Adds a new anomaly to the anomalies registry.
sourceraw docstring

anomaly?clj/s

(anomaly? x)

Returns true if x is an anomaly. Otherwise, false.

Returns `true` if `x` is an anomaly. Otherwise, `false`.
sourceraw docstring

as-acceptedclj/s

(as-accepted data)
(as-accepted data meta)

Returns a unified accepted response.

Returns a unified `accepted` response.
sourceraw docstring

as-busyclj/s

(as-busy data)
(as-busy data meta)

Returns a unified busy response.

Returns a unified `busy` response.
sourceraw docstring

as-conflictclj/s

(as-conflict data)
(as-conflict data meta)

Returns a unified conflict response.

Returns a unified `conflict` response.
sourceraw docstring

as-createdclj/s

(as-created data)
(as-created data meta)

Returns a unified created response.

Returns a unified `created` response.
sourceraw docstring

as-deletedclj/s

(as-deleted data)
(as-deleted data meta)

Returns a unified deleted response.

Returns a unified `deleted` response.
sourceraw docstring

as-errorclj/s

(as-error data)
(as-error data meta)

Returns a unified error response.

Returns a unified `error` response.
sourceraw docstring

as-exceptionclj/s

(as-exception data)
(as-exception data meta)

Returns a unified exception response.

Returns a unified `exception` response.
sourceraw docstring

as-forbiddenclj/s

(as-forbidden data)
(as-forbidden data meta)

Returns a unified forbidden response.

Returns a unified `forbidden` response.
sourceraw docstring

as-foundclj/s

(as-found data)
(as-found data meta)

Returns a unified found response.

Returns a unified `found` response.
sourceraw docstring

as-incorrectclj/s

(as-incorrect data)
(as-incorrect data meta)

Returns a unified incorrect response.

Returns a unified `incorrect` response.
sourceraw docstring

as-interruptedclj/s

(as-interrupted data)
(as-interrupted data meta)

Returns a unified interrupted response.

Returns a unified `interrupted` response.
sourceraw docstring

as-not-foundclj/s

(as-not-found data)
(as-not-found data meta)

Returns a unified not-found response.

Returns a unified `not-found` response.
sourceraw docstring

as-responseclj/s

(as-response type)
(as-response type data)
(as-response type data meta)

Returns an instance of a unified response.

Returns an instance of a unified response.
sourceraw docstring

as-successclj/s

(as-success data)
(as-success data meta)

Returns a unified success response.

Returns a unified `success` response.
sourceraw docstring

as-unauthorizedclj/s

(as-unauthorized data)
(as-unauthorized data meta)

Returns a unified unauthorized response.

Returns a unified `unauthorized` response.
sourceraw docstring

as-unavailableclj/s

(as-unavailable data)
(as-unavailable data meta)

Returns a unified unavailable response.

Returns a unified `unavailable` response.
sourceraw docstring

as-unknownclj/s

(as-unknown data)
(as-unknown data meta)

Returns a unified unknown response.

Returns a unified `unknown` response.
sourceraw docstring

as-unsupportedclj/s

(as-unsupported data)
(as-unsupported data meta)

Returns a unified unsupported response.

Returns a unified `unsupported` response.
sourceraw docstring

as-updatedclj/s

(as-updated data)
(as-updated data meta)

Returns a unified updated response.

Returns a unified `updated` response.
sourceraw docstring

as-warningclj/s

(as-warning data)
(as-warning data meta)

Returns a unified warning response.

Returns a unified `warning` response.
sourceraw docstring

cljs?clj

(cljs? env)

Checks &env in macro and returns true if that cljs env. Otherwise false.

Checks &env in macro and returns `true` if that cljs env. Otherwise `false`.
sourceraw docstring

dataclj/s

(data x)

Returns data of a unified response.

Returns `data` of a unified response.
sourceraw docstring

error?clj/s

(error? x)

Returns true if is a unified error response. Otherwise, false.

Returns `true` if is a unified error response. Otherwise, `false`.
sourceraw docstring

IResponseclj/sprotocol

A unified response protocol.

A unified response protocol.

-dataclj/s

(-data this)

Returns data of a unified response.

Returns `data` of a unified response.

-error?clj/s

(-error? this)

Returns true if type of a unified response is an anomaly. Otherwise, false.

Returns `true` if `type` of a unified response is an anomaly. Otherwise, `false`.

-metaclj/s

(-meta this)

Returns meta of a unified response.

Returns `meta` of a unified response.

-typeclj/s

(-type this)

Returns type of a unified response.

Returns `type` of a unified response.
sourceraw docstring

metaclj/s

(meta x)

Returns meta of a unified response.

Returns `meta` of a unified response.
sourceraw docstring

remove-anomaly!clj/s

(remove-anomaly! anomaly)

Removes an anomaly from the anomalies registry.

Removes an anomaly from the anomalies registry.
sourceraw docstring

Responseclj/s

source

safecljmacro

(safe body)
(safe body with)

Extended version of try-catch. Usage:

  • (safe (/ 1 0)) ;; => nil
  • (safe (/ 1 0) #(ex-message %)) ;; => "Divide by zero"
  • (safe (/ 1 0) #(as-exception (ex-message %))) ;; => #ninja/response{:type :exception, :data "Divide by zero", :meta nil}
Extended version of try-catch.
Usage:
 * (safe (/ 1 0))                                ;; => nil
 * (safe (/ 1 0) #(ex-message %))                ;; => "Divide by zero"
 * (safe (/ 1 0) #(as-exception (ex-message %))) ;; => #ninja/response{:type :exception, :data "Divide by zero", :meta nil}
sourceraw docstring

tagclj/s

source

typeclj/s

(type x)

Returns type of a unified response.

Returns `type` of a unified response.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close