Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Add `readme` and `contents` from the Contents API #15

Closed
wants to merge 1 commit into from

2 participants

@devth

http://developer.github.com/v3/repos/contents/

I begin adding archive-link too, but it didn't play well with api-call since it doesn't return json.

Here's my partial impl incase anyone wants to pick it up from here:

(defn archive-link
  "Get a URL to download a tarball or zipball archive for a repository.
     archive-format -- tarball or zipball
     git-ref        -- a valid git ref (e.g. master)"
  ([user repo archive-format git-ref options]
   (api-call :get "repos/%s/%s/%s/%s" [user repo archive-format git-ref] options)))
@Raynes
Owner

archive-link can be implemented without api-call. See the download API for a similar deviation. api-call is just for the typical json-based API calls.

@devth

Main reason I wanted to use api-call/method-request was for its auth parsing. Should the part that determines whether to use basic auth or set the Authorization header be extracted so it can be used from non-json calls?

@Raynes
Owner

Yeah, I'd pull that out.

@Raynes
Owner

This pull request is no longer automatically mergeable, and the remainder of the changes weren't made. If you're still interested in this patch, please update the pull request to make it auto-mergable again and I'll merge it in regardless (archive-link could be added later).

@Raynes Raynes closed this
@devth

Looks like 2b883ec did all the work for contents, readme and archive-link so we're all good. I never got around to it :no_mouth:

@Raynes
Owner

Oh. Man. I need to catch up. :p

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 29, 2012
  1. @devth

    Add Contents API

    devth authored
This page is out of date. Refresh to see the latest.
Showing with 13 additions and 1 deletion.
  1. +13 −1 src/tentacles/repos.clj
View
14 src/tentacles/repos.clj
@@ -402,4 +402,16 @@
user repo event)
"hub.callback" callback}
(when-let [secret (:secret options)]
- {"hub.secret" secret}))})))
+ {"hub.secret" secret}))})))
+
+;; ## Repo Contents API
+
+(defn readme
+ "Get the preferred README for a repository."
+ [user repo options]
+ (api-call :get "repos/%s/%s/readme" [user repo] options))
+
+(defn contents
+ "Get the contents of any file or directory in a repository."
+ [user repo path options]
+ (api-call :get "repos/%s/%s/contents/%s" [user repo path] options))
Something went wrong with that request. Please try again.