star-gist

1.0.0 • Public • Published

star-gist

NPM version Build Status Coverage Status Dependency Status devDependency Status

Star a gist

const starGist = require('star-gist');

starGist('2790533', {token: 'xxxx'}).then(response => {
  response.statusCode; //=> 204
  console.log('Starred a gist: https://gist.github.com/2790533');
});

Installation

Use npm.

npm install star-gist

API

const starGist = require('star-gist');

starGist(gistId [, options])

gistId: String (a gist ID, for example https://gist.github.com/tim/34309'34309')
options: Object (gh-get options)
Return: Promise instance

It makes an API request to star a gist by the authenticated user, and returns a promise.

The promise will be fulfilled with an http.IncomingMessage object if successful, otherwise rejected with an error.

starGist('ab12852099', {token: 'xxxxxx'}).catch(err => {
  err.message;
  //=> '404 Not Found (Gist not found: https://gist.github.com/ab12852099)'
});

starGist('2790533', {token: 'invalid_token'}).catch(err => {
  err.message;
  //=> '401 Unauthorized (Bad credentials)'
});

Related Projects

License

Copyright (c) 2015 Shinnosuke Watanabe

Licensed under the MIT License.

Package Sidebar

Install

npm i star-gist

Weekly Downloads

1

Version

1.0.0

License

MIT

Last publish

Collaborators

  • shinnn