You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

unsplash-js

Package Overview
Dependencies
Maintainers
2
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.1.3 to 3.0.0

native.js

42

dist/unsplash.js

@@ -69,6 +69,4 @@ (function webpackUniversalModuleDefinition(root, factory) {

var _utils = __webpack_require__(11);
var _utils = __webpack_require__(10);
var _services = __webpack_require__(10);
var _auth = __webpack_require__(3);

@@ -106,4 +104,2 @@

var fetch = (0, _services.requireFetch)();
var Unsplash = function () {

@@ -170,4 +166,4 @@ function Unsplash(options) {

exports.decode = exports.parse = __webpack_require__(13);
exports.encode = exports.stringify = __webpack_require__(14);
exports.decode = exports.parse = __webpack_require__(12);
exports.encode = exports.stringify = __webpack_require__(13);

@@ -670,7 +666,10 @@

photos: function photos(username) {
var orderBy = arguments.length <= 1 || arguments[1] === undefined ? "latest" : arguments[1];
var page = arguments.length <= 1 || arguments[1] === undefined ? 1 : arguments[1];
var perPage = arguments.length <= 2 || arguments[2] === undefined ? 10 : arguments[2];
var orderBy = arguments.length <= 3 || arguments[3] === undefined ? "latest" : arguments[3];
var url = "/users/" + username + "/photos";
var query = {
page: page,
per_page: perPage,
order_by: orderBy

@@ -692,3 +691,2 @@ };

var url = "/users/" + username + "/likes";
var query = {

@@ -718,19 +716,3 @@ page: page,

});
exports.requireFetch = requireFetch;
function requireFetch() {
var isClient = (true) || false;
return isClient ? window.fetch : __webpack_require__(!(function webpackMissingModule() { var e = new Error("Cannot find module \"node-fetch\""); e.code = 'MODULE_NOT_FOUND'; throw e; }()));
}
/***/ },
/* 11 */
/***/ function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

@@ -743,3 +725,3 @@

var _formUrlencoded = __webpack_require__(12);
var _formUrlencoded = __webpack_require__(11);

@@ -785,3 +767,3 @@ var _formUrlencoded2 = _interopRequireDefault(_formUrlencoded);

/***/ },
/* 12 */
/* 11 */
/***/ function(module, exports) {

@@ -854,3 +836,3 @@

/***/ },
/* 13 */
/* 12 */
/***/ function(module, exports) {

@@ -941,3 +923,3 @@

/***/ },
/* 14 */
/* 13 */
/***/ function(module, exports) {

@@ -944,0 +926,0 @@

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Unsplash=t():e.Unsplash=t()}(this,function(){return function(e){function t(o){if(r[o])return r[o].exports;var n=r[o]={exports:{},id:o,loaded:!1};return e[o].call(n.exports,n,n.exports,t),n.loaded=!0,n.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e){return e.json()}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}();t.toJson=u;var s=r(1),a=r(11),c=r(10),l=r(3),d=o(l),f=r(6),h=o(f),p=r(9),v=o(p),_=r(7),b=o(_),m=r(4),y=o(m),g=r(5),T=o(g),q=r(8),O=o(q),E=(0,c.requireFetch)(),U=function(){function e(t){n(this,e),this._apiUrl=t.apiUrl||s.API_URL,this._apiVersion=t.apiVersion||s.API_VERSION,this._applicationId=t.applicationId,this._secret=t.secret,this._callbackUrl=t.callbackUrl,this._bearerToken=t.bearerToken,this.auth=d["default"].bind(this)(),this.currentUser=h["default"].bind(this)(),this.users=v["default"].bind(this)(),this.photos=b["default"].bind(this)(),this.categories=y["default"].bind(this)(),this.collections=T["default"].bind(this)(),this.stats=O["default"].bind(this)()}return i(e,[{key:"request",value:function(e){var t=a.buildFetchOptions.bind(this)(e),r=t.url,o=t.options;return E(r,o)}}]),e}();t["default"]=U},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.API_URL="https://api.unsplash.com",t.API_VERSION="v1",t.OAUTH_AUTHORIZE_URL="https://unsplash.com/oauth/authorize",t.OAUTH_TOKEN_URL="https://unsplash.com/oauth/token"},function(e,t,r){"use strict";t.decode=t.parse=r(13),t.encode=t.stringify=r(14)},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function n(){var e=this;return{getAuthenticationUrl:function(){var t=arguments.length<=0||void 0===arguments[0]?["public"]:arguments[0],r=i["default"].stringify({client_id:e._applicationId,redirect_uri:e._callbackUrl,response_type:"code",scope:t.length>1?t.join("+"):t.toString()});return decodeURIComponent(s.OAUTH_AUTHORIZE_URL+"?"+r)},userAuthentication:function(t){var r=s.OAUTH_TOKEN_URL;return e.request({url:r,method:"POST",body:{client_id:e._applicationId,client_secret:e._secret,redirect_uri:e._callbackUrl,grant_type:"authorization_code",code:t},oauth:!0})},setBearerToken:function(t){t&&(e._bearerToken=t)}}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=n;var u=r(2),i=o(u),s=r(1)},function(e,t){"use strict";function r(){var e=this;return{listCategories:function(){var t="/categories";return e.request({url:t,method:"GET"})},category:function(t){var r="/categories/"+t;return e.request({url:r,method:"GET"})},categoryPhotos:function(t,r,o){var n="/categories/"+t+"/photos",u={page:r,per_page:o};return e.request({url:n,method:"GET",query:u})}}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r},function(e,t){"use strict";function r(){var e=this;return{listCollections:function(){var t=arguments.length<=0||void 0===arguments[0]?1:arguments[0],r=arguments.length<=1||void 0===arguments[1]?10:arguments[1],o="/collections",n={page:t,per_page:r};return e.request({url:o,method:"GET",query:n})},listCuratedCollections:function(){var t=arguments.length<=0||void 0===arguments[0]?1:arguments[0],r=arguments.length<=1||void 0===arguments[1]?10:arguments[1],o="/collections/curated",n={page:t,per_page:r};return e.request({url:o,method:"GET",query:n})},getCollection:o.bind(this,!1),getCuratedCollection:o.bind(this,!0),getCuratedCollectionPhotos:n.bind(this,!0),getCollectionPhotos:n.bind(this,!1),createCollection:u.bind(this,null),updateCollection:u.bind(this),deleteCollection:function(t){var r="/collections/"+t;return e.request({url:r,method:"DELETE"})},addPhotoToCollection:function(t,r){var o="/collections/"+t+"/add";return e.request({url:o,method:"POST",body:{photo_id:r}})},removePhotoFromCollection:function(t,r){var o="/collections/"+t+"/remove?photo_id="+r;return e.request({url:o,method:"DELETE"})}}}function o(e,t){var r=e?"/collections/curated/"+t:"/collections/"+t;return this.request({url:r,method:"GET"})}function n(e,t){var r=arguments.length<=2||void 0===arguments[2]?"latest":arguments[2],o=e?"/collections/curated/"+t+"/photos":"/collections/"+t+"/photos",n={order_by:r};return this.request({url:o,method:"GET",query:n})}function u(e,t,r,o){var n=e?"/collections/"+e:"/collections",u={title:t,description:r,"private":o};return this.request({url:n,method:e?"PUT":"POST",body:u})}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r},function(e,t){"use strict";function r(){var e=this;return{profile:function(){var t="/me";return e.request({url:t,method:"GET"})},updateProfile:function(t){var r="/me",o=t.username,n=t.firstName,u=t.lastName,i=t.email,s=t.url,a=t.location,c=t.bio,l=t.instagramUsername,d={username:o,first_name:n,last_name:u,email:i,url:s,location:a,bio:c,instagram_username:l};return Object.keys(d).forEach(function(e){d[e]||delete d[e]}),e.request({url:r,method:"PUT",body:d})}}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r},function(e,t){"use strict";function r(){var e=this;return{listPhotos:function(){var t=arguments.length<=0||void 0===arguments[0]?1:arguments[0],r=arguments.length<=1||void 0===arguments[1]?10:arguments[1],o=arguments.length<=2||void 0===arguments[2]?"latest":arguments[2],n="/photos",u={page:t,per_page:r,order_by:o};return e.request({url:n,method:"GET",query:u})},searchPhotos:function(t){var r=arguments.length<=1||void 0===arguments[1]?[""]:arguments[1],o=arguments.length<=2||void 0===arguments[2]?1:arguments[2],n=arguments.length<=3||void 0===arguments[3]?10:arguments[3],u="/photos/search",i={query:t,category:r.length>1?r.join(","):r.toString(),page:o,per_page:n};return e.request({url:u,method:"GET",query:i})},getPhoto:function(t,r,o,n){var u="/photos/"+t,i={w:r,h:o,rect:n};return e.request({url:u,method:"GET",query:i})},getRandomPhoto:function(){var t=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],r="/photos/random",o={category:t.category,featured:t.featured,username:t.username,q:t.query,w:t.width,h:t.height,c:t.cacheBuster||(new Date).getTime()};return Object.keys(o).forEach(function(e){o[e]||delete o[e]}),e.request({url:r,method:"GET",query:o})},uploadPhoto:function(t){if(!e._bearerToken)throw new Error("Requires a bearerToken to be set.");var r="/photos";return e.request({url:r,method:"POST",body:{photo:t}})},likePhoto:function(t){if(!e._bearerToken)throw new Error("Requires a bearerToken to be set.");var r="/photos/"+t+"/like";return e.request({url:r,method:"POST"})},unlikePhoto:function(t){if(!e._bearerToken)throw new Error("Requires a bearerToken to be set.");var r="/photos/"+t+"/like";return e.request({url:r,method:"DELETE"})}}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r},function(e,t){"use strict";function r(){var e=this;return{total:function(){var t="/stats/total";return e.request({url:t,method:"GET"})}}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r},function(e,t){"use strict";function r(){var e=this;return{profile:function(t){var r="/users/"+t;return e.request({url:r,method:"GET"})},photos:function(t){var r=arguments.length<=1||void 0===arguments[1]?"latest":arguments[1],o="/users/"+t+"/photos",n={order_by:r};return e.request({url:o,method:"GET",query:n})},likes:function(t){var r=arguments.length<=1||void 0===arguments[1]?1:arguments[1],o=arguments.length<=2||void 0===arguments[2]?10:arguments[2],n=arguments.length<=3||void 0===arguments[3]?"latest":arguments[3],u="/users/"+t+"/likes",i={page:r,per_page:o,order_by:n};return e.request({url:u,method:"GET",query:i})}}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r},function(e,t,r){"use strict";function o(){var e=!0;return e?window.fetch:r(!function(){var e=new Error('Cannot find module "node-fetch"');throw e.code="MODULE_NOT_FOUND",e}())}Object.defineProperty(t,"__esModule",{value:!0}),t.requireFetch=o},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function n(e){return(0,c["default"])(e)}function u(e){var t=e.method,r=e.query,o=e.oauth,u=e.body,a=o===!0?e.url:""+this._apiUrl+e.url,c=i({},e.headers,{"Accept-Version":this._apiVersion,Authorization:this._bearerToken?"Bearer "+this._bearerToken:"Client-ID "+this._applicationId});return u&&(c["Content-Type"]="application/x-www-form-urlencoded"),r&&(a=decodeURIComponent(a+"?"+(0,s.stringify)(r))),{url:a,options:{method:t,headers:c,body:"GET"!==t&&u?n(u):void 0}}}Object.defineProperty(t,"__esModule",{value:!0});var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e};t.formUrlEncode=n,t.buildFetchOptions=u;var s=r(2),a=r(12),c=o(a)},function(e,t){e.exports=function(e,t){function r(e){return String(e).replace(/[^ !'()~\*]*/g,encodeURIComponent).replace(/ /g,"+").replace(/[!'()~\*]/g,function(e){return"%"+e.charCodeAt().toString(16).slice(-2).toUpperCase()})}function o(e){var r=Object.keys(e);return t.sorted?r.sort():r}function n(e){return e.filter(function(e){return e}).join("&")}function u(e,t){return n(o(t).map(function(r){return s(e+"["+r+"]",t[r])}))}function i(e,t){return n(t.map(function(t){return s(e+"[]",t)}))}function s(e,o){var n=typeof o,s=null;return o===s?s=t.ignorenull?s:r(e)+"="+s:/string|number|boolean/.test(n)?s=r(e)+"="+r(o):Array.isArray(o)?s=i(e,o):"object"===n&&(s=u(e,o)),s}return t="object"==typeof t?t:{},n(o(e).map(function(t){return s(t,e[t])}))}},function(e,t){"use strict";function r(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.exports=function(e,t,o,n){t=t||"&",o=o||"=";var u={};if("string"!=typeof e||0===e.length)return u;var i=/\+/g;e=e.split(t);var s=1e3;n&&"number"==typeof n.maxKeys&&(s=n.maxKeys);var a=e.length;s>0&&a>s&&(a=s);for(var c=0;a>c;++c){var l,d,f,h,p=e[c].replace(i,"%20"),v=p.indexOf(o);v>=0?(l=p.substr(0,v),d=p.substr(v+1)):(l=p,d=""),f=decodeURIComponent(l),h=decodeURIComponent(d),r(u,f)?Array.isArray(u[f])?u[f].push(h):u[f]=[u[f],h]:u[f]=h}return u}},function(e,t){"use strict";var r=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};e.exports=function(e,t,o,n){return t=t||"&",o=o||"=",null===e&&(e=void 0),"object"==typeof e?Object.keys(e).map(function(n){var u=encodeURIComponent(r(n))+o;return Array.isArray(e[n])?e[n].map(function(e){return u+encodeURIComponent(r(e))}).join(t):u+encodeURIComponent(r(e[n]))}).join(t):n?encodeURIComponent(r(n))+o+encodeURIComponent(r(e)):""}}])});
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Unsplash=t():e.Unsplash=t()}(this,function(){return function(e){function t(o){if(r[o])return r[o].exports;var n=r[o]={exports:{},id:o,loaded:!1};return e[o].call(n.exports,n,n.exports,t),n.loaded=!0,n.exports}var r={};return t.m=e,t.c=r,t.p="",t(0)}([function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e){return e.json()}Object.defineProperty(t,"__esModule",{value:!0});var u=function(){function e(e,t){for(var r=0;r<t.length;r++){var o=t[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,r,o){return r&&e(t.prototype,r),o&&e(t,o),t}}();t.toJson=i;var s=r(1),a=r(10),c=r(3),l=o(c),d=r(6),h=o(d),f=r(9),p=o(f),v=r(7),b=o(v),_=r(4),m=o(_),g=r(5),y=o(g),T=r(8),q=o(T),E=function(){function e(t){n(this,e),this._apiUrl=t.apiUrl||s.API_URL,this._apiVersion=t.apiVersion||s.API_VERSION,this._applicationId=t.applicationId,this._secret=t.secret,this._callbackUrl=t.callbackUrl,this._bearerToken=t.bearerToken,this.auth=l["default"].bind(this)(),this.currentUser=h["default"].bind(this)(),this.users=p["default"].bind(this)(),this.photos=b["default"].bind(this)(),this.categories=m["default"].bind(this)(),this.collections=y["default"].bind(this)(),this.stats=q["default"].bind(this)()}return u(e,[{key:"request",value:function(e){var t=a.buildFetchOptions.bind(this)(e),r=t.url,o=t.options;return fetch(r,o)}}]),e}();t["default"]=E},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.API_URL="https://api.unsplash.com",t.API_VERSION="v1",t.OAUTH_AUTHORIZE_URL="https://unsplash.com/oauth/authorize",t.OAUTH_TOKEN_URL="https://unsplash.com/oauth/token"},function(e,t,r){"use strict";t.decode=t.parse=r(12),t.encode=t.stringify=r(13)},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function n(){var e=this;return{getAuthenticationUrl:function(){var t=arguments.length<=0||void 0===arguments[0]?["public"]:arguments[0],r=u["default"].stringify({client_id:e._applicationId,redirect_uri:e._callbackUrl,response_type:"code",scope:t.length>1?t.join("+"):t.toString()});return decodeURIComponent(s.OAUTH_AUTHORIZE_URL+"?"+r)},userAuthentication:function(t){var r=s.OAUTH_TOKEN_URL;return e.request({url:r,method:"POST",body:{client_id:e._applicationId,client_secret:e._secret,redirect_uri:e._callbackUrl,grant_type:"authorization_code",code:t},oauth:!0})},setBearerToken:function(t){t&&(e._bearerToken=t)}}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=n;var i=r(2),u=o(i),s=r(1)},function(e,t){"use strict";function r(){var e=this;return{listCategories:function(){var t="/categories";return e.request({url:t,method:"GET"})},category:function(t){var r="/categories/"+t;return e.request({url:r,method:"GET"})},categoryPhotos:function(t,r,o){var n="/categories/"+t+"/photos",i={page:r,per_page:o};return e.request({url:n,method:"GET",query:i})}}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r},function(e,t){"use strict";function r(){var e=this;return{listCollections:function(){var t=arguments.length<=0||void 0===arguments[0]?1:arguments[0],r=arguments.length<=1||void 0===arguments[1]?10:arguments[1],o="/collections",n={page:t,per_page:r};return e.request({url:o,method:"GET",query:n})},listCuratedCollections:function(){var t=arguments.length<=0||void 0===arguments[0]?1:arguments[0],r=arguments.length<=1||void 0===arguments[1]?10:arguments[1],o="/collections/curated",n={page:t,per_page:r};return e.request({url:o,method:"GET",query:n})},getCollection:o.bind(this,!1),getCuratedCollection:o.bind(this,!0),getCuratedCollectionPhotos:n.bind(this,!0),getCollectionPhotos:n.bind(this,!1),createCollection:i.bind(this,null),updateCollection:i.bind(this),deleteCollection:function(t){var r="/collections/"+t;return e.request({url:r,method:"DELETE"})},addPhotoToCollection:function(t,r){var o="/collections/"+t+"/add";return e.request({url:o,method:"POST",body:{photo_id:r}})},removePhotoFromCollection:function(t,r){var o="/collections/"+t+"/remove?photo_id="+r;return e.request({url:o,method:"DELETE"})}}}function o(e,t){var r=e?"/collections/curated/"+t:"/collections/"+t;return this.request({url:r,method:"GET"})}function n(e,t){var r=arguments.length<=2||void 0===arguments[2]?"latest":arguments[2],o=e?"/collections/curated/"+t+"/photos":"/collections/"+t+"/photos",n={order_by:r};return this.request({url:o,method:"GET",query:n})}function i(e,t,r,o){var n=e?"/collections/"+e:"/collections",i={title:t,description:r,"private":o};return this.request({url:n,method:e?"PUT":"POST",body:i})}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r},function(e,t){"use strict";function r(){var e=this;return{profile:function(){var t="/me";return e.request({url:t,method:"GET"})},updateProfile:function(t){var r="/me",o=t.username,n=t.firstName,i=t.lastName,u=t.email,s=t.url,a=t.location,c=t.bio,l=t.instagramUsername,d={username:o,first_name:n,last_name:i,email:u,url:s,location:a,bio:c,instagram_username:l};return Object.keys(d).forEach(function(e){d[e]||delete d[e]}),e.request({url:r,method:"PUT",body:d})}}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r},function(e,t){"use strict";function r(){var e=this;return{listPhotos:function(){var t=arguments.length<=0||void 0===arguments[0]?1:arguments[0],r=arguments.length<=1||void 0===arguments[1]?10:arguments[1],o=arguments.length<=2||void 0===arguments[2]?"latest":arguments[2],n="/photos",i={page:t,per_page:r,order_by:o};return e.request({url:n,method:"GET",query:i})},searchPhotos:function(t){var r=arguments.length<=1||void 0===arguments[1]?[""]:arguments[1],o=arguments.length<=2||void 0===arguments[2]?1:arguments[2],n=arguments.length<=3||void 0===arguments[3]?10:arguments[3],i="/photos/search",u={query:t,category:r.length>1?r.join(","):r.toString(),page:o,per_page:n};return e.request({url:i,method:"GET",query:u})},getPhoto:function(t,r,o,n){var i="/photos/"+t,u={w:r,h:o,rect:n};return e.request({url:i,method:"GET",query:u})},getRandomPhoto:function(){var t=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],r="/photos/random",o={category:t.category,featured:t.featured,username:t.username,q:t.query,w:t.width,h:t.height,c:t.cacheBuster||(new Date).getTime()};return Object.keys(o).forEach(function(e){o[e]||delete o[e]}),e.request({url:r,method:"GET",query:o})},uploadPhoto:function(t){if(!e._bearerToken)throw new Error("Requires a bearerToken to be set.");var r="/photos";return e.request({url:r,method:"POST",body:{photo:t}})},likePhoto:function(t){if(!e._bearerToken)throw new Error("Requires a bearerToken to be set.");var r="/photos/"+t+"/like";return e.request({url:r,method:"POST"})},unlikePhoto:function(t){if(!e._bearerToken)throw new Error("Requires a bearerToken to be set.");var r="/photos/"+t+"/like";return e.request({url:r,method:"DELETE"})}}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r},function(e,t){"use strict";function r(){var e=this;return{total:function(){var t="/stats/total";return e.request({url:t,method:"GET"})}}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r},function(e,t){"use strict";function r(){var e=this;return{profile:function(t){var r="/users/"+t;return e.request({url:r,method:"GET"})},photos:function(t){var r=arguments.length<=1||void 0===arguments[1]?1:arguments[1],o=arguments.length<=2||void 0===arguments[2]?10:arguments[2],n=arguments.length<=3||void 0===arguments[3]?"latest":arguments[3],i="/users/"+t+"/photos",u={page:r,per_page:o,order_by:n};return e.request({url:i,method:"GET",query:u})},likes:function(t){var r=arguments.length<=1||void 0===arguments[1]?1:arguments[1],o=arguments.length<=2||void 0===arguments[2]?10:arguments[2],n=arguments.length<=3||void 0===arguments[3]?"latest":arguments[3],i="/users/"+t+"/likes",u={page:r,per_page:o,order_by:n};return e.request({url:i,method:"GET",query:u})}}}Object.defineProperty(t,"__esModule",{value:!0}),t["default"]=r},function(e,t,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function n(e){return(0,c["default"])(e)}function i(e){var t=e.method,r=e.query,o=e.oauth,i=e.body,a=o===!0?e.url:""+this._apiUrl+e.url,c=u({},e.headers,{"Accept-Version":this._apiVersion,Authorization:this._bearerToken?"Bearer "+this._bearerToken:"Client-ID "+this._applicationId});return i&&(c["Content-Type"]="application/x-www-form-urlencoded"),r&&(a=decodeURIComponent(a+"?"+(0,s.stringify)(r))),{url:a,options:{method:t,headers:c,body:"GET"!==t&&i?n(i):void 0}}}Object.defineProperty(t,"__esModule",{value:!0});var u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e};t.formUrlEncode=n,t.buildFetchOptions=i;var s=r(2),a=r(11),c=o(a)},function(e,t){e.exports=function(e,t){function r(e){return String(e).replace(/[^ !'()~\*]*/g,encodeURIComponent).replace(/ /g,"+").replace(/[!'()~\*]/g,function(e){return"%"+e.charCodeAt().toString(16).slice(-2).toUpperCase()})}function o(e){var r=Object.keys(e);return t.sorted?r.sort():r}function n(e){return e.filter(function(e){return e}).join("&")}function i(e,t){return n(o(t).map(function(r){return s(e+"["+r+"]",t[r])}))}function u(e,t){return n(t.map(function(t){return s(e+"[]",t)}))}function s(e,o){var n=typeof o,s=null;return o===s?s=t.ignorenull?s:r(e)+"="+s:/string|number|boolean/.test(n)?s=r(e)+"="+r(o):Array.isArray(o)?s=u(e,o):"object"===n&&(s=i(e,o)),s}return t="object"==typeof t?t:{},n(o(e).map(function(t){return s(t,e[t])}))}},function(e,t){"use strict";function r(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.exports=function(e,t,o,n){t=t||"&",o=o||"=";var i={};if("string"!=typeof e||0===e.length)return i;var u=/\+/g;e=e.split(t);var s=1e3;n&&"number"==typeof n.maxKeys&&(s=n.maxKeys);var a=e.length;s>0&&a>s&&(a=s);for(var c=0;a>c;++c){var l,d,h,f,p=e[c].replace(u,"%20"),v=p.indexOf(o);v>=0?(l=p.substr(0,v),d=p.substr(v+1)):(l=p,d=""),h=decodeURIComponent(l),f=decodeURIComponent(d),r(i,h)?Array.isArray(i[h])?i[h].push(f):i[h]=[i[h],f]:i[h]=f}return i}},function(e,t){"use strict";var r=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};e.exports=function(e,t,o,n){return t=t||"&",o=o||"=",null===e&&(e=void 0),"object"==typeof e?Object.keys(e).map(function(n){var i=encodeURIComponent(r(n))+o;return Array.isArray(e[n])?e[n].map(function(e){return i+encodeURIComponent(r(e))}).join(t):i+encodeURIComponent(r(e[n]))}).join(t):n?encodeURIComponent(r(n))+o+encodeURIComponent(r(e)):""}}])});
require('babel-register');
global.fetch = require('node-fetch');
require('./app');

@@ -13,2 +13,3 @@ {

"babel-register": "6.6.5",
"node-fetch": "1.5.0",
"universal-config": "0.1.0",

@@ -15,0 +16,0 @@ "unsplash-js": "../.."

@@ -36,5 +36,3 @@ 'use strict';

'process.browser': true
}),
new webpack.IgnorePlugin(/^form-data/),
new webpack.IgnorePlugin(/^node-fetch/)
})
]

