A client for Fakturoid API based on clj-http.client.
[clj-fakturoid "0.2.0"]
All functions are designed to return errors instead of throwing exceptions (except :pre
in a function).
To be able to run examples these lines are needed:
(require '[clj-fakturoid.core :as fakturoid])
(def host "https://app.fakturoid.cz/api/v2")
Returns an account by a given credentials
and slug
. Where credentials
is a tuple with username
and API token
.
(:body (fakturoid/get-account host [username token] slug))
{:invoice_language "cz", :phone "", :name "Vaše Jméno",...}
In case of any error while parsing a body, :body
attribute is set to nil
and the body is associates
to :body-unparsed
as a string
.
(def response (fakturoid/get-account host [username token] slug))
(:body response)
nil
(:body-unparsed response)
"{\"I'm not a JSON\"}"
Creates new subject in the addressbook.
(:body (fakturoid/create-subject host [username token] slug {:street "Masarykova 1", :name "foo", ...}))
{:id 1, :street "Masarykova 1", :name "foo",...}
Creates new invoice.
(:body (fakturoid/create-invoice host [username token] slug {:variable_symbol "100012014", ...}))
{:id 1, :variable_symbol "100012014",...}