@hapl/api-queries 0.2.14 → 0.2.15--canary.134.247c9c3.0

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 (112) hide show
  1. package/CHANGELOG.md +0 -24
  2. package/dist/api-queries.cjs.development.js +6283 -4255
  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 +6283 -4255
  7. package/dist/api-queries.esm.js.map +1 -1
  8. package/dist/clients/v1/api/bill/createBill/index.d.ts +0 -2
  9. package/dist/clients/v1/api/buyer/closeBuyer/index.d.ts +37 -0
  10. package/dist/clients/v1/api/buyer/findBuyerById/index.d.ts +33 -0
  11. package/dist/clients/v1/api/buyer/findBuyerStatuses/index.d.ts +36 -0
  12. package/dist/clients/v1/api/buyer/findBuyerUniquePhones/index.d.ts +23 -0
  13. package/dist/clients/v1/api/buyer/findBuyers/index.d.ts +15 -2
  14. package/dist/clients/v1/api/buyer/resetBuyerStatusTimer/index.d.ts +29 -0
  15. package/dist/clients/v1/api/buyer/shareBuyer/index.d.ts +33 -0
  16. package/dist/clients/v1/api/buyer/updateBuyer/index.d.ts +38 -0
  17. package/dist/clients/v1/api/call/createCallComment/index.d.ts +33 -0
  18. package/dist/clients/v1/api/call/findCallById/index.d.ts +29 -0
  19. package/dist/clients/v1/api/callTask/callCallTask.d.ts +29 -0
  20. package/dist/clients/v1/api/callTask/closeCallTask.d.ts +35 -0
  21. package/dist/clients/v1/api/callTask/findCallQualityAssessors.d.ts +35 -0
  22. package/dist/clients/v1/api/callTask/findCallTaskById.d.ts +29 -0
  23. package/dist/clients/v1/api/callTask/findCallTasks.d.ts +9 -3
  24. package/dist/clients/v1/api/callTask/updateCallTask.d.ts +24 -0
  25. package/dist/clients/v1/api/comment/findComments/index.d.ts +41 -0
  26. package/dist/clients/v1/api/deal/findDealExpertStatistics/index.d.ts +39 -0
  27. package/dist/clients/v1/api/index.d.ts +39 -7
  28. package/dist/clients/v1/api/messenger/findMessengerInviteLinks/index.d.ts +31 -0
  29. package/dist/clients/v1/api/motivationCalculator/createMotivationCalculatorRequest/index.d.ts +37 -0
  30. package/dist/clients/v1/api/motivationGlossary/findMotivationGlossary/index.d.ts +29 -0
  31. package/dist/clients/v1/api/motivationStatus/findMotivationStatus/index.d.ts +35 -0
  32. package/dist/clients/v1/api/payslip/findPayslipById.d.ts +29 -0
  33. package/dist/clients/v1/api/payslip/findPayslips.d.ts +56 -0
  34. package/dist/clients/v1/api/payslip/updatePayslip.d.ts +35 -0
  35. package/dist/clients/v1/api/realty/findRealtyPriceHistory/index.d.ts +39 -0
  36. package/dist/clients/v1/api/serviceRequest/buyer/findBuyerRejectionReasonStatistic/index.d.ts +36 -0
  37. package/dist/clients/v1/api/serviceRequest/buyer/findBuyerStatusStatistic/index.d.ts +40 -0
  38. package/dist/clients/v1/api/serviceRequest/chat/findChatsByServiceRequestId/index.d.ts +28 -0
  39. package/dist/clients/v1/api/serviceRequest/chat/message/findChatMessageByServiceRequestId/index.d.ts +43 -0
  40. package/dist/clients/v1/api/serviceRequest/createServiceRequestSellerReport/index.d.ts +31 -0
  41. package/dist/clients/v1/api/serviceRequest/findServiceRequestCategoryById/index.d.ts +44 -0
  42. package/dist/clients/v1/api/serviceRequest/restoreServiceRequest/index.d.ts +28 -0
  43. package/dist/clients/v1/api/slack/createCianRating/index.d.ts +29 -0
  44. package/dist/clients/v1/api/task/findTasks/index.d.ts +4 -0
  45. package/dist/clients/v1/api/user/findUsers/index.d.ts +2 -0
  46. package/dist/clients/v1/dictionaries/Bill.d.ts +1 -1
  47. package/dist/clients/v1/dictionaries/CallTask.d.ts +4 -0
  48. package/dist/clients/v1/index.d.ts +32 -0
  49. package/dist/clients/v1/types/Bill.d.ts +1 -3
  50. package/dist/clients/v1/types/Buyer.d.ts +6 -0
  51. package/dist/clients/v1/types/BuyerStatusHistory.d.ts +11 -0
  52. package/dist/clients/v1/types/Call.d.ts +2 -2
  53. package/dist/clients/v1/types/CallTask.d.ts +5 -0
  54. package/dist/clients/v1/types/Comment.d.ts +11 -0
  55. package/dist/clients/v1/types/Message.d.ts +20 -0
  56. package/dist/clients/v1/types/Motivation.d.ts +58 -0
  57. package/dist/clients/v1/types/Payslip.d.ts +61 -0
  58. package/dist/clients/v1/types/PriceHistory.d.ts +9 -0
  59. package/dist/clients/v1/types/index.d.ts +7 -1
  60. package/package.json +1 -1
  61. package/src/clients/v1/api/bill/createBill/index.ts +0 -2
  62. package/src/clients/v1/api/buyer/closeBuyer/index.ts +47 -0
  63. package/src/clients/v1/api/buyer/findBuyerById/index.ts +48 -0
  64. package/src/clients/v1/api/buyer/findBuyerStatuses/index.ts +61 -0
  65. package/src/clients/v1/api/buyer/findBuyerUniquePhones/index.ts +51 -0
  66. package/src/clients/v1/api/buyer/findBuyers/index.ts +17 -2
  67. package/src/clients/v1/api/buyer/resetBuyerStatusTimer/index.ts +42 -0
  68. package/src/clients/v1/api/buyer/shareBuyer/index.ts +40 -0
  69. package/src/clients/v1/api/buyer/updateBuyer/index.ts +48 -0
  70. package/src/clients/v1/api/call/createCallComment/index.ts +41 -0
  71. package/src/clients/v1/api/call/findCallById/index.ts +39 -0
  72. package/src/clients/v1/api/callTask/callCallTask.ts +46 -0
  73. package/src/clients/v1/api/callTask/closeCallTask.ts +45 -0
  74. package/src/clients/v1/api/callTask/findCallQualityAssessors.ts +59 -0
  75. package/src/clients/v1/api/callTask/findCallTaskById.ts +39 -0
  76. package/src/clients/v1/api/callTask/findCallTasks.ts +6 -3
  77. package/src/clients/v1/api/callTask/updateCallTask.ts +49 -0
  78. package/src/clients/v1/api/comment/findComments/index.ts +54 -0
  79. package/src/clients/v1/api/deal/findDealExpertStatistics/index.ts +43 -0
  80. package/src/clients/v1/api/index.ts +42 -7
  81. package/src/clients/v1/api/messenger/findMessengerInviteLinks/index.ts +40 -0
  82. package/src/clients/v1/api/motivationCalculator/createMotivationCalculatorRequest/index.ts +48 -0
  83. package/src/clients/v1/api/motivationGlossary/findMotivationGlossary/index.ts +38 -0
  84. package/src/clients/v1/api/motivationStatus/findMotivationStatus/index.ts +47 -0
  85. package/src/clients/v1/api/payslip/findPayslipById.ts +39 -0
  86. package/src/clients/v1/api/payslip/findPayslips.ts +53 -0
  87. package/src/clients/v1/api/payslip/updatePayslip.ts +45 -0
  88. package/src/clients/v1/api/realty/findRealtyPriceHistory/index.ts +43 -0
  89. package/src/clients/v1/api/serviceRequest/buyer/findBuyerRejectionReasonStatistic/index.ts +44 -0
  90. package/src/clients/v1/api/serviceRequest/buyer/findBuyerStatusStatistic/index.ts +48 -0
  91. package/src/clients/v1/api/serviceRequest/chat/findChatsByServiceRequestId/index.ts +37 -0
  92. package/src/clients/v1/api/serviceRequest/chat/message/findChatMessageByServiceRequestId/index.ts +59 -0
  93. package/src/clients/v1/api/serviceRequest/createServiceRequestSellerReport/index.ts +42 -0
  94. package/src/clients/v1/api/serviceRequest/findServiceRequestCategoryById/index.ts +48 -0
  95. package/src/clients/v1/api/serviceRequest/restoreServiceRequest/index.ts +41 -0
  96. package/src/clients/v1/api/slack/createCianRating/index.ts +34 -0
  97. package/src/clients/v1/api/task/findTasks/index.ts +1 -0
  98. package/src/clients/v1/api/user/findUsers/index.ts +2 -0
  99. package/src/clients/v1/dictionaries/Bill.ts +1 -1
  100. package/src/clients/v1/dictionaries/CallTask.ts +4 -0
  101. package/src/clients/v1/index.ts +257 -5
  102. package/src/clients/v1/types/Bill.ts +1 -3
  103. package/src/clients/v1/types/Buyer.ts +7 -0
  104. package/src/clients/v1/types/BuyerStatusHistory.ts +12 -0
  105. package/src/clients/v1/types/Call.ts +2 -2
  106. package/src/clients/v1/types/CallTask.ts +5 -0
  107. package/src/clients/v1/types/Comment.ts +10 -0
  108. package/src/clients/v1/types/Message.ts +20 -0
  109. package/src/clients/v1/types/Motivation.ts +64 -0
  110. package/src/clients/v1/types/Payslip.ts +62 -0
  111. package/src/clients/v1/types/PriceHistory.ts +7 -0
  112. package/src/clients/v1/types/index.ts +7 -1
