Skip to content

jbatch/trellolib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

trellolib

A Clojure library designed to interact with trello through clojure

Latest Version

Clojars Project

Installing

add [trellolib "0.2.0-SNAPSHOT"] as a Leiningen dependency to get the latest release

Running Tests

run lein midje from the command line.

Example

(require '[trellolib :as trello])

; First you will need to create a client to test
(def test-client {:key <your key>
                  :secret <yoursecret>
                  :name <yourappname>
                  :callback <yourcallback>})

; If you don't know your application id you can get it from Trello
; at https://trello.com/1/appKey/generate

; Now you can use this to generate the url your user needs to go to
; to authorize your application

(def auth-client (trello/authorize-client test-client))
;{:consumer
; {:key "<yourkey>",
;  :secret
;  "<yoursecret>",
;  :request-uri "https://trello.com/1/OAuthGetRequestToken",
;  :access-uri "https://trello.com/1/OAuthGetAccessToken",
;  :authorize-uri "https://trello.com/1/OAuthAuthorizeToken",
;  :signature-method :hmac-sha1},
; :key "yourkey",
; :authorize-url
; "https://trello.com/1/OAuthAuthorizeToken?oauth_token=<new-token>&name=<yourappname>&expiration=never&scope=read,write",
; :name "<yourappname>",
; :secret
; "<yoursecret>",
; :request-token
; {:oauth_token "<temp-token>",
;  :oauth_token_secret "<temp-secret>",
;  :oauth_callback_confirmed "true"},
; :callback "<yourcallback>"}

; Your application can now direct the user to the url stored in :authorize-url so
; they can give your appilcation permission to access their protected resources.
; The user will be redirected to your :callback address and in their url parameters
; will be a verifier. You can now use this to swap your temporary token and secret
; for an access token and secret

(def access-client (trello/get-access-token test-client <verifier>))
;{:consumer
; {:key "<yourkey>",
;  :secret
;  "<yoursecret>",
;  :request-uri "https://trello.com/1/OAuthGetRequestToken",
;  :access-uri "https://trello.com/1/OAuthGetAccessToken",
;  :authorize-uri "https://trello.com/1/OAuthAuthorizeToken",
;  :signature-method :hmac-sha1},
; :key "18093394fb3a0e8ae6393a830df946d5",
; :authorize-url
; "https://trello.com/1/OAuthAuthorizeToken?oauth_token=<temp-token>&name=<yourappname>&expiration=never&scope=read,write",
; :name "OAuth App",
; :secret
; "<yoursecret>",
; :access-token
; {:oauth_token
;  "<youraccesstoken>",
;  :oauth_token_secret "<youraccesstokensecret>"},
; :request-token
; {:oauth_token "<temp-token>",
;  :oauth_token_secret "<temp-secret>",
;  :oauth_callback_confirmed "true"},
; :callback "<yourcallback>"}

; Now we need the id of the list we want to post the card to
; If you don't know this you can get all the lists from a board
; like so

; As of 0.2.1 you no longer need to generate a new set of credentials yourself
; everytime you want to do a request

(trello/get-lists "<yourboardid>" access-client)
; Use this to get a list of lists on a board

; You can get a board id by going to the board you like and copying
; it from the URL. It will look like https://trello.com/b/<boardid>/hello-world

; With this we can now create our card
(def test-card {:name "This is my test card"
                :desc "This is the description of my test card"
                :idList <id of list you want to put card on>})

;now we can simply post our card
(trello/post-card test-card access-client)

License

Copyright © 2014 Josh Batchelor

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

About

A Trello library written in clojure

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published