Liking cljdoc? Tell your friends :D

sweet-tooth.endpoint.liberator

Includes:

  • Utility functions for retrieving common values from the context (record, errrors, params)
  • A template of decision defaults appropriate for an SPA
  • Utility functions for auth

Introduces loose convention of putting a record under :record in the context

Extends liberator's representations to handle transit

Includes:

* Utility functions for retrieving common values from the
context (`record`, `errrors`, `params`)
* A template of decision defaults appropriate for an SPA
* Utility functions for auth

Introduces loose convention of putting a record under `:record` in
the context

Extends liberator's representations to handle transit
raw docstring

->ctxclj

(->ctx x k)

Make it easy to thread data into liberator context

Make it easy to thread data into liberator context
sourceraw docstring

assoc-in-paramsclj

(assoc-in-params ctx path v)
source

assoc-paramclj

(assoc-param ctx k v)
source

assoc-paramsclj

(assoc-params ctx params)
source

assoc-userclj

(assoc-user ctx user-key)
source

authclj

source

auth-idclj

(auth-id {:keys [auth-id-key] :as ctx})

Retrieve the ID of authenticated user. Assumes :auth-id-key is in the ctx

Retrieve the ID of authenticated user. Assumes `:auth-id-key` is in
the ctx
sourceraw docstring

auth-withclj

(auth-with & fns)

If any auth function authenticates the context, return true. Used to e.g. auth by ownership or adminship

If any auth function authenticates the context, return true. Used
to e.g. auth by ownership or adminship
sourceraw docstring

authenticated?clj

(authenticated? ctx)

To use with liberator's :authorized? decision

To use with liberator's :authorized? decision
sourceraw docstring

authentication-errorclj

source

authorization-errorclj

source

ctx-idclj

(ctx-id ctx & [id-key])

Get id from the params

Get id from the params
sourceraw docstring

decision-defaultsclj

A base set of liberator resource decisions

A base set of liberator resource decisions
sourceraw docstring

error-responseclj

(error-response status errors)

For cases where the error happens before the request gets to liberator

For cases where the error happens before the request gets to liberator
sourceraw docstring

errorsclj

source

errors-mapclj

(errors-map errors)

Add errors to context, setting media-type in case liberator doesn't get to that decision

Add errors to context, setting media-type in case liberator doesn't
get to that decision
sourceraw docstring

exists-fnclj

(exists-fn ent-fn)

Given a function to retrieve a record, store it under :record in the context if it exists

Given a function to retrieve a record, store it under `:record` in the
context if it exists
sourceraw docstring

get-ctxclj

(get-ctx path)
source

html-resourceclj

(html-resource path)

Serve resource at path as html

Serve resource at `path` as html
sourceraw docstring

initialize-decisionsclj

(initialize-decisions decisions context-initializer)

Adds :initalize to multiple decisions. Used by sweet-tooth.endpoint.module.liberator-reitit-router to inject context values set in routes.

Adds `:initalize` to multiple decisions. Used by
`sweet-tooth.endpoint.module.liberator-reitit-router` to inject
context values set in routes.
sourceraw docstring

paramsclj

source

rawclj

(raw response)
source

recordclj

source

req-id-keyclj

(req-id-key ctx & [id-key])
source

segment-responseclj

(segment-response data ctx)
source

transit-responseclj

(transit-response payload & [opts])
source

TransitResponseclj

source

update-paramsclj

(update-params ctx f & args)
source

validate-describeclj

(validate-describe rules & [describe-context])

Use describe lib to validate a request. Returns a function that's meant to be used with the :malformed? liberator decision

Use describe lib to validate a request. Returns a function that's
meant to be used with the `:malformed?` liberator decision
sourceraw docstring

validatorcljmacro

(validator validation)
(validator ctx-sym validation)

Used in invalid? which is why truth values are reversed

Used in invalid? which is why truth values are reversed
sourceraw docstring

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

× close