joshrotenberg / clj-wordnik

Wordnik API library for Clojure

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

clj-wordnik

A Clojure client for Wordnik's API.

Docs

See the uberdoc in docs, generated by Marginalia.

For the most part API calls follow the methods found on Wordnik's API documentation, with a few exceptions. Most calls are simply the call name and then the params as keywords:

(examples "vinculum" :include-duplicates false :api-key "<your api key>") 

All call parameters can use the more lispy '-' separated style and they will be converted to camel case automatically, for example the word-examples call has a 'useCanonical' param, but in clj-wordnik this can be specified as 'use-canonical'.

You can specify the api-key as a parameter directly, or use the with-api-key call to group multiple calls together without having to specify it for each one. You can also do the same with with-auth-token for calls that require it.

Usage

in your project.clj

[clj-wordnik "0.1.0-alpha1"]
(ns your.app
    (:use wordnik.core
          [wordnik.api word])
)
;; get your api key from somewhere

(def my-api-key "<your wordnik api key here>")

;; look up the word discombobulated
(with-api-key my-api-key
    (let [discombobulated (word "discombobulated")]
    	 ;; do stuff with discombobulated
))

Testing

You'll need to specify your Wordnik API key, username and password in the resources/test.properties file to run the tests.

Examples

For now just see the unit tests.

Status/TODO

  • all api calls are supported
  • nuke obvious args like :word in favor of a required first position arg or something
  • write more docs
  • write more tests

Credits

Lots of inspiration from Adam Wynne/Stream Science's twitter-api.

Raynes put a clj-wordnik up just after mine, so we decided to work together to fight for wordless people everywhere.

License

Copyright (C) 2011 Josh Rotenberg

Distributed under the Eclipse Public License, the same as Clojure.

Bitdeli Badge

About

Wordnik API library for Clojure


Languages

Language:Clojure 100.0%