node-fred
Version:
Another nodejs wrapper for the st louis fed
2 lines • 26.7 kB
JavaScript
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("axios")):"function"==typeof define&&define.amd?define("node-fred",["axios"],t):"object"==typeof exports?exports["node-fred"]=t(require("axios")):e["node-fred"]=t(e.axios)}(global,(e=>(()=>{var t={300:t=>{"use strict";t.exports=e},115:e=>{e.exports=function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e},e.exports.__esModule=!0,e.exports.default=e.exports},690:e=>{e.exports=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")},e.exports.__esModule=!0,e.exports.default=e.exports},728:(e,t,r)=>{var n=r(62);function a(e,t){for(var r=0;r<t.length;r++){var a=t[r];a.enumerable=a.enumerable||!1,a.configurable=!0,"value"in a&&(a.writable=!0),Object.defineProperty(e,n(a.key),a)}}e.exports=function(e,t,r){return t&&a(e.prototype,t),r&&a(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e},e.exports.__esModule=!0,e.exports.default=e.exports},808:e=>{function t(r){return e.exports=t=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},e.exports.__esModule=!0,e.exports.default=e.exports,t(r)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},655:(e,t,r)=>{var n=r(15);e.exports=function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&n(e,t)},e.exports.__esModule=!0,e.exports.default=e.exports},993:(e,t,r)=>{var n=r(698).default,a=r(115);e.exports=function(e,t){if(t&&("object"===n(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return a(e)},e.exports.__esModule=!0,e.exports.default=e.exports},15:e=>{function t(r,n){return e.exports=t=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},e.exports.__esModule=!0,e.exports.default=e.exports,t(r,n)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports},36:(e,t,r)=>{var n=r(698).default;e.exports=function(e,t){if("object"!==n(e)||null===e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var a=r.call(e,t||"default");if("object"!==n(a))return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)},e.exports.__esModule=!0,e.exports.default=e.exports},62:(e,t,r)=>{var n=r(698).default,a=r(36);e.exports=function(e){var t=a(e,"string");return"symbol"===n(t)?t:String(t)},e.exports.__esModule=!0,e.exports.default=e.exports},698:e=>{function t(r){return e.exports=t="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.__esModule=!0,e.exports.default=e.exports,t(r)}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports}},r={};function n(e){var a=r[e];if(void 0!==a)return a.exports;var s=r[e]={exports:{}};return t[e](s,s.exports,n),s.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var a={};return(()=>{"use strict";n.d(a,{default:()=>x});var e=n(728),t=n.n(e),r=n(690),s=n.n(r),i=n(300);const o=n.n(i)().create({baseURL:"https://api.stlouisfed.org/fred/",timeout:5e3,headers:{}});var c=n(655),u=n.n(c),l=n(993),f=n.n(l),d=n(808),h=n.n(d);const y=function(){function e(){s()(this,e),this.url=""}return t()(e,[{key:"addAttribute",value:function(e){return this.url+=(""===this.url?"":"&")+e,this}},{key:"setAPIKey",value:function(e){return this.addAttribute("api_key=".concat(e))}},{key:"setFileType",value:function(e){return this.addAttribute("file_type=".concat(e))}},{key:"isValidDate",value:function(e){return null!=e.match(/^\d{4}-\d{2}-\d{2}$/)}},{key:"setRealTimeStart",value:function(e){var t=e.realtime_start;if(!t)return this;if(!this.isValidDate(t))throw new Error("The format of this date is not valid. Please format the date like this: YYYY-MM-DD");return this.addAttribute("realtime_start=".concat(t))}},{key:"setRealTimeEnd",value:function(e){var t=e.realtime_end;if(!t)return this;if(!this.isValidDate(t))throw new Error("The format of this date is not valid. Please format the date like this: YYYY-MM-DD");return this.addAttribute("realtime_end=".concat(t))}},{key:"setLimit",value:function(e){var t=parseInt(e.limit,10);if(!t)return this;if(t<0||t>1e3)throw new Error("Limit must be between 0 and 1000");return this.addAttribute("limit=".concat(t))}},{key:"setOffset",value:function(e){var t=parseInt(e.offset,10);if(!t)return this;if(t<0)throw new Error("Offset must be greater than 0");return this.addAttribute("offset=".concat(t))}},{key:"setOrderBy",value:function(e){var t=e.order_by;return t?this.addAttribute("order_by=".concat(t)):this}},{key:"setSortOrder",value:function(e){var t=e.sort_order;if(!t)return this;if("asc"!==(t=t.toLowerCase())&&"desc"!==t)throw new Error("Sort order can only be either asc or desc");return this.addAttribute("sort_order=".concat(t))}},{key:"setFilterVariable",value:function(e){var t=e.filter_variable;return t?this.addAttribute("filter_variable=".concat(t)):this}},{key:"setFilterValue",value:function(e){var t=e.filter_value;return t?this.addAttribute("filter_value=".concat(t)):this}},{key:"setTagNames",value:function(e){if("string"==typeof e)return this.addAttribute("tag_names=".concat(e));var t=e.tag_names;return t?this.addAttribute("tag_names=".concat(t)):this}},{key:"setExcludeTagNames",value:function(e){var t=e.exclude_tag_names;return t?this.addAttribute("exclude_tag_names=".concat(t)):this}},{key:"setSearchText",value:function(e){var t=e.search_text;return t?this.addAttribute("search_text=".concat(t)):this}},{key:"setTagGroupId",value:function(e){var t=e.tag_group_id;return t?this.addAttribute("tag_group_id=".concat(t)):this}},{key:"getUrl",value:function(){return this.url}}]),e}();const p=function(e){u()(i,e);var r,n,a=(r=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=h()(r);if(n){var a=h()(this).constructor;e=Reflect.construct(t,arguments,a)}else e=t.apply(this,arguments);return f()(this,e)});function i(){return s()(this,i),a.apply(this,arguments)}return t()(i,[{key:"setSeriesId",value:function(e){return this.addAttribute("series_id=".concat(e))}},{key:"setObservationStart",value:function(e){var t=e.observation_start;if(!t)return this;if(!this.isValidDate(t))throw new Error("The format of this date is not valid. Please format the date like this: YYYY-MM-DD");return this.addAttribute("observation_start=".concat(t))}},{key:"setObservationEnd",value:function(e){var t=e.observation_end;if(!t)return this;if(!this.isValidDate(t))throw new Error("The format of this date is not valid. Please format the date like this: YYYY-MM-DD");return this.addAttribute("observation_end=".concat(t))}},{key:"setUnits",value:function(e){var t=e.units;return t&&""!==t?this.addAttribute("units=".concat(t)):this}},{key:"setFrequency",value:function(e){var t=e.frequency;return t?this.addAttribute("frequency=".concat(t)):this}},{key:"setAggregationMethod",value:function(e){var t=e.aggregation_method;return t?this.addAttribute("aggregation_method=".concat(t)):this}},{key:"setOutputType",value:function(e){var t=e.output_type;return t?this.addAttribute("output_type=".concat(t)):this}},{key:"setVintageDate",value:function(e){var t=e.vintage_dates;return t?this.addAttribute("vintage_dates=".concat(t)):this}},{key:"setSearchType",value:function(e){var t=e.search_type;return t?this.addAttribute("search_type=".concat(t)):this}},{key:"setSearchText",value:function(e){return e?this.addAttribute("search_text=".concat(e)):this}},{key:"setSeriesSearchText",value:function(e){return this.addAttribute("series_search_text=".concat(e))}},{key:"setTagSearchText",value:function(e){var t=e.tag_search_text;return t?this.addAttribute("tag_search_text=".concat(t)):this}}]),i}(y),v=function(){function e(t,r){s()(this,e),this.apiKey=t,this.returnType=r}return t()(e,[{key:"getSeries",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise((function(n,a){try{var s=(new p).setAPIKey(t.apiKey).setFileType(t.returnType).setSeriesId(e).setRealTimeStart(r).setRealTimeEnd(r).getUrl();o.get("series?".concat(s)).then((function(e){n(e.data)})).catch((function(e){a(e.response.data)}))}catch(e){a(e)}}))}},{key:"getCategoriesForSeries",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise((function(n,a){try{var s=(new p).setAPIKey(t.apiKey).setFileType(t.returnType).setSeriesId(e).setRealTimeStart(r).setRealTimeEnd(r).getUrl();o.get("series/categories?".concat(s)).then((function(e){n(e.data)})).catch((function(e){a(e.response.data)}))}catch(e){a(e)}}))}},{key:"getObservationsForSeries",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise((function(n,a){try{var s=(new p).setAPIKey(t.apiKey).setFileType(t.returnType).setSeriesId(e).setRealTimeStart(r).setRealTimeEnd(r).setLimit(r).setOffset(r).setSortOrder(r).setObservationStart(r).setObservationEnd(r).setUnits(r).setFrequency(r).setAggregationMethod(r).setOutputType(r).setVintageDate(r).getUrl();o.get("series/observations?".concat(s)).then((function(e){n(e.data)})).catch((function(e){a(e.response.data)}))}catch(e){a(e)}}))}},{key:"getReleaseForSeries",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise((function(n,a){try{var s=(new p).setAPIKey(t.apiKey).setFileType(t.returnType).setSeriesId(e).setRealTimeStart(r).setRealTimeEnd(r).getUrl();o.get("series/release?".concat(s)).then((function(e){n(e.data)})).catch((function(e){a(e.response.data)}))}catch(e){a(e)}}))}},{key:"getSeriesThatMatchesSearch",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise((function(n,a){try{var s=(new p).setAPIKey(t.apiKey).setFileType(t.returnType).setSearchText(e).setRealTimeStart(r).setRealTimeEnd(r).setLimit(r).setOffset(r).setOrderBy(r).setSortOrder(r).setFilterVariable(r).setFilterValue(r).setTagNames(r).setExcludeTagNames(r).setSearchType(r).getUrl();o.get("series/search?".concat(s)).then((function(e){n(e.data)})).catch((function(e){a(e.response.data)}))}catch(e){a(e)}}))}},{key:"getTagsForSeriesSearch",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise((function(n,a){try{var s=(new p).setAPIKey(t.apiKey).setFileType(t.returnType).setRealTimeStart(r).setRealTimeEnd(r).setLimit(r).setOffset(r).setOrderBy(r).setSortOrder(r).setTagNames(r).setTagGroupId(r).setTagSearchText(r).setSeriesSearchText(e).getUrl();o.get("series/search/tags?".concat(s)).then((function(e){n(e.data)})).catch((function(e){a(e.response.data)}))}catch(e){a(e)}}))}},{key:"getRelatedTagsForSeriesSearch",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise((function(n,a){try{var s=(new p).setAPIKey(t.apiKey).setFileType(t.returnType).setRealTimeStart(r).setRealTimeEnd(r).setLimit(r).setOffset(r).setOrderBy(r).setSortOrder(r).setTagNames(r).setExcludeTagNames(r).setTagGroupId(r).setTagSearchText(r).setSeriesSearchText(e).getUrl();o.get("series/search/related_tags?".concat(s)).then((function(e){n(e.data)})).catch((function(e){a(e.response.data)}))}catch(e){a(e)}}))}},{key:"getTagsForSeries",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise((function(n,a){try{var s=(new p).setAPIKey(t.apiKey).setFileType(t.returnType).setSeriesId(e).setRealTimeStart(r).setRealTimeEnd(r).setOrderBy(r).setSortOrder(r).getUrl();o.get("series/tags?".concat(s)).then((function(e){n(e.data)})).catch((function(e){a(e.response.data)}))}catch(e){a(e)}}))}},{key:"getUpdatedSeries",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new Promise((function(r,n){try{var a=(new p).setAPIKey(e.apiKey).setFileType(e.returnType).setRealTimeStart(t).setRealTimeEnd(t).setLimit(t).setOffset(t).setFilterValue(t).getUrl();o.get("series/updates?".concat(a)).then((function(e){r(e.data)})).catch((function(e){n(e.response.data)}))}catch(e){n(e)}}))}},{key:"getVintageDatesSeries",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise((function(n,a){try{var s=(new p).setAPIKey(t.apiKey).setFileType(t.returnType).setSeriesId(e).setRealTimeStart(r).setRealTimeEnd(r).setLimit(r).setOffset(r).setSortOrder(r).getUrl();o.get("series/vintagedates?".concat(s)).then((function(e){n(e.data)})).catch((function(e){a(e.response.data)}))}catch(e){a(e)}}))}}]),e}();const g=function(e){u()(i,e);var r,n,a=(r=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=h()(r);if(n){var a=h()(this).constructor;e=Reflect.construct(t,arguments,a)}else e=t.apply(this,arguments);return f()(this,e)});function i(){return s()(this,i),a.apply(this,arguments)}return t()(i,[{key:"setCategoryId",value:function(e){return this.addAttribute("category_id=".concat(e))}}]),i}(y),T=function(){function e(t,r){s()(this,e),this.apiKey=t,this.returnType=r}return t()(e,[{key:"getCategory",value:function(e){var t=this;return new Promise((function(r,n){try{var a=(new g).setAPIKey(t.apiKey).setCategoryId(e).setFileType(t.returnType).getUrl();o.get("category?".concat(a)).then((function(e){r(e.data)})).catch((function(e){n(e.response.data)}))}catch(e){n(e)}}))}},{key:"getChildCategories",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise((function(n,a){try{var s=(new g).setAPIKey(t.apiKey).setCategoryId(e).setFileType(t.returnType).setRealTimeStart(r).setRealTimeEnd(r).getUrl();o.get("category/children?".concat(s)).then((function(e){n(e.data)})).catch((function(e){a(e.response.data)}))}catch(e){a(e)}}))}},{key:"getRelatedCategories",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise((function(n,a){try{var s=(new g).setAPIKey(t.apiKey).setCategoryId(e).setFileType(t.returnType).setRealTimeStart(r).setRealTimeEnd(r).getUrl();o.get("category/related?".concat(s)).then((function(e){n(e.data)})).catch((function(e){a(e.response.data)}))}catch(e){a(e)}}))}},{key:"getCategorySeries",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise((function(n,a){try{var s=(new g).setAPIKey(t.apiKey).setCategoryId(e).setFileType(t.returnType).setRealTimeStart(r).setRealTimeEnd(r).setLimit(r).setOffset(r).setOrderBy(r).setSortOrder(r).setFilterVariable(r).setFilterValue(r).setTagNames(r).setExcludeTagNames(r).getUrl();o.get("category/series?".concat(s)).then((function(e){n(e.data)})).catch((function(e){a(e.response.data)}))}catch(e){a(e)}}))}},{key:"getCategoryTags",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise((function(n,a){try{var s=(new g).setAPIKey(t.apiKey).setCategoryId(e).setFileType(t.returnType).setRealTimeStart(r).setRealTimeEnd(r).setLimit(r).setOffset(r).setOrderBy(r).setSortOrder(r).setTagNames(r).setTagGroupId(r).setSearchText(r).getUrl();o.get("category/tags?".concat(s)).then((function(e){n(e.data)})).catch((function(e){a(e.response.data)}))}catch(e){a(e)}}))}},{key:"getCategoryRelatedTags",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise((function(n,a){try{var s=(new g).setAPIKey(t.apiKey).setCategoryId(e).setFileType(t.returnType).setRealTimeStart(r).setRealTimeEnd(r).setLimit(r).setOffset(r).setOrderBy(r).setSortOrder(r).setTagNames(r).setTagGroupId(r).setSearchText(r).getUrl();o.get("category/related_tags?".concat(s)).then((function(e){n(e.data)})).catch((function(e){a(e.response.data)}))}catch(e){a(e)}}))}}]),e}();const m=function(e){u()(i,e);var r,n,a=(r=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=h()(r);if(n){var a=h()(this).constructor;e=Reflect.construct(t,arguments,a)}else e=t.apply(this,arguments);return f()(this,e)});function i(){return s()(this,i),a.apply(this,arguments)}return t()(i,[{key:"setReleaseId",value:function(e){if(parseInt(e,10)<=0)throw new Error("The release id must be a positive integer");return this.addAttribute("release_id=".concat(e))}},{key:"setIncludeRelatedDatesWithNoData",value:function(e){var t=e.include_release_dates_with_no_data;return t?this.addAttribute("include_release_dates_with_no_data=".concat(t)):this}},{key:"setElementId",value:function(e){var t=e.element_id;return t?this.addAttribute("element_id=".concat(t)):this}},{key:"setIncludeObservationValues",value:function(e){var t=e.include_observation_values;if(!t)return this;if("true"!==t&&"false"!==t)throw new Error("The include_observation_values field must either be true or false");return this.addAttribute("include_observation_values=".concat(t))}},{key:"setObservationDate",value:function(e){var t=e.observation_date;if(!t)return this;if(!this.isValidDate(t))throw new Error("The format of this date is not valid. Please format the date like this: YYYY-MM-DD");return this.addAttribute("observation_date=".concat(t))}}]),i}(y),b=function(){function e(t,r){s()(this,e),this.apiKey=t,this.returnType=r}return t()(e,[{key:"getAllReleases",value:function(e){var t=this;return new Promise((function(r,n){try{var a=(new m).setAPIKey(t.apiKey).setFileType(t.returnType).setRealTimeStart(e).setRealTimeEnd(e).setLimit(e).setOffset(e).setOrderBy(e).setSortOrder(e).getUrl();o.get("releases?".concat(a)).then((function(e){r(e.data)})).catch((function(e){n(e.response.data)}))}catch(e){n(e)}}))}},{key:"getAllReleasesWithDates",value:function(e){var t=this;return new Promise((function(r,n){try{var a=(new m).setAPIKey(t.apiKey).setFileType(t.returnType).setRealTimeStart(e).setRealTimeEnd(e).setLimit(e).setOffset(e).setOrderBy(e).setSortOrder(e).setIncludeRelatedDatesWithNoData(e).getUrl();o.get("releases/dates?".concat(a)).then((function(e){r(e.data)})).catch((function(e){n(e.response.data)}))}catch(e){n(e)}}))}},{key:"getRelease",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise((function(n,a){try{var s=(new m).setAPIKey(t.apiKey).setFileType(t.returnType).setReleaseId(e).setRealTimeStart(r).setRealTimeEnd(r).getUrl();o.get("release?".concat(s)).then((function(e){n(e.data)})).catch((function(e){a(e.response.data)}))}catch(e){a(e)}}))}},{key:"getReleaseWithDates",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise((function(n,a){try{var s=(new m).setAPIKey(t.apiKey).setFileType(t.returnType).setReleaseId(e).setRealTimeStart(r).setRealTimeEnd(r).setLimit(r).setOffset(r).setSortOrder(r).setIncludeRelatedDatesWithNoData(r).getUrl();o.get("release/dates?".concat(s)).then((function(e){n(e.data)})).catch((function(e){a(e.response.data)}))}catch(e){a(e)}}))}},{key:"getSeriesForRelease",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise((function(n,a){try{var s=(new m).setAPIKey(t.apiKey).setFileType(t.returnType).setReleaseId(e).setRealTimeStart(r).setRealTimeEnd(r).setLimit(r).setOffset(r).setSortOrder(r).setOrderBy(r).setFilterVariable(r).setFilterValue(r).setTagNames(r).setExcludeTagNames(r).getUrl();o.get("release/series?".concat(s)).then((function(e){n(e.data)})).catch((function(e){a(e.response.data)}))}catch(e){a(e)}}))}},{key:"getSourcesForRelease",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise((function(n,a){try{var s=(new m).setAPIKey(t.apiKey).setFileType(t.returnType).setReleaseId(e).setRealTimeStart(r).setRealTimeEnd(r).getUrl();o.get("release/sources?".concat(s)).then((function(e){n(e.data)})).catch((function(e){a(e.response.data)}))}catch(e){a(e)}}))}},{key:"getTagsForRelease",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise((function(n,a){try{var s=(new m).setAPIKey(t.apiKey).setFileType(t.returnType).setReleaseId(e).setRealTimeStart(r).setRealTimeEnd(r).setLimit(r).setOffset(r).setSortOrder(r).setOrderBy(r).setTagNames(r).setTagGroupId(r).setSearchText(r).getUrl();o.get("release/tags?".concat(s)).then((function(e){n(e.data)})).catch((function(e){a(e.response.data)}))}catch(e){a(e)}}))}},{key:"getRelatedTagsForRelease",value:function(e,t){var r=this,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};return new Promise((function(a,s){try{var i=(new m).setAPIKey(r.apiKey).setFileType(r.returnType).setReleaseId(e).setRealTimeStart(n).setRealTimeEnd(n).setLimit(n).setOffset(n).setSortOrder(n).setOrderBy(n).setTagNames({tag_names:t}).setExcludeTagNames(n).setTagGroupId(n).setSearchText(n).getUrl();o.get("release/related_tags?".concat(i)).then((function(e){a(e.data)})).catch((function(e){s(e.response.data)}))}catch(e){s(e)}}))}},{key:"getTableTreesForRelease",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise((function(n,a){try{var s=(new m).setAPIKey(t.apiKey).setFileType(t.returnType).setReleaseId(e).setElementId(r).setIncludeObservationValues(r).setObservationDate(r).getUrl();o.get("release/tables?".concat(s)).then((function(e){n(e.data)})).catch((function(e){a(e.response.data)}))}catch(e){a(e)}}))}}]),e}();const R=function(e){u()(i,e);var r,n,a=(r=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=h()(r);if(n){var a=h()(this).constructor;e=Reflect.construct(t,arguments,a)}else e=t.apply(this,arguments);return f()(this,e)});function i(){return s()(this,i),a.apply(this,arguments)}return t()(i,[{key:"setSourceId",value:function(e){return this.addAttribute("source_id=".concat(e))}}]),i}(y),S=function(){function e(t,r){s()(this,e),this.apiKey=t,this.returnType=r}return t()(e,[{key:"getAllSources",value:function(e){var t=this;return new Promise((function(r,n){try{var a=(new R).setAPIKey(t.apiKey).setFileType(t.returnType).setRealTimeStart(e).setRealTimeEnd(e).setLimit(e).setOffset(e).setOrderBy(e).setSortOrder(e).getUrl();o.get("sources?".concat(a)).then((function(e){r(e.data)})).catch((function(e){n(e.response.data)}))}catch(e){n(e)}}))}},{key:"getSource",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise((function(n,a){try{var s=(new R).setAPIKey(t.apiKey).setFileType(t.returnType).setSourceId(e).setRealTimeStart(r).setRealTimeEnd(r).getUrl();o.get("source?".concat(s)).then((function(e){n(e.data)})).catch((function(e){a(e.response.data)}))}catch(e){a(e)}}))}},{key:"getReleasesForSource",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise((function(n,a){try{var s=(new R).setAPIKey(t.apiKey).setFileType(t.returnType).setSourceId(e).setRealTimeStart(r).setRealTimeEnd(r).setLimit(r).setOffset(r).setOrderBy(r).setSortOrder(r).getUrl();o.get("source/releases?".concat(s)).then((function(e){n(e.data)})).catch((function(e){a(e.response.data)}))}catch(e){a(e)}}))}}]),e}();const _=function(e){u()(i,e);var r,n,a=(r=i,n=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var e,t=h()(r);if(n){var a=h()(this).constructor;e=Reflect.construct(t,arguments,a)}else e=t.apply(this,arguments);return f()(this,e)});function i(){return s()(this,i),a.apply(this,arguments)}return t()(i)}(y),w=function(){function e(t,r){s()(this,e),this.apiKey=t,this.returnType=r}return t()(e,[{key:"getAllTags",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return new Promise((function(r,n){try{var a=(new _).setAPIKey(e.apiKey).setFileType(e.returnType).setRealTimeStart(t).setRealTimeEnd(t).setLimit(t).setOffset(t).setOrderBy(t).setSortOrder(t).setTagNames(t).setTagGroupId(t).setSearchText(t).getUrl();o.get("tags?".concat(a)).then((function(e){r(e.data)})).catch((function(e){n(e.response.data)}))}catch(e){n(e)}}))}},{key:"getAllRelatedTags",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise((function(n,a){try{var s=(new _).setAPIKey(t.apiKey).setFileType(t.returnType).setRealTimeStart(r).setRealTimeEnd(r).setLimit(r).setOffset(r).setOrderBy(r).setSortOrder(r).setTagNames(e).setExcludeTagNames(r).setTagGroupId(r).setSearchText(r).getUrl();o.get("related_tags?".concat(s)).then((function(e){n(e.data)})).catch((function(e){a(e.response.data)}))}catch(e){a(e)}}))}},{key:"getAllSeriesMatchingTags",value:function(e){var t=this,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise((function(n,a){try{var s=(new _).setAPIKey(t.apiKey).setFileType(t.returnType).setRealTimeStart(r).setRealTimeEnd(r).setLimit(r).setOffset(r).setOrderBy(r).setSortOrder(r).setTagNames({tag_names:e}).setExcludeTagNames(r).getUrl();o.get("tags/series?".concat(s)).then((function(e){n(e.data)})).catch((function(e){a(e.response.data)}))}catch(e){a(e)}}))}}]),e}(),x=t()((function e(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"json";s()(this,e),this.categories=new T(t,r),this.releases=new b(t,r),this.sources=new S(t,r),this.series=new v(t,r),this.tags=new w(t,r)}))})(),a.default})()));
//# sourceMappingURL=index.js.map