Skip to content

Instantly share code, notes, and snippets.

@zephraph zephraph/imgur.js
Created Aug 6, 2015

Embed
What would you like to do?
// Builds out a request function with a default payload
function requestBuilder(api, settings) {
return function request(endpoint, payload) {
payload = $.extend(true, settings, payload || {});
return $.ajax(api + endpoint, payload);
}
}
// -- Imgur Module ----------------------------------------
var imgur = (function() {
var api = 'https://api.imgur.com/3';
var randomEndpoint = '/gallery/random/random';
var request = requestBuilder(api, {
headers: {
Authorization: 'Client-ID 44099d515f0aac2'
}
});
// link, title, account_url
return {
getRandomImages: function() {
return request('/gallery/random/random');
}
}
})();
// --------------------------------------------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.