Liking cljdoc? Tell your friends :D

metabase.api.common.internal

Internal functions used by metabase.api.common. These are primarily used as the internal implementation of defendpoint.

Internal functions used by `metabase.api.common`.
These are primarily used as the internal implementation of `defendpoint`.
raw docstring

*auto-parse-types*clj

Map of param-type -> map with the following keys:

:route-param-regex Regex pattern that should be used for params in Compojure route forms :parser Function that should be used to parse args

Map of `param-type` -> map with the following keys:

:route-param-regex Regex pattern that should be used for params in Compojure route forms
:parser            Function that should be used to parse args
sourceraw docstring

arg-typeclj

(arg-type arg)

Return a key into *auto-parse-types* if ARG has a matching pattern in auto-parse-arg-name-patterns.

(arg-type :id) -> :int

Return a key into `*auto-parse-types*` if ARG has a matching pattern in `auto-parse-arg-name-patterns`.

(arg-type :id) -> :int
sourceraw docstring

auto-parsecljmacro

(auto-parse args & body)

Create a let form that applies corresponding parse-fn for any symbols in ARGS that are present in *auto-parse-types*.

Create a `let` form that applies corresponding parse-fn for any symbols in ARGS that are present in
`*auto-parse-types*`.
sourceraw docstring

let-form-for-argclj

(let-form-for-arg arg-symbol)

Given an ARG-SYMBOL like id, return a pair like [id (Integer/parseInt id)] that can be used in a let form.

Given an ARG-SYMBOL like `id`, return a pair like `[id (Integer/parseInt id)]` that can be used in a `let` form.
sourceraw docstring

parse-intclj

(parse-int value)

Parse VALUE (presumabily a string) as an Integer, or throw a 400 exception. Used to automatically to parse id parameters in defendpoint functions.

Parse VALUE (presumabily a string) as an Integer, or throw a 400 exception. Used to automatically to parse `id`
parameters in `defendpoint` functions.
sourceraw docstring

route-arg-keywordsclj

(route-arg-keywords route)

Return a sequence of keywords for URL args in string ROUTE.

(route-arg-keywords "/:id/cards") -> [:id]

Return a sequence of keywords for URL args in string ROUTE.

(route-arg-keywords "/:id/cards") -> [:id]
sourceraw docstring

route-doxclj

(route-dox method route docstr args param->schema body)

Generate a documentation string for a defendpoint route.

Generate a documentation string for a `defendpoint` route.
sourceraw docstring

route-fn-nameclj

(route-fn-name method route)

Generate a symbol suitable for use as the name of an API endpoint fn. Name is just METHOD + ROUTE with slashes replaced by underscores.

(route-fn-name GET "/:id") ;-> GET_:id

Generate a symbol suitable for use as the name of an API endpoint fn. Name is just METHOD + ROUTE with slashes
replaced by underscores.

  (route-fn-name GET "/:id") ;-> GET_:id
sourceraw docstring

route-param-regexclj

(route-param-regex arg)

If keyword ARG has a matching type, return a pair like [arg route-param-regex],where ROUTE-PARAM-REGEX is the regex that this param that arg must match.

(route-param-regex :id) -> [:id #"[0-9]+"]

If keyword ARG has a matching type, return a pair like `[arg route-param-regex]`,where ROUTE-PARAM-REGEX is the
regex that this param that arg must match.

  (route-param-regex :id) -> [:id #"[0-9]+"]
sourceraw docstring

typify-argsclj

(typify-args args)

Given a sequence of keyword ARGS, return a sequence of [:arg pattern :arg pattern ...] for args that have matching types.

Given a sequence of keyword ARGS, return a sequence of `[:arg pattern :arg pattern ...]` for args that have
matching types.
sourceraw docstring

typify-routeclj

(typify-route route)

Expand a ROUTE string like "/:id" into a Compojure route form that uses regexes to match parameters whose name matches a regex from auto-parse-arg-name-patterns.

(typify-route "/:id/card") -> ["/:id/card" :id #"[0-9]+"]

Expand a ROUTE string like "/:id" into a Compojure route form that uses regexes to match parameters whose name
matches a regex from `auto-parse-arg-name-patterns`.

  (typify-route "/:id/card") -> ["/:id/card" :id #"[0-9]+"]
sourceraw docstring

validate-paramclj

(validate-param field-name value schema)

Validate a parameter against its respective schema, or throw an Exception.

Validate a parameter against its respective schema, or throw an Exception.
sourceraw docstring

validate-paramsclj

(validate-params param->schema)

Generate a series of validate-param calls for each param and schema pair in PARAM->SCHEMA.

Generate a series of `validate-param` calls for each param and schema pair in PARAM->SCHEMA.
sourceraw docstring

wrap-response-if-neededclj

(wrap-response-if-needed response)

If RESPONSE isn't already a map with keys :status and :body, wrap it in one (using status 200).

If RESPONSE isn't already a map with keys `:status` and `:body`, wrap it in one (using status 200).
sourceraw docstring

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

× close