1.0.0 • Published 7 years ago

imgur-wrapper v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
7 years ago

built on node.js & imgur

About

imgur.js is a simple node.js wrapper for Imgur's API, it uses node-fetch to request calls.

Setup

In order to use this package, you must register an application. Once you registered, you gain access to your client's client_id and client_secret. For public-readonly usage, such as looking up details about a certain post, looking up user comments, anonymously posting an image, this is all you need, you may skip the rest of this section.

If you want to do certain actions, such as postin an image to your account, editing a post, favoriting a post, you must authorize your account by going to the url https://api.imgur.com/oauth2/authorize?client_id=YOUR_CLIENT_ID&response_type=REQUESTED_RESPONSE_TYPE&state=APPLICATION_STATE```. While replacingYOUR_CLIENT_ID` with your client id.

Once authorized, you'll be redirected to a link containing your access_token and refresh_token.

Installation

npm install imgur.js

Usage

const imgur = require("imgur.js");

console.log(imgur.version);
// -> the current release

// initialize a new client
const client = new imgur.Wrapper({
  id: "",
  accessToken: "",
  secret: "",
  refreshToken: ""
});

// here's an example method, you can
// use this method to determine the remaining
// credits you have for your client
client.getCredits().then(data => console.log(data));

Documentation

The documentation for this package lies here.

License

This project is licensed under the MIT.

1.0.0

7 years ago