@hapl/api-queries 0.1.163 → 0.1.164

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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,15 @@
1
+ # v0.1.164 (Wed May 25 2022)
2
+
3
+ #### 🐛 Bug Fix
4
+
5
+ - FE-1272: Добавлена ручка на загрузку картинок [#91](https://github.com/homeappcorporate/api-queries/pull/91) ([@alexandropavlov](https://github.com/alexandropavlov))
6
+
7
+ #### Authors: 1
8
+
9
+ - Alexander Pavlov ([@alexandropavlov](https://github.com/alexandropavlov))
10
+
11
+ ---
12
+
1
13
  # v0.1.163 (Tue May 24 2022)
2
14
 
3
15
  #### 🐛 Bug Fix
@@ -6980,6 +6980,46 @@ function findComplexIdsRequest(_ref) {
6980
6980
  });
6981
6981
  }
6982
6982
 
6983
+ function uploadImagesRequest(_ref) {
6984
+ var _ref$baseURL = _ref.baseURL,
6985
+ baseURL = _ref$baseURL === void 0 ? 'https://registry.homeapp.ru' : _ref$baseURL,
6986
+ body = _ref.body,
6987
+ headers = _ref.headers;
6988
+ var formData = new FormData();
6989
+
6990
+ if (body.length === 0) {
6991
+ throw new Error('Список изображений пуст');
6992
+ }
6993
+
6994
+ body.forEach(function (file, index) {
6995
+ formData.append("file" + index, file);
6996
+ });
6997
+ return axios.post('/api/image/upload', formData, {
6998
+ baseURL: baseURL,
6999
+ headers: _extends({
7000
+ Accept: 'application/json',
7001
+ 'Content-Type': 'multipart/form-data'
7002
+ }, headers),
7003
+ transformResponse: [].concat(axios.defaults.transformResponse, [function (data) {
7004
+ if (!data.success) return data.data.error || data.data.message;
7005
+ var ids = [];
7006
+ var byId = {};
7007
+ data.data.forEach(function (entity) {
7008
+ byId[entity.id] = entity;
7009
+ ids.push(entity.id);
7010
+ });
7011
+ return {
7012
+ ids: ids,
7013
+ byId: byId
7014
+ };
7015
+ }])
7016
+ }).then(function (res) {
7017
+ return res;
7018
+ })["catch"](function (err) {
7019
+ throw err;
7020
+ });
7021
+ }
7022
+
6983
7023
  function findRealtiesRequest$1(_ref) {
6984
7024
  var _ref$baseURL = _ref.baseURL,
6985
7025
  baseURL = _ref$baseURL === void 0 ? 'https://registry.homeapp.ru' : _ref$baseURL,
@@ -7245,15 +7285,7 @@ var ValuationDictionary = {
7245
7285
  var Api$3 = function Api(baseURL) {
7246
7286
  var _this = this;
7247
7287
 
7248
- this.baseURL = baseURL; // complex
7249
-
7250
- this.findComplexIds = function (params) {
7251
- return findComplexIdsRequest({
7252
- params: params,
7253
- baseURL: _this.baseURL
7254
- });
7255
- }; // address
7256
-
7288
+ this.baseURL = baseURL; // address
7257
7289
 
7258
7290
  this.createAddress = function (body, headers) {
7259
7291
  return createAddressRequest$1({
@@ -7269,6 +7301,23 @@ var Api$3 = function Api(baseURL) {
7269
7301
  headers: headers,
7270
7302
  baseURL: _this.baseURL
7271
7303
  });
7304
+ }; // complex
7305
+
7306
+
7307
+ this.findComplexIds = function (params) {
7308
+ return findComplexIdsRequest({
7309
+ params: params,
7310
+ baseURL: _this.baseURL
7311
+ });
7312
+ }; // image
7313
+
7314
+
7315
+ this.uploadImages = function (body, headers) {
7316
+ return uploadImagesRequest({
7317
+ body: body,
7318
+ headers: headers,
7319
+ baseURL: _this.baseURL
7320
+ });
7272
7321
  }; // realty
7273
7322
 
7274
7323
 
@@ -7286,7 +7335,7 @@ var Api$3 = function Api(baseURL) {
7286
7335
  headers: headers,
7287
7336
  baseURL: _this.baseURL
7288
7337
  });
7289
- }; // valuate
7338
+ }; // valuation
7290
7339
 
7291
7340
 
7292
7341
  this.calculateValuation = function (body, headers) {
@@ -7305,6 +7354,7 @@ var index$3 = {
7305
7354
  findAddressByIdRequest: findAddressByIdRequest,
7306
7355
  findAddressesByRealtyParamsRequest: findAddressesByRealtyParamsRequest,
7307
7356
  findComplexIdsRequest: findComplexIdsRequest,
7357
+ uploadImagesRequest: uploadImagesRequest,
7308
7358
  findRealtiesRequest: findRealtiesRequest$1,
7309
7359
  calculateValuationRequest: calculateValuationRequest,
7310
7360
  AddressBTIParamsDictionary: AddressBTIParamsDictionary$2,