unstar-gist

1.0.0 • Public • Published

unstar-gist

NPM version Build Status Coverage Status Dependency Status devDependency Status

Unstar a gist

const unstarGist = require('unstar-gist');
 
unstarGist('2790533', {token: 'xxxx'}).then(response => {
  response.statusCode; //=> 204
  console.log('Unstarred a gist: https://gist.github.com/2790533');
});

Installation

Use npm.

npm install unstar-gist

API

const unstarGist = require('unstar-gist');

unstarGist(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 unstar 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.

unstarGist('ab12852099', {token: 'xxxxxx'}).catch(err => {
  err.message;
  //=> '404 Not Found (Gist not found: https://gist.github.com/ab12852099)'
});
 
unstarGist('2790533', {token: 'invalid_token'}).catch(err => {
  err.message;
  //=> '401 Unauthorized (Bad credentials)'
});

License

Copyright (c) 2015 Shinnosuke Watanabe

Licensed under the MIT License.

Package Sidebar

Install

npm i unstar-gist

Weekly Downloads

2

Version

1.0.0

License

MIT

Last publish

Collaborators

  • shinnn