Ring-style middleware for Jira REST API requests.
Ring-style middleware for Jira REST API requests.
(wrap-api host)
Creates a Ring-style middleware that configures a request map to make it work with Jira REST API.
Arguments
host
Hostname of the Jira instance to connect to.
Creates a [Ring-style] middleware that configures a request map to make it work with Jira REST API. **Arguments** **`host`** Hostname of the Jira instance to connect to. [Ring-style]: https://github.com/ring-clojure/ring/blob/master/SPEC
(wrap-token-auth email token)
Creates a Ring-style middleware that configures a request map to use Basic auth for REST APIs.
Arguments
email
Atlassian account email address.
token
Atlassian API token.
The middleware adds :basic-auth
key to the request map and you
have to use it to setup basic HTTP auth headers somewhere later by
youself or using corresponding middleware from HTTP client library
you use. For example, for clj-http you can do this:
(ns manenko.clj-jira.example
(:require [clj-http.client :as client]
[manenko.clj-jira.core :as jira]
[manenko.clj-jira.middleware :as middleware]))
,,,
(client/with-middleware
(conj
client/default-middleware
(middleware/wrap-api host)
(middleware/wrap-token-auth email token))
(client/request m))
The clj-http.client/default-middleware
var includes
clj-http.client/wrap-basic-auth
middleware which looks for
:basic-auth
key in a request map and configures the request for
basic HTTP authentication.
Creates a [Ring-style] middleware that configures a request map to use [Basic auth for REST APIs]. **Arguments** **`email`** Atlassian account email address. **`token`** Atlassian [API token]. The middleware adds `:basic-auth` key to the request map and you have to use it to setup basic HTTP auth headers somewhere later by youself or using corresponding middleware from HTTP client library you use. For example, for [clj-http] you can do this: ```clojure (ns manenko.clj-jira.example (:require [clj-http.client :as client] [manenko.clj-jira.core :as jira] [manenko.clj-jira.middleware :as middleware])) ,,, (client/with-middleware (conj client/default-middleware (middleware/wrap-api host) (middleware/wrap-token-auth email token)) (client/request m)) ``` The `clj-http.client/default-middleware` var includes `clj-http.client/wrap-basic-auth` middleware which looks for `:basic-auth` key in a request map and configures the request for basic HTTP authentication. [Basic auth for REST APIs]: https://developer.atlassian.com/cloud/jira/platform/jira-rest-api-basic-authentication/ [API token]: https://confluence.atlassian.com/cloud/api-tokens-938839638.html [Ring-style]: https://github.com/ring-clojure/ring/blob/master/SPEC [clj-http]: https://github.com/dakrone/clj-http
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close