[racket] Github API in Racket

From: Sam Tobin-Hochstadt (samth at cs.indiana.edu)
Date: Fri Dec 12 20:09:24 EST 2014

Hi Animesh,

You're on the right track in using the API for getting data from
github. I've written a wrapper already that covers some parts of the
github api, but far from all of it. You can see the code here:
https://github.com/samth/github.rkt and you can install it with `raco
pkg install github`. Like I said, there's lots missing there, and so
I'd love help in filling out more of the API -- I've really only
written the parts I've needed in the past.

Sam

On Fri, Dec 12, 2014 at 8:03 PM, Animesh Pandey
<animeshpandey.etno at gmail.com> wrote:
> Hi,
> I want to write a wrapper for the GitHub API. I have never actually written
> a wrapper before so I wanted to know if there is any specific design
> methodology that we have to follow for writing a wrapper.
> The Github API as I see returns a JSON object as the response after we send
> a request to it. I tried writing a script for reading that response.
>
> #lang racket
>
> (require net/url)
> (require json)
>
> (define input
>   (get-pure-port
>    (string->url "https://api.github.com/users/some_username")))
> (define response (port->string input))
> (close-input-port input)
>
> (define x (string->jsexpr response))
> (for (((key val) (in-hash x)))
>   (printf "~a = ~a~%" key val))
>
> Please tell me this method is correct or not? Is this how we start writing a
> wrapper?
>
> Thanks!

Posted on the users mailing list.