Skip to content

Files

Latest commit

ed593fa · Feb 28, 2018

History

History
69 lines (46 loc) · 1.82 KB

README.md

File metadata and controls

69 lines (46 loc) · 1.82 KB

clj-fakturoid

A client for Fakturoid API based on clj-http.client.

CircleCI Dependencies Status License

Leiningen/Boot

[clj-fakturoid "0.2.0"]

Documentation

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")

get-account

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\"}"

create-subject

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",...}

create-invoice

Creates new invoice.

(:body (fakturoid/create-invoice host [username token] slug {:variable_symbol "100012014", ...}))
{:id 1, :variable_symbol "100012014",...}