@hapl/api-queries 0.1.143 → 0.1.144
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 +12 -0
- package/dist/api-queries.cjs.development.js +62 -0
- 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 +62 -0
- package/dist/api-queries.esm.js.map +1 -1
- package/dist/clients/v1/api/contract/createContract/index.d.ts +29 -0
- package/dist/clients/v1/api/contract/updateContract/index.d.ts +40 -0
- package/dist/clients/v1/api/index.d.ts +2 -0
- package/dist/clients/v1/index.d.ts +2 -0
- package/dist/clients/v1/types/Contract.d.ts +9 -0
- package/package.json +1 -1
- package/src/clients/v1/api/contract/createContract/index.ts +36 -0
- package/src/clients/v1/api/contract/updateContract/index.ts +51 -0
- package/src/clients/v1/api/index.ts +2 -0
- package/src/clients/v1/index.ts +12 -0
- package/src/clients/v1/types/Contract.ts +9 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { AxiosResponse, AxiosError } from 'axios';
|
|
2
|
+
import { Contract, ServiceRequest } from '../../../types';
|
|
3
|
+
declare type SuccessData = {
|
|
4
|
+
success: true;
|
|
5
|
+
data: Contract;
|
|
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 CreateContractHeaders = {
|
|
16
|
+
'x-auth-hc': string;
|
|
17
|
+
};
|
|
18
|
+
export declare type CreateContractBody = Pick<Contract, 'amount' | 'duration' | 'isFixedCashCommission' | 'kind' | 'type'> & {
|
|
19
|
+
serviceRequest: Pick<ServiceRequest, 'id'>;
|
|
20
|
+
};
|
|
21
|
+
export declare type CreateContractData = AxiosResponse<ResultData>;
|
|
22
|
+
export declare type CreateContractError = AxiosError<ResultError>;
|
|
23
|
+
export declare type CreateContractConfig = {
|
|
24
|
+
baseURL?: string;
|
|
25
|
+
body: CreateContractBody;
|
|
26
|
+
headers: CreateContractHeaders;
|
|
27
|
+
};
|
|
28
|
+
export declare function createContractRequest({ baseURL, body, headers }: CreateContractConfig): Promise<CreateContractData>;
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { AxiosResponse, AxiosError } from 'axios';
|
|
2
|
+
import { Contract, ContractKind, ContractStatus, ContractType, ServiceRequest } from '../../../types';
|
|
3
|
+
declare type SuccessData = {
|
|
4
|
+
success: true;
|
|
5
|
+
data: Contract;
|
|
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 UpdateContractUrlParams = {
|
|
16
|
+
id: number;
|
|
17
|
+
};
|
|
18
|
+
export declare type UpdateContractHeaders = {
|
|
19
|
+
'x-auth-hc': string;
|
|
20
|
+
};
|
|
21
|
+
export declare type UpdateContractBody = Partial<Contract> & {
|
|
22
|
+
amount: number;
|
|
23
|
+
duration: number;
|
|
24
|
+
formalId: string;
|
|
25
|
+
isFixedCashCommission: boolean;
|
|
26
|
+
kind: ContractKind;
|
|
27
|
+
serviceRequest: Pick<ServiceRequest, 'id'>;
|
|
28
|
+
status: ContractStatus;
|
|
29
|
+
type: ContractType;
|
|
30
|
+
};
|
|
31
|
+
export declare type UpdateContractData = AxiosResponse<ResultData>;
|
|
32
|
+
export declare type UpdateContractError = AxiosError<ResultError>;
|
|
33
|
+
export declare type UpdateContractConfig = {
|
|
34
|
+
baseURL?: string;
|
|
35
|
+
urlParams: UpdateContractUrlParams;
|
|
36
|
+
headers: UpdateContractHeaders;
|
|
37
|
+
body: UpdateContractBody;
|
|
38
|
+
};
|
|
39
|
+
export declare function updateContractRequest({ baseURL, urlParams, body, headers, }: UpdateContractConfig): Promise<UpdateContractData>;
|
|
40
|
+
export {};
|
|
@@ -22,6 +22,7 @@ export * from './callCenter/startOperatorWork';
|
|
|
22
22
|
export * from './callTask/createCallTask';
|
|
23
23
|
export * from './callTask/findCallTasks';
|
|
24
24
|
export * from './contract/approveContract';
|
|
25
|
+
export * from './contract/createContract';
|
|
25
26
|
export * from './contract/createContractLegalDocument';
|
|
26
27
|
export * from './contract/declineContract';
|
|
27
28
|
export * from './contract/findContractById';
|
|
@@ -29,6 +30,7 @@ export * from './contract/findContractLegalDocumentById';
|
|
|
29
30
|
export * from './contract/findContracts';
|
|
30
31
|
export * from './contract/signContract';
|
|
31
32
|
export * from './contract/terminateContract';
|
|
33
|
+
export * from './contract/updateContract';
|
|
32
34
|
export * from './contract/upgradeContract';
|
|
33
35
|
export * from './deal/createDealCategorizedFile';
|
|
34
36
|
export * from './deal/createDealInvestPrepayment';
|
|
@@ -26,6 +26,7 @@ export declare class Api {
|
|
|
26
26
|
createCallTask: (body: api.CreateCallTaskBody, headers: api.CreateCallTaskHeaders) => Promise<api.CreateCallTaskData>;
|
|
27
27
|
findCallTasks: (params: api.FindCallTasksParams, headers: api.FindCallTasksHeaders) => Promise<api.FindCallTasksData>;
|
|
28
28
|
approveContract: (urlParams: api.ApproveContractUrlParams, body: api.ApproveContractBody, headers: api.ApproveContractHeaders) => Promise<api.ApproveContractData>;
|
|
29
|
+
createContract: (body: api.CreateContractBody, headers: api.CreateContractHeaders) => Promise<api.CreateContractData>;
|
|
29
30
|
createContractLegalDocument: (urlParams: api.CreateContractLegalDocumentUrlParams, headers: api.CreateContractLegalDocumentHeaders) => Promise<api.CreateContractLegalDocumentData>;
|
|
30
31
|
declineContract: (urlParams: api.DeclineContractUrlParams, body: api.DeclineContractBody, headers: api.DeclineContractHeaders) => Promise<api.DeclineContractData>;
|
|
31
32
|
findContracts: (params: api.FindContractsParams, headers: api.FindContractsHeaders) => Promise<api.FindContractsData>;
|
|
@@ -33,6 +34,7 @@ export declare class Api {
|
|
|
33
34
|
findContractLegalDocumentById: (urlParams: api.FindContractLegalDocumentByIdUrlParams, headers: api.FindContractLegalDocumentByIdHeaders) => Promise<api.FindContractLegalDocumentByIdData>;
|
|
34
35
|
signContract: (urlParams: api.SignContractUrlParams, body: api.SignContractBody, headers: api.SignContractHeaders) => Promise<api.SignContractData>;
|
|
35
36
|
terminateContract: (urlParams: api.TerminateContractUrlParams, body: api.TerminateContractBody, headers: api.TerminateContractHeaders) => Promise<api.TerminateContractData>;
|
|
37
|
+
updateContract: (urlParams: api.UpdateContractUrlParams, body: api.UpdateContractBody, headers: api.UpdateContractHeaders) => Promise<api.UpdateContractData>;
|
|
36
38
|
upgradeContract: (urlParams: api.UpgradeContractUrlParams, body: api.UpgradeContractBody, headers: api.UpgradeContractHeaders) => Promise<api.UpgradeContractData>;
|
|
37
39
|
createDealCategorizedFile: (urlParams: api.CreateDealCategorizedFileUrlParams, body: api.CreateDealCategorizedFileBody, headers: api.CreateDealCategorizedFileHeaders) => Promise<api.CreateDealCategorizedFileData>;
|
|
38
40
|
createDealInvestPrepayment: (urlParams: api.CreateDealInvestPrepaymentUrlParams, body: api.CreateDealInvestPrepaymentBody, headers: api.CreateDealInvestPrepaymentHeaders) => Promise<api.CreateDealInvestPrepaymentData>;
|
|
@@ -46,13 +46,22 @@ export declare type Contract = {
|
|
|
46
46
|
amountPenalty?: number;
|
|
47
47
|
amountReceived?: number;
|
|
48
48
|
approvedAt?: string;
|
|
49
|
+
closedAt?: string;
|
|
49
50
|
comment?: string;
|
|
51
|
+
commissionAt?: string;
|
|
52
|
+
commissionPlannedAt?: string;
|
|
50
53
|
canTerminate?: boolean;
|
|
51
54
|
deal?: Partial<Deal> & {
|
|
52
55
|
id: number;
|
|
53
56
|
};
|
|
57
|
+
dealSignPlannedAt?: string;
|
|
58
|
+
dealSignedAt?: string;
|
|
54
59
|
declinedAt?: string;
|
|
55
60
|
developerCommission?: number;
|
|
61
|
+
prepaidAt?: string;
|
|
62
|
+
prepaymentPlannedAt?: string;
|
|
63
|
+
registerPlannedAt?: string;
|
|
64
|
+
reason?: string;
|
|
56
65
|
signPlannedAt?: string;
|
|
57
66
|
signedAt?: string;
|
|
58
67
|
terminatedAt?: string;
|
package/package.json
CHANGED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import axios, { AxiosResponse, AxiosError, AxiosTransformer } from 'axios';
|
|
2
|
+
import { Contract, ServiceRequest } from '../../../types';
|
|
3
|
+
|
|
4
|
+
type SuccessData = { success: true; data: Contract };
|
|
5
|
+
type ErrorData = { success: false; data: { error: string } };
|
|
6
|
+
|
|
7
|
+
type ResultData = SuccessData['data'];
|
|
8
|
+
type ResultError = ErrorData['data']['error'];
|
|
9
|
+
|
|
10
|
+
export type CreateContractHeaders = { 'x-auth-hc': string };
|
|
11
|
+
export type CreateContractBody = Pick<Contract, 'amount' | 'duration' | 'isFixedCashCommission' | 'kind' | 'type'> & {
|
|
12
|
+
serviceRequest: Pick<ServiceRequest, 'id'>;
|
|
13
|
+
};
|
|
14
|
+
export type CreateContractData = AxiosResponse<ResultData>;
|
|
15
|
+
export type CreateContractError = AxiosError<ResultError>;
|
|
16
|
+
export type CreateContractConfig = {
|
|
17
|
+
baseURL?: string;
|
|
18
|
+
body: CreateContractBody;
|
|
19
|
+
headers: CreateContractHeaders;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export function createContractRequest({ baseURL = 'https://clients.homeapp.ru', body, headers }: CreateContractConfig) {
|
|
23
|
+
return axios
|
|
24
|
+
.post(`/api/contract`, body, {
|
|
25
|
+
baseURL,
|
|
26
|
+
headers: { Accept: 'application/json', 'Content-Type': 'application/json', ...headers },
|
|
27
|
+
transformResponse: [
|
|
28
|
+
...(axios.defaults.transformResponse as AxiosTransformer[]),
|
|
29
|
+
(data: SuccessData | ErrorData): ResultData | ResultError => (data.success ? data.data : data.data.error),
|
|
30
|
+
],
|
|
31
|
+
})
|
|
32
|
+
.then((res: CreateContractData) => res)
|
|
33
|
+
.catch((err: CreateContractError) => {
|
|
34
|
+
throw err;
|
|
35
|
+
});
|
|
36
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import axios, { AxiosResponse, AxiosError, AxiosTransformer } from 'axios';
|
|
2
|
+
import { Contract, ContractKind, ContractStatus, ContractType, ServiceRequest } from '../../../types';
|
|
3
|
+
|
|
4
|
+
type SuccessData = { success: true; data: Contract };
|
|
5
|
+
type ErrorData = { success: false; data: { error: string } };
|
|
6
|
+
|
|
7
|
+
type ResultData = SuccessData['data'];
|
|
8
|
+
type ResultError = ErrorData['data']['error'];
|
|
9
|
+
|
|
10
|
+
export type UpdateContractUrlParams = { id: number };
|
|
11
|
+
export type UpdateContractHeaders = { 'x-auth-hc': string };
|
|
12
|
+
export type UpdateContractBody = Partial<Contract> & {
|
|
13
|
+
amount: number;
|
|
14
|
+
duration: number;
|
|
15
|
+
formalId: string;
|
|
16
|
+
isFixedCashCommission: boolean;
|
|
17
|
+
kind: ContractKind;
|
|
18
|
+
serviceRequest: Pick<ServiceRequest, 'id'>;
|
|
19
|
+
status: ContractStatus;
|
|
20
|
+
type: ContractType;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export type UpdateContractData = AxiosResponse<ResultData>;
|
|
24
|
+
export type UpdateContractError = AxiosError<ResultError>;
|
|
25
|
+
export type UpdateContractConfig = {
|
|
26
|
+
baseURL?: string;
|
|
27
|
+
urlParams: UpdateContractUrlParams;
|
|
28
|
+
headers: UpdateContractHeaders;
|
|
29
|
+
body: UpdateContractBody;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export function updateContractRequest({
|
|
33
|
+
baseURL = 'https://clients.homeapp.ru',
|
|
34
|
+
urlParams,
|
|
35
|
+
body,
|
|
36
|
+
headers,
|
|
37
|
+
}: UpdateContractConfig) {
|
|
38
|
+
return axios
|
|
39
|
+
.put(`/api/contract/${urlParams.id}`, body, {
|
|
40
|
+
baseURL,
|
|
41
|
+
headers: { Accept: 'application/json', 'Content-Type': 'application/json', ...headers },
|
|
42
|
+
transformResponse: [
|
|
43
|
+
...(axios.defaults.transformResponse as AxiosTransformer[]),
|
|
44
|
+
(data: SuccessData | ErrorData): ResultData | ResultError => (data.success ? data.data : data.data.error),
|
|
45
|
+
],
|
|
46
|
+
})
|
|
47
|
+
.then((res: UpdateContractData) => res)
|
|
48
|
+
.catch((err: UpdateContractError) => {
|
|
49
|
+
throw err;
|
|
50
|
+
});
|
|
51
|
+
}
|
|
@@ -29,6 +29,7 @@ export * from './callTask/createCallTask';
|
|
|
29
29
|
export * from './callTask/findCallTasks';
|
|
30
30
|
|
|
31
31
|
export * from './contract/approveContract';
|
|
32
|
+
export * from './contract/createContract';
|
|
32
33
|
export * from './contract/createContractLegalDocument';
|
|
33
34
|
export * from './contract/declineContract';
|
|
34
35
|
export * from './contract/findContractById';
|
|
@@ -36,6 +37,7 @@ export * from './contract/findContractLegalDocumentById';
|
|
|
36
37
|
export * from './contract/findContracts';
|
|
37
38
|
export * from './contract/signContract';
|
|
38
39
|
export * from './contract/terminateContract';
|
|
40
|
+
export * from './contract/updateContract';
|
|
39
41
|
export * from './contract/upgradeContract';
|
|
40
42
|
|
|
41
43
|
export * from './deal/createDealCategorizedFile';
|
package/src/clients/v1/index.ts
CHANGED
|
@@ -126,6 +126,10 @@ export class Api {
|
|
|
126
126
|
return api.approveContractRequest({ urlParams, body, headers, baseURL: this.baseURL });
|
|
127
127
|
};
|
|
128
128
|
|
|
129
|
+
createContract = (body: api.CreateContractBody, headers: api.CreateContractHeaders) => {
|
|
130
|
+
return api.createContractRequest({ body, headers, baseURL: this.baseURL });
|
|
131
|
+
};
|
|
132
|
+
|
|
129
133
|
createContractLegalDocument = (
|
|
130
134
|
urlParams: api.CreateContractLegalDocumentUrlParams,
|
|
131
135
|
headers: api.CreateContractLegalDocumentHeaders
|
|
@@ -172,6 +176,14 @@ export class Api {
|
|
|
172
176
|
return api.terminateContractRequest({ urlParams, body, headers, baseURL: this.baseURL });
|
|
173
177
|
};
|
|
174
178
|
|
|
179
|
+
updateContract = (
|
|
180
|
+
urlParams: api.UpdateContractUrlParams,
|
|
181
|
+
body: api.UpdateContractBody,
|
|
182
|
+
headers: api.UpdateContractHeaders
|
|
183
|
+
) => {
|
|
184
|
+
return api.updateContractRequest({ urlParams, body, headers, baseURL: this.baseURL });
|
|
185
|
+
};
|
|
186
|
+
|
|
175
187
|
upgradeContract = (
|
|
176
188
|
urlParams: api.UpgradeContractUrlParams,
|
|
177
189
|
body: api.UpgradeContractBody,
|
|
@@ -49,11 +49,20 @@ export type Contract = {
|
|
|
49
49
|
amountPenalty?: number;
|
|
50
50
|
amountReceived?: number;
|
|
51
51
|
approvedAt?: string;
|
|
52
|
+
closedAt?: string;
|
|
52
53
|
comment?: string;
|
|
54
|
+
commissionAt?: string;
|
|
55
|
+
commissionPlannedAt?: string;
|
|
53
56
|
canTerminate?: boolean;
|
|
54
57
|
deal?: Partial<Deal> & { id: number };
|
|
58
|
+
dealSignPlannedAt?: string;
|
|
59
|
+
dealSignedAt?: string;
|
|
55
60
|
declinedAt?: string;
|
|
56
61
|
developerCommission?: number;
|
|
62
|
+
prepaidAt?: string;
|
|
63
|
+
prepaymentPlannedAt?: string;
|
|
64
|
+
registerPlannedAt?: string;
|
|
65
|
+
reason?: string;
|
|
57
66
|
signPlannedAt?: string;
|
|
58
67
|
signedAt?: string;
|
|
59
68
|
terminatedAt?: string;
|