gmail-clj
A Clojure library designed to abstract the details of the GMail REST API: developers.google.com/gmail/api/
gmail-clj
is available as a Maven artifact from Clojars:
Require the library in your REPL:
(require '[gmail-clj.core :as gmail])
...or in your project.clj file
(ns my-app.core
(:require [gmail-clj.core :as gmail]))
Be sure to set your Google API Application Key and Secret:
(gmail/set-client-secret! "aaaaa")
(gmail/set-client-id! "bbbbbb")
(gmail/set-refresh-token! "ccccc")
(gmail/set-access-token! "dddddd") ; Optional. If you already have an access token.
This library takes your API information and will do an authorization based on a refresh token. (Note: If your app doesn't request a refresh token, you can simply set the access-token with gmail/set-access-token!, but we can't re-authorize after that token expires without a refresh token.)
To generate the refresh token you need to write your own interface with the Google OAuth endpoint, but for development and testing I've included an HTML file that does the basic OAuth handshake and returns the refresh token: /resources/index.html.
Here's a few things I haven't gotten to yet, mostly because I didn't need them in my specific use case. If you'd like to dive in an help on these, that would much appreciated!
Copyright © 2014 Mike Flynn / @thatmikeflynn
Distributed under the Eclipse Public License, the same as Clojure.
Can you improve this documentation?Edit on GitHub
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close