bitbucket added by ente on Wed May 30 11:45:00 2012

;;; parse bitbucket json and then what...

(module bb (bb-issue-url bb-fetch-parse)
	(import scheme chicken)
	(use http-client json uri-common data-structures)

	(define apiurl (make-uri scheme: 'https host: "api.bitbucket.org"))
	(define (bb-issue-url user repo #!optional (id ""))
		(update-uri apiurl path: `(/ "1.0" "repositories" ,user ,repo "issues" ,(->string id))))
		
	(define (bb-fetch-parse url)
		(let* ((res #f)
		       (_ (with-input-from-request url #f (lambda () (set! res (json-read))))))
			   res)))

; result:
;#;1> (use bb)
;; loading ./bb.scm ...
;#;2> (bb-fetch-parse (bb-issue-url "wilhelmy" "lua-bencode" 1))
;#(("status" . "resolved") ("priority" . "major") ("title" . "package lua-bencode for luarocks") ("reported_by" . #(("username" . "wilhelmy") ("first_name" . "Moritz") ("last_name" . "Wilhelmy") ("avatar" . "https://secure.gravatar.com/avatar/db852e95e342efecec1893edc8ae21cd?d=identicon&s=32") ("resource_uri" . "/1.0/users/wilhelmy"))) ("utc_last_updated" . "2011-04-25 09:11:46+00:00") ("comment_count" . 2) ("metadata" . #(("kind" . "enhancement") ("version" . #<unspecified>) ("component" . #<unspecified>) ("milestone" . #<unspecified>))) ("content" . "packaging lua-bencode for luarocks is on the TODO list. It would be appreciated if who knows how to package things for luarocks could help me out with this.") ("created_on" . "2011-04-22 18:30:40") ("local_id" . 1) ("follower_count" . 1) ("utc_created_on" . "2011-04-22 16:30:40+00:00") ("resource_uri" . "/1.0/repositories/wilhelmy/lua-bencode/issues/1") ("is_spam" . #f))