2.0.1 • Published 7 years ago

github-integration v2.0.1

Weekly downloads
1
License
ISC
Repository
github
Last release
7 years ago

GitHub Integration

NodeJS module for building GitHub Integrations.

Installation

npm install --save github-integration

Usage

const createIntegration = require('github-integration');

const integration = createIntegration({
  // Your integration id
  id: 987,
  // The private key for your integration, which can be downloaded from the
  // integration's settings: https://github.com/settings/integrations
  cert: require('fs').readFileSync('private-key.pem')
});

asInstallation

Authenticate as an installation, returning a github API client, which can be used to call any of the APIs supported by GitHub Integrations:

var installationId = 99999;

integration.asInstallation(installationId).then(github => {
  github.issues.createComment({
    owner: 'foo',
    repo: 'bar',
    number: 999,
    body: 'hello world!'
  });
});

asIntegration

Authenticate as an integration, also returning an instance of the GitHub API client.

integration.asIntegration().then(github => {
  console.log("Installations:")
  github.integrations.getInstallations({}).then(console.log);
});
2.0.1

7 years ago

2.0.0

7 years ago

1.0.0

7 years ago