@@ -11,11 +11,20 @@ export * from './bill/createBill';
11
11
  export * from './bill/findBills';
12
12
 
13
13
  export * from './buyer/callbackBuyer';
14
+ export * from './buyer/closeBuyer';
14
15
  export * from './buyer/countBuyers';
15
16
  export * from './buyer/createBuyer';
16
17
  export * from './buyer/findBuyerClosingReason';
18
+ export * from './buyer/findBuyerStatuses';
19
+ export * from './buyer/findBuyerUniquePhones';
17
20
  export * from './buyer/findBuyers';
21
+ export * from './buyer/findBuyerById';
22
+ export * from './buyer/resetBuyerStatusTimer';
23
+ export * from './buyer/shareBuyer';
24
+ export * from './buyer/updateBuyer';
18
25
 
26
+ export * from './call/createCallComment';
27
+ export * from './call/findCallById';
19
28
  export * from './call/findCalls';
20
29
  export * from './call/findFirstSuccessOutgoingCalls';
21
30
  export * from './call/markupCall';
@@ -26,8 +35,15 @@ export * from './callCenter/finishOperatorWork';
26
35
  export * from './callCenter/getOperatorStatus';
27
36
  export * from './callCenter/startOperatorWork';
28
37
 
38
+ export * from './callTask/callCallTask';
39
+ export * from './callTask/closeCallTask';
29
40
  export * from './callTask/createCallTask';
