Giter Site home page Giter Site logo

ghissues's Introduction

ghissues

Build Status

A node library to interact with the GitHub issues API

NPM

Example usage

const ghissues     = require('ghissues')
    , authOptions = { user: 'rvagg', token: '24d5dee258c64aef38a66c0c5eca459c379901c2' }

// list all issues in a repo
ghissues.list(authOptions, 'rvagg', 'jsonist', function (err, issuelist) {
  // Array of issues data for 'rvagg/jsonist'
  console.log(issuelist)
})

// get issue data by number (not internal GitHub id)
ghissues.get(authOptions, 'rvagg', 'nan', 123, function (err, issue) {
  // object containing full issue #123
  console.log(issue)
})

// create an issue
var data = {
    title : 'New issue bro'
  , body  : 'Pretty **slick** `markdown`'
}
ghissues.create(authOptions, 'rvagg', 'jsonist', data, function (err, issue) {
  // data for new issue
  console.log(issue)
})

// list all comments in an issue
ghissues.listComments(authOptions, 'rvagg', 'jsonist', 47, function (err, commentlist) {
  // Array of comment data for 'rvagg/jsonist#47'
  console.log(commentlist)
})

// create a comment
var body = 'Whoa dude, this is awesomesauce!! :+1:'
ghissues.createComment(authOptions, 'rvagg', 'jsonist', 101, body, function (err, issue) {
  // data for new comment in 'rvagg/jsonist#101'
  console.log(issue)
})

The auth data is compatible with ghauth so you can just connect them together to make a simple command-line application:

const ghauth      = require('ghauth')
    , ghissues    = require('ghissues')
    , authOptions = {
          configName : 'issue-lister'
        , scopes     : [ 'user' ]
      }

ghauth(authOptions, function (err, authData) {
  ghissues.list(authData, 'rvagg', 'node-levelup', function (err, list) {
    console.log('Issues in rvagg/node-levelup:')
    list.forEach(function (i) {
      console.log('#%s: %s', i.number, i.title) 
    })
  })
})

License

ghissues is Copyright (c) 2014 Rod Vagg @rvagg and licensed under the MIT licence. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE file for more details.

ghissues's People

Contributors

ralphtheninja avatar rvagg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

ghissues's Issues

Not fetching all issues

I have the following code:

const issues = require('ghissues')
const options = {
  user: process.env.GITHUB_USER,
  token: process.env.GITHUB_TOKEN
}

issues.list(options, 'electron', 'electron', function (err, issuelist) {
  if (err) throw err
  process.stdout.write(JSON.stringify(issuelist, null, 2))
  process.exit()
})

It works like a charm, but I only end up with 563 issues each time, each of which has a state of open:

screen shot 2017-06-26 at 9 08 22 pm

This doesn't coincide with what GitHub (the website) is telling me about that repo:

screen shot 2017-06-26 at 9 07 04 pm

It's also strange that the number of open issues is higher than the count on github.com... ๐Ÿค”

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.