github-api-global

1.0.8 • Public • Published

GitHub Api's

npm Support Node of LTS dependencies Status

To create calls to get the data you need by using GitHub Rest API

Installation

$ npm install github-api-global

Usage

var githubRequest = require("github-api-global");

GitHub Rest Api Request

// To create calls to get the data you need by using GitHub Rest Api
const options = {
  token: "1e3ed294c3f7tce7btdb743f9135656", // To get token see link below
  method: "get", // As per request
  path: "/repos/{owner}/{repo}/issues", // As per request, owner or user
  body: {
    name: "name",
    description: "description",
    state: "open",
    labels: ["bug", "dev"],
    // Add more body params from GitHub Api docs as per request method describe
  },
};

(async () => {
  console.log(await githubRequest(options)); // returns <response_data>
})();

// More examples of GitHub api request - {}
// GET /user/repos - List repositories for the authenticated user
// POST /user/repos - Create a repository for the authenticated user
// PATCH /repos/{owner}/{repo} - Update a repository
// DELETE /repos/{owner}/{repo} - Delete a repository
// GET /repos/{owner}/{repo}/issues - List repository issues
// POST /repos/{owner}/{repo}/issues - Create an issue
// PATCH /repos/{owner}/{repo}/issues/{issue_number} - Update an issue
// GET /repos/{owner}/{repo}/issues/{issue_number}/comments -Issue comments
// POST /repos/{owner}/{repo}/issues/{issue_number}/comments -Create an comment
// PATCH /repos/{owner}/{repo}/issues/comments/{comment_id} -Update an comment
// ETC as per GitHub REST API docs link below

For more GetHub API method, path and body options flow GitHub Rest Api Docs.

To authenticate with GitHub, set the token option.

License

MIT license.

Copyright

Copyright © 2021. S.Gupta

Package Sidebar

Install

npm i github-api-global

Weekly Downloads

0

Version

1.0.8

License

MIT

Unpacked Size

4.81 kB

Total Files

4

Last publish

Collaborators

  • samkgpt