41
+ export * from './callTask/findCallQualityAssessors';
42
+ export * from './callTask/findCallTaskById';
30
43
  export * from './callTask/findCallTasks';
44
+ export * from './callTask/updateCallTask';
45
+
46
+ export * from './comment/findComments';
31
47
 
32
48
  export * from './contract/approveContract';
33
49
  export * from './contract/createContract';
@@ -51,6 +67,7 @@ export * from './deal/createDealCategorizedFile';
51
67
  export * from './deal/createDealInvestPrepayment';
52
68
  export * from './deal/deleteDealCategorizedFile';
53
69
  export * from './deal/findDealCategorizedFiles';
70
+ export * from './deal/findDealExpertStatistics';
54
71
  export * from './deal/findDeals';
55
72
  export * from './deal/setDealDoneState';
56
73
  export * from './deal/setDealPrepaymentState';
@@ -90,6 +107,15 @@ export * from './internalCrossSale/findInternalCrossSaleInfo';
90
107
  export * from './internalCrossSale/findInternalCrossSales';
91
108
  export * from './internalCrossSale/updateInternalCrossSale';
92
109
 
110
+ export * from './messenger/findMessengerInviteLinks';
111
+ export * from './motivationCalculator/createMotivationCalculatorRequest';
112
+ export * from './motivationGlossary/findMotivationGlossary';
113
+ export * from './motivationStatus/findMotivationStatus';
114
+
115
+ export * from './payslip/findPayslips';
116
+ export * from './payslip/findPayslipById';
117
+ export * from './payslip/updatePayslip';
118
+
93
119
  export * from './phoneBookContact/createPhoneBookContact';
94
120
  export * from './phoneBookContact/deletePhoneBookContact';
95
121
  export * from './phoneBookContact/findPhoneBookContacts';
@@ -100,43 +126,52 @@ export * from './photoOrder/findPhotoOrders';
100
126
  export * from './photoOrder/sendPhotoOrderFeedback';
101
127
  export * from './photoOrder/terminatePhotoOrder';
102
128
 
129
+ export * from './realty/findRealtyPriceHistory';
103
130
  export * from './realty/findSimilarRealtyIdsById';
104
131
  export * from './realty/subscribeToRealtyUpdates';
105
132
 
106
133
  export * from './serviceRequest/approveCloseServiceRequest';
134
+ export * from './serviceRequest/buyer/findBuyerRejectionReasonStatistic';
135
+ export * from './serviceRequest/buyer/findBuyerStatusStatistic';
107
136
  export * from './serviceRequest/callbackServiceRequest';
137
+ export * from './serviceRequest/chat/findChatsByServiceRequestId';
138
+ export * from './serviceRequest/chat/message/findChatMessageByServiceRequestId';
108
139
  export * from './serviceRequest/closeServiceRequest';
109
140
  export * from './serviceRequest/completeServiceRequestModeration';
110
141
  export * from './serviceRequest/createInvestSellServiceRequest';
111
142
  export * from './serviceRequest/createServiceRequest';
112
- export * from './serviceRequest/createServiceRequestByCrossSaleId';
113
143
  export * from './serviceRequest/createServiceRequestActivity';
144
+ export * from './serviceRequest/createServiceRequestByCrossSaleId';
114
145
  export * from './serviceRequest/createServiceRequestCategorizedFile';
146
+ export * from './serviceRequest/createServiceRequestSellerReport';
115
147
  export * from './serviceRequest/deferServiceRequest';
116
148
  export * from './serviceRequest/deleteServiceRequestCategorizedFile';
117
149
  export * from './serviceRequest/deleteServiceRequestReportForSeller';
150
+ export * from './serviceRequest/depublishServiceRequest';
118
151
  export * from './serviceRequest/disapproveCloseServiceRequest';
152
+ export * from './serviceRequest/findPriceHistoryAnalyticsById';
119
153
  export * from './serviceRequest/findServiceRequestActivities';
120
154
  export * from './serviceRequest/findServiceRequestById';
155
+ export * from './serviceRequest/findServiceRequestCategorizedFileCreatedDate';
156
+ export * from './serviceRequest/findServiceRequestCategorizedFiles';
157
+ export * from './serviceRequest/findServiceRequestCategoryById';
121
158
  export * from './serviceRequest/findServiceRequestDuplicates';
122
- export * from './serviceRequest/findServiceRequests';
123
159
  export * from './serviceRequest/findServiceRequestSellerReports';
124
160
  export * from './serviceRequest/findServiceRequestShortInfo';
125
161
  export * from './serviceRequest/findServiceRequestShortInfoByDealId';
126
162
  export * from './serviceRequest/findServiceRequestShortInfoById';
127
163
  export * from './serviceRequest/findServiceRequestStatisticsById';
128
- export * from './serviceRequest/findServiceRequestCategorizedFiles';
129
- export * from './serviceRequest/findServiceRequestCategorizedFileCreatedDate';
130
- export * from './serviceRequest/findPriceHistoryAnalyticsById';
164
+ export * from './serviceRequest/findServiceRequests';
165
+ export * from './serviceRequest/publishServiceRequest';
166
+ export * from './serviceRequest/restoreServiceRequest';
131
167
  export * from './serviceRequest/returnDeferredServiceRequest';
