Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Changes to the README to reflect the lack of an *authentication* var …

…now.
  • Loading branch information...
commit 83404a6379dfe6e2aff80468926e3fd0d8dcf18d 1 parent cb3ac23
Anthony Grimes authored September 20, 2010

Showing 2 changed files with 4 additions and 14 deletions. Show diff stats Hide diff stats

  1. 15  README.md
  2. 3  project.clj
15  README.md
Source Rendered
@@ -4,21 +4,12 @@ Much needed Github API bindings for Clojure.
4 4
 
5 5
 ## Usage
6 6
 
7  
-clj-github works by using a top-level *authentication* var that holds a map containing keys :user and :pass. This var is meant to be rebound to hold your authentication information before you make any Github API requests. Here's an example:
8 7
 
9 8
     (use '[clj-github.users :only [search]])
10  
-    (binding [*authentication* {:username "Raynes" :password "asifimgoingtotellyou"}] (search "Licenser"))
  9
+    (def auth {:username "Raynes" :password "asifimgoingtotellyou"})
  10
+    (search auth "Raynes")
11 11
 
12  
-In clj-github.core, I've defined a helper-macro for this called with-auth. Here is the example above written using with-auth:
13  
-
14  
-    (use '[clj-github [core :only [with-auth]] [users :only [search]]])
15  
-    (with-auth {:username "Raynes" :password "asifimgoingtotellyou"} (search "Licenser"))
16  
-
17  
-If you'd like to authenticate with your token rather than your password, just pass in :token rather than :password in your auth map.
18  
-
19  
-While the *authentication* var could have been replaced with each of the API functions taking an auth map explicitly, I think the rebinding scheme that clj-github uses is better suited for this particular task, simply because it's much easier to chain API calls together without having an extra parameter to pass to each of them.
20  
-
21  
-It's worth it to note that authentication is not enforced by clj-github. If you do not wrap API calls in with-auth, clj-github will not complain, even if the particular API function your calling requires that you be autheticated to use it. Rather, the API will error out with "not authorizied" or something. No errors are ever thrown by clj-github. It simply returns the error message given by the API. The only way to know if something requires authentication is to look it up in the API docs. After everything is finished, I'll add notices detailing what requires authentication and what doesn't to docstrings.
  12
+It's worth it to note that authentication is not enforced by clj-github. If you pass an empty map or nil rather than real credentials, and the API call requires it, clj-github will not complain. clj-github will not complain. Rather, the API will error out with "not authorizied" or something. No errors are ever thrown by clj-github. It simply returns the error message given by the API. The only way to know if something requires authentication is to look it up in the API docs. After everything is finished, I'll add notices detailing what requires authentication and what doesn't to docstrings.
22 13
 
23 14
 API functions are sectioned into categories and placed in different files. Autodoc-generated documentation is [here](http://raynes.github.com/clj-github/). Have fun exploring. :)
24 15
 
3  project.clj
@@ -3,5 +3,4 @@
3 3
   :dependencies [[org.clojure/clojure "1.2.0"]
4 4
 		 [clj-http "0.1.1"]
5 5
                  [org.clojure/clojure-contrib "1.2.0"]]
6  
-  :dev-dependencies [[swank-clojure "1.2.1"]
7  
-		     [cake-autodoc "0.0.1-SNAPSHOT"]])
  6
+  :dev-dependencies [[swank-clojure "1.2.1"]])

0 notes on commit 83404a6

Please sign in to comment.
Something went wrong with that request. Please try again.