Code Monkey home page Code Monkey logo

gist-get's Introduction

gist-get

node module to retrieve gists using github api.

installation

npm install gist-get

usage

This module wraps the github api for retrieving gists. It uses the request module to send GET requests to the api.

var gist = require('gist-get');

methods

gist.get(id, [opts], callback)

id is a gist id, such as 0d1faa46f230d941e184.

opts is an optional object, with one field, "headers". This can be used to specify the headers for the request. It defaults to the value of require('github-api-base').headers. This default exists to ensure that a User-Agent header is sent with the request, as required by the github api.

callback(err, result) will be passed the result of JSON.parse(body), which is a javascript object representing the requested gist, assuming no errors.

gist.version(id, version, [opts], callback)

version is a revision hash, for requesting a specific revision of a gist, such as 70dc7bf945f1577eb650c6a6658b6e91973b836e. The other parameters are the same as for gist.get.

gist.latest(id, [opts], callback)

callback(err, result) will, on success, be passed an object of the form { version: "70dc7bf945f1577eb650c6a6658b6e91973b836e", committed_at: "2014-10-22T23:43:30Z" } corresponding to the version and commit time of the most recent version of the requested gist.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.