Liking cljdoc? Tell your friends :D

liberator-mixin.core

Functions for defining liberator mixins: partial liberator resource definitions that can be composed together to build up a liberator resource with canned functionality.

The most important function in this namespace is build-resource which accepts a sequence of liberator mixins (or resource definition maps) and produces a liberator resource.

Functions for defining liberator mixins: partial liberator resource
definitions that can be composed together to build up a liberator resource
with canned functionality.

The most important function in this namespace is [[build-resource]] which
accepts a sequence of liberator mixins (or resource definition maps) and
produces a liberator resource.
raw docstring

build-resourceclj

(build-resource & ms-or-seqs)

Builds a liberator resource from the specified resource definitions, specified as either maps or sequences of maps.

This function represents the core of the mixin functionality in that each mixin produces either a map or a sequence of maps representing partial resource definitions.

The resource definitions are merged together using merge-resource-definitions. See the documentation there for specific details of the merge process used.

Builds a liberator resource from the specified resource definitions,
specified as either maps or sequences of maps.

This function represents the core of the mixin functionality in that
each mixin produces either a map or a sequence of maps representing partial
resource definitions.

The resource definitions are merged together using
[[merge-resource-definitions]]. See the documentation there for specific
details of the merge process used.
sourceraw docstring

is-action?clj

(is-action? k)

Returns true if k, a keyword, represents a liberator action, false otherwise.

Returns `true` if `k`, a keyword, represents a liberator action, `false`
otherwise.
sourceraw docstring

is-configuration?clj

(is-configuration? k)

Return true if k, a keyword, represents a liberator configuration parameter, false otherwise.

Return `true` if `k`, a keyword, represents a liberator configuration
parameter, `false` otherwise.
sourceraw docstring

is-decision?clj

(is-decision? k)

Returns true if k, a keyword, represents a liberator decision, false otherwise.

Returns `true` if `k`, a keyword, represents a liberator decision, `false`
otherwise.
sourceraw docstring

is-handler?clj

(is-handler? k)

Returns true if k, a keyword, represents a liberator handler, false otherwise.

Returns `true` if `k`, a keyword, represents a liberator handler, `false`
otherwise.
sourceraw docstring

merge-actionsclj

(merge-actions left right)

Merges together two liberator actions, left and right.

The resulting action will execute both actions in the order left first, then right, such that the right action will see any context updates made by the left. The result will be that of the right action.

Merges together two liberator actions, `left` and `right`.

The resulting action will execute both actions in the order `left` first,
then `right`, such that the `right` action will see any context updates made
by the `left`. The result will be that of the `right` action.
sourceraw docstring

merge-configurationsclj

(merge-configurations left right)

Merges together two liberator configuration parameters, left and right.

The resulting configuration parameter will be deduced as follows:

  • If right includes :replace in its metadata, the result will be right.
  • If left results in a list, the result will be a list containing all elements from right followed by all elements from left, such that right takes precedence.
  • If left results in a vector, the result will be a vector containing all elements from right followed by all elements from left, such that right takes precedence.
  • If left results in a set, the result will be a set containing the union of left and right.
  • Otherwise, the result will be right.

Both left and right can also be functions taking context returning in line with the above types.

Merges together two liberator configuration parameters, `left` and `right`.

The resulting configuration parameter will be deduced as follows:

  - If `right` includes `:replace` in its metadata, the result will be
    `right`.
  - If `left` results in a list, the result will be a list containing all
    elements from `right` followed by all elements from `left`, such that
    `right` takes precedence.
  - If `left` results in a vector, the result will be a vector containing all
    elements from `right` followed by all elements from `left`, such that
    `right` takes precedence.
  - If `left` results in a set, the result will be a set containing the union
    of `left` and `right`.
  - Otherwise, the result will be `right`.

Both `left` and `right` can also be functions taking `context` returning
in line with the above types.
sourceraw docstring

merge-decisionsclj

(merge-decisions left right)

Merges together two liberator decisions, left and right.

Decisions can return various different shapes of result:

  • boolean, i.e., true or false
  • truthy, e.g., {:foo :bar} which represents true and is used to update the context
  • vector of boolean and context update, e.g., [true, {:foo :bar}]

The resulting decision merges these return values in such a way that both the boolean result of the decision is retained and all context updates are made correctly.

The decisions are applied in the order left first, then right, such that the right decision will see any context updates made by the left.

Merges together two liberator decisions, `left` and `right`.

Decisions can return various different shapes of result:

  - boolean, i.e., `true` or `false`
  - truthy, e.g., `{:foo :bar}` which represents `true` and is used to update
    the context
  - vector of boolean and context update, e.g., `[true, {:foo :bar}]`

The resulting decision merges these return values in such a way that both
the boolean result of the decision is retained and all context updates are
made correctly.

The decisions are applied in the order `left` first, then `right`, such that
the `right` decision will see any context updates made by the `left`.
sourceraw docstring

merge-handlersclj

(merge-handlers left right)

Merges together two liberator handlers, left and right.

Currently, the left handler is discarded and the right is used in its place. In future, this may be improved such that some aspect of the left handler is retained.

Merges together two liberator handlers, `left` and `right`.

Currently, the `left` handler is discarded and the `right` is used in its
place. In future, this may be improved such that some aspect of the `left`
handler is retained.
sourceraw docstring

merge-resource-definitionsclj

(merge-resource-definitions & maps)

Merges together multiple liberator resource definitions, specified as maps.

For the mechanism employed:

Any other map keys that do not correspond to the above liberator definition types will be retained in the resulting resource definition. If the same non-liberator definition map key is specified more than once, the rightmost definition takes precedence.

Merges together multiple liberator resource definitions, specified as maps.

For the mechanism employed:

  - for liberator decisions, see [[merge-decisions]],
  - for liberator actions, see [[merge-actions]],
  - for liberator handlers, see [[merge-handlers]],
  - for liberator configuration, see [[merge-configurations]].

Any other map keys that do not correspond to the above liberator definition
types will be retained in the resulting resource definition. If the same
non-liberator definition map key is specified more than once, the rightmost
definition takes precedence.
sourceraw docstring

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

× close