# fetch-github-app

> Node.js wrapper around Fetch to query the GitHub API as a GitHub App

Latest version **0.3.0** (published 2017-08-21) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install fetch-github-app
pnpm add fetch-github-app
yarn add fetch-github-app
bun add fetch-github-app
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.3.0 |
| Published | 2017-08-21 |
| First published | 2017-06-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 6.10.2 |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | micaste, jbe789, tibdex |
| Keywords | node, fetch, github, app, api |

## Links

- npm: https://www.npmjs.com/package/fetch-github-app
- Repository: https://github.com/activeviam/fetch-github-app
- Homepage: https://github.com/activeviam/fetch-github-app#readme
- Issues: https://github.com/activeviam/fetch-github-app/issues
- npm.io page: https://npm.io/package/fetch-github-app

## Dependencies (2)

- [jwt-simple](https://npm.io/package/jwt-simple.md) ^0.5.1
- [node-fetch-json](https://npm.io/package/node-fetch-json.md) ^0.0.3

## Alternatives

- [launchdarkly-js-client-sdk](https://npm.io/package/launchdarkly-js-client-sdk.md) — 2.5M weekly downloads
- [@elastic/elasticsearch](https://npm.io/package/@elastic/elasticsearch.md) — 2.1M weekly downloads
- [@c8y/client](https://npm.io/package/@c8y/client.md) — 15.3K weekly downloads
- [@signaldb/maverickjs](https://npm.io/package/@signaldb/maverickjs.md) — 1.7K weekly downloads
- [@bbc/http-transport-cache](https://npm.io/package/@bbc/http-transport-cache.md) — 1.2K weekly downloads

## Recent versions

- 0.3.0 (latest) — 2017-08-21
- 0.2.0 — 2017-07-24
- 0.1.0 — 2017-06-19

## README

[![npm version](https://img.shields.io/npm/v/fetch-github-app.svg)](https://npmjs.org/package/fetch-github-app)
[![build status](https://img.shields.io/circleci/project/github/activeviam/fetch-github-app.svg)](https://circleci.com/gh/activeviam/fetch-github-app)

# Goal

This package is made to simplify calls to the GitHub API as a [GitHub App](https://developer.github.com/apps/). It [authenticates as a GitHub App](https://developer.github.com/apps/building-integrations/setting-up-and-registering-github-apps/about-authentication-options-for-github-apps/#authenticating-as-a-github-app) and then gives you a wrapper around [Fetch](https://developer.mozilla.org/en/docs/Web/API/Fetch_API) so that you can interact with the GitHub API easily.

# Usage

 1. Add this package to your dependencies: `npm install --save fetch-github-app`
 2. Use it like this:
   ```javascript
   const fetchGithubApp = require('fetch-github-app');

   const config = {
     // Can be found in the "GitHub Apps" section of your developer or organization settings.
     appId: 1337,
     // See https://developer.github.com/apps/building-integrations/setting-up-and-registering-github-apps/registering-github-apps/#generating-a-private-key.
     appPrivateKey: '-----BEGIN RSA PRIVATE KEY----- ...',
     // Can be found in the "Installed GitHub Apps" section of your developer or organization settings,
     // or in the payload of WebHook requests sent by GitHub to your App.
     installationId: 42,
     // See https://developer.github.com/v3/#user-agent-required.
     userAgent: 'your-username-or-org-name'
    };

   fetchGithubApp(config).then(githubApp => {
    // You can retrieve the installation access token if you need to use it directly.
    console.log(githubApp.installationAccessToken);

    // And you can call the GitHub API (notice that you do not have to prefix your paths by https://api.github.com/).
    return githubApp.fetch('installation/repositories').then(body => {
      console.log(body.repositories);
    });
   });
   ```

# Testing

To test the package on your machine:
 1. `npm install`
 2. Create a `.env` file respecting the [dotenv guidelines](https://github.com/motdotla/dotenv) and add the environment variables mentioned by `index.test.js`.
 3. `npm test`

---
_Source: https://npm.io/package/fetch-github-app · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
