@hapl/api-queries 0.2.63 → 0.2.64
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/dist/api-queries.cjs.development.js +723 -667
- package/dist/api-queries.cjs.development.js.map +1 -1
- package/dist/api-queries.cjs.production.min.js +1 -1
- package/dist/api-queries.cjs.production.min.js.map +1 -1
- package/dist/api-queries.esm.js +723 -667
- package/dist/api-queries.esm.js.map +1 -1
- package/dist/clients/v1/api/index.d.ts +1 -0
- package/dist/clients/v1/api/phone/callbackPhone.d.ts +29 -0
- package/dist/clients/v1/api/serviceRequest/callbackServiceRequest.d.ts +1 -1
- package/dist/clients/v1/index.d.ts +2 -1
- package/dist/clients/v1/types/Contract.d.ts +0 -9
- package/package.json +1 -1
- package/src/clients/v1/api/index.ts +1 -0
- package/src/clients/v1/api/phone/callbackPhone.ts +38 -0
- package/src/clients/v1/api/serviceRequest/callbackServiceRequest.ts +1 -1
- package/src/clients/v1/index.ts +9 -5
- package/src/clients/v1/types/Contract.ts +0 -10
|
@@ -126,6 +126,7 @@ export * from './payslip/findPayslips';
|
|
|
126
126
|
export * from './payslip/findPayslipById';
|
|
127
127
|
export * from './payslip/updatePayslip';
|
|
128
128
|
export * from './phone/findPhones';
|
|
129
|
+
export * from './phone/callbackPhone';
|
|
129
130
|
export * from './phone/blockPhone';
|
|
130
131
|
export * from './phone/unblockPhone';
|
|
131
132
|
export * from './phoneBookContact/createPhoneBookContact';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { AxiosResponse, AxiosError } from 'axios';
|
|
2
|
+
import { Call } from '../../types';
|
|
3
|
+
declare type SuccessData = {
|
|
4
|
+
success: true;
|
|
5
|
+
data: Partial<Call> & Required<Pick<Call, 'id'>>;
|
|
6
|
+
};
|
|
7
|
+
declare type ErrorData = {
|
|
8
|
+
success: false;
|
|
9
|
+
data: {
|
|
10
|
+
error: string;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
declare type ResultData = SuccessData['data'];
|
|
14
|
+
declare type ResultError = ErrorData['data']['error'];
|
|
15
|
+
export declare type CallbackPhoneHeaders = {
|
|
16
|
+
'x-auth-hc': string;
|
|
17
|
+
};
|
|
18
|
+
export declare type CallbackPhoneUrlParams = {
|
|
19
|
+
phoneNumber: string;
|
|
20
|
+
};
|
|
21
|
+
export declare type CallbackPhoneData = AxiosResponse<ResultData>;
|
|
22
|
+
export declare type CallbackPhoneError = AxiosError<ResultError>;
|
|
23
|
+
export declare type CallbackPhoneConfig = {
|
|
24
|
+
baseURL?: string;
|
|
25
|
+
urlParams: CallbackPhoneUrlParams;
|
|
26
|
+
headers: CallbackPhoneHeaders;
|
|
27
|
+
};
|
|
28
|
+
export declare function callbackPhoneRequest({ baseURL, urlParams, headers, }: CallbackPhoneConfig): Promise<CallbackPhoneData>;
|
|
29
|
+
export {};
|
|
@@ -25,5 +25,5 @@ export declare type CallbackServiceRequestConfig = {
|
|
|
25
25
|
urlParams: CallbackServiceRequestUrlParams;
|
|
26
26
|
headers: CallbackServiceRequestHeaders;
|
|
27
27
|
};
|
|
28
|
-
export declare function
|
|
28
|
+
export declare function callbackServiceRequestRequest({ baseURL, urlParams, headers, }: CallbackServiceRequestConfig): Promise<CallbackServiceRequestData>;
|
|
29
29
|
export {};
|
|
@@ -129,8 +129,9 @@ export declare class Api {
|
|
|
129
129
|
findPayslips: (params: api.FindPayslipsParams, headers: api.FindPayslipsHeaders) => Promise<api.FindPayslipsData>;
|
|
130
130
|
findPayslipById: (urlParams: api.FindPayslipByIdUrlParams, headers: api.FindPayslipByIdHeaders) => Promise<api.FindPayslipByIdData>;
|
|
131
131
|
updatePayslip: (urlParams: api.UpdatePayslipUrlParams, body: api.UpdatePayslipBody, headers: api.UpdatePayslipHeaders) => Promise<api.UpdatePayslipData>;
|
|
132
|
-
findPhones: (params: api.FindPhonesParams, headers: api.FindPayslipsHeaders) => Promise<api.FindPhonesData>;
|
|
133
132
|
blockPhone: (urlParams: api.BlockPhoneUrlParams, headers: api.BlockPhoneHeaders) => Promise<api.BlockPhoneData>;
|
|
133
|
+
callbackPhone: (urlParams: api.CallbackPhoneUrlParams, headers: api.CallbackPhoneHeaders) => Promise<api.CallbackPhoneData>;
|
|
134
|
+
findPhones: (params: api.FindPhonesParams, headers: api.FindPayslipsHeaders) => Promise<api.FindPhonesData>;
|
|
134
135
|
unblockPhone: (urlParams: api.UnblockPhoneUrlParams, headers: api.UnblockPhoneHeaders) => Promise<api.UnblockPhoneData>;
|
|
135
136
|
createPhoneBookContact: (body: api.CreatePhoneBookContactBody, headers: api.CreatePhoneBookContactHeaders) => Promise<api.CreatePhoneBookContactData>;
|
|
136
137
|
findPhoneBookContacts: (params: api.FindPhoneBookContactsParams, headers: api.FindPhoneBookContactsHeaders) => Promise<api.FindPhoneBookContactsData>;
|
|
@@ -47,21 +47,12 @@ export declare type Contract = {
|
|
|
47
47
|
amountPenalty?: MoneyAmount;
|
|
48
48
|
amountReceived?: MoneyAmount;
|
|
49
49
|
approvedAt?: string;
|
|
50
|
-
closedAt?: string;
|
|
51
50
|
comment?: string;
|
|
52
|
-
commissionAt?: string;
|
|
53
|
-
commissionPlannedAt?: string;
|
|
54
51
|
canTerminate?: boolean;
|
|
55
52
|
deal?: Partial<Deal> & {
|
|
56
53
|
id: number;
|
|
57
54
|
};
|
|
58
|
-
dealSignPlannedAt?: string;
|
|
59
|
-
dealSignedAt?: string;
|
|
60
55
|
declinedAt?: string;
|
|
61
|
-
developerCommission?: MoneyAmount;
|
|
62
|
-
prepaidAt?: string;
|
|
63
|
-
prepaymentPlannedAt?: string;
|
|
64
|
-
registerPlannedAt?: string;
|
|
65
56
|
reason?: string;
|
|
66
57
|
signPlannedAt?: string;
|
|
67
58
|
signedAt?: string;
|
package/package.json
CHANGED
|
@@ -152,6 +152,7 @@ export * from './payslip/findPayslipById';
|
|
|
152
152
|
export * from './payslip/updatePayslip';
|
|
153
153
|
|
|
154
154
|
export * from './phone/findPhones';
|
|
155
|
+
export * from './phone/callbackPhone';
|
|
155
156
|
export * from './phone/blockPhone';
|
|
156
157
|
export * from './phone/unblockPhone';
|
|
157
158
|
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import axios, { AxiosResponse, AxiosError, AxiosResponseTransformer } from 'axios';
|
|
2
|
+
import { Call } from '../../types';
|
|
3
|
+
|
|
4
|
+
type SuccessData = { success: true; data: Partial<Call> & Required<Pick<Call, 'id'>> };
|
|
5
|
+
type ErrorData = { success: false; data: { error: string } };
|
|
6
|
+
|
|
7
|
+
type ResultData = SuccessData['data'];
|
|
8
|
+
type ResultError = ErrorData['data']['error'];
|
|
9
|
+
|
|
10
|
+
export type CallbackPhoneHeaders = { 'x-auth-hc': string };
|
|
11
|
+
export type CallbackPhoneUrlParams = { phoneNumber: string };
|
|
12
|
+
export type CallbackPhoneData = AxiosResponse<ResultData>;
|
|
13
|
+
export type CallbackPhoneError = AxiosError<ResultError>;
|
|
14
|
+
export type CallbackPhoneConfig = {
|
|
15
|
+
baseURL?: string;
|
|
16
|
+
urlParams: CallbackPhoneUrlParams;
|
|
17
|
+
headers: CallbackPhoneHeaders;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export function callbackPhoneRequest({
|
|
21
|
+
baseURL = 'https://clients.homeapp.ru',
|
|
22
|
+
urlParams,
|
|
23
|
+
headers,
|
|
24
|
+
}: CallbackPhoneConfig) {
|
|
25
|
+
return axios
|
|
26
|
+
.post(`/api/phone/callback/${urlParams.phoneNumber}`, null, {
|
|
27
|
+
baseURL,
|
|
28
|
+
headers: { Accept: 'application/json', ...headers },
|
|
29
|
+
transformResponse: [
|
|
30
|
+
...(axios.defaults.transformResponse as AxiosResponseTransformer[]),
|
|
31
|
+
(data: SuccessData | ErrorData): ResultData | ResultError => (data.success ? data.data : data.data.error),
|
|
32
|
+
],
|
|
33
|
+
})
|
|
34
|
+
.then((res: CallbackPhoneData) => res)
|
|
35
|
+
.catch((err: CallbackPhoneError) => {
|
|
36
|
+
throw err;
|
|
37
|
+
});
|
|
38
|
+
}
|
|
@@ -17,7 +17,7 @@ export type CallbackServiceRequestConfig = {
|
|
|
17
17
|
headers: CallbackServiceRequestHeaders;
|
|
18
18
|
};
|
|
19
19
|
|
|
20
|
-
export function
|
|
20
|
+
export function callbackServiceRequestRequest({
|
|
21
21
|
baseURL = 'https://clients.homeapp.ru',
|
|
22
22
|
urlParams,
|
|
23
23
|
headers,
|
package/src/clients/v1/index.ts
CHANGED
|
@@ -793,14 +793,18 @@ export class Api {
|
|
|
793
793
|
|
|
794
794
|
// phone
|
|
795
795
|
|
|
796
|
-
findPhones = async (params: api.FindPhonesParams, headers: api.FindPayslipsHeaders) => {
|
|
797
|
-
return api.findPhonesRequest({ params, headers, baseURL: await this.baseURL });
|
|
798
|
-
};
|
|
799
|
-
|
|
800
796
|
blockPhone = async (urlParams: api.BlockPhoneUrlParams, headers: api.BlockPhoneHeaders) => {
|
|
801
797
|
return api.blockPhoneRequest({ urlParams, headers, baseURL: await this.baseURL });
|
|
802
798
|
};
|
|
803
799
|
|
|
800
|
+
callbackPhone = async (urlParams: api.CallbackPhoneUrlParams, headers: api.CallbackPhoneHeaders) => {
|
|
801
|
+
return api.callbackPhoneRequest({ urlParams, headers, baseURL: await this.baseURL });
|
|
802
|
+
};
|
|
803
|
+
|
|
804
|
+
findPhones = async (params: api.FindPhonesParams, headers: api.FindPayslipsHeaders) => {
|
|
805
|
+
return api.findPhonesRequest({ params, headers, baseURL: await this.baseURL });
|
|
806
|
+
};
|
|
807
|
+
|
|
804
808
|
unblockPhone = async (urlParams: api.UnblockPhoneUrlParams, headers: api.UnblockPhoneHeaders) => {
|
|
805
809
|
return api.unblockPhoneRequest({ urlParams, headers, baseURL: await this.baseURL });
|
|
806
810
|
};
|
|
@@ -898,7 +902,7 @@ export class Api {
|
|
|
898
902
|
urlParams: api.CallbackServiceRequestUrlParams,
|
|
899
903
|
headers: api.CallbackServiceRequestHeaders
|
|
900
904
|
) => {
|
|
901
|
-
return api.
|
|
905
|
+
return api.callbackServiceRequestRequest({ urlParams, headers, baseURL: await this.baseURL });
|
|
902
906
|
};
|
|
903
907
|
|
|
904
908
|
closeServiceRequest = async (
|
|
@@ -44,25 +44,15 @@ export type Contract = {
|
|
|
44
44
|
serviceRequest: Partial<ServiceRequest> & { id: number };
|
|
45
45
|
status: ContractStatus;
|
|
46
46
|
type: ContractType;
|
|
47
|
-
|
|
48
47
|
accountingDoc?: string;
|
|
49
48
|
amountDue?: number;
|
|
50
49
|
amountPenalty?: MoneyAmount;
|
|
51
50
|
amountReceived?: MoneyAmount;
|
|
52
51
|
approvedAt?: string;
|
|
53
|
-
closedAt?: string;
|
|
54
52
|
comment?: string;
|
|
55
|
-
commissionAt?: string;
|
|
56
|
-
commissionPlannedAt?: string;
|
|
57
53
|
canTerminate?: boolean;
|
|
58
54
|
deal?: Partial<Deal> & { id: number };
|
|
59
|
-
dealSignPlannedAt?: string;
|
|
60
|
-
dealSignedAt?: string;
|
|
61
55
|
declinedAt?: string;
|
|
62
|
-
developerCommission?: MoneyAmount;
|
|
63
|
-
prepaidAt?: string;
|
|
64
|
-
prepaymentPlannedAt?: string;
|
|
65
|
-
registerPlannedAt?: string;
|
|
66
56
|
reason?: string;
|
|
67
57
|
signPlannedAt?: string;
|
|
68
58
|
signedAt?: string;
|