Skip to content

Instantly share code, notes, and snippets.

@clojj
Created January 23, 2015 23:45
Show Gist options
  • Save clojj/412f0e858a00b60d8672 to your computer and use it in GitHub Desktop.
Save clojj/412f0e858a00b60d8672 to your computer and use it in GitHub Desktop.
github v3 api with tentacles
(ns github-api.core
(:gen-class)
(:require [tentacles.repos :as repos])
(:use [clojure.pprint])
(:import (java.time Period LocalDateTime)))
(let [starred (repos/starring "clojj"
{:per-page 4
:accept "application/vnd.github.v3.star+json"})
;git-urls (map #(get-in % [:repo :git_url]) starred)
users-and-names (map (fn [s] [(get-in s [:repo :owner :login]) (get-in s [:repo :name])]) starred)]
(pprint users-and-names)
(let [commits-last-week
(for [[user repo] users-and-names :let [commits (repos/commits user repo {:per-page 100 :since (-> (LocalDateTime/now) (.minus (Period/ofYears 1)) (.toString))})]]
(map #(str repo " : " (get-in % [:commit :message]))
commits))]
(pprint commits-last-week)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment