/discovery-api

Primary LanguageClojureEclipse Public License 1.0EPL-1.0

discovery-api

An library for generating an API from a Google API discovery document.

Installation

Add [com.palletops/discovery-api "0.1.0-SNAPSHOT"] to your :dependencies.

Usage

(require '[com.palletops.discovery :as discovery])

You need a clojure map that contains the discovery document, with keys that are keywords. You can read a json file from resources using the document-from-resource function.

(def doc (discovery/document-from-resource "fleet-v1-alpha"))

To generate an API namespace, pass the document to the api-ns-string function, that returns a string that contains the source code for you API namespace, which you can write to file.

(discovery/api-ns-string
  doc (symbol (str "com.palletops.fleet." version)) options)

For a full example, see clj-fleet.

License

Copyright © 2014 Hugo Duncan

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.