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.
@@ -5440,6 +5440,36 @@ class DataService extends _dcatResource__WEBPACK_IMPORTED_MODULE_4__["default"]
5440
5440
  throw new _core_error__WEBPACK_IMPORTED_MODULE_0__.UnexpectedResponseFormatError(response);
5441
5441
  });
5442
5442
  }
5443
+ static searchDBRecords(searchKeyword_1) {
5444
+ return __awaiter(this, arguments, void 0, function* (searchKeyword, pageNumber = 1, pageSize = 10, sortOrder = _core_type__WEBPACK_IMPORTED_MODULE_1__.SortOrder.DESC) {
5445
+ if (!searchKeyword || !searchKeyword.trim()) {
5446
+ return this.listDBRecords(pageNumber, pageSize, sortOrder);
5447
+ }
5448
+ // @ts-ignore - static helper expects SODAS_SDK_CLASS constructor type
5449
+ (0,_sodasSDKClass__WEBPACK_IMPORTED_MODULE_3__.throwErrorIfAPIURLNotSetForStatic)(this);
5450
+ let response;
5451
+ try {
5452
+ response = yield axios__WEBPACK_IMPORTED_MODULE_5__["default"].get(this.prototype.constructor.LIST_URL, {
5453
+ params: { pageNumber, pageSize, sortOrder, search: searchKeyword },
5454
+ });
5455
+ }
5456
+ catch (error) {
5457
+ (0,_core_util__WEBPACK_IMPORTED_MODULE_2__.handleAxiosError)(error);
5458
+ }
5459
+ if (response.data.total != null && Array.isArray(response.data.list)) {
5460
+ const list = yield Promise.all(response.data.list.map((item) => __awaiter(this, void 0, void 0, function* () {
5461
+ const dataService = new this();
5462
+ yield dataService.populateFromDTO(item);
5463
+ return dataService;
5464
+ })));
5465
+ return {
5466
+ total: response.data.total,
5467
+ list,
5468
+ };
5469
+ }
5470
+ throw new _core_error__WEBPACK_IMPORTED_MODULE_0__.UnexpectedResponseFormatError(response);
5471
+ });
5472
+ }
5443
5473
  toDTO() {
5444
5474
  return Object.assign(Object.assign(Object.assign({}, super.toDTO()), (this.DataServiceID && { DataServiceID: this.DataServiceID })), { EndpointURL: this.EndpointURL, EndpointDescription: this.EndpointDescription });
5445
5475
  }
@@ -6093,6 +6123,36 @@ class DatasetSeries extends _dcatResource__WEBPACK_IMPORTED_MODULE_5__["default"
6093
6123
  throw new _core_error__WEBPACK_IMPORTED_MODULE_0__.UnexpectedResponseFormatError(response);
6094
6124
  });
6095
6125
  }
6126
+ static searchDBRecords(searchKeyword_1) {
6127
+ return __awaiter(this, arguments, void 0, function* (searchKeyword, pageNumber = 1, pageSize = 10, sortOrder = _core_type__WEBPACK_IMPORTED_MODULE_1__.SortOrder.DESC) {
6128
+ if (!searchKeyword || !searchKeyword.trim()) {
6129
+ return this.listDBRecords(pageNumber, pageSize, sortOrder);
6130
+ }
6131
+ // @ts-ignore - static helper expects SODAS_SDK_CLASS constructor type
6132
+ (0,_sodasSDKClass__WEBPACK_IMPORTED_MODULE_3__.throwErrorIfAPIURLNotSetForStatic)(this);
6133
+ let response;
6134
+ try {
6135
+ response = yield axios__WEBPACK_IMPORTED_MODULE_6__["default"].get(this.prototype.constructor.LIST_URL, {
6136
+ params: { pageNumber, pageSize, sortOrder, search: searchKeyword },
6137
+ });
6138
+ }
6139
+ catch (error) {
6140
+ (0,_core_util__WEBPACK_IMPORTED_MODULE_2__.handleAxiosError)(error);
6141
+ }
6142
+ if (response.data.total != null && Array.isArray(response.data.list)) {
6143
+ const list = yield Promise.all(response.data.list.map((item) => __awaiter(this, void 0, void 0, function* () {
6144
+ const datasetSeries = new this();
6145
+ yield datasetSeries.populateFromDTO(item);
6146
+ return datasetSeries;
6147
+ })));
6148
+ return {
6149
+ total: response.data.total,
6150
+ list,
6151
+ };
6152
+ }
6153
+ throw new _core_error__WEBPACK_IMPORTED_MODULE_0__.UnexpectedResponseFormatError(response);
6154
+ });
6155
+ }
6096
6156
  toDTO() {
6097
6157
  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 }));
6098
6158
  return result;