Liking cljdoc? Tell your friends :D

unifier.response

A Clojure(Script) library for unified responses.

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

->clj/smacro

(-> expr & forms)

This macro is the same as clojure.core/some->, but the check is done using the predicate error? of the IUnifiedResponse protocol and the substitution occurs as in macro -> (the thread-first macro).

This macro is the same as `clojure.core/some->`, but the check is done
using the predicate `error?` of the `IUnifiedResponse` protocol and
the substitution occurs as in macro `->` (the `thread-first` macro).
sourceraw docstring

->>clj/smacro

(->> expr & forms)

This macro is the same as clojure.core/some->>, but the check is done using the predicate error? of the IUnifiedResponse protocol and the substitution occurs as in macro ->> (the thread-last macro).

This macro is the same as `clojure.core/some->>`, but the check is done
using the predicate `error?` of the `IUnifiedResponse` protocol and
the substitution occurs as in macro `->>` (the `thread-last` macro).
sourceraw docstring

?->clj/smacro

(?-> & forms)

The safe version of the macro -> (the thread-first macro).

The safe version of the macro `->` (the `thread-first` macro).
sourceraw docstring

?->>clj/smacro

(?->> & forms)

The safe version of the macro ->> (the thread-last macro).

The safe version of the macro `->>` (the `thread-last` macro).
sourceraw docstring

as-acceptedclj/s

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

Returns unified ::accepted response. Instance of unifier.response/UnifiedSuccess.

Returns unified `::accepted` response.
Instance of `unifier.response/UnifiedSuccess`.
sourceraw docstring

as-busyclj/s

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

Returns unified ::busy response. Instance of unifier.response/UnifiedError.

Returns unified `::busy` response.
Instance of `unifier.response/UnifiedError`.
sourceraw docstring

as-conflictclj/s

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

Returns unified ::conflict response. Instance of unifier.response/UnifiedError.

Returns unified `::conflict` response.
Instance of `unifier.response/UnifiedError`.
sourceraw docstring

as-createdclj/s

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

Returns unified ::accepted response. Instance of unifier.response/UnifiedSuccess.

Returns unified `::accepted` response.
Instance of `unifier.response/UnifiedSuccess`.
sourceraw docstring

as-errorclj/s

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

Returns unified ::error response. Instance of unifier.response/UnifiedError. Examples:

  • with default error type (as-error "a user was not found")

  • with specified error type (as-error :user/not-found "a user was not found")

  • with specified error type and meta (as-error :user/not-found "john@doe.com" {:i18n/key :user/not-found})

Returns unified `::error` response. Instance of `unifier.response/UnifiedError`.
Examples:
  * with default error `type`
  (as-error "a user was not found")

  * with specified error `type`
  (as-error :user/not-found "a user was not found")

  * with specified error `type` and `meta`
  (as-error :user/not-found "john@doe.com" {:i18n/key :user/not-found})
sourceraw docstring

as-exceptionclj/s

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

Returns unified ::exception response. Instance of unifier.response/UnifiedError.

Returns unified `::exception` response.
Instance of `unifier.response/UnifiedError`.
sourceraw docstring

as-faultclj/s

(as-fault data)
(as-fault data meta)

Returns unified ::fault response. Instance of unifier.response/UnifiedError.

Returns unified `::fault` response.
Instance of `unifier.response/UnifiedError`.
sourceraw docstring

as-forbiddenclj/s

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

Returns unified ::forbidden response. Instance of unifier.response/UnifiedError.

Returns unified `::forbidden` response.
Instance of `unifier.response/UnifiedError`.
sourceraw docstring

as-incorrectclj/s

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

Returns unified ::incorrect response. Instance of unifier.response/UnifiedError.

Returns unified `::incorrect` response.
Instance of `unifier.response/UnifiedError`.
sourceraw docstring

as-interruptedclj/s

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

Returns unified ::interrupted response. Instance of unifier.response/UnifiedError.

Returns unified `::interrupted` response.
Instance of `unifier.response/UnifiedError`.
sourceraw docstring

as-not-foundclj/s

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

Returns unified ::not-found response. Instance of unifier.response/UnifiedError.

Returns unified `::not-found` response.
Instance of `unifier.response/UnifiedError`.
sourceraw docstring

as-okclj/s

(as-ok data)
(as-ok data meta)

Returns unified ::ok response. Instance of unifier.response/UnifiedSuccess.

Returns unified `::ok` response.
Instance of `unifier.response/UnifiedSuccess`.
sourceraw docstring

as-successclj/s

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

