gh-post

1.0.0 • Public • Published

gh-post

NPM version Build Status Coverage Status Dependency Status devDependency Status

A Node module to create a POST request to the Github API

const ghPost = require('gh-post');

ghPost('gists', {
  headers: {
    'user-agent': 'your application name'
  },
  token: 'your access token',
  body: {
    files: {
      'file1.txt': {
        content: 'Hi'
      }
    }
  }
}).then(response => {
  response.headers.status; //=> '201 Created'
  response.headers.location; //=> for example 'https://api.github.com/gists/6ba9f11f4e1acf13645'
});

Installation

Use npm.

npm install gh-post

API

const ghPost = require('gh-post');

ghPost(url [, options])

url: String ("path" part of a Github API URL)
options: Object (gh-get options)
Return: Object (Promise instance)

Almost the same as gh-get, except that the method option defaults to 'POST' and unchangable.

License

Copyright (c) 2015 Shinnosuke Watanabe

Licensed under the MIT License.

Package Sidebar

Install

npm i gh-post

Weekly Downloads

0

Version

1.0.0

License

MIT

Last publish

Collaborators

  • shinnn