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.
@@ -5425,6 +5425,36 @@ class DataService extends _dcatResource__WEBPACK_IMPORTED_MODULE_4__["default"]
5425
5425
  throw new _core_error__WEBPACK_IMPORTED_MODULE_0__.UnexpectedResponseFormatError(response);
5426
5426
  });
5427
5427
  }
5428
+ static searchDBRecords(searchKeyword_1) {
5429
+ return __awaiter(this, arguments, void 0, function* (searchKeyword, pageNumber = 1, pageSize = 10, sortOrder = _core_type__WEBPACK_IMPORTED_MODULE_1__.SortOrder.DESC) {
5430
+ if (!searchKeyword || !searchKeyword.trim()) {
5431
+ return this.listDBRecords(pageNumber, pageSize, sortOrder);
5432
+ }
5433
+ // @ts-ignore - static helper expects SODAS_SDK_CLASS constructor type
5434
+ (0,_sodasSDKClass__WEBPACK_IMPORTED_MODULE_3__.throwErrorIfAPIURLNotSetForStatic)(this);
5435
+ let response;
5436
+ try {
5437
+ response = yield axios__WEBPACK_IMPORTED_MODULE_5__["default"].get(this.prototype.constructor.LIST_URL, {
5438
+ params: { pageNumber, pageSize, sortOrder, search: searchKeyword },
5439
+ });
5440
+ }
5441
+ catch (error) {
5442
+ (0,_core_util__WEBPACK_IMPORTED_MODULE_2__.handleAxiosError)(error);
5443
+ }
5444
+ if (response.data.total != null && Array.isArray(response.data.list)) {
5445
+ const list = yield Promise.all(response.data.list.map((item) => __awaiter(this, void 0, void 0, function* () {
5446
+ const dataService = new this();
5447
+ yield dataService.populateFromDTO(item);
5448
+ return dataService;
5449
+ })));
5450
+ return {
5451
+ total: response.data.total,
5452
+ list,
5453
+ };
5454
+ }
5455
+ throw new _core_error__WEBPACK_IMPORTED_MODULE_0__.UnexpectedResponseFormatError(response);
5456
+ });
5457
+ }
5428
5458
  toDTO() {
5429
5459
  return Object.assign(Object.assign(Object.assign({}, super.toDTO()), (this.DataServiceID && { DataServiceID: this.DataServiceID })), { EndpointURL: this.EndpointURL, EndpointDescription: this.EndpointDescription });
5430
5460
  }
@@ -6076,6 +6106,36 @@ class DatasetSeries extends _dcatResource__WEBPACK_IMPORTED_MODULE_5__["default"
6076
6106
  throw new _core_error__WEBPACK_IMPORTED_MODULE_0__.UnexpectedResponseFormatError(response);
6077
6107
  });
6078
6108
  }
6109
+ static searchDBRecords(searchKeyword_1) {
6110
+ return __awaiter(this, arguments, void 0, function* (searchKeyword, pageNumber = 1, pageSize = 10, sortOrder = _core_type__WEBPACK_IMPORTED_MODULE_1__.SortOrder.DESC) {
6111
+ if (!searchKeyword || !searchKeyword.trim()) {
6112
+ return this.listDBRecords(pageNumber, pageSize, sortOrder);
6113
+ }
6114
+ // @ts-ignore - static helper expects SODAS_SDK_CLASS constructor type
6115
+ (0,_sodasSDKClass__WEBPACK_IMPORTED_MODULE_3__.throwErrorIfAPIURLNotSetForStatic)(this);
6116
+ let response;
6117
+ try {
6118
+ response = yield axios__WEBPACK_IMPORTED_MODULE_6__["default"].get(this.prototype.constructor.LIST_URL, {
6119
+ params: { pageNumber, pageSize, sortOrder, search: searchKeyword },
6120
+ });
6121
+ }
6122
+ catch (error) {
6123
+ (0,_core_util__WEBPACK_IMPORTED_MODULE_2__.handleAxiosError)(error);
6124
+ }
6125
+ if (response.data.total != null && Array.isArray(response.data.list)) {
6126
+ const list = yield Promise.all(response.data.list.map((item) => __awaiter(this, void 0, void 0, function* () {
6127
+ const datasetSeries = new this();
6128
+ yield datasetSeries.populateFromDTO(item);
6129
+ return datasetSeries;
6130
+ })));
6131
+ return {
6132
+ total: response.data.total,
6133
+ list,
6134
+ };
6135
+ }
6136
+ throw new _core_error__WEBPACK_IMPORTED_MODULE_0__.UnexpectedResponseFormatError(response);
6137
+ });
6138
+ }
6079
6139
  toDTO() {
6080
6140
  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 }));
6081
6141
  return result;