@@ -41,0 +39,0 @@ },

@@ -21,7 +21,10 @@ "use strict";

photos: function photos(username) {
var orderBy = arguments.length <= 1 || arguments[1] === undefined ? "latest" : arguments[1];
var page = arguments.length <= 1 || arguments[1] === undefined ? 1 : arguments[1];
var perPage = arguments.length <= 2 || arguments[2] === undefined ? 10 : arguments[2];
var orderBy = arguments.length <= 3 || arguments[3] === undefined ? "latest" : arguments[3];
var url = "/users/" + username + "/photos";
var query = {
page: page,
per_page: perPage,
order_by: orderBy

@@ -43,3 +46,2 @@ };

var url = "/users/" + username + "/likes";
var query = {

@@ -46,0 +48,0 @@ page: page,

@@ -15,4 +15,2 @@ "use strict";

var _services = require("./services");
var _auth = require("./methods/auth");

@@ -50,4 +48,2 @@

var fetch = (0, _services.requireFetch)();
var Unsplash = function () {

@@ -54,0 +50,0 @@ function Unsplash(options) {

{
"name": "unsplash-js",
"version": "2.1.3",
"version": "3.0.0",
"description": "A Universal JavaScript wrapper for the Unsplash API",

@@ -18,4 +18,4 @@ "main": "lib/unsplash.js",

"test:ci": "npm run lint && npm run flow && npm run test:browser && npm run test:coverage",
"test:coverage": "babel-node ./node_modules/.bin/isparta cover _mocha",
"test:node": "mocha --compilers js:babel-core/register --recursive",
"test:coverage": "babel-node ./node_modules/.bin/isparta cover _mocha -- --require test/setup",
"test:node": "mocha --compilers js:babel-core/register --require test/setup --recursive",
"test:watch": "npm test -- --watch"

@@ -67,2 +67,3 @@ },

"mockery": "1.4.0",
"node-fetch": "1.5.0",
"webpack": "1.12.14"

@@ -72,5 +73,4 @@ },

"form-urlencoded": "1.2.0",
"node-fetch": "1.3.3",
"querystring": "0.2.0"
}
}
# Unsplash
[![npm](https://img.shields.io/npm/v/unsplash-js.svg?style=flat-square)](https://www.npmjs.com/package/unsplash-js)
[![Travis](https://img.shields.io/travis/naoufal/unsplash-js/master.svg?style=flat-square)](https://travis-ci.org/naoufal/unsplash-js/branches)
[![Coveralls](https://img.shields.io/coveralls/naoufal/unsplash-js/master.svg?style=flat-square)](https://coveralls.io/github/naoufal/unsplash-js?branch=master)
[![Travis](https://img.shields.io/travis/unsplash/unsplash-js/master.svg?style=flat-square)](https://travis-ci.org/unsplash/unsplash-js/branches)
[![Coveralls](https://img.shields.io/coveralls/unsplash/unsplash-js/master.svg?style=flat-square)](https://coveralls.io/github/unsplash/unsplash-js?branch=master)

@@ -15,10 +15,11 @@ A [Universal JavaScript](https://medium.com/@mjackson/universal-javascript-4761051b7ae9) wrapper for the [Unsplash API](https://unsplash.com/developers).

## Documentation
- [Installation](https://github.com/naoufal/unsplash-js#installation)
- [Dependencies](https://github.com/naoufal/unsplash-js#dependencies)
- [Usage](https://github.com/naoufal/unsplash-js#usage)
- [Instance Methods](https://github.com/naoufal/unsplash-js#instance-methods)
- [Helpers](https://github.com/naoufal/unsplash-js#helpers)
- [Shoutouts](https://github.com/naoufal/unsplash-js#shoutouts)
- [License](https://github.com/naoufal/unsplash-js#license)
- [Installation](https://github.com/unsplash/unsplash-js#installation)
- [Dependencies](https://github.com/unsplash/unsplash-js#dependencies)
- [Usage](https://github.com/unsplash/unsplash-js#usage)
- [Instance Methods](https://github.com/unsplash/unsplash-js#instance-methods)
- [Helpers](https://github.com/unsplash/unsplash-js#helpers)
- [Shoutouts](https://github.com/unsplash/unsplash-js#shoutouts)
- [License](https://github.com/unsplash/unsplash-js#license)

@@ -31,3 +32,3 @@ ## Installation

## Dependencies
This library depends on [fetch](https://fetch.spec.whatwg.org/) to make requests to the Unsplash API. __For browsers__ that don't support fetch, you'll need to provide a [poly](https://github.com/github/fetch)[fill](https://cdnjs.com/libraries/fetch).
This library depends on [fetch](https://fetch.spec.whatwg.org/) to make requests to the Unsplash API. For environments that don't support fetch, you'll need to provide a [poly](https://github.com/github/fetch)[fill](https://github.com/bitinn/node-fetch).

@@ -39,3 +40,5 @@ ## Usage

```js
let unsplash = new Unsplash({
import Unsplash from 'unsplash-js';
const unsplash = new Unsplash({
applicationId: "{APP_ID}",

@@ -50,3 +53,3 @@ secret: "{APP_SECRET}",

```js
let unsplash = new Unsplash({
const unsplash = new Unsplash({
applicationId: "{APP_ID}",

@@ -61,2 +64,9 @@ secret: "{APP_SECRET}",

### React Native
For use with React Native, import from `unsplash-js/native` instead.
```js
import Unsplash from 'unsplash-js/native';
```
---

@@ -110,9 +120,9 @@

## Instance Methods
- [Authorization](https://github.com/naoufal/unsplash-js#authorization)
- [Current User](https://github.com/naoufal/unsplash-js#current-user)
- [Users](https://github.com/naoufal/unsplash-js#users)
- [Photos](https://github.com/naoufal/unsplash-js#photos)
- [Categories](https://github.com/naoufal/unsplash-js#categories)
- [Collections](https://github.com/naoufal/unsplash-js#collections)
- [Stats](https://github.com/naoufal/unsplash-js#stats)
- [Authorization](https://github.com/unsplash/unsplash-js#authorization)
- [Current User](https://github.com/unsplash/unsplash-js#current-user)
- [Users](https://github.com/unsplash/unsplash-js#users)
- [Photos](https://github.com/unsplash/unsplash-js#photos)
- [Categories](https://github.com/unsplash/unsplash-js#categories)
- [Collections](https://github.com/unsplash/unsplash-js#collections)
- [Stats](https://github.com/unsplash/unsplash-js#stats)

@@ -244,3 +254,3 @@ <div id="authorization" />

### users.photos(username, orderBy)
### users.photos(username, page, perPage, orderBy)
Get a list of photos uploaded by a user.

@@ -253,2 +263,4 @@

|__`username`__|_string_|Required||
|__`page`__|_number_|Optional||
|__`perPage`__|_number_|Optional||
|__`orderBy`__|_string_|Optional|`latest`, `popular` or `oldest`|

@@ -774,7 +786,7 @@

## Shoutouts
- Shoutout to all the [contributors](https://github.com/naoufal/unsplash-js/graphs/contributors) for lending a helping hand.
- Shoutout to all the [contributors](https://github.com/unsplash/unsplash-js/graphs/contributors) for lending a helping hand.
- Shoutout to [BrowserStack](https://www.browserstack.com/) for letting us use their service to run automated browser tests.
## License
Copyright (c) 2015, [Naoufal Kadhom](http://naoufal.com)
Copyright (c) 2015, [Unsplash](https://unsplash.com)

@@ -781,0 +793,0 @@ Permission is hereby granted, free of charge, to any person obtaining a copy

@@ -16,3 +16,2 @@ "use strict";

plugins: [
new webpack.IgnorePlugin(/node-fetch/),
new webpack.DefinePlugin({

@@ -19,0 +18,0 @@ "process.browser": true

@@ -12,7 +12,5 @@ 'use strict';

'process.browser': true
}),
new webpack.IgnorePlugin(/^form-data/),
new webpack.IgnorePlugin(/^node-fetch/)
})
];
module.exports = config;

@@ -18,7 +18,5 @@ 'use strict';

'process.browser': true
}),
new webpack.IgnorePlugin(/^form-data/),
new webpack.IgnorePlugin(/^node-fetch/)
})
];
module.exports = config;

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc