1.0.0 • Published 8 years ago

unstar-gist v1.0.0

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

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.