Returns instance of unifier.response/UnifiedSuccess. Examples:

  • with default success type (as-success "a user was created successfully")

  • with specified success type (as-success :user/created "a user was created successfully")

  • with specified success type and meta (as-success :user/created "a user was created successfully" {:i18n/key :user/created})

Returns instance of `unifier.response/UnifiedSuccess`.
Examples:
  * with default success `type`
  (as-success "a user was created successfully")

  * with specified success `type`
  (as-success :user/created "a user was created successfully")

  * with specified success `type` and `meta`
  (as-success :user/created "a user was created successfully" {:i18n/key :user/created})
sourceraw docstring

as-unavailableclj/s

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

Returns unified ::unavailable response. Instance of unifier.response/UnifiedError.

Returns unified `::unavailable` response.
Instance of `unifier.response/UnifiedError`.
sourceraw docstring

as-unknownclj/s

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

Returns unified ::unknown response. Instance of unifier.response/UnifiedError.

Returns unified `::unknown` response.
Instance of `unifier.response/UnifiedError`.
sourceraw docstring

as-unsupportedclj/s

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

Returns unified ::unsupported response. Instance of unifier.response/UnifiedError.

Returns unified `::unsupported` response.
Instance of `unifier.response/UnifiedError`.
sourceraw docstring

as-warningclj/s

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

Returns unified ::warning response. Instance of unifier.response/UnifiedError.

Returns unified `::warning` response.
Instance of `unifier.response/UnifiedError`.
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

error-typesclj/s

Common error types.

Common `error` types.
sourceraw docstring

error?clj/s

(error? x)

Returns true if the given value is instance of unifier.response/UnifiedError. Otherwise false.

Returns `true` if the given value is instance of `unifier.response/UnifiedError`. Otherwise `false`.
sourceraw docstring

get-dataclj/s

(get-data x)

Returns data of response.

Returns `data` of response.
sourceraw docstring

get-metaclj/s

(get-meta x)

Returns meta of response.

Returns `meta` of response.
sourceraw docstring

get-typeclj/s

(get-type x)

Returns type of response.

Returns `type` of response.
sourceraw docstring

IUnifiedResponseclj/s≠protocol

-get-metaclj/s

(-get-meta _)

Returns meta of response.

Returns `meta` of response.

-error?clj/s

(-error? _)

Returns true if the given value is instance of unifier.response/UnifiedError. Otherwise false.

Returns `true` if the given value is instance of `unifier.response/UnifiedError`. Otherwise `false`.

-success?clj/s

(-success? _)

Returns true if the given value is instance of unifier.response/UnifiedSuccess. Otherwise false.

Returns `true` if the given value is instance of `unifier.response/UnifiedSuccess`. Otherwise `false`.

-set-dataclj/s

(-set-data _ data)

Sets data of response.

Sets `data` of response.

-set-typeclj/s

(-set-type _ type)

Sets type of response.

Sets `type` of response.

-set-metaclj/s

(-set-meta _ meta)

Sets meta of response.

Sets `meta` of response.

-get-typeclj/s

(-get-type _)

Returns type of response.

Returns `type` of response.

-response?clj/s

(-response? _)

Returns true if the given value is implements unifier.response/IUnifiedResponse protocol. Otherwise false.

Returns `true` if the given value is implements `unifier.response/IUnifiedResponse` protocol. Otherwise `false`.

-get-dataclj/s

(-get-data _)

Returns data of response.

Returns `data` of response.
source

response?clj/s

(response? x)

Returns true if the given value is implements unifier.response/IUnifiedResponse protocol. Otherwise false.

Returns `true` if the given value is implements `unifier.response/IUnifiedResponse` protocol. Otherwise `false`.
sourceraw docstring

safeclj/smacro

(safe body)
(safe body handler)

Extended version of try-catch.

Extended version of try-catch.
sourceraw docstring

set-dataclj/s

(set-data x data)

Sets data of response.

Sets `data` of response.
sourceraw docstring

set-metaclj/s

(set-meta x meta)

Sets meta of response.

Sets `meta` of response.
sourceraw docstring

set-typeclj/s

(set-type x type)

Sets type of response.

Sets `type` of response.
sourceraw docstring

success-typesclj/s

Common success types.

Common `success` types.
sourceraw docstring

success?clj/s

(success? x)

Returns true if the given value is instance of unifier.response/UnifiedSuccess. Otherwise false.

Returns `true` if the given value is instance of `unifier.response/UnifiedSuccess`. Otherwise `false`.
sourceraw docstring

UnifiedErrorcljs

source

UnifiedSuccesscljs

source

unwrapclj/s

(unwrap response)

Returns unwrapped unified response (as map).

Returns unwrapped unified response (as map).
sourceraw docstring

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

× close