@hapl/api-queries 0.1.118 → 0.1.119

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.
Files changed (47) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/api-queries.cjs.development.js +255 -9
  3. package/dist/api-queries.cjs.development.js.map +1 -1
  4. package/dist/api-queries.cjs.production.min.js +1 -1
  5. package/dist/api-queries.cjs.production.min.js.map +1 -1
  6. package/dist/api-queries.esm.js +255 -9
  7. package/dist/api-queries.esm.js.map +1 -1
  8. package/dist/clients/v1/api/index.d.ts +1 -1
  9. package/dist/clients/v1/api/serviceRequest/findServiceRequestSellerReports/index.d.ts +42 -0
  10. package/dist/clients/v1/index.d.ts +1 -1
  11. package/dist/registry/v1/api/{complexes → complex}/findComplexIds/index.d.ts +0 -0
  12. package/dist/registry/v1/api/index.d.ts +2 -1
  13. package/dist/registry/v1/api/realty/findRealties/index.d.ts +34 -0
  14. package/dist/registry/v1/dictionaries/AddressBTIParams.d.ts +24 -0
  15. package/dist/registry/v1/dictionaries/Realty.d.ts +71 -0
  16. package/dist/registry/v1/dictionaries/Shape.d.ts +11 -0
  17. package/dist/registry/v1/dictionaries/index.d.ts +3 -0
  18. package/dist/registry/v1/index.d.ts +3 -0
  19. package/dist/registry/v1/types/Address.d.ts +31 -0
  20. package/dist/registry/v1/types/AddressBTIParams.d.ts +39 -0
  21. package/dist/registry/v1/types/AddressMetroDistance.d.ts +9 -0
  22. package/dist/registry/v1/types/Image.d.ts +15 -0
  23. package/dist/registry/v1/types/Realty.d.ts +116 -0
  24. package/dist/registry/v1/types/RealtyOffer.d.ts +6 -0
  25. package/dist/registry/v1/types/Shape.d.ts +24 -0
  26. package/dist/registry/v1/types/index.d.ts +7 -0
  27. package/package.json +1 -1
  28. package/src/clients/v1/api/index.ts +1 -1
  29. package/src/clients/v1/api/serviceRequest/{findServiceRequestSellerReport → findServiceRequestSellerReports}/index.ts +13 -13
  30. package/src/clients/v1/index.ts +5 -5
  31. package/src/registry/v1/api/{complexes → complex}/findComplexIds/index.ts +0 -0
  32. package/src/registry/v1/api/index.ts +3 -1
  33. package/src/registry/v1/api/realty/findRealties/index.ts +54 -0
  34. package/src/registry/v1/dictionaries/AddressBTIParams.ts +25 -0
  35. package/src/registry/v1/dictionaries/Realty.ts +84 -0
  36. package/src/registry/v1/dictionaries/Shape.ts +12 -0
  37. package/src/registry/v1/dictionaries/index.ts +3 -0
  38. package/src/registry/v1/index.ts +10 -0
  39. package/src/registry/v1/types/Address.ts +29 -0
  40. package/src/registry/v1/types/AddressBTIParams.ts +42 -0
  41. package/src/registry/v1/types/AddressMetroDistance.ts +9 -0
  42. package/src/registry/v1/types/Image.ts +13 -0
  43. package/src/registry/v1/types/Realty.ts +123 -0
  44. package/src/registry/v1/types/RealtyOffer.ts +6 -0
  45. package/src/registry/v1/types/Shape.ts +24 -0
  46. package/src/registry/v1/types/index.ts +7 -0
  47. package/dist/clients/v1/api/serviceRequest/findServiceRequestSellerReport/index.d.ts +0 -42
@@ -43,7 +43,7 @@ export * from './serviceRequest/findServiceRequestActivities';
43
43
  export * from './serviceRequest/findServiceRequestById';
44
44
  export * from './serviceRequest/findServiceRequestDuplicates';
