Liking cljdoc? Tell your friends :D

outpace.remote.service


add-endpointclj/s

(add-endpoint spec key endpoint-config)
source

add-headersclj/s

(add-headers spec headers)
source

add-methodclj/s

(add-method spec method)
source

add-on-exceptionclj/s

(add-on-exception spec f)
source

add-on-requestclj/s

(add-on-request spec f)
source

add-on-statusclj/s

(add-on-status spec m)
source

defendpointcljmacro

(defendpoint sym url-template & body)

Shorthand syntax for defining and endpoint and configuring it.

Ex.

(defendpoint all "/users" (method :get)

(on-status
  (200 [{:keys [body]}]
    (let [c (count (:body resp))]
      (js/console.log c "USERS FOUND")))))
Shorthand syntax for defining and endpoint and configuring it.

Ex.

  (defendpoint all "/users"
    (method :get)

    (on-status
      (200 [{:keys [body]}]
        (let [c (count (:body resp))]
          (js/console.log c "USERS FOUND")))))
sourceraw docstring

defservicecljmacro

(defservice sym & body)

Shorthand syntax for defining a service and configuring it.

Ex.

(defservice user-service (on-status (200 [_] (js/console.log "SUCCESS"))) (endpoint :all "/users" (method :get)))

Shorthand syntax for defining a service and configuring it.

Ex.

  (defservice user-service
    (on-status
      (200 [_]
        (js/console.log "SUCCESS")))
    (endpoint :all "/users"
      (method :get)))
sourceraw docstring

endpointcljmacro

(endpoint service-spec key url-template & config)

Shorthand syntax to add :on-response configuration to an endpoint or service spec.

Ex. (endpoint {} "/users/:id" (method :get))

Shorthand syntax to add :on-response configuration to an endpoint
or service spec.

Ex.
  (endpoint {} "/users/:id"
    (method :get))
sourceraw docstring

headerscljmacro

(headers spec headers)

Shortand syntax to add :headers configuration to an endpoint spec.

Ex. (headers {} {"X-Foo" "bar"})

Shortand syntax to add :headers configuration to an endpoint spec.

Ex.
  (headers {} {"X-Foo" "bar"})
sourceraw docstring

make-endpointclj/s

(make-endpoint
  {:keys [method url-template on-request on-status on-exception headers username
          password]
   :or {on-request identity on-status {} on-exception identity headers {}}
   :as opts})
source

make-serviceclj/s

(make-service {:keys [endpoints] :as service-spec})

Return a function which takes an endpoint key and any number of additional arguments and applies the function given by (make-endpoint (get-in service-spec [:endpoints key])). If the service-spec includes configuration for :headers, :on-status, or :on-request, the endpoint configuration will be merged in to it.

Options:

  • headers - A map of headers to use with each HTTP request.
  • on-status - A map of status code to response handler.
  • on-request - A function of at least one arity which accepts the request map as it's first argument.
  • endpoints - A map of endpoint-key to endpoint-config. See make-endpoint for endpoint-config details.
Return a function which takes an endpoint key and any number of
additional arguments and applies the function given by
(make-endpoint (get-in service-spec [:endpoints key])). If the
service-spec includes configuration for :headers, :on-status, or
:on-request, the endpoint configuration will be merged in to it.

Options:
  * headers - A map of headers to use with each HTTP request.
  * on-status - A map of status code to response handler.
  * on-request - A function of at least one arity which accepts the
                 request map as it's first argument.
  * endpoints - A map of endpoint-key to endpoint-config. See
                `make-endpoint` for endpoint-config details.
sourceraw docstring

methodcljmacro

(method spec method)

Shortand syntax to add :method configuration to an endpoint spec.

Ex. (method {} :get)

Shortand syntax to add :method configuration to an endpoint spec.

Ex.
  (method {} :get)
sourceraw docstring

method->http-fnclj/s

source

on-exceptioncljmacro

(on-exception spec & fn-tail)

Shorthand syntax to add :on-exception configuation to an endpoint or spec.

Ex. (on-exception {} [err] (println "ERROR: " (.getMessage err))

Shorthand syntax to add :on-exception configuation to an endpoint or
spec.

Ex.
  (on-exception {} [err]
    (println "ERROR: " (.getMessage err))
sourceraw docstring

on-requestcljmacro

(on-request spec & fn-tail)

Shorthand syntax to add :on-request configuation to an endpoint or spec.

Ex. (on-request {} [req] (assoc-in req [:headers "X-Foo"] "bar"))

Shorthand syntax to add :on-request configuation to an endpoint or
 spec.

Ex.
  (on-request {} [req]
    (assoc-in req [:headers "X-Foo"] "bar"))
sourceraw docstring

on-statuscljmacro

(on-status spec & fn-specs)

Shorthand syntax to add :on-status configuation to an endpoint or service spec.

Ex. (on-status {} (200 [_] (pritnln "YAY!")) (404 [_] (println "BOO!")))

Shorthand syntax to add :on-status configuation to an endpoint or
service spec.

Ex.
  (on-status {}
    (200 [_] (pritnln "YAY!"))
    (404 [_] (println "BOO!")))
sourceraw docstring

service-spec?clj/s

(service-spec? spec)
source

templateclj/s

(template s)
(template s {:keys [regex]})

Return a string template fn from s.

Return a string template fn from s.
source (clj)source (cljs)raw docstring

url-callclj/s

(url-call http-fn url req)
source (clj)source (cljs)

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

× close