sodas-sdk 1.4.1 → 1.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1859,6 +1859,36 @@ class DataService extends _dcatResource__WEBPACK_IMPORTED_MODULE_4__["default"]
1859
1859
  throw new _core_error__WEBPACK_IMPORTED_MODULE_0__.UnexpectedResponseFormatError(response);
1860
1860
  });
1861
1861
  }
1862
+ static searchDBRecords(searchKeyword_1) {
1863
+ return __awaiter(this, arguments, void 0, function* (searchKeyword, pageNumber = 1, pageSize = 10, sortOrder = _core_type__WEBPACK_IMPORTED_MODULE_1__.SortOrder.DESC) {
1864
+ if (!searchKeyword || !searchKeyword.trim()) {
1865
+ return this.listDBRecords(pageNumber, pageSize, sortOrder);
1866
+ }
1867
+ // @ts-ignore - static helper expects SODAS_SDK_CLASS constructor type
1868
+ (0,_sodasSDKClass__WEBPACK_IMPORTED_MODULE_3__.throwErrorIfAPIURLNotSetForStatic)(this);
1869
+ let response;
1870
+ try {
1871
+ response = yield axios__WEBPACK_IMPORTED_MODULE_5__["default"].get(this.prototype.constructor.LIST_URL, {
1872
+ params: { pageNumber, pageSize, sortOrder, search: searchKeyword },
1873
+ });
1874
+ }
1875
+ catch (error) {
1876
+ (0,_core_util__WEBPACK_IMPORTED_MODULE_2__.handleAxiosError)(error);
1877
+ }
1878
+ if (response.data.total != null && Array.isArray(response.data.list)) {
1879
+ const list = yield Promise.all(response.data.list.map((item) => __awaiter(this, void 0, void 0, function* () {
1880
+ const dataService = new this();
1881
+ yield dataService.populateFromDTO(item);
1882
+ return dataService;
1883
+ })));
1884
+ return {
1885
+ total: response.data.total,
1886
+ list,
1887
+ };
1888
+ }
1889
+ throw new _core_error__WEBPACK_IMPORTED_MODULE_0__.UnexpectedResponseFormatError(response);
1890
+ });
1891
+ }
1862
1892
  toDTO() {
1863
1893
  return Object.assign(Object.assign(Object.assign({}, super.toDTO()), (this.DataServiceID && { DataServiceID: this.DataServiceID })), { EndpointURL: this.EndpointURL, EndpointDescription: this.EndpointDescription });
1864
1894
  }
@@ -2512,6 +2542,36 @@ class DatasetSeries extends _dcatResource__WEBPACK_IMPORTED_MODULE_5__["default"
2512
2542
  throw new _core_error__WEBPACK_IMPORTED_MODULE_0__.UnexpectedResponseFormatError(response);
2513
2543
  });
2514
2544
  }
2545
+ static searchDBRecords(searchKeyword_1) {
2546
+ return __awaiter(this, arguments, void 0, function* (searchKeyword, pageNumber = 1, pageSize = 10, sortOrder = _core_type__WEBPACK_IMPORTED_MODULE_1__.SortOrder.DESC) {
2547
+ if (!searchKeyword || !searchKeyword.trim()) {
2548
+ return this.listDBRecords(pageNumber, pageSize, sortOrder);
2549
+ }
2550
+ // @ts-ignore - static helper expects SODAS_SDK_CLASS constructor type
2551
+ (0,_sodasSDKClass__WEBPACK_IMPORTED_MODULE_3__.throwErrorIfAPIURLNotSetForStatic)(this);
2552
+ let response;
2553
+ try {
2554
+ response = yield axios__WEBPACK_IMPORTED_MODULE_6__["default"].get(this.prototype.constructor.LIST_URL, {
2555
+ params: { pageNumber, pageSize, sortOrder, search: searchKeyword },
2556
+ });
2557
+ }
2558
+ catch (error) {
2559
+ (0,_core_util__WEBPACK_IMPORTED_MODULE_2__.handleAxiosError)(error);
2560
+ }
2561
+ if (response.data.total != null && Array.isArray(response.data.list)) {
2562
+ const list = yield Promise.all(response.data.list.map((item) => __awaiter(this, void 0, void 0, function* () {
2563
+ const datasetSeries = new this();
2564
+ yield datasetSeries.populateFromDTO(item);
2565
+ return datasetSeries;
2566
+ })));
2567
+ return {
2568
+ total: response.data.total,
2569
+ list,
2570
+ };
2571
+ }
2572
+ throw new _core_error__WEBPACK_IMPORTED_MODULE_0__.UnexpectedResponseFormatError(response);
2573
+ });
2574
+ }
2515
2575
  toDTO() {
2516
2576
  const result = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, super.toDTO()), (this.DatasetSeriesID && { DatasetSeriesID: this.DatasetSeriesID })), (this.InSeriesID && { InSeriesID: this.InSeriesID })), { Frequency: this.Frequency, SpatialResolutionInMeters: this.SpatialResolutionInMeters, TemporalResolution: this.TemporalResolution, Spatial: this.Spatial, Temporal: this.Temporal, WasGeneratedBy: this.WasGeneratedBy }), (this.SeriesMemberIDs && { SeriesMemberIDs: this.SeriesMemberIDs }));
2517
2577
  return result;