Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

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

unsplash-js - npm Package Compare versions

Comparing version 4.3.1 to 4.4.0

.github/ISSUE_TEMPLATE.md

4

dist/unsplash.js

@@ -690,6 +690,8 @@ (function webpackUniversalModuleDefinition(root, factory) {

var page = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
var per_page = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 10;
var query = {
query: keyword,
page: page
page: page,
per_page: per_page
};

@@ -696,0 +698,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 i(e){return"function"==typeof e.json?e.json():e}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(11),l=r(3),c=o(l),d=r(6),h=o(d),f=r(10),p=o(f),v=r(7),g=o(v),b=r(4),_=o(b),m=r(5),y=o(m),T=r(8),q=o(T),E=r(9),P=o(E),O=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=c["default"].bind(this)(),this.currentUser=h["default"].bind(this)(),this.users=p["default"].bind(this)(),this.photos=g["default"].bind(this)(),this.categories=_["default"].bind(this)(),this.collections=y["default"].bind(this)(),this.search=q["default"].bind(this)(),this.stats=P["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"]=O},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]?arguments[0]:["public"],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]?arguments[0]:1,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10,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]?arguments[0]:1,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10,o="/collections/curated",n={page:t,per_page:r};return e.request({url:o,method:"GET",query:n})},listFeaturedCollections:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10,o="/collections/featured",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]?arguments[2]:1,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:10,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"latest",i=e?"/collections/curated/"+t+"/photos":"/collections/"+t+"/photos",u={page:r,per_page:o,order_by:n};return this.request({url:i,method:"GET",query:u})}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,l=t.bio,c=t.instagramUsername,d={username:o,first_name:n,last_name:i,email:u,url:s,location:a,bio:l,instagram_username:c};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]?arguments[0]:1,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"latest",n="/photos",i={page:t,per_page:r,order_by:o};return e.request({url:n,method:"GET",query:i})},listCuratedPhotos:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"latest",n="/photos/curated",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]?arguments[2]:1,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:10,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})},getPhotoStats:function(t){var r="/photos/"+t+"/stats";return e.request({url:r,method:"GET"})},getRandomPhoto:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r="/photos/random",o=t.collections||[],n={category:t.category,featured:t.featured,username:t.username,collections:o.join(),query:t.query,w:t.width,h:t.height,c:t.cacheBuster||(new Date).getTime()};return Object.keys(n).forEach(function(e){n[e]||delete n[e]}),e.request({url:r,method:"GET",query:n})},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(){return{all:o.bind(this,"/search"),photos:o.bind(this,"/search/photos"),users:o.bind(this,"/search/users"),collections:o.bind(this,"/search/collections")}}function o(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o={query:t,page:r};return this.request({url:e,method:"GET",query:o})}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]?arguments[1]:1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"latest",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]?arguments[1]:1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"latest",i="/users/"+t+"/likes",u={page:r,per_page:o,order_by:n};return e.request({url:i,method:"GET",query:u})},collections:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10,n="/users/"+t+"/collections",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,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function n(e){return(0,l["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,l=u({},e.headers,{"Accept-Version":this._apiVersion,Authorization:this._bearerToken?"Bearer "+this._bearerToken:"Client-ID "+this._applicationId});return i&&(l["Content-Type"]="application/x-www-form-urlencoded"),r&&(a=decodeURIComponent(a+"?"+(0,s.stringify)(r))),{url:a,options:{method:t,headers:l,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(12),l=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 l=0;l<a;++l){var c,d,h,f,p=e[l].replace(u,"%20"),v=p.indexOf(o);v>=0?(c=p.substr(0,v),d=p.substr(v+1)):(c=p,d=""),h=decodeURIComponent(c),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)):""}}])});
!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"function"==typeof e.json?e.json():e}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(11),l=r(3),c=o(l),d=r(6),h=o(d),f=r(10),p=o(f),v=r(7),g=o(v),b=r(4),_=o(b),m=r(5),y=o(m),T=r(8),q=o(T),E=r(9),P=o(E),O=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=c["default"].bind(this)(),this.currentUser=h["default"].bind(this)(),this.users=p["default"].bind(this)(),this.photos=g["default"].bind(this)(),this.categories=_["default"].bind(this)(),this.collections=y["default"].bind(this)(),this.search=q["default"].bind(this)(),this.stats=P["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"]=O},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]?arguments[0]:["public"],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]?arguments[0]:1,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10,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]?arguments[0]:1,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10,o="/collections/curated",n={page:t,per_page:r};return e.request({url:o,method:"GET",query:n})},listFeaturedCollections:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10,o="/collections/featured",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]?arguments[2]:1,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:10,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"latest",i=e?"/collections/curated/"+t+"/photos":"/collections/"+t+"/photos",u={page:r,per_page:o,order_by:n};return this.request({url:i,method:"GET",query:u})}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,l=t.bio,c=t.instagramUsername,d={username:o,first_name:n,last_name:i,email:u,url:s,location:a,bio:l,instagram_username:c};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]?arguments[0]:1,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"latest",n="/photos",i={page:t,per_page:r,order_by:o};return e.request({url:n,method:"GET",query:i})},listCuratedPhotos:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"latest",n="/photos/curated",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]?arguments[2]:1,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:10,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})},getPhotoStats:function(t){var r="/photos/"+t+"/stats";return e.request({url:r,method:"GET"})},getRandomPhoto:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r="/photos/random",o=t.collections||[],n={category:t.category,featured:t.featured,username:t.username,collections:o.join(),query:t.query,w:t.width,h:t.height,c:t.cacheBuster||(new Date).getTime()};return Object.keys(n).forEach(function(e){n[e]||delete n[e]}),e.request({url:r,method:"GET",query:n})},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(){return{all:o.bind(this,"/search"),photos:o.bind(this,"/search/photos"),users:o.bind(this,"/search/users"),collections:o.bind(this,"/search/collections")}}function o(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:10,n={query:t,page:r,per_page:o};return this.request({url:e,method:"GET",query:n})}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]?arguments[1]:1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"latest",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]?arguments[1]:1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"latest",i="/users/"+t+"/likes",u={page:r,per_page:o,order_by:n};return e.request({url:i,method:"GET",query:u})},collections:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10,n="/users/"+t+"/collections",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,r){"use strict";function o(e){return e&&e.__esModule?e:{"default":e}}function n(e){return(0,l["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,l=u({},e.headers,{"Accept-Version":this._apiVersion,Authorization:this._bearerToken?"Bearer "+this._bearerToken:"Client-ID "+this._applicationId});return i&&(l["Content-Type"]="application/x-www-form-urlencoded"),r&&(a=decodeURIComponent(a+"?"+(0,s.stringify)(r))),{url:a,options:{method:t,headers:l,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(12),l=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 l=0;l<a;++l){var c,d,h,f,p=e[l].replace(u,"%20"),v=p.indexOf(o);v>=0?(c=p.substr(0,v),d=p.substr(v+1)):(c=p,d=""),h=decodeURIComponent(c),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)):""}}])});

@@ -22,6 +22,8 @@ "use strict";

var page = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
var per_page = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 10;
var query = {
query: keyword,
page: page
page: page,
per_page: per_page
};

@@ -28,0 +30,0 @@

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

@@ -21,2 +21,3 @@ "main": "lib/unsplash.js",

"test:watch": "npm test -- --watch",
"prepublish": "npm run build",
"publish:major": "npm run build && npm version major",

@@ -23,0 +24,0 @@ "publish:minor": "npm run build && npm version minor",

@@ -121,2 +121,3 @@ # Unsplash

- [Collections](https://github.com/unsplash/unsplash-js#collections)
- [Search](https://github.com/unsplash/unsplash-js#searchallkeyword-page)
- [Stats](https://github.com/unsplash/unsplash-js#stats)

@@ -825,6 +826,7 @@

| Argument | Type | Opt/Required | Notes |
| Argument | Type | Opt/Required | Default |
|---|---|---|---|
|__`keyword`__|_number_|Required||
|__`page`__|_number_|Optional|
|__`page`__|_number_|Optional||
|__`per_page`__|_number_|Optional|10|

@@ -846,6 +848,7 @@

| Argument | Type | Opt/Required | Notes |
| Argument | Type | Opt/Required | Default |
|---|---|---|---|
|__`keyword`__|_number_|Required||
|__`page`__|_number_|Optional|
|__`page`__|_number_|Optional||
|__`per_page`__|_number_|Optional|10|

@@ -867,6 +870,7 @@

| Argument | Type | Opt/Required | Notes |
| Argument | Type | Opt/Required | Default |
|---|---|---|---|
|__`keyword`__|_number_|Required||
|__`page`__|_number_|Optional|
|__`page`__|_number_|Optional||
|__`per_page`__|_number_|Optional|10|

@@ -888,6 +892,7 @@

| Argument | Type | Opt/Required | Notes |
| Argument | Type | Opt/Required | Default |
|---|---|---|---|
|__`keyword`__|_number_|Required||
|__`page`__|_number_|Optional|
|__`page`__|_number_|Optional||
|__`per_page`__|_number_|Optional|10|

@@ -894,0 +899,0 @@

@@ -15,6 +15,7 @@ /* @flow */

function searcher(url, keyword = "", page = 1) {
function searcher(url, keyword = "", page = 1, per_page = 10) {
const query = {
query: keyword,
page
page,
per_page
};

@@ -21,0 +22,0 @@

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc