@mariolazzari/rijks
Advanced tools
Comparing version 0.0.3 to 0.0.5
import Rijks from "./Rijks"; | ||
import CollectionRequest from "./types/CollectionRequest"; | ||
import CollectionResponse from "./types/CollectionResponse"; | ||
export { Rijks, CollectionRequest, CollectionResponse }; | ||
import CollectionDetailsRequest from "./types/CollectionDetailsRequest"; | ||
import CollectionDetailsResponse from "./types/CollectionDetailsResponse"; | ||
import CollectionImageRequest from "./types/CollectionImageRequest"; | ||
import CollectionImageResponse from "./types/CollectionImageResponse"; | ||
export { Rijks, CollectionRequest, CollectionResponse, CollectionDetailsRequest, CollectionDetailsResponse, CollectionImageRequest, CollectionImageResponse, }; | ||
export default Rijks; |
@@ -443,12 +443,20 @@ 'use strict'; | ||
_proto.getCollectionDetails = /*#__PURE__*/function () { | ||
var _getCollectionDetails = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() { | ||
var _getCollectionDetails = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(params) { | ||
var objectNumber, _params$format, format, url; | ||
return _regeneratorRuntime().wrap(function _callee2$(_context2) { | ||
while (1) switch (_context2.prev = _context2.next) { | ||
case 0: | ||
objectNumber = params.objectNumber, _params$format = params.format, format = _params$format === void 0 ? "json" : _params$format; | ||
url = this.baseUrl + "/" + objectNumber + "?key=" + this.apiKey + "&format=" + format; | ||
_context2.next = 4; | ||
return fetchData(url); | ||
case 4: | ||
return _context2.abrupt("return", _context2.sent); | ||
case 5: | ||
case "end": | ||
return _context2.stop(); | ||
} | ||
}, _callee2); | ||
}, _callee2, this); | ||
})); | ||
function getCollectionDetails() { | ||
function getCollectionDetails(_x2) { | ||
return _getCollectionDetails.apply(this, arguments); | ||
@@ -476,3 +484,3 @@ } | ||
})); | ||
function getCollectionImage(_x2) { | ||
function getCollectionImage(_x3) { | ||
return _getCollectionImage.apply(this, arguments); | ||
@@ -479,0 +487,0 @@ } |
@@ -1,2 +0,2 @@ | ||
"use strict";function t(){t=function(){return e};var r,e={},n=Object.prototype,o=n.hasOwnProperty,i=Object.defineProperty||function(t,r,e){t[r]=e.value},a="function"==typeof Symbol?Symbol:{},c=a.iterator||"@@iterator",u=a.asyncIterator||"@@asyncIterator",s=a.toStringTag||"@@toStringTag";function f(t,r,e){return Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{f({},"")}catch(r){f=function(t,r,e){return t[r]=e}}function h(t,r,e,n){var o=Object.create((r&&r.prototype instanceof g?r:g).prototype),a=new T(n||[]);return i(o,"_invoke",{value:O(t,e,a)}),o}function l(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}e.wrap=h;var p="suspendedStart",v="executing",y="completed",d={};function g(){}function m(){}function w(){}var x={};f(x,c,(function(){return this}));var b=Object.getPrototypeOf,L=b&&b(b(G([])));L&&L!==n&&o.call(L,c)&&(x=L);var E=w.prototype=g.prototype=Object.create(x);function k(t){["next","throw","return"].forEach((function(r){f(t,r,(function(t){return this._invoke(r,t)}))}))}function j(t,r){function e(n,i,a,c){var u=l(t[n],t,i);if("throw"!==u.type){var s=u.arg,f=s.value;return f&&"object"==typeof f&&o.call(f,"__await")?r.resolve(f.__await).then((function(t){e("next",t,a,c)}),(function(t){e("throw",t,a,c)})):r.resolve(f).then((function(t){s.value=t,a(s)}),(function(t){return e("throw",t,a,c)}))}c(u.arg)}var n;i(this,"_invoke",{value:function(t,o){function i(){return new r((function(r,n){e(t,o,r,n)}))}return n=n?n.then(i,i):i()}})}function O(t,e,n){var o=p;return function(i,a){if(o===v)throw new Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:r,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=_(c,n);if(u){if(u===d)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=y,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=v;var s=l(t,e,n);if("normal"===s.type){if(o=n.done?y:"suspendedYield",s.arg===d)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=y,n.method="throw",n.arg=s.arg)}}}function _(t,e){var n=e.method,o=t.iterator[n];if(o===r)return e.delegate=null,"throw"===n&&t.iterator.return&&(e.method="return",e.arg=r,_(t,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),d;var i=l(o,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,d;var a=i.arg;return a?a.done?(e[t.resultName]=a.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=r),e.delegate=null,d):a:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,d)}function P(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function N(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function G(t){if(t||""===t){var e=t[c];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(o.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=r,e.done=!0,e};return i.next=i}}throw new TypeError(typeof t+" is not iterable")}return m.prototype=w,i(E,"constructor",{value:w,configurable:!0}),i(w,"constructor",{value:m,configurable:!0}),m.displayName=f(w,s,"GeneratorFunction"),e.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===m||"GeneratorFunction"===(r.displayName||r.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,w):(t.__proto__=w,f(t,s,"GeneratorFunction")),t.prototype=Object.create(E),t},e.awrap=function(t){return{__await:t}},k(j.prototype),f(j.prototype,u,(function(){return this})),e.AsyncIterator=j,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new j(h(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},k(E),f(E,s,"Generator"),f(E,c,(function(){return this})),f(E,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var r=Object(t),e=[];for(var n in r)e.push(n);return e.reverse(),function t(){for(;e.length;){var n=e.pop();if(n in r)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=G,T.prototype={constructor:T,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=r,this.done=!1,this.delegate=null,this.method="next",this.arg=r,this.tryEntries.forEach(N),!t)for(var e in this)"t"===e.charAt(0)&&o.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=r)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(n,o){return c.type="throw",c.arg=t,e.next=n,o&&(e.method="next",e.arg=r),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var u=o.call(a,"catchLoc"),s=o.call(a,"finallyLoc");if(u&&s){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(t,r){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=r&&r<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=r,i?(this.method="next",this.next=i.finallyLoc,d):this.complete(a)},complete:function(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),d},finish:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),N(e),d}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;N(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:G(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=r),d}},e}function r(t,r,e,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void e(t)}c.done?r(u):Promise.resolve(u).then(n,o)}function e(t){return function(){var e=this,n=arguments;return new Promise((function(o,i){var a=t.apply(e,n);function c(t){r(a,o,i,c,u,"next",t)}function u(t){r(a,o,i,c,u,"throw",t)}c(void 0)}))}}function n(t){return o.apply(this,arguments)}function o(){return(o=e(t().mark((function r(e){var n,o;return t().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n={success:!1,status:500,data:void 0,error:void 0},t.prev=1,t.next=4,fetch(e);case 4:if(n.status=(o=t.sent).status,!o.ok){t.next=13;break}return n.success=!0,t.next=10,o.json();case 10:n.data=t.sent,t.next=14;break;case 13:n.error=o.statusText;case 14:t.next=19;break;case 16:t.prev=16,t.t0=t.catch(1),n.error=t.t0 instanceof Error?t.t0.message:JSON.stringify(t.t0);case 19:return t.prev=19,t.abrupt("return",n);case 22:case"end":return t.stop()}}),r,null,[[1,16,19,22]])})))).apply(this,arguments)}Object.defineProperty(exports,"__esModule",{value:!0});var i=function(){function r(t,r){void 0===r&&(r="en"),this.apiKey="",this.baseUrl="https://www.rijksmuseum.nl/api/",this.apiKey=t,this.baseUrl+=r+"/collection"}var o=r.prototype;return o.getCollection=function(){var r=e(t().mark((function r(e){var o;return t().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=this.baseUrl+"?key="+this.apiKey,e.searchTerm&&(o+="&q="+e.searchTerm),e.involvedMaker&&(o+="&involvedMaker="+e.involvedMaker),e.imageOnly&&(o+="&imgonly="+e.imageOnly),e.page&&(o+="&p="+e.page),e.perPage&&(o+="&ps="+e.perPage),t.next=8,n(o);case 8:return t.abrupt("return",t.sent);case 9:case"end":return t.stop()}}),r,this)})));return function(t){return r.apply(this,arguments)}}(),o.getCollectionDetails=function(){var r=e(t().mark((function r(){return t().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:case"end":return t.stop()}}),r)})));return function(){return r.apply(this,arguments)}}(),o.getCollectionImage=function(){var r=e(t().mark((function r(e){var o;return t().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=this.baseUrl+"/"+e.objectNumber+"/tiles?key="+this.apiKey,t.next=4,n(o);case 4:return t.abrupt("return",t.sent);case 5:case"end":return t.stop()}}),r,this)})));return function(t){return r.apply(this,arguments)}}(),r}();exports.Rijks=i,exports.default=i; | ||
"use strict";function t(){t=function(){return e};var r,e={},n=Object.prototype,o=n.hasOwnProperty,i=Object.defineProperty||function(t,r,e){t[r]=e.value},a="function"==typeof Symbol?Symbol:{},c=a.iterator||"@@iterator",u=a.asyncIterator||"@@asyncIterator",s=a.toStringTag||"@@toStringTag";function f(t,r,e){return Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{f({},"")}catch(r){f=function(t,r,e){return t[r]=e}}function h(t,r,e,n){var o=Object.create((r&&r.prototype instanceof g?r:g).prototype),a=new T(n||[]);return i(o,"_invoke",{value:O(t,e,a)}),o}function l(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}e.wrap=h;var p="suspendedStart",v="executing",y="completed",d={};function g(){}function m(){}function w(){}var b={};f(b,c,(function(){return this}));var x=Object.getPrototypeOf,L=x&&x(x(G([])));L&&L!==n&&o.call(L,c)&&(b=L);var k=w.prototype=g.prototype=Object.create(b);function E(t){["next","throw","return"].forEach((function(r){f(t,r,(function(t){return this._invoke(r,t)}))}))}function j(t,r){function e(n,i,a,c){var u=l(t[n],t,i);if("throw"!==u.type){var s=u.arg,f=s.value;return f&&"object"==typeof f&&o.call(f,"__await")?r.resolve(f.__await).then((function(t){e("next",t,a,c)}),(function(t){e("throw",t,a,c)})):r.resolve(f).then((function(t){s.value=t,a(s)}),(function(t){return e("throw",t,a,c)}))}c(u.arg)}var n;i(this,"_invoke",{value:function(t,o){function i(){return new r((function(r,n){e(t,o,r,n)}))}return n=n?n.then(i,i):i()}})}function O(t,e,n){var o=p;return function(i,a){if(o===v)throw new Error("Generator is already running");if(o===y){if("throw"===i)throw a;return{value:r,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=_(c,n);if(u){if(u===d)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=y,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=v;var s=l(t,e,n);if("normal"===s.type){if(o=n.done?y:"suspendedYield",s.arg===d)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=y,n.method="throw",n.arg=s.arg)}}}function _(t,e){var n=e.method,o=t.iterator[n];if(o===r)return e.delegate=null,"throw"===n&&t.iterator.return&&(e.method="return",e.arg=r,_(t,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),d;var i=l(o,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,d;var a=i.arg;return a?a.done?(e[t.resultName]=a.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=r),e.delegate=null,d):a:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,d)}function P(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function N(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function T(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function G(t){if(t||""===t){var e=t[c];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function e(){for(;++n<t.length;)if(o.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=r,e.done=!0,e};return i.next=i}}throw new TypeError(typeof t+" is not iterable")}return m.prototype=w,i(k,"constructor",{value:w,configurable:!0}),i(w,"constructor",{value:m,configurable:!0}),m.displayName=f(w,s,"GeneratorFunction"),e.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===m||"GeneratorFunction"===(r.displayName||r.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,w):(t.__proto__=w,f(t,s,"GeneratorFunction")),t.prototype=Object.create(k),t},e.awrap=function(t){return{__await:t}},E(j.prototype),f(j.prototype,u,(function(){return this})),e.AsyncIterator=j,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new j(h(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},E(k),f(k,s,"Generator"),f(k,c,(function(){return this})),f(k,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var r=Object(t),e=[];for(var n in r)e.push(n);return e.reverse(),function t(){for(;e.length;){var n=e.pop();if(n in r)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=G,T.prototype={constructor:T,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=r,this.done=!1,this.delegate=null,this.method="next",this.arg=r,this.tryEntries.forEach(N),!t)for(var e in this)"t"===e.charAt(0)&&o.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=r)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function n(n,o){return c.type="throw",c.arg=t,e.next=n,o&&(e.method="next",e.arg=r),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var u=o.call(a,"catchLoc"),s=o.call(a,"finallyLoc");if(u&&s){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(t,r){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=r&&r<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=r,i?(this.method="next",this.next=i.finallyLoc,d):this.complete(a)},complete:function(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),d},finish:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),N(e),d}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;N(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:G(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=r),d}},e}function r(t,r,e,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void e(t)}c.done?r(u):Promise.resolve(u).then(n,o)}function e(t){return function(){var e=this,n=arguments;return new Promise((function(o,i){var a=t.apply(e,n);function c(t){r(a,o,i,c,u,"next",t)}function u(t){r(a,o,i,c,u,"throw",t)}c(void 0)}))}}function n(t){return o.apply(this,arguments)}function o(){return(o=e(t().mark((function r(e){var n,o;return t().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n={success:!1,status:500,data:void 0,error:void 0},t.prev=1,t.next=4,fetch(e);case 4:if(n.status=(o=t.sent).status,!o.ok){t.next=13;break}return n.success=!0,t.next=10,o.json();case 10:n.data=t.sent,t.next=14;break;case 13:n.error=o.statusText;case 14:t.next=19;break;case 16:t.prev=16,t.t0=t.catch(1),n.error=t.t0 instanceof Error?t.t0.message:JSON.stringify(t.t0);case 19:return t.prev=19,t.abrupt("return",n);case 22:case"end":return t.stop()}}),r,null,[[1,16,19,22]])})))).apply(this,arguments)}Object.defineProperty(exports,"__esModule",{value:!0});var i=function(){function r(t,r){void 0===r&&(r="en"),this.apiKey="",this.baseUrl="https://www.rijksmuseum.nl/api/",this.apiKey=t,this.baseUrl+=r+"/collection"}var o=r.prototype;return o.getCollection=function(){var r=e(t().mark((function r(e){var o;return t().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=this.baseUrl+"?key="+this.apiKey,e.searchTerm&&(o+="&q="+e.searchTerm),e.involvedMaker&&(o+="&involvedMaker="+e.involvedMaker),e.imageOnly&&(o+="&imgonly="+e.imageOnly),e.page&&(o+="&p="+e.page),e.perPage&&(o+="&ps="+e.perPage),t.next=8,n(o);case 8:return t.abrupt("return",t.sent);case 9:case"end":return t.stop()}}),r,this)})));return function(t){return r.apply(this,arguments)}}(),o.getCollectionDetails=function(){var r=e(t().mark((function r(e){var o,i;return t().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=this.baseUrl+"/"+e.objectNumber+"?key="+this.apiKey+"&format="+(void 0===(o=e.format)?"json":o),t.next=4,n(i);case 4:return t.abrupt("return",t.sent);case 5:case"end":return t.stop()}}),r,this)})));return function(t){return r.apply(this,arguments)}}(),o.getCollectionImage=function(){var r=e(t().mark((function r(e){var o;return t().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=this.baseUrl+"/"+e.objectNumber+"/tiles?key="+this.apiKey,t.next=4,n(o);case 4:return t.abrupt("return",t.sent);case 5:case"end":return t.stop()}}),r,this)})));return function(t){return r.apply(this,arguments)}}(),r}();exports.Rijks=i,exports.default=i; | ||
//# sourceMappingURL=rijks.cjs.production.min.js.map |
import Culture from "./types/Culture"; | ||
import CollectionRequest from "./types/CollectionRequest"; | ||
import CollectionResponse from "./types/CollectionResponse"; | ||
import CollectionDetailsRequest from "./types/CollectionDetailsRequest"; | ||
import CollectionDetailsResponse from "./types/CollectionDetailsResponse"; | ||
import CollectionImageRequest from "./types/CollectionImageRequest"; | ||
import CollectionImageResponse from "./types/CollectionImageResponse"; | ||
declare class Rijks { | ||
@@ -8,6 +12,6 @@ private apiKey; | ||
constructor(apiKey: string, culture?: Culture); | ||
getCollection(params: CollectionRequest): Promise<import("./types/Result").default<Readonly<import("./types/CollectionResponse").ICollectionResponse>>>; | ||
getCollectionDetails(): Promise<void>; | ||
getCollectionImage(params: CollectionImageRequest): Promise<import("./types/Result").default<Readonly<import("./types/CollectionImageResponse").ICollectionImageResponse>>>; | ||
getCollection(params: CollectionRequest): Promise<import("./types/Result").default<CollectionResponse>>; | ||
getCollectionDetails(params: CollectionDetailsRequest): Promise<import("./types/Result").default<CollectionDetailsResponse>>; | ||
getCollectionImage(params: CollectionImageRequest): Promise<import("./types/Result").default<CollectionImageResponse>>; | ||
} | ||
export default Rijks; |
@@ -439,12 +439,20 @@ function _regeneratorRuntime() { | ||
_proto.getCollectionDetails = /*#__PURE__*/function () { | ||
var _getCollectionDetails = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() { | ||
var _getCollectionDetails = /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(params) { | ||
var objectNumber, _params$format, format, url; | ||
return _regeneratorRuntime().wrap(function _callee2$(_context2) { | ||
while (1) switch (_context2.prev = _context2.next) { | ||
case 0: | ||
objectNumber = params.objectNumber, _params$format = params.format, format = _params$format === void 0 ? "json" : _params$format; | ||
url = this.baseUrl + "/" + objectNumber + "?key=" + this.apiKey + "&format=" + format; | ||
_context2.next = 4; | ||
return fetchData(url); | ||
case 4: | ||
return _context2.abrupt("return", _context2.sent); | ||
case 5: | ||
case "end": | ||
return _context2.stop(); | ||
} | ||
}, _callee2); | ||
}, _callee2, this); | ||
})); | ||
function getCollectionDetails() { | ||
function getCollectionDetails(_x2) { | ||
return _getCollectionDetails.apply(this, arguments); | ||
@@ -472,3 +480,3 @@ } | ||
})); | ||
function getCollectionImage(_x2) { | ||
function getCollectionImage(_x3) { | ||
return _getCollectionImage.apply(this, arguments); | ||
@@ -475,0 +483,0 @@ } |
import Link from "./Link"; | ||
import Image from "./Image"; | ||
declare type ArtObject = { | ||
interface ArtObject { | ||
links: Link; | ||
@@ -13,6 +13,6 @@ id: string; | ||
permitDownload: boolean; | ||
webImage: Image; | ||
headerImage: Image; | ||
webImage?: Image; | ||
headerImage?: Image; | ||
productionPlaces: string[]; | ||
}; | ||
} | ||
export default ArtObject; |
@@ -1,6 +0,4 @@ | ||
interface ICollectionImageRequest { | ||
declare type CollectionImageRequest = { | ||
objectNumber: string; | ||
} | ||
declare type CollectionImageRequest = Readonly<ICollectionImageRequest>; | ||
export { ICollectionImageRequest, CollectionImageRequest }; | ||
}; | ||
export default CollectionImageRequest; |
import Level from "./Level"; | ||
interface ICollectionImageResponse { | ||
declare type CollectionImageResponse = { | ||
levels: Level[]; | ||
} | ||
declare type CollectionImageResponse = Readonly<ICollectionImageResponse>; | ||
export { ICollectionImageResponse, CollectionImageResponse }; | ||
}; | ||
export default CollectionImageResponse; |
import Culture from "./Culture"; | ||
import Format from "./Format"; | ||
import Sort from "./Sort"; | ||
interface ICollectionRequest { | ||
key: string; | ||
format: Format; | ||
culture: Culture; | ||
declare type CollectionRequest = { | ||
searchTerm: string; | ||
page: number; | ||
perPage: number; | ||
searchTerm: string; | ||
involvedMaker: string; | ||
type: string; | ||
material: string; | ||
technique: string; | ||
period: string; | ||
hex: string; | ||
imageOnly: boolean; | ||
topPieces: boolean; | ||
sort: Sort; | ||
} | ||
declare type CollectionRequest = Partial<ICollectionRequest>; | ||
export { ICollectionRequest, CollectionRequest }; | ||
format?: Format; | ||
culture?: Culture; | ||
involvedMaker?: string; | ||
type?: string; | ||
material?: string; | ||
technique?: string; | ||
period?: string; | ||
hex?: string; | ||
imageOnly?: boolean; | ||
topPieces?: boolean; | ||
sort?: Sort; | ||
}; | ||
export default CollectionRequest; |
import ArtObject from "./ArtObject"; | ||
interface ICollectionResponse { | ||
import CountFacets from "./CountFacets"; | ||
declare type CollectionResponse = { | ||
elapsedMilliseconds: number; | ||
count: number; | ||
countFacets: CountFacets; | ||
artObjects: ArtObject[]; | ||
} | ||
declare type CollectionResponse = Readonly<ICollectionResponse>; | ||
export { ICollectionResponse, CollectionResponse }; | ||
}; | ||
export default CollectionResponse; |
declare type Link = { | ||
self: string; | ||
web: string; | ||
self?: string; | ||
web?: string; | ||
search?: string; | ||
}; | ||
export default Link; |
{ | ||
"version": "0.0.3", | ||
"version": "0.0.5", | ||
"license": "MIT", | ||
@@ -19,4 +19,3 @@ "main": "dist/index.js", | ||
"prepare": "tsdx build", | ||
"size": "size-limit", | ||
"analyze": "size-limit --why" | ||
"size": "size-limit" | ||
}, | ||
@@ -23,0 +22,0 @@ "name": "@mariolazzari/rijks", |
@@ -1,2 +0,2 @@ | ||
# TSDX User Guide | ||
# Rijks Museum REST APIs client | ||
@@ -3,0 +3,0 @@ Congrats! You just saved yourself hours of work by bootstrapping this project with TSDX. Let’s get you oriented with what’s here and how to use it. |
@@ -5,4 +5,16 @@ // https://data.rijksmuseum.nl/object-metadata/api/ | ||
import CollectionResponse from "./types/CollectionResponse"; | ||
import CollectionDetailsRequest from "./types/CollectionDetailsRequest"; | ||
import CollectionDetailsResponse from "./types/CollectionDetailsResponse"; | ||
import CollectionImageRequest from "./types/CollectionImageRequest"; | ||
import CollectionImageResponse from "./types/CollectionImageResponse"; | ||
export { Rijks, CollectionRequest, CollectionResponse }; | ||
export { | ||
Rijks, | ||
CollectionRequest, | ||
CollectionResponse, | ||
CollectionDetailsRequest, | ||
CollectionDetailsResponse, | ||
CollectionImageRequest, | ||
CollectionImageResponse, | ||
}; | ||
export default Rijks; |
@@ -5,2 +5,4 @@ import Culture from "./types/Culture"; | ||
import CollectionResponse from "./types/CollectionResponse"; | ||
import CollectionDetailsRequest from "./types/CollectionDetailsRequest"; | ||
import CollectionDetailsResponse from "./types/CollectionDetailsResponse"; | ||
import CollectionImageRequest from "./types/CollectionImageRequest"; | ||
@@ -15,3 +17,3 @@ import CollectionImageResponse from "./types/CollectionImageResponse"; | ||
this.apiKey = apiKey; | ||
this.baseUrl += culture + "/collection"; | ||
this.baseUrl += `${culture}/collection`; | ||
} | ||
@@ -41,4 +43,9 @@ | ||
public async getCollectionDetails() {} | ||
public async getCollectionDetails(params: CollectionDetailsRequest) { | ||
const { objectNumber, format = "json" } = params; | ||
const url = `${this.baseUrl}/${objectNumber}?key=${this.apiKey}&format=${format}`; | ||
return await fetchData<CollectionDetailsResponse>(url); | ||
} | ||
public async getCollectionImage(params: CollectionImageRequest) { | ||
@@ -45,0 +52,0 @@ const { objectNumber } = params; |
import Link from "./Link"; | ||
import Image from "./Image"; | ||
type ArtObject = { | ||
interface ArtObject { | ||
links: Link; | ||
@@ -14,7 +14,7 @@ id: string; | ||
permitDownload: boolean; | ||
webImage: Image; | ||
headerImage: Image; | ||
webImage?: Image; | ||
headerImage?: Image; | ||
productionPlaces: string[]; | ||
}; | ||
} | ||
export default ArtObject; |
@@ -1,8 +0,5 @@ | ||
interface ICollectionImageRequest { | ||
type CollectionImageRequest = { | ||
objectNumber: string; | ||
} | ||
}; | ||
type CollectionImageRequest = Readonly<ICollectionImageRequest>; | ||
export { ICollectionImageRequest, CollectionImageRequest }; | ||
export default CollectionImageRequest; |
import Level from "./Level"; | ||
interface ICollectionImageResponse { | ||
type CollectionImageResponse = { | ||
levels: Level[]; | ||
} | ||
}; | ||
type CollectionImageResponse = Readonly<ICollectionImageResponse>; | ||
export { ICollectionImageResponse, CollectionImageResponse }; | ||
export default CollectionImageResponse; |
@@ -5,23 +5,19 @@ import Culture from "./Culture"; | ||
interface ICollectionRequest { | ||
key: string; | ||
format: Format; | ||
culture: Culture; | ||
type CollectionRequest = { | ||
searchTerm: string; | ||
page: number; | ||
perPage: number; | ||
searchTerm: string; | ||
involvedMaker: string; | ||
type: string; | ||
material: string; | ||
technique: string; | ||
period: string; | ||
hex: string; | ||
imageOnly: boolean; | ||
topPieces: boolean; | ||
sort: Sort; | ||
} | ||
format?: Format; | ||
culture?: Culture; | ||
involvedMaker?: string; | ||
type?: string; | ||
material?: string; | ||
technique?: string; | ||
period?: string; | ||
hex?: string; | ||
imageOnly?: boolean; | ||
topPieces?: boolean; | ||
sort?: Sort; | ||
}; | ||
type CollectionRequest = Partial<ICollectionRequest>; | ||
export { ICollectionRequest, CollectionRequest }; | ||
export default CollectionRequest; |
import ArtObject from "./ArtObject"; | ||
import CountFacets from "./CountFacets"; | ||
interface ICollectionResponse { | ||
type CollectionResponse = { | ||
elapsedMilliseconds: number; | ||
count: number; | ||
countFacets: CountFacets; | ||
artObjects: ArtObject[]; | ||
} | ||
}; | ||
type CollectionResponse = Readonly<ICollectionResponse>; | ||
export { ICollectionResponse, CollectionResponse }; | ||
export default CollectionResponse; |
type Link = { | ||
self: string; | ||
web: string; | ||
self?: string; | ||
web?: string; | ||
search?: string; | ||
}; | ||
export default Link; |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
82286
54
1438
3