GitHub Integration
NodeJS module for building GitHub Integrations.
Installation
npm install --save github-integration
Usage
const createIntegration = require('github-integration');
const integration = createIntegration({
id: 987,
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);
});