unsplash-js
Advanced tools
Comparing version 7.0.0 to 7.0.1
import * as search from './methods/search'; | ||
import * as _internals from './internals'; | ||
export declare const createApi: (args: ({ | ||
apiVersion?: string | undefined; | ||
fetch?: typeof fetch | undefined; | ||
} & Pick<RequestInit, "cache" | "credentials" | "headers" | "integrity" | "keepalive" | "mode" | "redirect" | "referrer" | "referrerPolicy" | "signal" | "window"> & { | ||
@@ -9,2 +11,3 @@ accessKey: string; | ||
apiVersion?: string | undefined; | ||
fetch?: typeof fetch | undefined; | ||
} & Pick<RequestInit, "cache" | "credentials" | "headers" | "integrity" | "keepalive" | "mode" | "redirect" | "referrer" | "referrerPolicy" | "signal" | "window"> & { | ||
@@ -95,1 +98,2 @@ apiUrl: string; | ||
export { OrderBy, Orientation } from './types/request'; | ||
export { _internals }; |
@@ -377,2 +377,10 @@ 'use strict'; | ||
var index = { | ||
__proto__: null, | ||
getPhotos: getPhotos, | ||
get: get, | ||
list: list, | ||
getRelated: getRelated | ||
}; | ||
var PHOTOS_PATH_PREFIX = '/photos'; | ||
@@ -451,2 +459,11 @@ var list$1 = { | ||
var index$1 = { | ||
__proto__: null, | ||
list: list$1, | ||
get: get$1, | ||
getStats: getStats, | ||
getRandom: getRandom, | ||
trackDownload: trackDownload | ||
}; | ||
var SEARCH_PATH_PREFIX = "/search"; | ||
@@ -508,2 +525,9 @@ var getPhotos$1 = { | ||
var index$2 = { | ||
__proto__: null, | ||
getPhotos: getPhotos$1, | ||
getCollections: getCollections$1, | ||
getUsers: getUsers | ||
}; | ||
var USERS_PATH_PREFIX = '/users'; | ||
@@ -565,2 +589,35 @@ var get$2 = { | ||
var index$3 = { | ||
__proto__: null, | ||
get: get$2, | ||
getPhotos: getPhotos$2, | ||
getLikes: getLikes, | ||
getCollections: getCollections$2 | ||
}; | ||
var trackNonHotLinkedPhotoView = function trackNonHotLinkedPhotoView(_ref) { | ||
var appId = _ref.appId; | ||
return function (_ref2) { | ||
var photoId = _ref2.photoId; | ||
var ids = !Array.isArray(photoId) ? [photoId] : photoId; | ||
if (ids.length > 20) { | ||
throw new Error('You cannot track more than 20 photos at once. Please try again with fewer photos.'); | ||
} | ||
return fetch("views.unsplash.com/v?photo_id=" + ids.join() + "&app_id=" + appId); | ||
}; | ||
}; | ||
var internals = { | ||
__proto__: null, | ||
collections: index, | ||
photos: index$1, | ||
search: index$2, | ||
users: index$3, | ||
trackNonHotLinkedPhotoView: trackNonHotLinkedPhotoView | ||
}; | ||
(function (Language) { | ||
@@ -713,3 +770,4 @@ Language["Afrikaans"] = "af"; | ||
exports._internals = internals; | ||
exports.createApi = createApi; | ||
//# sourceMappingURL=unsplash-js.cjs.development.js.map |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("content-type");function n(){return(n=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var r=arguments[n];for(var t in r)Object.prototype.hasOwnProperty.call(r,t)&&(e[t]=r[t])}return e}).apply(this,arguments)}function r(e,n){if(null==e)return{};var r,t,a={},o=Object.keys(e);for(t=0;t<o.length;t++)n.indexOf(r=o[t])>=0||(a[r]=e[r]);return a}var t=o((function(e){return"string"==typeof e?e:null})),a=function(e){return null!=e};function o(e){return function(n){return a(e(n))}}var s=function(e){return Object.keys(e).reduce((function(r,t){var o,s=e[t];return n({},r,a(s)?((o={})[t]=s,o):{})}),{})};function i(){for(var e=arguments.length,n=new Array(e),r=0;r<e;r++)n[r]=arguments[r];var t=n.length-1;return function(){for(var e=arguments.length,r=new Array(e),a=0;a<e;a++)r[a]=arguments[a];for(var o=n[0].apply(this,r),s=1;s<=t;s++)o=n[s].call(this,o);return o}}var u,l,c=o((function(e){return a(e)&&"object"==typeof e&&!Array.isArray(e)?e:null})),h=o((function(e){return Array.isArray(e)&&e.every(t)&&e.length>0?e:null})),d=o((function(e){return c(e)&&"errors"in e&&h(e.errors)?{errors:e.errors}:null})),p=function(e){this.message=e},f=function(n){if(function(n){var r=n.headers.get("content-type");return a(r)&&"application/json"===e.parse(r).type}(n))return n.json().catch((function(e){throw new p("unable to parse JSON response.")}));throw new p("expected JSON response from server.")},y=function(){return function(e){return f(e.response)}},g=function(e){return function(t,a){void 0===a&&(a={});var o=e(t),s=o.headers,i=o.query;return n({},r(o,["headers","query"]),a,{query:i,headers:n({},s,a.headers)})}},m=function(e){var t=e.accessKey,o=e.apiVersion,s=void 0===o?"v1":o,u=e.apiUrl,l=void 0===u?"https://api.unsplash.com":u,c=e.headers,h=e.fetch,y=r(e,["accessKey","apiVersion","apiUrl","headers","fetch"]);return function(e){var r=e.handleResponse;return i(e.handleRequest,(function(e){var o=e.method,i=void 0===o?"GET":o,u=e.headers,g=e.body,m=e.signal,q=function(e){var n=e.pathname,r=e.query;return function(e){var t=new URL(n,e);return function(e){return function(n){Object.keys(e).forEach((function(r){return n.searchParams.set(r,e[r].toString())}))}}(r)(t),t.toString()}}({pathname:e.pathname,query:e.query})(l),v=n({method:i,headers:n({},c,u,{"Accept-Version":s},a(t)?{Authorization:"Client-ID "+t}:{}),body:g,signal:m},y);return(null!=h?h:fetch)(q,v).then(function(e){return function(r){return(r.ok?e({response:r}).then((function(e){return{type:"success",status:r.status,response:e}})):f(r).then((function(e){return n({type:"error",status:r.status},function(e){return d(e)?{errors:e.errors,source:"api"}:{errors:["Responded with a status code outside the 2xx range, and the response body is not recognisable."],source:"decoding"}}(e))}))).catch((function(e){if(e instanceof p)return{type:"error",source:"decoding",status:r.status,errors:[e.message]};throw e}))}}(r))}))}},q=function(e){var n=e.headers.get("x-total");if(a(n)){var r=parseInt(n);if(Number.isInteger(r))return r;throw new p("expected x-total header to be valid integer.")}throw new p("expected x-total header to exist.")},v=function(){return function(e){var n=e.response;return y()({response:n}).then((function(e){return{results:e,total:q(n)}}))}},R=function(e){return a(e)?{collections:e.join()}:{}},b=function(e){return s({per_page:e.perPage,order_by:e.orderBy,page:e.page})},w={handleRequest:g((function(e){var t=e.collectionId,a=e.orientation,o=r(e,["collectionId","orientation"]);return{pathname:"/collections/"+t+"/photos",query:s(n({},b(o),{orientation:a}))}})),handleResponse:v()},k={handleRequest:g((function(e){return{pathname:"/collections/"+e.collectionId,query:{}}})),handleResponse:y()},S={handleRequest:g((function(e){return void 0===e&&(e={}),{pathname:"/collections",query:b(e)}})),handleResponse:v()},x={handleRequest:g((function(e){return{pathname:"/collections/"+e.collectionId+"/related",query:{}}})),handleResponse:y()},I={handleRequest:g((function(e){return void 0===e&&(e={}),{pathname:"/photos",query:s(b(e))}})),handleResponse:v()},P={handleRequest:g((function(e){return{pathname:"/photos/"+e.photoId,query:{}}})),handleResponse:y()},j={handleRequest:g((function(e){return{pathname:"/photos/"+e.photoId+"/statistics",query:{}}})),handleResponse:y()},A={handleRequest:g((function(e){var t=void 0===e?{}:e,a=t.collectionIds,o=r(t,["collectionIds"]);return{pathname:"/photos/random",query:s(n({},o,R(a))),headers:{"cache-control":"no-cache"}}})),handleResponse:y()},O={handleRequest:g((function(e){var n=function(e){var n=new URL(e),r=n.pathname,t={};return n.searchParams.forEach((function(e,n){t[n]=e})),{query:t,pathname:"/"===r?void 0:r}}(e.downloadLocation),r=n.pathname,t=n.query;if(!a(r))throw new Error("Could not parse pathname from url.");return{pathname:r,query:s(t)}})),handleResponse:y()},L={handleRequest:g((function(e){var t=e.query,a=e.page,o=e.perPage,i=e.orderBy,u=e.collectionIds,l=e.lang,c=e.contentFilter,h=r(e,["query","page","perPage","orderBy","collectionIds","lang","contentFilter"]);return{pathname:"/search/photos",query:s(n({query:t,content_filter:c,lang:l,order_by:i},b({page:a,perPage:o}),R(u),h))}})),handleResponse:y()},T={handleRequest:g((function(e){var t=e.query,a=r(e,["query"]);return{pathname:"/search/collections",query:n({query:t},b(a))}})),handleResponse:y()},C={handleRequest:g((function(e){var t=e.query,a=r(e,["query"]);return{pathname:"/search/users",query:n({query:t},b(a))}})),handleResponse:y()},z={handleRequest:g((function(e){return{pathname:"/users/"+e.username,query:{}}})),handleResponse:y()},B={handleRequest:g((function(e){var t=e.username,a=e.stats,o=e.orientation,i=r(e,["username","stats","orientation"]);return{pathname:"/users/"+t+"/photos",query:s(n({},b(i),{orientation:o,stats:a}))}})),handleResponse:v()},M={handleRequest:g((function(e){var t=e.username,a=e.orientation,o=r(e,["username","orientation"]);return{pathname:"/users/"+t+"/likes",query:s(n({},b(o),{orientation:a}))}})),handleResponse:v()},U={handleRequest:g((function(e){var n=e.username,t=r(e,["username"]);return{pathname:"/users/"+n+"/collections",query:b(t)}})),handleResponse:v()};(u=exports.Language||(exports.Language={})).Afrikaans="af",u.Amharic="am",u.Arabic="ar",u.Azerbaijani="az",u.Belarusian="be",u.Bulgarian="bg",u.Bengali="bn",u.Bosnian="bs",u.Catalan="ca",u.Cebuano="ceb",u.Corsican="co",u.Czech="cs",u.Welsh="cy",u.Danish="da",u.German="de",u.Greek="el",u.English="en",u.Esperanto="eo",u.Spanish="es",u.Estonian="et",u.Basque="eu",u.Persian="fa",u.Finnish="fi",u.French="fr",u.Frisian="fy",u.Irish="ga",u.ScotsGaelic="gd",u.Galician="gl",u.Gujarati="gu",u.Hausa="ha",u.Hawaiian="haw",u.Hindi="hi",u.Hmong="hmn",u.Croatian="hr",u.HaitianCreole="ht",u.Hungarian="hu",u.Armenian="hy",u.Indonesian="id",u.Igbo="ig",u.Icelandic="is",u.Italian="it",u.Hebrew="iw",u.Japanese="ja",u.Javanese="jw",u.Georgian="ka",u.Kazakh="kk",u.Khmer="km",u.Kannada="kn",u.Korean="ko",u.Kurdish="ku",u.Kyrgyz="ky",u.Latin="la",u.Luxembourgish="lb",u.Lao="lo",u.Lithuanian="lt",u.Latvian="lv",u.Malagasy="mg",u.Maori="mi",u.Macedonian="mk",u.Malayalam="ml",u.Mongolian="mn",u.Marathi="mr",u.Malay="ms",u.Maltese="mt",u.Myanmar="my",u.Nepali="ne",u.Dutch="nl",u.Norwegian="no",u.Nyanja="ny",u.Oriya="or",u.Punjabi="pa",u.Polish="pl",u.Pashto="ps",u.Portuguese="pt",u.Romanian="ro",u.Russian="ru",u.Kinyarwanda="rw",u.Sindhi="sd",u.Sinhala="si",u.Slovak="sk",u.Slovenian="sl",u.Samoan="sm",u.Shona="sn",u.Somali="so",u.Albanian="sq",u.Serbian="sr",u.Sesotho="st",u.Sundanese="su",u.Swedish="sv",u.Swahili="sw",u.Tamil="ta",u.Telugu="te",u.Tajik="tg",u.Thai="th",u.Turkmen="tk",u.Filipino="tl",u.Turkish="tr",u.Tatar="tt",u.Uighur="ug",u.Ukrainian="uk",u.Urdu="ur",u.Uzbek="uz",u.Vietnamese="vi",u.Xhosa="xh",u.Yiddish="yi",u.Yoruba="yo",u.ChineseSimplified="zh",u.ChineseTraditional="zh-TW",u.Zulu="zu",(l=exports.OrderBy||(exports.OrderBy={})).LATEST="latest",l.POPULAR="popular",l.OLDEST="oldest",exports.createApi=i(m,(function(e){return{photos:{get:e(P),list:e(I),getStats:e(j),getRandom:e(A),trackDownload:e(O)},users:{getPhotos:e(B),getCollections:e(U),getLikes:e(M),get:e(z)},search:{getCollections:e(T),getPhotos:e(L),getUsers:e(C)},collections:{getPhotos:e(w),get:e(k),list:e(S),getRelated:e(x)}}})); | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("content-type");function n(){return(n=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e}).apply(this,arguments)}function t(e,n){if(null==e)return{};var t,r,a={},o=Object.keys(e);for(r=0;r<o.length;r++)n.indexOf(t=o[r])>=0||(a[t]=e[t]);return a}var r=o((function(e){return"string"==typeof e?e:null})),a=function(e){return null!=e};function o(e){return function(n){return a(e(n))}}var s=function(e){return Object.keys(e).reduce((function(t,r){var o,s=e[r];return n({},t,a(s)?((o={})[r]=s,o):{})}),{})};function i(){for(var e=arguments.length,n=new Array(e),t=0;t<e;t++)n[t]=arguments[t];var r=n.length-1;return function(){for(var e=arguments.length,t=new Array(e),a=0;a<e;a++)t[a]=arguments[a];for(var o=n[0].apply(this,t),s=1;s<=r;s++)o=n[s].call(this,o);return o}}var u,l,c=o((function(e){return a(e)&&"object"==typeof e&&!Array.isArray(e)?e:null})),h=o((function(e){return Array.isArray(e)&&e.every(r)&&e.length>0?e:null})),p=o((function(e){return c(e)&&"errors"in e&&h(e.errors)?{errors:e.errors}:null})),d=function(e){this.message=e},f=function(n){if(function(n){var t=n.headers.get("content-type");return a(t)&&"application/json"===e.parse(t).type}(n))return n.json().catch((function(e){throw new d("unable to parse JSON response.")}));throw new d("expected JSON response from server.")},g=function(){return function(e){return f(e.response)}},y=function(e){return function(r,a){void 0===a&&(a={});var o=e(r),s=o.headers,i=o.query;return n({},t(o,["headers","query"]),a,{query:i,headers:n({},s,a.headers)})}},m=function(e){var r=e.accessKey,o=e.apiVersion,s=void 0===o?"v1":o,u=e.apiUrl,l=void 0===u?"https://api.unsplash.com":u,c=e.headers,h=e.fetch,g=t(e,["accessKey","apiVersion","apiUrl","headers","fetch"]);return function(e){var t=e.handleResponse;return i(e.handleRequest,(function(e){var o=e.method,i=void 0===o?"GET":o,u=e.headers,y=e.body,m=e.signal,v=function(e){var n=e.pathname,t=e.query;return function(e){var r=new URL(n,e);return function(e){return function(n){Object.keys(e).forEach((function(t){return n.searchParams.set(t,e[t].toString())}))}}(t)(r),r.toString()}}({pathname:e.pathname,query:e.query})(l),q=n({method:i,headers:n({},c,u,{"Accept-Version":s},a(r)?{Authorization:"Client-ID "+r}:{}),body:y,signal:m},g);return(null!=h?h:fetch)(v,q).then(function(e){return function(t){return(t.ok?e({response:t}).then((function(e){return{type:"success",status:t.status,response:e}})):f(t).then((function(e){return n({type:"error",status:t.status},function(e){return p(e)?{errors:e.errors,source:"api"}:{errors:["Responded with a status code outside the 2xx range, and the response body is not recognisable."],source:"decoding"}}(e))}))).catch((function(e){if(e instanceof d)return{type:"error",source:"decoding",status:t.status,errors:[e.message]};throw e}))}}(t))}))}},v=function(e){var n=e.headers.get("x-total");if(a(n)){var t=parseInt(n);if(Number.isInteger(t))return t;throw new d("expected x-total header to be valid integer.")}throw new d("expected x-total header to exist.")},q=function(){return function(e){var n=e.response;return g()({response:n}).then((function(e){return{results:e,total:v(n)}}))}},R=function(e){return a(e)?{collections:e.join()}:{}},w=function(e){return s({per_page:e.perPage,order_by:e.orderBy,page:e.page})},b={handleRequest:y((function(e){var r=e.collectionId,a=e.orientation,o=t(e,["collectionId","orientation"]);return{pathname:"/collections/"+r+"/photos",query:s(n({},w(o),{orientation:a}))}})),handleResponse:q()},k={handleRequest:y((function(e){return{pathname:"/collections/"+e.collectionId,query:{}}})),handleResponse:g()},_={handleRequest:y((function(e){return void 0===e&&(e={}),{pathname:"/collections",query:w(e)}})),handleResponse:q()},P={handleRequest:y((function(e){return{pathname:"/collections/"+e.collectionId+"/related",query:{}}})),handleResponse:g()},S={__proto__:null,getPhotos:b,get:k,list:_,getRelated:P},I={handleRequest:y((function(e){return void 0===e&&(e={}),{pathname:"/photos",query:s(w(e))}})),handleResponse:q()},x={handleRequest:y((function(e){return{pathname:"/photos/"+e.photoId,query:{}}})),handleResponse:g()},A={handleRequest:y((function(e){return{pathname:"/photos/"+e.photoId+"/statistics",query:{}}})),handleResponse:g()},j={handleRequest:y((function(e){var r=void 0===e?{}:e,a=r.collectionIds,o=t(r,["collectionIds"]);return{pathname:"/photos/random",query:s(n({},o,R(a))),headers:{"cache-control":"no-cache"}}})),handleResponse:g()},L={handleRequest:y((function(e){var n=function(e){var n=new URL(e),t=n.pathname,r={};return n.searchParams.forEach((function(e,n){r[n]=e})),{query:r,pathname:"/"===t?void 0:t}}(e.downloadLocation),t=n.pathname,r=n.query;if(!a(t))throw new Error("Could not parse pathname from url.");return{pathname:t,query:s(r)}})),handleResponse:g()},O={__proto__:null,list:I,get:x,getStats:A,getRandom:j,trackDownload:L},C={handleRequest:y((function(e){var r=e.query,a=e.page,o=e.perPage,i=e.orderBy,u=e.collectionIds,l=e.lang,c=e.contentFilter,h=t(e,["query","page","perPage","orderBy","collectionIds","lang","contentFilter"]);return{pathname:"/search/photos",query:s(n({query:r,content_filter:c,lang:l,order_by:i},w({page:a,perPage:o}),R(u),h))}})),handleResponse:g()},T={handleRequest:y((function(e){var r=e.query,a=t(e,["query"]);return{pathname:"/search/collections",query:n({query:r},w(a))}})),handleResponse:g()},z={handleRequest:y((function(e){var r=e.query,a=t(e,["query"]);return{pathname:"/search/users",query:n({query:r},w(a))}})),handleResponse:g()},U={__proto__:null,getPhotos:C,getCollections:T,getUsers:z},B={handleRequest:y((function(e){return{pathname:"/users/"+e.username,query:{}}})),handleResponse:g()},E={handleRequest:y((function(e){var r=e.username,a=e.stats,o=e.orientation,i=t(e,["username","stats","orientation"]);return{pathname:"/users/"+r+"/photos",query:s(n({},w(i),{orientation:o,stats:a}))}})),handleResponse:q()},M={handleRequest:y((function(e){var r=e.username,a=e.orientation,o=t(e,["username","orientation"]);return{pathname:"/users/"+r+"/likes",query:s(n({},w(o),{orientation:a}))}})),handleResponse:q()},K={handleRequest:y((function(e){var n=e.username,r=t(e,["username"]);return{pathname:"/users/"+n+"/collections",query:w(r)}})),handleResponse:q()},H={__proto__:null,collections:S,photos:O,search:U,users:{__proto__:null,get:B,getPhotos:E,getLikes:M,getCollections:K},trackNonHotLinkedPhotoView:function(e){var n=e.appId;return function(e){var t=e.photoId,r=Array.isArray(t)?t:[t];if(r.length>20)throw new Error("You cannot track more than 20 photos at once. Please try again with fewer photos.");return fetch("views.unsplash.com/v?photo_id="+r.join()+"&app_id="+n)}}};(u=exports.Language||(exports.Language={})).Afrikaans="af",u.Amharic="am",u.Arabic="ar",u.Azerbaijani="az",u.Belarusian="be",u.Bulgarian="bg",u.Bengali="bn",u.Bosnian="bs",u.Catalan="ca",u.Cebuano="ceb",u.Corsican="co",u.Czech="cs",u.Welsh="cy",u.Danish="da",u.German="de",u.Greek="el",u.English="en",u.Esperanto="eo",u.Spanish="es",u.Estonian="et",u.Basque="eu",u.Persian="fa",u.Finnish="fi",u.French="fr",u.Frisian="fy",u.Irish="ga",u.ScotsGaelic="gd",u.Galician="gl",u.Gujarati="gu",u.Hausa="ha",u.Hawaiian="haw",u.Hindi="hi",u.Hmong="hmn",u.Croatian="hr",u.HaitianCreole="ht",u.Hungarian="hu",u.Armenian="hy",u.Indonesian="id",u.Igbo="ig",u.Icelandic="is",u.Italian="it",u.Hebrew="iw",u.Japanese="ja",u.Javanese="jw",u.Georgian="ka",u.Kazakh="kk",u.Khmer="km",u.Kannada="kn",u.Korean="ko",u.Kurdish="ku",u.Kyrgyz="ky",u.Latin="la",u.Luxembourgish="lb",u.Lao="lo",u.Lithuanian="lt",u.Latvian="lv",u.Malagasy="mg",u.Maori="mi",u.Macedonian="mk",u.Malayalam="ml",u.Mongolian="mn",u.Marathi="mr",u.Malay="ms",u.Maltese="mt",u.Myanmar="my",u.Nepali="ne",u.Dutch="nl",u.Norwegian="no",u.Nyanja="ny",u.Oriya="or",u.Punjabi="pa",u.Polish="pl",u.Pashto="ps",u.Portuguese="pt",u.Romanian="ro",u.Russian="ru",u.Kinyarwanda="rw",u.Sindhi="sd",u.Sinhala="si",u.Slovak="sk",u.Slovenian="sl",u.Samoan="sm",u.Shona="sn",u.Somali="so",u.Albanian="sq",u.Serbian="sr",u.Sesotho="st",u.Sundanese="su",u.Swedish="sv",u.Swahili="sw",u.Tamil="ta",u.Telugu="te",u.Tajik="tg",u.Thai="th",u.Turkmen="tk",u.Filipino="tl",u.Turkish="tr",u.Tatar="tt",u.Uighur="ug",u.Ukrainian="uk",u.Urdu="ur",u.Uzbek="uz",u.Vietnamese="vi",u.Xhosa="xh",u.Yiddish="yi",u.Yoruba="yo",u.ChineseSimplified="zh",u.ChineseTraditional="zh-TW",u.Zulu="zu",(l=exports.OrderBy||(exports.OrderBy={})).LATEST="latest",l.POPULAR="popular",l.OLDEST="oldest";var G=i(m,(function(e){return{photos:{get:e(x),list:e(I),getStats:e(A),getRandom:e(j),trackDownload:e(L)},users:{getPhotos:e(E),getCollections:e(K),getLikes:e(M),get:e(B)},search:{getCollections:e(T),getPhotos:e(C),getUsers:e(z)},collections:{getPhotos:e(b),get:e(k),list:e(_),getRelated:e(P)}}}));exports._internals=H,exports.createApi=G; | ||
//# sourceMappingURL=unsplash-js.cjs.production.min.js.map |
@@ -373,2 +373,10 @@ import { parse } from 'content-type'; | ||
var index = { | ||
__proto__: null, | ||
getPhotos: getPhotos, | ||
get: get, | ||
list: list, | ||
getRelated: getRelated | ||
}; | ||
var PHOTOS_PATH_PREFIX = '/photos'; | ||
@@ -447,2 +455,11 @@ var list$1 = { | ||
var index$1 = { | ||
__proto__: null, | ||
list: list$1, | ||
get: get$1, | ||
getStats: getStats, | ||
getRandom: getRandom, | ||
trackDownload: trackDownload | ||
}; | ||
var SEARCH_PATH_PREFIX = "/search"; | ||
@@ -504,2 +521,9 @@ var getPhotos$1 = { | ||
var index$2 = { | ||
__proto__: null, | ||
getPhotos: getPhotos$1, | ||
getCollections: getCollections$1, | ||
getUsers: getUsers | ||
}; | ||
var USERS_PATH_PREFIX = '/users'; | ||
@@ -561,2 +585,35 @@ var get$2 = { | ||
var index$3 = { | ||
__proto__: null, | ||
get: get$2, | ||
getPhotos: getPhotos$2, | ||
getLikes: getLikes, | ||
getCollections: getCollections$2 | ||
}; | ||
var trackNonHotLinkedPhotoView = function trackNonHotLinkedPhotoView(_ref) { | ||
var appId = _ref.appId; | ||
return function (_ref2) { | ||
var photoId = _ref2.photoId; | ||
var ids = !Array.isArray(photoId) ? [photoId] : photoId; | ||
if (ids.length > 20) { | ||
throw new Error('You cannot track more than 20 photos at once. Please try again with fewer photos.'); | ||
} | ||
return fetch("views.unsplash.com/v?photo_id=" + ids.join() + "&app_id=" + appId); | ||
}; | ||
}; | ||
var internals = { | ||
__proto__: null, | ||
collections: index, | ||
photos: index$1, | ||
search: index$2, | ||
users: index$3, | ||
trackNonHotLinkedPhotoView: trackNonHotLinkedPhotoView | ||
}; | ||
var Language; | ||
@@ -713,3 +770,3 @@ | ||
export { Language, OrderBy, createApi }; | ||
export { Language, OrderBy, internals as _internals, createApi }; | ||
//# sourceMappingURL=unsplash-js.esm.js.map |
{ | ||
"name": "unsplash-js", | ||
"version": "7.0.0", | ||
"version": "7.0.1", | ||
"description": "Official JavaScript wrapper for the Unsplash API", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -7,8 +7,10 @@ # Unsplash | ||
Before using the Unsplash API, you need to [register as a developer](https://unsplash.com/developers) and read the [API Guidelines](https://help.unsplash.com/api-guidelines/unsplash-api-guidelines). | ||
Key Links: | ||
- Before using the Unsplash API, [register as a developer](https://unsplash.com/developers). | ||
- Before using the Unsplash API, read the [API Guidelines](https://help.unsplash.com/api-guidelines/unsplash-api-guidelines). Specifically, you _must_: | ||
- [hotlink images](https://help.unsplash.com/api-guidelines/more-on-each-guideline/guideline-hotlinking-images) | ||
- [attribute photographers](https://help.unsplash.com/api-guidelines/more-on-each-guideline/guideline-attribution) | ||
- [trigger a download when appropriate](https://help.unsplash.com/api-guidelines/more-on-each-guideline/guideline-triggering-a-download) | ||
- Once you create an application and have an access key, go try the [demo](https://stackblitz.com/edit/unsplash-js-example?file=index.tsx)! | ||
Once you have an access key, go [here](https://stackblitz.com/edit/unsplash-js-example?file=index.tsx) to try the demo! | ||
**Note:** Every application must abide by the [API Guidelines](https://help.unsplash.com/api-guidelines/unsplash-api-guidelines). Specifically, remember to [hotlink images](https://help.unsplash.com/api-guidelines/more-on-each-guideline/guideline-hotlinking-images), [attribute photographers](https://help.unsplash.com/api-guidelines/more-on-each-guideline/guideline-attribution), and [trigger a download when appropriate](https://help.unsplash.com/api-guidelines/more-on-each-guideline/guideline-triggering-a-download). | ||
## Documentation | ||
@@ -15,0 +17,0 @@ |
@@ -8,2 +8,4 @@ import { flow } from './helpers/fp'; | ||
import * as _internals from './internals'; | ||
export const createApi = flow(initMakeRequest, makeRequest => ({ | ||
@@ -38,1 +40,2 @@ photos: { | ||
export { OrderBy, Orientation } from './types/request'; | ||
export { _internals }; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
258076
47
2751
605
6