45
45
  export * from './serviceRequest/findServiceRequests';
46
- export * from './serviceRequest/findServiceRequestSellerReport';
46
+ export * from './serviceRequest/findServiceRequestSellerReports';
47
47
  export * from './serviceRequest/findServiceRequestShortInfo';
48
48
  export * from './serviceRequest/findServiceRequestShortInfoById';
49
49
  export * from './serviceRequest/findServiceRequestShortInfoByDealId';
@@ -0,0 +1,42 @@
1
+ import { AxiosResponse, AxiosError } from 'axios';
2
+ import { ServiceRequestSellerReport } from '../../../types';
3
+ declare type ErrorData = {
4
+ success: false;
5
+ data: {
6
+ error: string;
7
+ };
8
+ };
9
+ declare type ResultData = {
10
+ ids: string[];
11
+ byId: Record<string, ServiceRequestSellerReport>;
12
+ meta: {
13
+ total: number;
14
+ };
15
+ };
16
+ declare type ResultError = ErrorData['data']['error'];
17
+ export declare type FindServiceRequestSellerReportsParams = {
18
+ sorting?: {
19
+ type: 'createdAt';
20
+ direction: 'asc' | 'desc';
21
+ };
22
+ limits?: {
23
+ page?: number;
24
+ count?: number | 'all';
25
+ };
26
+ };
27
+ export declare type FindServiceRequestSellerReportsUrlParams = {
28
+ id: number;
29
+ };
30
+ export declare type FindServiceRequestSellerReportsHeaders = {
31
+ 'x-auth-hc': string;
32
+ };
33
+ export declare type FindServiceRequestSellerReportsData = AxiosResponse<ResultData>;
34
+ export declare type FindServiceRequestSellerReportsError = AxiosError<ResultError>;
35
+ export declare type FindServiceRequestSellerReportsConfig = {
36
+ baseURL?: string;
37
+ urlParams: FindServiceRequestSellerReportsUrlParams;
38
+ params: FindServiceRequestSellerReportsParams;
39
+ headers?: FindServiceRequestSellerReportsHeaders;
40
+ };
41
+ export declare function findServiceRequestSellerReportsRequest({ baseURL, urlParams, headers, params, }: FindServiceRequestSellerReportsConfig): Promise<FindServiceRequestSellerReportsData>;
42
+ export {};
@@ -56,7 +56,7 @@ export declare class Api {
56
56
  returnDeferredServiceRequest: (body: api.ReturnDeferredServiceRequestBody, headers: api.ReturnDeferredServiceRequestHeaders) => Promise<api.ReturnDeferredServiceRequestData>;
57
57
  startServiceRequestModeration: (urlParams: api.StartServiceRequestModerationUrlParams, headers: api.StartServiceRequestModerationHeaders) => Promise<api.StartServiceRequestModerationData>;
58
58
  startServiceRequestModerationForOldRealty: (urlParams: api.StartServiceRequestModerationForOldRealtyUrlParams, headers: api.StartServiceRequestModerationForOldRealtyHeaders) => Promise<api.StartServiceRequestModerationForOldRealtyData>;
59
- findServiceRequestSellerReport: (urlParams: api.FindServiceRequestSellerReportUrlParams, params: api.FindServiceRequestSellerReportParams, headers: api.FindServiceRequestSellerReportHeaders) => Promise<api.FindServiceRequestSellerReportData>;
59
+ findServiceRequestSellerReports: (urlParams: api.FindServiceRequestSellerReportsUrlParams, params: api.FindServiceRequestSellerReportsParams, headers: api.FindServiceRequestSellerReportsHeaders) => Promise<api.FindServiceRequestSellerReportsData>;
60
60
  findSoldStatistic: (headers?: api.FindSoldStatisticHeaders | undefined) => Promise<api.FindSoldStatisticData>;
61
61
  findTasks: (params: api.FindTasksParams, headers: api.FindTasksHeaders) => Promise<api.FindTasksData>;
62
62
  createUser: (body: api.CreateUserBody, headers: api.CreateUserHeaders) => Promise<api.CreateUserData>;
@@ -1 +1,2 @@
1
- export * from './complexes/findComplexIds';
1
+ export * from './complex/findComplexIds';
2
+ export * from './realty/findRealties';
@@ -0,0 +1,34 @@
1
+ import { AxiosResponse, AxiosError } from 'axios';
2
+ import { Realty } from '../../../types';
3
+ declare type ResultData = {
4
+ ids: number[];
5
+ byId: Record<string, Realty>;
6
+ meta: {
7
+ total: number;
8
+ };
9
+ };
10
+ declare type ResultError = string;
11
+ export declare type FindRealtiesHeaders = {
12
+ 'x-auth-hc': string;
13
+ };
14
+ export declare type FindRealtiesParams = {
15
+ filter?: {
16
+ id?: number | number[];
17
+ };
18
+ limits?: {
19
+ page?: number;
20
+ count?: number | 'all';
21
+ };
22
+ sorting?: {
23
+ direction: 'asc' | 'desc';
24
+ type: 'createdAt' | 'id';
25
+ };
26
+ };
27
+ export declare type FindRealtiesData = AxiosResponse<ResultData>;
28
+ export declare type FindRealtiesError = AxiosError<ResultError>;
29
+ export declare type FindRealtiesConfig = {
30
+ baseURL?: string;
31
+ params: FindRealtiesParams;
32
+ };
33
+ export declare function findRealtiesRequest({ baseURL, params }: FindRealtiesConfig): Promise<FindRealtiesData>;
34
+ export {};
@@ -0,0 +1,24 @@
1
+ import { AddressBTIParamsParking, AddressBTIParamsWallsMaterial, AddressBTIParamsHeatingType } from '../types';
2
+ export declare const AddressBTIParamsDictionary: {
3
+ Parking: {
4
+ ground: string;
5
+ multilevel: string;
6
+ underground: string;
7
+ };
8
+ WallsMaterial: {
9
+ brick: string;
10
+ monolith: string;
11
+ monobrick: string;
12
+ timber: string;
13
+ panel: string;
14
+ block: string;
15
+ };
16
+ HeatingType: {
17
+ none: string;
18
+ central: string;
19
+ local: string;
20
+ gas: string;
21
+ electricity: string;
22
+ liquid: string;
23
+ };
24
+ };
@@ -0,0 +1,71 @@
1
+ import { RealtyType, RealtyRenovationType, RealtyGas, RealtyHouseType, RealtyLandShape, RealtyLandUsageType, RealtyRelief, RealtyElectricity, RealtyFurniture, RealtySewerage, RealtyWindowView } from '../types';
2
+ export declare const RealtyDictionary: {
3
+ Type: {
4
+ flat: string;
5
+ house: string;
6
+ };
7
+ RenovationType: {
8
+ none: string;
9
+ author: string;
10
+ cosmetic: string;
11
+ euro: string;
12
+ fine_finishing: string;
13
+ rough_finishing: string;
14
+ };
15
+ Gas: {
16
+ none: string;
17
+ connected: string;
18
+ border: string;
19
+ possible: string;
20
+ autonomous: string;
21
+ };
22
+ HouseType: {
23
+ townhouse: string;
24
+ house: string;
25
+ cottage: string;
26
+ part: string;
27
+ duplex: string;
28
+ };
29
+ LandShape: {
30
+ regular: string;
31
+ irregular: string;
32
+ };
33
+ LandUsageType: {
34
+ igs: string;
35
+ lph: string;
36
+ dnp: string;
37
+ snt: string;
38
+ farm: string;
39
+ garden: string;
40
+ investproject: string;
41
+ };
42
+ Relief: {
43
+ flat: string;
44
+ elevations: string;
45
+ slope: string;
46
+ hills: string;
47
+ };
48
+ Electricity: {
49
+ none: string;
50
+ connected: string;
51
+ possible: string;
52
+ autonomous: string;
53
+ };
54
+ Furniture: {
55
+ none: string;
56
+ full: string;
57
+ part: string;
58
+ };
59
+ Sewerage: {
60
+ none: string;
61
+ cesspool: string;
62
+ septic: string;
63
+ bio: string;
64
+ central: string;
65
+ };
66
+ WindowView: {
67
+ street: string;
68
+ yard: string;
69
+ both: string;
70
+ };
71
+ };
@@ -0,0 +1,11 @@
1
+ import { ShapeType } from '../types';
2
+ export declare const ShapeDictionary: {
3
+ Type: {
4
+ administrative_district: string;
5
+ block: string;
6
+ complex: string;
7
+ district: string;
8
+ house: string;
9
+ microdistrict: string;
10
+ };
11
+ };
@@ -0,0 +1,3 @@
1
+ export * from './AddressBTIParams';
2
+ export * from './Realty';
3
+ export * from './Shape';
@@ -3,5 +3,8 @@ export declare class Api {
3
3
  private baseURL;
4
4
  constructor(baseURL: string | undefined);
5
5
  findComplexIds: (params: api.FindComplexIdsParams) => Promise<api.FindComplexIdsData>;
6
+ findRealties: (params: api.FindRealtiesParams) => Promise<api.FindRealtiesData>;
6
7
  }
7
8
  export * from './api';
9
+ export * from './dictionaries';
10
+ export * from './types';
@@ -0,0 +1,31 @@
1
+ import { AddressBTIParams } from './AddressBTIParams';
2
+ import { AddressMetroDistance } from './AddressMetroDistance';
3
+ import { Shape } from './Shape';
4
+ export declare type Address = {
5
+ btiParams: Partial<AddressBTIParams>;
6
+ country: string;
7
+ fullAddress: string;
8
+ id: number;
9
+ isManual: boolean;
10
+ lat: number;
11
+ lng: number;
12
+ metroDistances: Array<Partial<AddressMetroDistance> & {
13
+ id: number;
14
+ }>;
15
+ shapes: Array<Partial<Shape> & {
16
+ id: number;
17
+ }>;
18
+ city?: string;
19
+ cityArea?: string;
20
+ district?: string;
21
+ draftName?: string;
22
+ fiasCode?: number;
23
+ house?: string;
24
+ kladrCode?: number;
25
+ medianPrice?: number;
26
+ medianSqmPrice?: number;
27
+ postalCode?: number;
28
+ realtyIds?: number[];
29
+ region?: string;
30
+ street?: string;
31
+ };
@@ -0,0 +1,39 @@
1
+ export declare enum AddressBTIParamsParking {
2
+ Ground = "ground",
3
+ Multilevel = "multilevel",
4
+ Underground = "underground"
5
+ }
6
+ export declare enum AddressBTIParamsWallsMaterial {
7
+ Brick = "brick",
8
+ Monolith = "monolith",
9
+ Monobrick = "monobrick",
10
+ Timber = "timber",
11
+ Panel = "panel",
12
+ Block = "block"
13
+ }
14
+ export declare enum AddressBTIParamsHeatingType {
15
+ None = "none",
16
+ Central = "central",
17
+ Local = "local",
18
+ Gas = "gas",
19
+ Electricity = "electricity",
20
+ Liquid = "liquid"
21
+ }
22
+ export declare type AddressBTIParams = {
23
+ buildYear?: number;
24
+ cargoLifts?: number;
25
+ ceilingHeight?: number;
26
+ deliveryQuarter?: number;
27
+ deliveryYear?: number;
28
+ emergency?: boolean;
29
+ floors?: number;
30
+ garbageChute?: boolean;
31
+ heatingType?: AddressBTIParamsHeatingType;
32
+ id?: number;
33
+ isDelivered?: boolean;
34
+ isUpToDate?: boolean;
35
+ parking?: AddressBTIParamsParking;
36
+ passengerLifts?: number;
37
+ series?: string;
38
+ wallsMaterial?: AddressBTIParamsWallsMaterial;
39
+ };
@@ -0,0 +1,9 @@
1
+ export declare type AddressMetroDistance = {
2
+ distance: number;
3
+ id: number;
4
+ metroLine: string;
5
+ metroLineColor: string;
6
+ metroStation: string;
7
+ timeCar: number;
8
+ timeFoot: number;
9
+ };
@@ -0,0 +1,15 @@
1
+ export declare enum ImageType {
2
+ Complex = "complex",
3
+ Apartment = "apartment",
4
+ Layout = "layout"
5
+ }
6
+ export declare type Image = {
7
+ id: number;
8
+ properties: {
9
+ oldId?: number;
10
+ maxSize?: string;
11
+ };
12
+ storagePath: string;
13
+ thumbnailPath: string;
14
+ type: string | ImageType;
15
+ };
@@ -0,0 +1,116 @@
1
+ import { Address } from './Address';
2
+ import { Image } from './Image';
3
+ import { RealtyOffer } from './RealtyOffer';
4
+ export declare enum RealtyType {
5
+ Flat = "flat",
6
+ House = "house"
7
+ }
8
+ export declare enum RealtyRenovationType {
9
+ None = "none",
10
+ Author = "author",
11
+ Cosmetic = "cosmetic",
12
+ Euro = "euro",
13
+ FineFinishing = "fine_finishing",
14
+ RoughFinishing = "rough_finishing"
15
+ }
16
+ export declare enum RealtyGas {
17
+ None = "none",
18
+ Connected = "connected",
19
+ Border = "border",
20
+ Possible = "possible",
21
+ Autonomous = "autonomous"
22
+ }
23
+ export declare enum RealtyHouseType {
24
+ Townhouse = "townhouse",
25
+ House = "house",
26
+ Cottage = "cottage",
27
+ Part = "part",
28
+ Duplex = "duplex"
29
+ }
30
+ export declare enum RealtyLandShape {
31
+ Regular = "regular",
32
+ Irregular = "irregular"
33
+ }
34
+ export declare enum RealtyLandUsageType {
35
+ IGS = "igs",
36
+ LPH = "lph",
37
+ DNP = "dnp",
38
+ SNT = "snt",
39
+ Farm = "farm",
40
+ Garden = "garden",
41
+ Investproject = "investproject"
42
+ }
43
+ export declare enum RealtyRelief {
44
+ Flat = "flat",
45
+ Elevations = "elevations",
46
+ Slope = "slope",
47
+ Hills = "hills"
48
+ }
49
+ export declare enum RealtyElectricity {
50
+ None = "none",
51
+ Connected = "connected",
52
+ Possible = "possible",
53
+ Autonomous = "autonomous"
54
+ }
55
+ export declare enum RealtyFurniture {
56
+ None = "none",
57
+ Full = "full",
58
+ Part = "part"
59
+ }
60
+ export declare enum RealtySewerage {
61
+ None = "none",
62
+ Cesspool = "cesspool",
63
+ Septic = "septic",
64
+ Bio = "bio",
65
+ Central = "central"
66
+ }
67
+ export declare enum RealtyWindowView {
68
+ Street = "street",
69
+ Yard = "yard",
70
+ Both = "both"
71
+ }
72
+ export declare type Realty = {
73
+ address: Partial<Address> & {
74
+ id: number;
75
+ };
76
+ addressId: number;
77
+ area: number;
78
+ createdAt: string;
79
+ floor: number;
80
+ id: number;
81
+ images: Array<Partial<Image> & {
82
+ id: number;
83
+ }>;
84
+ price: number;
85
+ realtyType: RealtyType;
86
+ renovationType: RealtyRenovationType;
87
+ roomsNumber: number;
88
+ balconyCount?: number;
89
+ burden?: boolean;
90
+ ceilingHeight?: number;
91
+ chambers?: string;
92
+ cityDistance?: number;
93
+ communityName?: string;
94
+ documentationUrl?: number;
95
+ electricity?: RealtyElectricity;
96
+ features?: string[];
97
+ floorsNumber?: number;
98
+ furniture?: RealtyFurniture;
99
+ gas?: RealtyGas;
100
+ houseType?: RealtyHouseType;
101
+ isDevelopersOffer?: boolean;
102
+ kitchenArea?: number;
103
+ landArea?: number;
104
+ landShape?: RealtyLandShape;
105
+ landUsageType?: RealtyLandUsageType;
106
+ livingArea?: number;
107
+ mainOffer?: Partial<RealtyOffer> & {
108
+ id: number;
109
+ };
110
+ number?: number;
111
+ relief?: RealtyRelief;
112
+ separatedRoomsNumber?: number;
113
+ sewerage?: RealtySewerage;
114
+ soldAt?: string;
115
+ windowView?: RealtyWindowView;
116
+ };
@@ -0,0 +1,6 @@
1
+ export declare type RealtyOffer = {
2
+ extId: string;
3
+ id: number;
4
+ source: string;
5
+ url: string;
6
+ };
@@ -0,0 +1,24 @@
1
+ declare type Coordinates = number[];
2
+ declare type Polygon = {
3
+ type: 'Polygon';
4
+ coordinates: Array<Coordinates>;
5
+ };
6
+ declare type MultiPolygon = {
7
+ type: 'MultiPolygon';
8
+ coordinates: Array<Array<Coordinates>>;
9
+ };
10
+ export declare enum ShapeType {
11
+ AdministrativeDistrict = "administrative_district",
12
+ Block = "block",
13
+ Complex = "complex",
14
+ District = "district",
15
+ House = "house",
16
+ Microdistrict = "microdistrict"
17
+ }
18
+ export declare type Shape = {
19
+ geometry: Polygon | MultiPolygon;
20
+ id: number;
21
+ name: string;
22
+ type: ShapeType;
23
+ };
24
+ export {};
@@ -0,0 +1,7 @@
1
+ export * from './Address';
2
+ export * from './AddressBTIParams';
3
+ export * from './AddressMetroDistance';
4
+ export * from './Image';
5
+ export * from './Realty';
6
+ export * from './RealtyOffer';
7
+ export * from './Shape';
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.1.118",
2
+ "version": "0.1.119",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
@@ -51,7 +51,7 @@ export * from './serviceRequest/findServiceRequestActivities';
51
51
  export * from './serviceRequest/findServiceRequestById';
52
52
  export * from './serviceRequest/findServiceRequestDuplicates';
53
53
  export * from './serviceRequest/findServiceRequests';
54
- export * from './serviceRequest/findServiceRequestSellerReport';
54
+ export * from './serviceRequest/findServiceRequestSellerReports';
55
55
  export * from './serviceRequest/findServiceRequestShortInfo';
56
56
  export * from './serviceRequest/findServiceRequestShortInfoById';
57
57
  export * from './serviceRequest/findServiceRequestShortInfoByDealId';
@@ -8,30 +8,30 @@ type ErrorData = { success: false; data: { error: string } };
8
8
  type ResultData = { ids: string[]; byId: Record<string, ServiceRequestSellerReport>; meta: { total: number } };
9
9
  type ResultError = ErrorData['data']['error'];
10
10
 
11
- export type FindServiceRequestSellerReportParams = {
11
+ export type FindServiceRequestSellerReportsParams = {
12
12
  sorting?: {
13
13
  type: 'createdAt';
14
14
  direction: 'asc' | 'desc';
15
15
  };
16
16
  limits?: { page?: number; count?: number | 'all' };
17
17
  };
18
- export type FindServiceRequestSellerReportUrlParams = { id: number };
19
- export type FindServiceRequestSellerReportHeaders = { 'x-auth-hc': string };
20
- export type FindServiceRequestSellerReportData = AxiosResponse<ResultData>;
21
- export type FindServiceRequestSellerReportError = AxiosError<ResultError>;
22
- export type FindServiceRequestSellerReportConfig = {
18
+ export type FindServiceRequestSellerReportsUrlParams = { id: number };
19
+ export type FindServiceRequestSellerReportsHeaders = { 'x-auth-hc': string };
20
+ export type FindServiceRequestSellerReportsData = AxiosResponse<ResultData>;
21
+ export type FindServiceRequestSellerReportsError = AxiosError<ResultError>;
22
+ export type FindServiceRequestSellerReportsConfig = {
23
23
  baseURL?: string;
24
- urlParams: FindServiceRequestSellerReportUrlParams;
25
- params: FindServiceRequestSellerReportParams;
26
- headers?: FindServiceRequestSellerReportHeaders;
24
+ urlParams: FindServiceRequestSellerReportsUrlParams;
25
+ params: FindServiceRequestSellerReportsParams;
26
+ headers?: FindServiceRequestSellerReportsHeaders;
27
27
  };
28
28
 
29
- export function findServiceRequestSellerReportRequest({
29
+ export function findServiceRequestSellerReportsRequest({
30
30
  baseURL = 'https://clients.homeapp.ru',
31
31
  urlParams,
32
32
  headers,
33
33
  params,
34
- }: FindServiceRequestSellerReportConfig) {
34
+ }: FindServiceRequestSellerReportsConfig) {
35
35
  return axios
36
36
  .get(`/api/service-request/${urlParams.id}/report-for-seller`, {
37
37
  baseURL,
@@ -55,8 +55,8 @@ export function findServiceRequestSellerReportRequest({
55
55
  },
56
56
  ],
57
57
  })
58
- .then((res: FindServiceRequestSellerReportData) => res)
59
- .catch((err: FindServiceRequestSellerReportError) => {
58
+ .then((res: FindServiceRequestSellerReportsData) => res)
59
+ .catch((err: FindServiceRequestSellerReportsError) => {
60
60
  throw err;
61
61
  });
62
62
  }
@@ -347,12 +347,12 @@ export class Api {
347
347
  return api.startServiceRequestModerationForOldRealtyRequest({ urlParams, headers, baseURL: this.baseURL });
348
348
  };
349
349
 
350
- findServiceRequestSellerReport = (
351
- urlParams: api.FindServiceRequestSellerReportUrlParams,
352
- params: api.FindServiceRequestSellerReportParams,
353
- headers: api.FindServiceRequestSellerReportHeaders
350
+ findServiceRequestSellerReports = (
351
+ urlParams: api.FindServiceRequestSellerReportsUrlParams,
352
+ params: api.FindServiceRequestSellerReportsParams,
353
+ headers: api.FindServiceRequestSellerReportsHeaders
354
354
  ) => {
355
- return api.findServiceRequestSellerReportRequest({ urlParams, params, headers, baseURL: this.baseURL });
355
+ return api.findServiceRequestSellerReportsRequest({ urlParams, params, headers, baseURL: this.baseURL });
356
356
  };
357
357
 
358
358
  // sold
@@ -1 +1,3 @@
1
- export * from './complexes/findComplexIds';
1
+ export * from './complex/findComplexIds';
2
+
3
+ export * from './realty/findRealties';
@@ -0,0 +1,54 @@
1
+ import axios, { AxiosResponse, AxiosError, AxiosTransformer } from 'axios';
2
+ import qs from 'qs';
3
+ import { Realty } from '../../../types';
4
+
5
+ type SuccessData = { success: true; data: Realty[]; pageParams: { page: number; length: number } };
6
+ type ErrorData = { success: false; data: Record<'error' | 'message', string> };
7
+
8
+ type ResultData = { ids: number[]; byId: Record<string, Realty>; meta: { total: number } };
9
+ type ResultError = string;
10
+
11
+ export type FindRealtiesHeaders = { 'x-auth-hc': string };
12
+ export type FindRealtiesParams = {
13
+ filter?: { id?: number | number[] };
14
+ limits?: { page?: number; count?: number | 'all' };
15
+ sorting?: { direction: 'asc' | 'desc'; type: 'createdAt' | 'id' };
16
+ };
17
+ export type FindRealtiesData = AxiosResponse<ResultData>;
18
+ export type FindRealtiesError = AxiosError<ResultError>;
19
+ export type FindRealtiesConfig = {
20
+ baseURL?: string;
21
+ params: FindRealtiesParams;
22
+ };
23
+
24
+ export function findRealtiesRequest({ baseURL = 'https://clients.homeapp.ru', params }: FindRealtiesConfig) {
25
+ return axios
26
+ .get('/api/realty', {
27
+ baseURL,
28
+ params,
29
+ paramsSerializer: params => qs.stringify(params, { arrayFormat: 'brackets' }),
30
+ headers: { Accept: 'application/json' },
31
+ transformResponse: [
32
+ ...(axios.defaults.transformResponse as AxiosTransformer[]),
33
+ (data: SuccessData | ErrorData): ResultData | ResultError => {
34
+ if (!data.success) {
35
+ return data.data.error || data.data.message;
36
+ }
37
+
38
+ const ids: ResultData['ids'] = [];
39
+ const byId: ResultData['byId'] = {};
40
+
41
+ data.data.forEach(entity => {
42
+ byId[entity.id] = entity;
43
+ ids.push(entity.id);
44
+ });
45
+
46
+ return { ids, byId, meta: { total: data.pageParams.length } };
47
+ },
48
+ ],
49
+ })
50
+ .then((res: FindRealtiesData) => res)
51
+ .catch((err: FindRealtiesError) => {
52
+ throw err;
53
+ });
54
+ }
@@ -0,0 +1,25 @@
1
+ import { AddressBTIParamsParking, AddressBTIParamsWallsMaterial, AddressBTIParamsHeatingType } from '../types';
2
+
3
+ export const AddressBTIParamsDictionary = {
4
+ Parking: {
5
+ [AddressBTIParamsParking.Ground]: 'Наземная',
6
+ [AddressBTIParamsParking.Multilevel]: 'Многоуровневая',
7
+ [AddressBTIParamsParking.Underground]: 'Подземная',
8
+ },
9
+ WallsMaterial: {
10
+ [AddressBTIParamsWallsMaterial.Brick]: 'Кирпичный',
11
+ [AddressBTIParamsWallsMaterial.Monolith]: 'Монолитный',
12
+ [AddressBTIParamsWallsMaterial.Monobrick]: 'Монолитно-кирпичный',
13
+ [AddressBTIParamsWallsMaterial.Timber]: 'Деревянный',
14
+ [AddressBTIParamsWallsMaterial.Panel]: 'Панельный',
15
+ [AddressBTIParamsWallsMaterial.Block]: 'Блочный',
16
+ },
17
+ HeatingType: {
18
+ [AddressBTIParamsHeatingType.None]: 'Нет',
19
+ [AddressBTIParamsHeatingType.Central]: 'Центральное',
20
+ [AddressBTIParamsHeatingType.Local]: 'Отдельное',
21
+ [AddressBTIParamsHeatingType.Gas]: 'Газовое',
22
+ [AddressBTIParamsHeatingType.Electricity]: 'Электрическое',
23
+ [AddressBTIParamsHeatingType.Liquid]: 'Жидкое топливо',
24
+ },
25
+ };