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-errorclj/s

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

Returns 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 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-responseclj/smultimethod

A dispatcher for the unified responses.

A dispatcher for the unified responses.
sourceraw docstring

as-successclj/s

(as-success data)
(as-success type data)
(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

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

default-error-typeclj/s

Default error type.

Default error `type`.
sourceraw docstring

default-exception-typeclj/s

Default exception type.

Default exception `type`.
sourceraw docstring

default-success-typeclj/s

Default success type.

Default success `type`.
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`.

-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-default-error-type!clj/s

(set-default-error-type! type)

Overrides default error type.

Overrides default error `type`.
sourceraw docstring

set-default-exception-type!clj/s

(set-default-exception-type! type)

Overrides default exception type.

Overrides default exception `type`.
sourceraw docstring

set-default-success-type!clj/s

(set-default-success-type! type)

Overrides default success type.

Overrides default success `type`.
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

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

× close