GithubHelp home page GithubHelp logo

swarnendu0123 / github-stats Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 19 KB

A npm package to get all the open pull request/issues in a CURD application

Home Page: https://www.npmjs.com/package/@swarnendu0123/github-stats

TypeScript 100.00%
axios cheerio npm npm-module npm-package

github-stats's Introduction

github-stats (GitHub Statistics)

Get all your github issues and pull-request in one place.

NPM Version NPM Downloads GitHub Repo size

NPM License GitHub Repo issues GitHub Repo pull requests

Contributors GitHub Repo stars GitHub Repo forks

Usefull Links:

Features:

  • getPulls(repoUrl) : Function Get all the pull requests of a repository
  • getIssues(repoUrl) : Function Get all the issues of a repository
  • getPulls(repoUrl, by) : Function Get all the pull requests of a repository created by a specific user
  • getIssues(repoUrl, by) : Function Get all the issues of a repository created by a specific user
  • by (Optional): The user who created the pull request/issue . If not provided, it will return all the pull requests.

Installation:

Npm:

    npm install @swarnendu0123/github-stats

Yarn:

    yarn add @swarnendu0123/github-stats

if you are using Typescript, you can install the types for node:

Npm:

    npm i --save-dev @types/node

Yarn:

    yarn add --dev @types/node

Usage:

Promise Syntax:

const stats = require("@swarnendu0123/github-stats");
stats
  .getIssues("https://github.com/oxiton-foundation/click-metrics")
  .then((data) => {
    console.log(data);
  });

Async/Await Syntax:

const stats = require("@swarnendu0123/github-stats");
const myPulls = await stats.getPulls(
  "https://github.com/oxiton-foundation/click-metrics"
);
console.log(myPulls);
const stats = require("@swarnendu0123/github-stats");
const myPulls = await stats.getPulls(
  "https://github.com/oxiton-foundation/click-metrics",
  "Swarnendu0123"
);
console.log(myPulls);

Output:

[
  {
    title: 'Example PR for checking. (Do not merge it or close it)',
    url: 'https://github.com/oxiton-foundation/click-metrics/pull/9',
    openedBy: 'Swarnendu0123',
    issueLabel: [ 'level 4', 'OOSI' ],
    status: 'open'
  },
  {
    title: 'MINOR CHANGES',
    url: 'https://github.com/oxiton-foundation/click-metrics/pull/8',
    openedBy: 'Swarnendu0123',
    issueLabel: [],
    status: 'merged'
  }
]

Using in a react app:

import React, { useEffect, useState } from "react";
import { getIssues } from "@swarnendu0123/github-stats";

function MyComponent() {
  const [issues, setIssues] = useState([]);
  useEffect(() => {
    getIssues("https://github.com/oxiton-foundation/click-metrics").then(
      (data) => {
        setIssues(data);
      }
    );
  }, []);

  return (
    <div>
      {issues.map((index, issue) => (
        <div key={index}>
          <h1>{issue.title}</h1>
          <p>{issue.url}</p>
          <p>{issue.openedBy}</p>
          <p>
            {issue.issueLabel.map((label) => (
              <span>{label}</span>
            ))}
          </p>
          <p>{issue.status}</p>
        </div>
      ))}
    </div>
  );
}

export default MyComponent;

Keywords:

github-stats github stats issues pulls github-issues github-pulls github-stats github-api github-issues-api github-pulls-api github-stats-api github-issues-pulls github-issues-pulls-stats github-issues-pulls-stats-api github-issues-pulls-stats-npm github-issues-pulls-stats-npm-package github-issues-pulls-stats-npm-package-api

github-stats's People

Contributors

swarnendu0123 avatar

Watchers

 avatar

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.