@hapl/api-queries 0.1.188 → 0.1.189
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 +30 -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 +30 -0
- package/dist/api-queries.esm.js.map +1 -1
- package/dist/clients/v1/api/event/findEventById/index.d.ts +29 -0
- package/dist/clients/v1/api/expert/createExpertCase/index.d.ts +1 -1
- package/dist/clients/v1/api/index.d.ts +1 -0
- package/dist/clients/v1/index.d.ts +2 -1
- package/dist/clients/v1/types/Event.d.ts +12 -0
- package/dist/clients/v1/types/index.d.ts +1 -0
- package/package.json +1 -1
- package/src/clients/v1/api/event/findEventById/index.ts +39 -0
- package/src/clients/v1/api/expert/createExpertCase/index.ts +1 -1
- package/src/clients/v1/api/index.ts +2 -0
- package/src/clients/v1/index.ts +6 -1
- package/src/clients/v1/types/Event.ts +11 -0
- package/src/clients/v1/types/index.ts +1 -0
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { AxiosResponse, AxiosError } from 'axios';
|
|
2
|
+
import { Event } from '../../../types';
|
|
3
|
+
declare type SuccessData = {
|
|
4
|
+
success: true;
|
|
5
|
+
data: Event;
|
|
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 FindEventByIdUrlParams = {
|
|
16
|
+
id: number;
|
|
17
|
+
};
|
|
18
|
+
export declare type FindEventByIdHeaders = {
|
|
19
|
+
'x-auth-hc'?: string;
|
|
20
|
+
};
|
|
21
|
+
export declare type FindEventByIdData = AxiosResponse<ResultData>;
|
|
22
|
+
export declare type FindEventByIdError = AxiosError<ResultError>;
|
|
23
|
+
export declare type FindEventByIdConfig = {
|
|
24
|
+
baseURL?: string;
|
|
25
|
+
urlParams: FindEventByIdUrlParams;
|
|
26
|
+
headers?: FindEventByIdHeaders;
|
|
27
|
+
};
|
|
28
|
+
export declare function findEventByIdRequest({ baseURL, urlParams, headers, }: FindEventByIdConfig): Promise<FindEventByIdData>;
|
|
29
|
+
export {};
|
|
@@ -12,7 +12,7 @@ export declare type CreateExpertCaseError = {
|
|
|
12
12
|
};
|
|
13
13
|
export declare type CreateExpertCaseConfig = {
|
|
14
14
|
baseURL?: string;
|
|
15
|
-
headers
|
|
15
|
+
headers?: CreateExpertCaseHeaders;
|
|
16
16
|
body: CreateExpertCaseBody;
|
|
17
17
|
};
|
|
18
18
|
export declare function createExpertCaseRequest({ baseURL, headers, body, }: CreateExpertCaseConfig): Promise<CreateExpertCaseData>;
|
|
@@ -50,6 +50,7 @@ export * from './deal/setDealSignPlannedState';
|
|
|
50
50
|
export * from './deal/setDealSignedState';
|
|
51
51
|
export * from './deal/terminateDeal';
|
|
52
52
|
export * from './deal/updateDeal';
|
|
53
|
+
export * from './event/findEventById';
|
|
53
54
|
export * from './expert/createExpertCase';
|
|
54
55
|
export * from './expert/createExpertReview';
|
|
55
56
|
export * from './expert/findExpertById';
|
|
@@ -54,7 +54,8 @@ export declare class Api {
|
|
|
54
54
|
setDealSignPlannedState: (urlParams: api.SetDealSignPlannedStateUrlParams, body: api.SetDealSignPlannedStateBody, headers: api.SetDealSignPlannedStateHeaders) => Promise<api.SetDealSignPlannedStateData>;
|
|
55
55
|
terminateDeal: (urlParams: api.TerminateDealUrlParams, body: api.TerminateDealBody, headers: api.TerminateDealHeaders) => Promise<api.TerminateDealData>;
|
|
56
56
|
updateDeal: (urlParams: api.UpdateDealUrlParams, body: api.UpdateDealBody, headers: api.UpdateDealHeaders) => Promise<api.UpdateDealData>;
|
|
57
|
-
|
|
57
|
+
findEventById: (urlParams: api.FindEventByIdUrlParams, headers?: api.FindEventByIdHeaders | undefined) => Promise<api.FindEventByIdData>;
|
|
58
|
+
createExpertCase: (body: api.CreateExpertCaseBody, headers?: api.CreateExpertCaseHeaders | undefined) => Promise<api.CreateExpertCaseData>;
|
|
58
59
|
createExpertReview: (urlParams: api.CreateExpertReviewUrlParams, body: api.CreateExpertReviewBody, headers: api.CreateExpertReviewHeaders) => Promise<api.CreateExpertReviewData>;
|
|
59
60
|
findExpertById: (urlParams: api.FindExpertByIdUrlParams, headers: api.FindExpertByIdHeaders) => Promise<api.FindExpertByIdData>;
|
|
60
61
|
findExpertCaseById: (urlParams: api.FindExpertCaseByIdUrlParams, headers?: api.FindExpertCaseByIdHeaders | undefined) => Promise<api.FindExpertCaseByIdData>;
|
package/package.json
CHANGED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import axios, { AxiosResponse, AxiosError, AxiosTransformer } from 'axios';
|
|
2
|
+
import { Event } from '../../../types';
|
|
3
|
+
|
|
4
|
+
type SuccessData = { success: true; data: Event };
|
|
5
|
+
type ErrorData = { success: false; data: { error: string } };
|
|
6
|
+
|
|
7
|
+
type ResultData = SuccessData['data'];
|
|
8
|
+
type ResultError = ErrorData['data']['error'];
|
|
9
|
+
|
|
10
|
+
export type FindEventByIdUrlParams = { id: number };
|
|
11
|
+
export type FindEventByIdHeaders = { 'x-auth-hc'?: string };
|
|
12
|
+
export type FindEventByIdData = AxiosResponse<ResultData>;
|
|
13
|
+
export type FindEventByIdError = AxiosError<ResultError>;
|
|
14
|
+
|
|
15
|
+
export type FindEventByIdConfig = {
|
|
16
|
+
baseURL?: string;
|
|
17
|
+
urlParams: FindEventByIdUrlParams;
|
|
18
|
+
headers?: FindEventByIdHeaders;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export function findEventByIdRequest({
|
|
22
|
+
baseURL = 'https://clients.homeapp.ru',
|
|
23
|
+
urlParams,
|
|
24
|
+
headers,
|
|
25
|
+
}: FindEventByIdConfig) {
|
|
26
|
+
return axios
|
|
27
|
+
.get(`/api/site/event/${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: FindEventByIdData) => res)
|
|
36
|
+
.catch((err: FindEventByIdError) => {
|
|
37
|
+
throw err;
|
|
38
|
+
});
|
|
39
|
+
}
|
|
@@ -11,7 +11,7 @@ export type CreateExpertCaseData = { data: UserCase };
|
|
|
11
11
|
export type CreateExpertCaseError = { status: number; data: string };
|
|
12
12
|
export type CreateExpertCaseConfig = {
|
|
13
13
|
baseURL?: string;
|
|
14
|
-
headers
|
|
14
|
+
headers?: CreateExpertCaseHeaders;
|
|
15
15
|
body: CreateExpertCaseBody;
|
|
16
16
|
};
|
|
17
17
|
|
|
@@ -60,6 +60,8 @@ export * from './deal/setDealSignedState';
|
|
|
60
60
|
export * from './deal/terminateDeal';
|
|
61
61
|
export * from './deal/updateDeal';
|
|
62
62
|
|
|
63
|
+
export * from './event/findEventById';
|
|
64
|
+
|
|
63
65
|
export * from './expert/createExpertCase';
|
|
64
66
|
export * from './expert/createExpertReview';
|
|
65
67
|
export * from './expert/findExpertById';
|
package/src/clients/v1/index.ts
CHANGED
|
@@ -314,9 +314,14 @@ export class Api {
|
|
|
314
314
|
return api.updateDealRequest({ urlParams, body, headers, baseURL: this.baseURL });
|
|
315
315
|
};
|
|
316
316
|
|
|
317
|
+
// event
|
|
318
|
+
findEventById = (urlParams: api.FindEventByIdUrlParams, headers?: api.FindEventByIdHeaders) => {
|
|
319
|
+
return api.findEventByIdRequest({ urlParams, headers, baseURL: this.baseURL });
|
|
320
|
+
};
|
|
321
|
+
|
|
317
322
|
// expert
|
|
318
323
|
|
|
319
|
-
createExpertCase = (body: api.CreateExpertCaseBody, headers
|
|
324
|
+
createExpertCase = (body: api.CreateExpertCaseBody, headers?: api.CreateExpertCaseHeaders) => {
|
|
320
325
|
return api.createExpertCaseRequest({ body, headers, baseURL: this.baseURL });
|
|
321
326
|
};
|
|
322
327
|
|