132
168
  export * from './serviceRequest/sendServiceRequestToModeration';
133
169
  export * from './serviceRequest/startServiceRequestModeration';
134
170
  export * from './serviceRequest/startServiceRequestModerationForOldRealty';
135
- export * from './serviceRequest/publishServiceRequest';
136
- export * from './serviceRequest/depublishServiceRequest';
137
171
  export * from './serviceRequest/transferServiceRequest';
138
172
  export * from './serviceRequest/updateServiceRequest';
139
173
 
174
+ export * from './slack/createCianRating';
140
175
  export * from './soldStatistic/findSoldStatistic';
141
176
 
142
177
  export * from './user/assignSubordinateUsers';
@@ -0,0 +1,40 @@
1
+ import axios, { AxiosResponse, AxiosError, AxiosTransformer } from 'axios';
2
+
3
+ type SuccessData = {
4
+ success: true;
5
+ data: { type: 'telegram'; uri: string }[];
6
+ };
7
+ type ErrorData = { success: false; data: { error: string } };
8
+
9
+ type ResultData = SuccessData['data'];
10
+ type ResultError = ErrorData['data']['error'];
11
+
12
+ export type FindMessengerInviteLinksHeaders = { 'x-auth-hc': string };
13
+ export type FindMessengerInviteLinksUrlParams = { id: number };
14
+ export type FindMessengerInviteLinksData = AxiosResponse<ResultData>;
15
+ export type FindMessengerInviteLinksError = AxiosError<ResultError>;
16
+ export type FindMessengerInviteLinksConfig = {
17
+ baseURL?: string;
18
+ headers: FindMessengerInviteLinksHeaders;
19
+ urlParams: FindMessengerInviteLinksUrlParams;
20
+ };
21
+
22
+ export function findMessengerInviteLinksRequest({
23
+ baseURL = 'https://clients.homeapp.ru',
24
+ urlParams,
25
+ headers,
26
+ }: FindMessengerInviteLinksConfig) {
27
+ return axios
28
+ .get(`/api/motivation-status/${urlParams.id}`, {
29
+ baseURL,
30
+ headers: { Accept: 'application/json', ...headers },
31
+ transformResponse: [
32
+ ...(axios.defaults.transformResponse as AxiosTransformer[]),
33
+ (data: SuccessData | ErrorData): ResultData | ResultError => (data.success ? data.data : data.data.error),
34
+ ],
35
+ })
36
+ .then((res: FindMessengerInviteLinksData) => res)
37
+ .catch((err: FindMessengerInviteLinksError) => {
38
+ throw err;
39
+ });
40
+ }
@@ -0,0 +1,48 @@
1
+ import axios, { AxiosResponse, AxiosError, AxiosTransformer } from 'axios';
2
+ import { MotivationCommission, MotivationServiceTypeValues } from '../../../types';
3
+
4
+ type SuccessData = { success: true; data: MotivationCommission };
5
+ type ErrorData = { success: false; data: { error: string } };
6
+
7
+ type ResultData = SuccessData['data'];
8
+ type ResultError = ErrorData['data']['error'];
9
+
10
+ export type CreateMotivationCalculatorRequestHeaders = { 'x-auth-hc': string };
11
+ export type CreateMotivationCalculatorRequestBody = {
12
+ serviceType: MotivationServiceTypeValues;
13
+ price: number;
14
+ commission: number;
15
+ val: number;
16
+ partnerCommission?: number;
17
+ developerCommission?: number;
18
+ legalDiligenceCount?: number;
19
+ isLowCommissionBonusFineByROP?: boolean;
20
+ isTrainee?: boolean;
21
+ };
22
+ export type CreateMotivationCalculatorRequestData = AxiosResponse<ResultData>;
23
+ export type CreateMotivationCalculatorRequestError = AxiosError<ResultError>;
24
+ export type CreateMotivationCalculatorRequestConfig = {
25
+ baseURL?: string;
26
+ body: CreateMotivationCalculatorRequestBody;
27
+ headers: CreateMotivationCalculatorRequestHeaders;
28
+ };
29
+
30
+ export function createMotivationCalculatorRequest({
31
+ baseURL = 'https://clients.homeapp.ru',
32
+ body,
33
+ headers,
34
+ }: CreateMotivationCalculatorRequestConfig) {
35
+ return axios
36
+ .post('/api/motivation-calculator', body, {
37
+ baseURL,
38
+ headers: { Accept: 'application/json', 'Content-Type': 'application/json', ...headers },
39
+ transformResponse: [
40
+ ...(axios.defaults.transformResponse as AxiosTransformer[]),
41
+ (data: SuccessData | ErrorData): ResultData | ResultError => (data.success ? data.data : data.data.error),
42
+ ],
43
+ })
44
+ .then((res: CreateMotivationCalculatorRequestData) => res)
45
+ .catch((err: CreateMotivationCalculatorRequestError) => {
46
+ throw err;
47
+ });
48
+ }
@@ -0,0 +1,38 @@
1
+ import axios, { AxiosResponse, AxiosError, AxiosTransformer } from 'axios';
2
+ import { MotivationMinCommission, MotivationStep } from '../../../types';
3
+
4
+ type SuccessData = {
5
+ success: true;
6
+ data: { minCommission: MotivationMinCommission; highCommissionBonusPercent: number; steps: MotivationStep[] };
7
+ };
8
+ type ErrorData = { success: false; data: { error: string } };
9
+
10
+ type ResultData = SuccessData['data'];
11
+ type ResultError = ErrorData['data']['error'];
12
+
13
+ export type FindMotivationGlossaryHeaders = { 'x-auth-hc': string };
14
+ export type FindMotivationGlossaryData = AxiosResponse<ResultData>;
15
+ export type FindMotivationGlossaryError = AxiosError<ResultError>;
16
+ export type FindMotivationGlossaryConfig = {
17
+ baseURL?: string;
18
+ headers: FindMotivationGlossaryHeaders;
19
+ };
20
+
21
+ export function findMotivationGlossaryRequest({
22
+ baseURL = 'https://clients.homeapp.ru',
23
+ headers,
24
+ }: FindMotivationGlossaryConfig) {
25
+ return axios
26
+ .get('/api/motivation-glossary', {
27
+ baseURL,
28
+ headers: { Accept: 'application/json', ...headers },
29
+ transformResponse: [
30
+ ...(axios.defaults.transformResponse as AxiosTransformer[]),
31
+ (data: SuccessData | ErrorData): ResultData | ResultError => (data.success ? data.data : data.data.error),
32
+ ],
33
+ })
34
+ .then((res: FindMotivationGlossaryData) => res)
35
+ .catch((err: FindMotivationGlossaryError) => {
36
+ throw err;
37
+ });
38
+ }
@@ -0,0 +1,47 @@
1
+ import axios, { AxiosResponse, AxiosError, AxiosTransformer } from 'axios';
2
+
3
+ type SuccessData = {
4
+ success: true;
5
+ data: {
6
+ count: number; // количество закрытых сделок за 3 месяца + текущий месяц
7
+ val: number; // суммарная комиссия по сделкам, закрытым за последние 3 месяца + текущий месяц, в руб.
8
+ step: string;
9
+ bonus: number;
10
+ nextBonus?: number;
11
+ neededVal?: number; // необходимая комиссия до следующей ступени, в руб.
12
+ };
13
+ };
14
+ type ErrorData = { success: false; data: { error: string } };
15
+
16
+ type ResultData = SuccessData['data'];
17
+ type ResultError = ErrorData['data']['error'];
18
+
19
+ export type FindMotivationStatusHeaders = { 'x-auth-hc': string };
20
+ export type FindMotivationStatusUrlParams = { id: number };
21
+ export type FindMotivationStatusData = AxiosResponse<ResultData>;
22
+ export type FindMotivationStatusError = AxiosError<ResultError>;
23
+ export type FindMotivationStatusConfig = {
24
+ baseURL?: string;
25
+ headers: FindMotivationStatusHeaders;
26
+ urlParams: FindMotivationStatusUrlParams;
27
+ };
28
+
29
+ export function findMotivationStatusRequest({
30
+ baseURL = 'https://clients.homeapp.ru',
31
+ urlParams,
32
+ headers,
33
+ }: FindMotivationStatusConfig) {
34
+ return axios
35
+ .get(`/api/motivation-status/${urlParams.id}`, {
36
+ baseURL,
37
+ headers: { Accept: 'application/json', ...headers },
38
+ transformResponse: [
39
+ ...(axios.defaults.transformResponse as AxiosTransformer[]),
40
+ (data: SuccessData | ErrorData): ResultData | ResultError => (data.success ? data.data : data.data.error),
41
+ ],
42
+ })
43
+ .then((res: FindMotivationStatusData) => res)
44
+ .catch((err: FindMotivationStatusError) => {
45
+ throw err;
46
+ });
47
+ }
@@ -0,0 +1,39 @@
1
+ import axios, { AxiosResponse, AxiosError, AxiosTransformer } from 'axios';
2
+ import { Payslip } from '../../types';
3
+
4
+ type SuccessData = { success: true; data: Payslip };
5
+ type ErrorData = { success: false; data: { error: string } };
6
+
7
+ type ResultData = SuccessData['data'];
8
+ type ResultError = ErrorData['data']['error'];
9
+
10
+ export type FindPayslipByIdUrlParams = { id: number };
11
+ export type FindPayslipByIdHeaders = { 'x-auth-hc': string };
12
+ export type FindPayslipByIdData = AxiosResponse<ResultData>;
13
+ export type FindPayslipByIdError = AxiosError<ResultError>;
14
+
15
+ export type FindPayslipByIdConfig = {
16
+ baseURL?: string;
17
+ urlParams: FindPayslipByIdUrlParams;
18
+ headers: FindPayslipByIdHeaders;
19
+ };
20
+
21
+ export function findPayslipByIdRequest({
22
+ baseURL = 'https://clients.homeapp.ru',
23
+ urlParams,
24
+ headers,
25
+ }: FindPayslipByIdConfig) {
26
+ return axios
27
+ .get(`/api/payslip/${urlParams.id}`, {
28
+ baseURL,
29
+ headers: { Accept: 'application/json', ...headers },
30
+ transformResponse: [
31
+ ...(axios.defaults.transformResponse as AxiosTransformer[]),
32
+ (data: SuccessData | ErrorData): ResultData | ResultError => (data.success ? data.data : data.data.error),
33
+ ],
34
+ })
35
+ .then((res: FindPayslipByIdData) => res)
36
+ .catch((err: FindPayslipByIdError) => {
37
+ throw err;
38
+ });
39
+ }
@@ -0,0 +1,53 @@
1
+ import axios, { AxiosResponse, AxiosError, AxiosTransformer } from 'axios';
2
+ import qs from 'qs';
3
+ import { Payslip } from '../../types';
4
+
5
+ type SuccessData = { success: true; data: Payslip[]; pageParams: { page: number; length: number } };
6
+ type ErrorData = { success: false; data: { error: string } };
7
+
8
+ type ResultData = { data: SuccessData['data']; meta: { total: number } };
9
+ type ResultError = ErrorData['data']['error'];
10
+
11
+ export type FindPayslipsParams = {
12
+ filter?: {
13
+ dealId?: string | string[];
14
+ 'serviceRequest.id'?: string | string[];
15
+ 'serviceRequest.contract.formalId'?: string;
16
+ 'serviceRequest.curator.id'?: string;
17
+ 'serviceRequest.curator.supervisor.id'?: string;
18
+ closingDate?: string | { from?: string; to?: string };
19
+ };
20
+ sorting?: { type: 'closingDate'; direction: 'asc' | 'desc' };
21
+ limits?: { page?: number; count?: number | 'all' };
22
+ };
23
+
24
+ export type FindPayslipsHeaders = { 'x-auth-hc': string };
25
+ export type FindPayslipsData = AxiosResponse<ResultData>;
26
+ export type FindPayslipsError = AxiosError<ResultError>;
27
+ export type FindPayslipsConfig = {
28
+ baseURL?: string;
29
+ params: FindPayslipsParams;
30
+ headers: FindPayslipsHeaders;
31
+ };
32
+
33
+ export function findPayslipsRequest({ baseURL = 'https://clients.homeapp.ru', headers, params }: FindPayslipsConfig) {
34
+ return axios
35
+ .get('/api/payslip', {
36
+ baseURL,
37
+ params,
38
+ paramsSerializer: params => qs.stringify(params, { arrayFormat: 'brackets' }),
39
+ headers: { Accept: 'application/json', ...headers },
40
+ transformResponse: [
41
+ ...(axios.defaults.transformResponse as AxiosTransformer[]),
42
+ (data: SuccessData | ErrorData): ResultData | ResultError => {
43
+ if (!data.success) return data.data.error;
44
+
45
+ return { data: data.data, meta: { total: data.pageParams.length } };
46
+ },
47
+ ],
48
+ })
49
+ .then((res: FindPayslipsData) => res)
50
+ .catch((err: FindPayslipsError) => {
51
+ throw err;
52
+ });
53
+ }
@@ -0,0 +1,45 @@
1
+ import axios, { AxiosResponse, AxiosError, AxiosTransformer } from 'axios';
2
+ import { Payslip } from '../../types';
3
+
4
+ type SuccessData = { success: true; data: Payslip };
5
+ type ErrorData = { success: false; data: { error: string } };
6
+
7
+ type ResultData = SuccessData['data'];
8
+ type ResultError = ErrorData['data']['error'];
9
+
10
+ export type UpdatePayslipHeaders = { 'x-auth-hc': string };
11
+ export type UpdatePayslipUrlParams = { id: number };
12
+ export type UpdatePayslipBody = {
13
+ financeAdjustment?: string;
14
+ financeComment?: string;
15
+ ifFinalNotification: boolean;
16
+ };
17
+ export type UpdatePayslipData = AxiosResponse<ResultData>;
18
+ export type UpdatePayslipError = AxiosError<ResultError>;
19
+ export type UpdatePayslipConfig = {
20
+ baseURL?: string;
21
+ body: UpdatePayslipBody;
22
+ urlParams: UpdatePayslipUrlParams;
23
+ headers: UpdatePayslipHeaders;
24
+ };
25
+
26
+ export function updatePayslipRequest({
27
+ baseURL = 'https://clients.homeapp.ru',
28
+ urlParams,
29
+ body,
30
+ headers,
31
+ }: UpdatePayslipConfig) {
32
+ return axios
33
+ .post(`/api/payslip/${urlParams.id}`, body, {
34
+ baseURL,
35
+ headers: { Accept: 'application/json', 'Content-Type': 'application/json', ...headers },
36
+ transformResponse: [
37
+ ...(axios.defaults.transformResponse as AxiosTransformer[]),
38
+ (data: SuccessData | ErrorData): ResultData | ResultError => (data.success ? data.data : data.data.error),
39
+ ],
40
+ })
41
+ .then((res: UpdatePayslipData) => res)
42
+ .catch((err: UpdatePayslipError) => {
43
+ throw err;
44
+ });
45
+ }
@@ -0,0 +1,43 @@
1
+ import axios, { AxiosResponse, AxiosError, AxiosTransformer } from 'axios';
2
+ import { PriceHistory } from '../../../types';
3
+ import qs from 'qs';
4
+
5
+ type SuccessData = { success: true; data: PriceHistory[] };
6
+ type ErrorData = { success: false; data: { error: string } };
7
+
8
+ type ResultData = SuccessData['data'];
9
+ type ResultError = ErrorData['data']['error'];
10
+
11
+ export type FindRealtyPriceHistoryParams = {
12
+ filter?: { realtyId?: number | number[]; dateCreated?: { from?: string; to?: string } };
13
+ limits?: { page?: number; count?: number | 'all' };
14
+ sorting?: { type?: 'id' | 'realtyId' | 'dateCreated'; direction?: 'asc' | 'desc' };
15
+ };
16
+
17
+ export type FindRealtyPriceHistoryData = AxiosResponse<ResultData>;
18
+ export type FindRealtyPriceHistoryError = AxiosError<ResultError>;
19
+ export type FindRealtyPriceHistoryConfig = {
20
+ baseURL?: string;
21
+ params: FindRealtyPriceHistoryParams;
22
+ };
23
+
24
+ export function findRealtyPriceHistoryRequest({
25
+ baseURL = 'https://clients.homeapp.ru',
26
+ params,
27
+ }: FindRealtyPriceHistoryConfig) {
28
+ return axios
29
+ .get('/api/crud/price-history', {
30
+ baseURL,
31
+ params,
32
+ paramsSerializer: params => qs.stringify(params, { arrayFormat: 'brackets' }),
33
+ headers: { Accept: 'application/json' },
34
+ transformResponse: [
35
+ ...(axios.defaults.transformResponse as AxiosTransformer[]),
36
+ (data: SuccessData | ErrorData): ResultData | ResultError => (data.success ? data.data : data.data.error),
37
+ ],
38
+ })
39
+ .then((res: FindRealtyPriceHistoryData) => res)
40
+ .catch((err: FindRealtyPriceHistoryError) => {
41
+ throw err;
42
+ });
43
+ }
@@ -0,0 +1,44 @@
1
+ import axios, { AxiosResponse, AxiosError, AxiosTransformer } from 'axios';
2
+ import qs from 'qs';
3
+
4
+ type SuccessData = { success: true; data: { text: string; count: number }[] };
5
+ type ErrorData = { success: false; data: { error: string } };
6
+
7
+ type ResultData = SuccessData['data'];
8
+ type ResultError = ErrorData['data']['error'];
9
+
10
+ export type FindBuyerRejectionReasonStatisticUrlParams = { id: number };
11
+ export type FindBuyerRejectionReasonStatisticParams = { from?: string; to?: string };
12
+ export type FindBuyerRejectionReasonStatisticHeaders = { 'x-auth-hc': string };
13
+ export type FindBuyerRejectionReasonStatisticData = AxiosResponse<ResultData>;
14
+ export type FindBuyerRejectionReasonStatisticError = AxiosError<ResultError>;
15
+
16
+ export type FindBuyerRejectionReasonStatisticConfig = {
17
+ baseURL?: string;
18
+ urlParams: FindBuyerRejectionReasonStatisticUrlParams;
19
+ params: FindBuyerRejectionReasonStatisticParams;
20
+ headers: FindBuyerRejectionReasonStatisticHeaders;
21
+ };
22
+
23
+ export function findBuyerRejectionReasonStatisticRequest({
24
+ baseURL = 'https://clients.homeapp.ru',
25
+ urlParams,
26
+ params,
27
+ headers,
28
+ }: FindBuyerRejectionReasonStatisticConfig) {
29
+ return axios
30
+ .get(`/api/service-request/${urlParams.id}/buyer/closing/rejection-reason/statistic`, {
31
+ baseURL,
32
+ params,
33
+ paramsSerializer: params => qs.stringify(params, { arrayFormat: 'brackets' }),
34
+ headers: { Accept: 'application/json', ...headers },
35
+ transformResponse: [
36
+ ...(axios.defaults.transformResponse as AxiosTransformer[]),
37
+ (data: SuccessData | ErrorData): ResultData | ResultError => (data.success ? data.data ?? [] : data.data.error),
38
+ ],
39
+ })
40
+ .then((res: FindBuyerRejectionReasonStatisticData) => res)
41
+ .catch((err: FindBuyerRejectionReasonStatisticError) => {
42
+ throw err;
43
+ });
44
+ }
@@ -0,0 +1,48 @@
1
+ import axios, { AxiosResponse, AxiosError, AxiosTransformer } from 'axios';
2
+ import { BuyerStatus } from '../../../../types';
3
+ import qs from 'qs';
4
+
5
+ type SuccessData = {
6
+ success: true;
7
+ data: { status: BuyerStatus; values: { buyerId: number; count: number }[] }[];
8
+ };
9
+ type ErrorData = { success: false; data: { error: string } };
10
+
11
+ type ResultData = SuccessData['data'];
12
+ type ResultError = ErrorData['data']['error'];
13
+
14
+ export type FindBuyerStatusStatisticUrlParams = { id: number };
15
+ export type FindBuyerStatusStatisticParams = { from?: string; to?: string };
16
+ export type FindBuyerStatusStatisticHeaders = { 'x-auth-hc': string };
17
+ export type FindBuyerStatusStatisticData = AxiosResponse<ResultData>;
18
+ export type FindBuyerStatusStatisticError = AxiosError<ResultError>;
19
+
20
+ export type FindBuyerStatusStatisticConfig = {
21
+ baseURL?: string;
22
+ urlParams: FindBuyerStatusStatisticUrlParams;
23
+ params: FindBuyerStatusStatisticParams;
24
+ headers: FindBuyerStatusStatisticHeaders;
25
+ };
26
+
27
+ export function findBuyerStatusStatisticRequest({
28
+ baseURL = 'https://clients.homeapp.ru',
29
+ urlParams,
30
+ params,
31
+ headers,
32
+ }: FindBuyerStatusStatisticConfig) {
33
+ return axios
34
+ .get(`/api/service-request/${urlParams.id}/buyer/status/statistic`, {
35
+ baseURL,
36
+ params,
37
+ paramsSerializer: params => qs.stringify(params, { arrayFormat: 'brackets' }),
38
+ headers: { Accept: 'application/json', ...headers },
39
+ transformResponse: [
40
+ ...(axios.defaults.transformResponse as AxiosTransformer[]),
41
+ (data: SuccessData | ErrorData): ResultData | ResultError => (data.success ? data.data : data.data.error),
42
+ ],
43
+ })
44
+ .then((res: FindBuyerStatusStatisticData) => res)
45
+ .catch((err: FindBuyerStatusStatisticError) => {
46
+ throw err;
47
+ });
48
+ }
@@ -0,0 +1,37 @@
1
+ import axios, { AxiosResponse, AxiosError, AxiosTransformer } from 'axios';
2
+
3
+ type SuccessData = { success: true; data: string[] };
4
+ type ErrorData = { success: false; data: { error: string } };
5
+
6
+ type ResultData = SuccessData['data'];
7
+ type ResultError = ErrorData['data']['error'];
8
+
9
+ export type FindChatsByServiceRequestIdHeaders = { 'x-auth-hc': string };
10
+ export type FindChatsByServiceRequestIdUrlParams = { id: number };
11
+ export type FindChatsByServiceRequestIdData = AxiosResponse<ResultData>;
12
+ export type FindChatsByServiceRequestIdError = AxiosError<ResultError>;
13
+ export type FindChatsByServiceRequestIdConfig = {
14
+ baseURL?: string;
15
+ urlParams: FindChatsByServiceRequestIdUrlParams;
16
+ headers: FindChatsByServiceRequestIdHeaders;
17
+ };
18
+
19
+ export function findChatsByServiceRequestIdRequest({
20
+ baseURL = 'https://clients.homeapp.ru',
21
+ headers,
22
+ urlParams,
23
+ }: FindChatsByServiceRequestIdConfig) {
24
+ return axios
25
+ .get(`/api/service-request/${urlParams.id}/chat`, {
26
+ baseURL,
27
+ headers: { Accept: 'application/json', ...headers },
28
+ transformResponse: [
29
+ ...(axios.defaults.transformResponse as AxiosTransformer[]),
30
+ (data: SuccessData | ErrorData): ResultData | ResultError => (data.success ? data.data : data.data.error),
31
+ ],
32
+ })
33
+ .then((res: FindChatsByServiceRequestIdData) => res)
34
+ .catch((err: FindChatsByServiceRequestIdError) => {
35
+ throw err;
36
+ });
37
+ }
@@ -0,0 +1,59 @@
1
+ import axios, { AxiosResponse, AxiosError, AxiosTransformer } from 'axios';
2
+ import qs from 'qs';
3
+ import { Message } from '../../../../../types';
4
+
5
+ type SuccessData = { success: true; data: Message[]; pageParams: { page: number; length: number } };
6
+ type ErrorData = { success: false; data: { error: string } };
7
+
8
+ type ResultData = { ids: number[]; byId: Record<string, Message>; meta: { total: number } };
9
+ type ResultError = ErrorData['data']['error'];
10
+
11
+ export type FindChatMessagesByServiceRequestIdHeaders = { 'x-auth-hc': string };
12
+ export type FindChatMessagesByServiceRequestIdUrlParams = { id: number; srId: number };
13
+ export type FindChatMessagesByServiceRequestIdParams = {
14
+ limits?: { page?: number; count: number | 'all' };
15
+ sorting?: { direction: 'asc' | 'desc'; type: 'date' };
16
+ };
17
+ export type FindChatMessagesByServiceRequestIdData = AxiosResponse<ResultData>;
18
+ export type FindChatMessagesByServiceRequestIdError = AxiosError<ResultError>;
19
+ export type FindChatMessagesByServiceRequestIdConfig = {
20
+ baseURL?: string;
21
+ params?: FindChatMessagesByServiceRequestIdParams;
22
+ urlParams: FindChatMessagesByServiceRequestIdUrlParams;
23
+ headers: FindChatMessagesByServiceRequestIdHeaders;
24
+ };
25
+
26
+ export function findChatMessagesByServiceRequestIdRequest({
27
+ baseURL = 'https://clients.homeapp.ru',
28
+ headers,
29
+ urlParams,
30
+ params,
31
+ }: FindChatMessagesByServiceRequestIdConfig) {
32
+ return axios
33
+ .get(`/api/service-request/${urlParams.srId}/chat/${urlParams.id}/message`, {
34
+ baseURL,
35
+ params,
36
+ paramsSerializer: params => qs.stringify(params, { arrayFormat: 'brackets' }),
37
+ headers: { Accept: 'application/json', ...headers },
38
+ transformResponse: [
39
+ ...(axios.defaults.transformResponse as AxiosTransformer[]),
40
+ (data: SuccessData | ErrorData): ResultData | ResultError => {
41
+ if (!data.success) return data.data.error;
42
+
43
+ const ids: ResultData['ids'] = [];
44
+ const byId: ResultData['byId'] = {};
45
+
46
+ data.data.forEach(entity => {
47
+ byId[entity.id] = entity;
48
+ ids.push(entity.id);
49
+ });
50
+
51
+ return { ids, byId, meta: { total: data.pageParams.length } };
52
+ },
53
+ ],
54
+ })
55
+ .then((res: FindChatMessagesByServiceRequestIdData) => res)
56
+ .catch((err: FindChatMessagesByServiceRequestIdError) => {
57
+ throw err;
58
+ });
59
+ }