imgurwrap
Advanced tools
Comparing version 0.0.1 to 0.0.2
{ | ||
"name": "imgurwrap", | ||
"description": "A wrapper for the Imgur API", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"main": "src/imgurwrap.js", | ||
"scripts": { | ||
"test": "grunt --verbose" | ||
}, | ||
"dependencies": { | ||
@@ -7,0 +10,0 @@ "request": "~2.48.0" |
@@ -0,1 +1,3 @@ | ||
[![Build Status](https://travis-ci.org/msrxthr/imgurwrap.svg)](https://travis-ci.org/msrxthr/imgurwrap) | ||
# imgurwrap | ||
@@ -51,3 +53,3 @@ | ||
The returned urlType will be either 'image', 'images', or 'album' | ||
The returned model property will be either 'image', 'images', or 'album' | ||
@@ -70,13 +72,38 @@ ```javascript | ||
}); | ||
``` | ||
##### 4. Request rate limiting information | ||
```javascript | ||
imgurwrap.getRateLimitingData(function(err, res) { | ||
console.log(res); | ||
}); | ||
``` | ||
#### For commercial usage, Mashape can be utilized for making requests. | ||
* [Register with Mashape](https://www.mashape.com/imgur/imgur-9) to get a MashapeAuthID for your application. | ||
```javascript | ||
// Replace with your MashapeAuthID | ||
imgurwrap.setMashapeAuthID('cXs47w356nWDx2k9E34G36j4ZHBAdxmZ'); | ||
``` | ||
Note that on setting the MashapeAuthID, the endpoint used for making requests will automaticaly be | ||
updated to point to the Mashape Imgur endpoint (i.e. https://imgur-apiv3.p.mashape.com/). | ||
#### Available configuration options | ||
* [Register with Imgur](https://api.imgur.com/#register) to get a ClientID for your application. | ||
* [Register with Mashape](https://www.mashape.com/imgur/imgur-9) to get a MashapeAuthID for your application. | ||
```javascript | ||
imgurwrap.setClientID('eb534344da354de40d90'); // Replace with your CleintID | ||
// Replace with your CleintID | ||
imgurwrap.setClientID('eb534344da354de40d90'); | ||
// Replace with your MashapeAuthID | ||
imgurwrap.setMashapeAuthID('cXs47w356nWDx2k9E34G36j4ZHBAdxmZ'); | ||
imgurwrap.setUserAgent('imgurwrap default useragent v1.1'); | ||
@@ -83,0 +110,0 @@ imgurwrap.setApiHost('https://api.imgur.com'); |
@@ -69,2 +69,9 @@ 'use strict'; | ||
imgurwrap.setMashapeAuthID = function(mashapeAuthID) { | ||
if (mashapeAuthID) { | ||
_headers['X-Mashape-Authorization'] = mashapeAuthID; | ||
_host = 'https://imgur-apiv3.p.mashape.com/'; | ||
} | ||
}; | ||
var _getEndpoint = function(model, id) { | ||
@@ -71,0 +78,0 @@ return util.format('%s/%s/%s/%s', _host, _api, model, id); |
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
21454
8
364
1
111