# ghify-request-options

> Create a Request option object that helps to interact with the GitHub API

Latest version **1.0.0** (published 2015-12-22) · MIT license · 0 weekly downloads

## Install

```sh
npm install ghify-request-options
pnpm add ghify-request-options
yarn add ghify-request-options
bun add ghify-request-options
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2015-12-22 |
| First published | 2015-12-22 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Shinnosuke Watanabe |
| Maintainers | shinnn |
| Keywords | request, http, https, github, api, github-api, option, options, default, defaults, integration |

## Links

- npm: https://www.npmjs.com/package/ghify-request-options
- Repository: https://github.com/shinnn/ghify-request
- Homepage: https://github.com/shinnn/ghify-request#readme
- Issues: https://github.com/shinnn/ghify-request/issues
- npm.io page: https://npm.io/package/ghify-request-options

## 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

- 1.0.0 (latest) — 2015-12-22
- 0.0.0 — 2015-12-22

## README

# ghify-request-options

[![NPM version](https://img.shields.io/npm/v/ghify-request-options.svg)](https://www.npmjs.com/package/ghify-request-options)
[![Build Status](https://travis-ci.org/shinnn/ghify-request-options.svg?branch=master)](https://travis-ci.org/shinnn/ghify-request-options)
[![Coverage Status](https://img.shields.io/coveralls/shinnn/ghify-request-options.svg)](https://coveralls.io/r/shinnn/ghify-request-options)
[![devDependency Status](https://david-dm.org/shinnn/ghify-request-options/dev-status.svg)](https://david-dm.org/shinnn/ghify-request-options#info=devDependencies)

Create a [Request](https://www.npmjs.com/package/request) option object that helps to interact with the [GitHub API](https://developer.github.com/v3/)

```javascript
const ghifyRequestOptions = require('ghify-request-options');

ghifyRequestOptions({method: 'POST'});
/* => {
	 method: 'POST',
	 json: true,
     headers: {
       accept: 'application/vnd.github.v3+json',
       'user-agent': 'https://github.com/shinnn/ghify-request-options'
     },
     baseUrl: 'https://api.github.com'
   }
*/ 
```

## Installation

[Use npm.](https://docs.npmjs.com/cli/install)

```
npm install ghify-request-options
```

## API

```javascript
const ghifyRequest = require('ghify-request-options');
```

### ghifyRequestOptions([*options*])

*options*: `Object` ([`Request` options](https://github.com/request/request#requestoptions-callback) to overwrite the defaults, and [`token` option](https://github.com/shinnn/ghify-request-options#optionstoken))  
Return: `Object` (new `Request` options)

It returns [`Request`](https://github.com/request/request) options that defaults to the [GitHub-API](https://developer.github.com/v3/#overview)-friendly settings.

```javascript
ghifyRequestOptions();
/* => {
	 json: true,
     headers: {
       accept: 'application/vnd.github.v3+json',
       'user-agent': 'https://github.com/shinnn/ghify-request-options'
     },
     baseUrl: 'https://api.github.com'
   }
*/ 
```

#### options.token

Type: `String`  
Default: `process.env.GITHUB_TOKEN`

Use specific [GitHub access token](https://github.com/blog/1509-personal-api-tokens).

```javascript
ghifyRequestOptions({
  token: 'xxxxxxxxxxx' // your personal access token
});
/* => {
     json: true,
     token: 'xxxxxxx',
     headers: {
       accept: 'application/vnd.github.v3+json',
       'user-agent': 'https://github.com/shinnn/ghify-request-options',
       authorization: 'token xxxxxxxxxxx'
     },
     baseUrl: 'https://api.github.com'
   }
*/
```

#### options.baseUrl

Type: `String`  
Default: `process.env.GITHUB_ENDPOINT` if available, otherwise `'https://api.github.com'`

Use the different [endpoint](https://developer.github.com/v3/#root-endpoint) to support [Github enterprise](https://enterprise.github.com/).

## License

Copyright (c) 2015 [Shinnosuke Watanabe](https://github.com/shinnn)

Licensed under [the MIT License](./LICENSE).

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