ghify-request-options
Create a Request option object that helps to interact with the GitHub API
const ghifyRequestOptions = ; ;/* => { 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
npm install ghify-request-options
API
const ghifyRequest = ;
ghifyRequestOptions([options])
options: Object
(Request
options to overwrite the defaults, and token
option)
Return: Object
(new Request
options)
It returns Request
options that defaults to the GitHub-API-friendly settings.
;/* => { 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.
;/* => { 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 to support Github enterprise.
License
Copyright (c) 2015 Shinnosuke Watanabe
Licensed under the MIT License.