Socket
Socket
Sign inDemoInstall

typed-github-api

Package Overview
Dependencies
78
Maintainers
1
Versions
50
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    typed-github-api

Client for GitHub API written in Typescript. Includes support for WebHooks using Express.


Version published
Weekly downloads
61
increased by454.55%
Maintainers
1
Install size
7.08 MB
Created
Weekly downloads
 

Readme

Source

Typed GitHub API

This is another client for GitHub API, this one written in Typescript. It includes support for WebHooks using Express.

Example usage

This is how to set up a Web hook to receive notifications for issues being changed.

const bodyParser = require("body-parser");
import * as express from "express";
import * as gitHubApi from "typed-github-api";
import GitHubApi from "typed-github-api";
import { RequestWithRawBody } from "typed-github-api";

const app = express();
const gitHub = new GitHubApi({ userAgent: "My Client/1.0.0", oAuthToken: process.env.gitHubAccessToken });
const issueWebHook = new gitHubApi.IssueWebHook(process.env.gitHubWebHookSecret, gitHub);

// Configure app to let us get the data from a POST
app.use(bodyParser.json({
  verify: function (req: RequestWithRawBody, _res: express.Response, buf: Uint8Array, _encoding: string) {
    req.rawBody = buf;
  },
}));

app.use("/webhooks/github/issue", issueWebHook.router);

issueWebHook.registerAsyncHandler(
  async function (data: gitHubApi.IssueWebHookData) {
    const issue = data.issue;
    console.log(`Issue #${issue.number} created at ${issue.created} and closed at ${issue.closed}`);
  });

app.set("port", process.env.PORT || 8080);

app.listen(app.get("port"));

Keywords

FAQs

Last updated on 13 Feb 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc