@integraciones_doc24/sdk 0.39.5 → 0.39.7
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/lib/baseSdk/diagnostica.d.ts +54 -0
- package/lib/baseSdk/diagnostica.js +82 -0
- package/lib/baseSdk/external.d.ts +177 -0
- package/lib/baseSdk/external.js +96 -0
- package/lib/baseSdk/index.d.ts +2 -0
- package/lib/baseSdk/index.js +74 -0
- package/lib/baseSdk/user.d.ts +91 -0
- package/lib/baseSdk/user.js +136 -0
- package/lib/index.d.ts +365 -0
- package/lib/index.js +22 -0
- package/lib/request/index.d.ts +3 -0
- package/lib/request/index.js +26 -0
- package/lib/request/token.d.ts +2 -0
- package/lib/request/token.js +34 -0
- package/lib/request/validation.d.ts +10 -0
- package/lib/request/validation.js +28 -0
- package/lib/schemas.d.ts +1816 -0
- package/lib/schemas.js +420 -0
- package/lib/types.d.ts +146 -0
- package/lib/types.js +2 -0
- package/lib/userSdk/chat.d.ts +57 -0
- package/lib/userSdk/chat.js +98 -0
- package/lib/userSdk/external.d.ts +34 -0
- package/lib/userSdk/external.js +72 -0
- package/lib/userSdk/index.d.ts +2 -0
- package/lib/userSdk/index.js +30 -0
- package/lib/userSdk/patients.d.ts +38 -0
- package/lib/userSdk/patients.js +67 -0
- package/lib/userSdk/schedule.d.ts +47 -0
- package/lib/userSdk/schedule.js +81 -0
- package/lib/userSdk/specialties.d.ts +7 -0
- package/lib/userSdk/specialties.js +19 -0
- package/lib/userSdk/videoVisit.d.ts +113 -0
- package/lib/userSdk/videoVisit.js +154 -0
- package/lib/utils.d.ts +2 -0
- package/lib/utils.js +16 -0
- package/lib/webhook/index.d.ts +2 -0
- package/lib/webhook/index.js +56 -0
- package/lib/webhook/responses.d.ts +35 -0
- package/lib/webhook/responses.js +42 -0
- package/lib/webhook/token.d.ts +2 -0
- package/lib/webhook/token.js +23 -0
- package/package.json +1 -1
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { RequestMaker } from '../request';
|
|
2
|
+
export declare const getDiagnosticaMethods: (makeRequest: RequestMaker) => {
|
|
3
|
+
getDiagnosticaHistory: (patient: {
|
|
4
|
+
gender?: "m" | "f" | "o" | undefined;
|
|
5
|
+
identificationType: "DNI";
|
|
6
|
+
identificationValue: string;
|
|
7
|
+
}, from: Date, to: Date) => Promise<{
|
|
8
|
+
date: Date;
|
|
9
|
+
location: string;
|
|
10
|
+
exams: string[];
|
|
11
|
+
deepLink: string;
|
|
12
|
+
}[]>;
|
|
13
|
+
getDiagnosticaDeepLink: (kiosk: string, user: {
|
|
14
|
+
gender?: "m" | "f" | "o" | undefined;
|
|
15
|
+
firstName: string;
|
|
16
|
+
lastName: string;
|
|
17
|
+
identificationType: "DNI";
|
|
18
|
+
identificationValue: string;
|
|
19
|
+
phone: string;
|
|
20
|
+
email: string;
|
|
21
|
+
language: string;
|
|
22
|
+
birthday: Date;
|
|
23
|
+
}, patient: {
|
|
24
|
+
gender?: "m" | "f" | "o" | undefined;
|
|
25
|
+
firstName: string;
|
|
26
|
+
lastName: string;
|
|
27
|
+
identificationType: "DNI";
|
|
28
|
+
identificationValue: string;
|
|
29
|
+
birthday: Date;
|
|
30
|
+
}) => Promise<{
|
|
31
|
+
forwardingRequired: true;
|
|
32
|
+
deepLink: string;
|
|
33
|
+
} | {
|
|
34
|
+
forwardingRequired: false;
|
|
35
|
+
}>;
|
|
36
|
+
getDiagnosticaAccess: (kiosk: string, user: {
|
|
37
|
+
gender?: "m" | "f" | "o" | undefined;
|
|
38
|
+
firstName: string;
|
|
39
|
+
lastName: string;
|
|
40
|
+
identificationType: "DNI";
|
|
41
|
+
identificationValue: string;
|
|
42
|
+
phone: string;
|
|
43
|
+
email: string;
|
|
44
|
+
language: string;
|
|
45
|
+
birthday: Date;
|
|
46
|
+
}, patient: {
|
|
47
|
+
gender?: "m" | "f" | "o" | undefined;
|
|
48
|
+
firstName: string;
|
|
49
|
+
lastName: string;
|
|
50
|
+
identificationType: "DNI";
|
|
51
|
+
identificationValue: string;
|
|
52
|
+
birthday: Date;
|
|
53
|
+
}) => Promise<void>;
|
|
54
|
+
};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getDiagnosticaMethods = void 0;
|
|
4
|
+
const date_fns_1 = require("date-fns");
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
const validation_1 = require("../request/validation");
|
|
7
|
+
const schemas_1 = require("../schemas");
|
|
8
|
+
const getDiagnosticaMethods = (makeRequest) => {
|
|
9
|
+
const getDiagnosticaHistory = async (patient, from, to) => {
|
|
10
|
+
const path = '/history-diagnostica';
|
|
11
|
+
const response = await makeRequest('POST', path, {
|
|
12
|
+
patient: {
|
|
13
|
+
gender: patient.gender,
|
|
14
|
+
id_type: patient.identificationType,
|
|
15
|
+
id_value: patient.identificationValue,
|
|
16
|
+
},
|
|
17
|
+
dateFrom: from.toISOString(),
|
|
18
|
+
dateTo: to.toISOString(),
|
|
19
|
+
});
|
|
20
|
+
const list = response.data.info;
|
|
21
|
+
return list.map((i) => ({
|
|
22
|
+
date: new Date(Date.parse(i.date)),
|
|
23
|
+
location: i.location,
|
|
24
|
+
exams: i.exams,
|
|
25
|
+
deepLink: i.deeplink,
|
|
26
|
+
}));
|
|
27
|
+
};
|
|
28
|
+
const getDiagnosticaDeepLink = async (kiosk, user, patient) => {
|
|
29
|
+
const path = '/deeplink-diagnostica';
|
|
30
|
+
const response = await makeRequest('POST', path, {
|
|
31
|
+
kiosk,
|
|
32
|
+
user: mapUserData(user),
|
|
33
|
+
patient: mapPatientData(patient),
|
|
34
|
+
});
|
|
35
|
+
const data = response.data.info.data;
|
|
36
|
+
if (data.forwarding_required)
|
|
37
|
+
return { forwardingRequired: true, deepLink: data.deeplink };
|
|
38
|
+
return { forwardingRequired: false };
|
|
39
|
+
};
|
|
40
|
+
const getDiagnosticaAccess = async (kiosk, user, patient) => {
|
|
41
|
+
const path = '/access-diagnostica';
|
|
42
|
+
await makeRequest('POST', path, {
|
|
43
|
+
kiosk,
|
|
44
|
+
user: mapUserData(user),
|
|
45
|
+
patient: mapPatientData(patient),
|
|
46
|
+
});
|
|
47
|
+
return;
|
|
48
|
+
};
|
|
49
|
+
return {
|
|
50
|
+
getDiagnosticaHistory: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.diagnosticaPatientFilter, zod_1.date(), zod_1.date()]), schemas_1.doc24Schemas.diagnosticaHistoryAppointment.array(), getDiagnosticaHistory),
|
|
51
|
+
getDiagnosticaDeepLink: validation_1.validateFunction(zod_1.tuple([
|
|
52
|
+
zod_1.string(),
|
|
53
|
+
schemas_1.doc24Schemas.diagnosticaUser,
|
|
54
|
+
schemas_1.doc24Schemas.diagnosticaPatient,
|
|
55
|
+
]), schemas_1.doc24Schemas.diagnosticaDeepLinkResponse, getDiagnosticaDeepLink),
|
|
56
|
+
getDiagnosticaAccess: validation_1.validateFunction(zod_1.tuple([
|
|
57
|
+
zod_1.string(),
|
|
58
|
+
schemas_1.doc24Schemas.diagnosticaUser,
|
|
59
|
+
schemas_1.doc24Schemas.diagnosticaPatient,
|
|
60
|
+
]), zod_1.void(), getDiagnosticaAccess),
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
exports.getDiagnosticaMethods = getDiagnosticaMethods;
|
|
64
|
+
const mapPatientData = (patient) => {
|
|
65
|
+
var _a;
|
|
66
|
+
return {
|
|
67
|
+
name: patient.firstName,
|
|
68
|
+
surname: patient.lastName,
|
|
69
|
+
birthday: date_fns_1.format(patient.birthday, 'yyyy-MM-dd'),
|
|
70
|
+
id_type: 'DNI',
|
|
71
|
+
id_value: patient.identificationValue,
|
|
72
|
+
gender: (_a = patient.gender) === null || _a === void 0 ? void 0 : _a.toLocaleUpperCase(),
|
|
73
|
+
};
|
|
74
|
+
};
|
|
75
|
+
const mapUserData = (user) => {
|
|
76
|
+
return {
|
|
77
|
+
...mapPatientData(user),
|
|
78
|
+
phone: user.phone,
|
|
79
|
+
email: user.email,
|
|
80
|
+
language: user.language,
|
|
81
|
+
};
|
|
82
|
+
};
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import { RequestMaker } from '../request';
|
|
2
|
+
export declare const getExternalMethods: (makeRequest: RequestMaker) => {
|
|
3
|
+
externalLogin: (params: {
|
|
4
|
+
user: string;
|
|
5
|
+
password: string;
|
|
6
|
+
}) => Promise<{
|
|
7
|
+
gender?: "m" | "f" | "o" | undefined;
|
|
8
|
+
firstName: string;
|
|
9
|
+
lastName: string;
|
|
10
|
+
countryId: string;
|
|
11
|
+
phone: string;
|
|
12
|
+
email: string;
|
|
13
|
+
birthday: Date;
|
|
14
|
+
identificationNumber: string;
|
|
15
|
+
}>;
|
|
16
|
+
preExternalEnrollment: (params: ({
|
|
17
|
+
birthdate: Date;
|
|
18
|
+
identificationNumber: string;
|
|
19
|
+
} & {
|
|
20
|
+
phone: string;
|
|
21
|
+
email: string;
|
|
22
|
+
}) | ({
|
|
23
|
+
birthdate: Date;
|
|
24
|
+
identificationNumber: string;
|
|
25
|
+
} & {
|
|
26
|
+
phone?: undefined;
|
|
27
|
+
email: string;
|
|
28
|
+
}) | ({
|
|
29
|
+
birthdate: Date;
|
|
30
|
+
identificationNumber: string;
|
|
31
|
+
} & {
|
|
32
|
+
email?: undefined;
|
|
33
|
+
phone: string;
|
|
34
|
+
})) => Promise<void>;
|
|
35
|
+
externalEnrollment: (params: ({
|
|
36
|
+
birthdate: Date;
|
|
37
|
+
identificationNumber: string;
|
|
38
|
+
} & {
|
|
39
|
+
phone: string;
|
|
40
|
+
email: string;
|
|
41
|
+
} & {
|
|
42
|
+
password: string;
|
|
43
|
+
} & {
|
|
44
|
+
emailCode: string;
|
|
45
|
+
phoneCode: string;
|
|
46
|
+
}) | ({
|
|
47
|
+
birthdate: Date;
|
|
48
|
+
identificationNumber: string;
|
|
49
|
+
} & {
|
|
50
|
+
phone: string;
|
|
51
|
+
email: string;
|
|
52
|
+
} & {
|
|
53
|
+
password: string;
|
|
54
|
+
} & {
|
|
55
|
+
phoneCode?: undefined;
|
|
56
|
+
emailCode: string;
|
|
57
|
+
}) | ({
|
|
58
|
+
birthdate: Date;
|
|
59
|
+
identificationNumber: string;
|
|
60
|
+
} & {
|
|
61
|
+
phone: string;
|
|
62
|
+
email: string;
|
|
63
|
+
} & {
|
|
64
|
+
password: string;
|
|
65
|
+
} & {
|
|
66
|
+
emailCode?: undefined;
|
|
67
|
+
phoneCode: string;
|
|
68
|
+
}) | ({
|
|
69
|
+
birthdate: Date;
|
|
70
|
+
identificationNumber: string;
|
|
71
|
+
} & {
|
|
72
|
+
phone?: undefined;
|
|
73
|
+
email: string;
|
|
74
|
+
} & {
|
|
75
|
+
password: string;
|
|
76
|
+
} & {
|
|
77
|
+
emailCode: string;
|
|
78
|
+
phoneCode: string;
|
|
79
|
+
}) | ({
|
|
80
|
+
birthdate: Date;
|
|
81
|
+
identificationNumber: string;
|
|
82
|
+
} & {
|
|
83
|
+
phone?: undefined;
|
|
84
|
+
email: string;
|
|
85
|
+
} & {
|
|
86
|
+
password: string;
|
|
87
|
+
} & {
|
|
88
|
+
phoneCode?: undefined;
|
|
89
|
+
emailCode: string;
|
|
90
|
+
}) | ({
|
|
91
|
+
birthdate: Date;
|
|
92
|
+
identificationNumber: string;
|
|
93
|
+
} & {
|
|
94
|
+
phone?: undefined;
|
|
95
|
+
email: string;
|
|
96
|
+
} & {
|
|
97
|
+
password: string;
|
|
98
|
+
} & {
|
|
99
|
+
emailCode?: undefined;
|
|
100
|
+
phoneCode: string;
|
|
101
|
+
}) | ({
|
|
102
|
+
birthdate: Date;
|
|
103
|
+
identificationNumber: string;
|
|
104
|
+
} & {
|
|
105
|
+
email?: undefined;
|
|
106
|
+
phone: string;
|
|
107
|
+
} & {
|
|
108
|
+
password: string;
|
|
109
|
+
} & {
|
|
110
|
+
emailCode: string;
|
|
111
|
+
phoneCode: string;
|
|
112
|
+
}) | ({
|
|
113
|
+
birthdate: Date;
|
|
114
|
+
identificationNumber: string;
|
|
115
|
+
} & {
|
|
116
|
+
email?: undefined;
|
|
117
|
+
phone: string;
|
|
118
|
+
} & {
|
|
119
|
+
password: string;
|
|
120
|
+
} & {
|
|
121
|
+
phoneCode?: undefined;
|
|
122
|
+
emailCode: string;
|
|
123
|
+
}) | ({
|
|
124
|
+
birthdate: Date;
|
|
125
|
+
identificationNumber: string;
|
|
126
|
+
} & {
|
|
127
|
+
email?: undefined;
|
|
128
|
+
phone: string;
|
|
129
|
+
} & {
|
|
130
|
+
password: string;
|
|
131
|
+
} & {
|
|
132
|
+
emailCode?: undefined;
|
|
133
|
+
phoneCode: string;
|
|
134
|
+
})) => Promise<{
|
|
135
|
+
gender?: "m" | "f" | "o" | undefined;
|
|
136
|
+
firstName: string;
|
|
137
|
+
lastName: string;
|
|
138
|
+
countryId: string;
|
|
139
|
+
phone: string;
|
|
140
|
+
email: string;
|
|
141
|
+
birthday: Date;
|
|
142
|
+
identificationNumber: string;
|
|
143
|
+
}>;
|
|
144
|
+
sendExternalVerificationCode: (params: {
|
|
145
|
+
birthdate: Date;
|
|
146
|
+
channel: "1" | "2";
|
|
147
|
+
identificationNumber: string;
|
|
148
|
+
}) => Promise<void>;
|
|
149
|
+
verifyExternalVerificationCode: (params: {
|
|
150
|
+
code: string;
|
|
151
|
+
birthdate: Date;
|
|
152
|
+
channel: "1" | "2";
|
|
153
|
+
identificationNumber: string;
|
|
154
|
+
}) => Promise<any>;
|
|
155
|
+
externalResetPassword: (params: ({
|
|
156
|
+
birthdate: Date;
|
|
157
|
+
password: string;
|
|
158
|
+
identificationNumber: string;
|
|
159
|
+
} & {
|
|
160
|
+
emailCode: string;
|
|
161
|
+
phoneCode: string;
|
|
162
|
+
}) | ({
|
|
163
|
+
birthdate: Date;
|
|
164
|
+
password: string;
|
|
165
|
+
identificationNumber: string;
|
|
166
|
+
} & {
|
|
167
|
+
phoneCode?: undefined;
|
|
168
|
+
emailCode: string;
|
|
169
|
+
}) | ({
|
|
170
|
+
birthdate: Date;
|
|
171
|
+
password: string;
|
|
172
|
+
identificationNumber: string;
|
|
173
|
+
} & {
|
|
174
|
+
emailCode?: undefined;
|
|
175
|
+
phoneCode: string;
|
|
176
|
+
})) => Promise<any>;
|
|
177
|
+
};
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getExternalMethods = void 0;
|
|
4
|
+
const date_fns_1 = require("date-fns");
|
|
5
|
+
const zod_1 = require("zod");
|
|
6
|
+
const validation_1 = require("../request/validation");
|
|
7
|
+
const schemas_1 = require("../schemas");
|
|
8
|
+
const getExternalMethods = (makeRequest) => {
|
|
9
|
+
const externalLogin = async ({ user, password, }) => {
|
|
10
|
+
const path = '/external-login';
|
|
11
|
+
const response = await makeRequest('POST', path, { user, password });
|
|
12
|
+
const info = response.data.login_info;
|
|
13
|
+
return {
|
|
14
|
+
firstName: info.firstname,
|
|
15
|
+
lastName: info.lastname,
|
|
16
|
+
countryId: info.country_id,
|
|
17
|
+
birthday: new Date(Date.parse(info.birthdate)),
|
|
18
|
+
identificationNumber: info.identification_number,
|
|
19
|
+
gender: info.gender.toLowerCase(),
|
|
20
|
+
email: info.email,
|
|
21
|
+
phone: info.telephone,
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
const preExternalEnrollment = async (params) => {
|
|
25
|
+
const path = '/pre-external-enrollment';
|
|
26
|
+
await makeRequest('POST', path, {
|
|
27
|
+
identification_number: params.identificationNumber,
|
|
28
|
+
birthdate: date_fns_1.format(params.birthdate, 'yyyy-MM-dd'),
|
|
29
|
+
email: params.email,
|
|
30
|
+
telephone: params.phone,
|
|
31
|
+
});
|
|
32
|
+
return;
|
|
33
|
+
};
|
|
34
|
+
const externalEnrollment = async (params) => {
|
|
35
|
+
const path = '/external-enrollment';
|
|
36
|
+
const response = await makeRequest('POST', path, {
|
|
37
|
+
identification_number: params.identificationNumber,
|
|
38
|
+
birthdate: date_fns_1.format(params.birthdate, 'yyyy-MM-dd'),
|
|
39
|
+
email: params.email,
|
|
40
|
+
telephone: params.phone,
|
|
41
|
+
password: params.password,
|
|
42
|
+
email_code: params.emailCode,
|
|
43
|
+
telephone_code: params.phoneCode,
|
|
44
|
+
});
|
|
45
|
+
const info = response.data.info;
|
|
46
|
+
return {
|
|
47
|
+
firstName: info.firstname,
|
|
48
|
+
lastName: info.lastname,
|
|
49
|
+
countryId: info.country_id,
|
|
50
|
+
birthday: new Date(Date.parse(info.birthdate)),
|
|
51
|
+
identificationNumber: info.identification_number,
|
|
52
|
+
gender: info.gender.toLowerCase(),
|
|
53
|
+
email: info.email,
|
|
54
|
+
phone: info.telephone,
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
const sendExternalVerificationCode = async (params) => {
|
|
58
|
+
const path = '/send-external-verification-code';
|
|
59
|
+
await makeRequest('POST', path, {
|
|
60
|
+
identification_number: params.identificationNumber,
|
|
61
|
+
birthdate: date_fns_1.format(params.birthdate, 'yyyy-MM-dd'),
|
|
62
|
+
channel: params.channel,
|
|
63
|
+
});
|
|
64
|
+
return;
|
|
65
|
+
};
|
|
66
|
+
const verifyExternalVerificationCode = async (params) => {
|
|
67
|
+
const path = '/verify-external-verification-code';
|
|
68
|
+
const response = await makeRequest('POST', path, {
|
|
69
|
+
identification_number: params.identificationNumber,
|
|
70
|
+
birthdate: date_fns_1.format(params.birthdate, 'yyyy-MM-dd'),
|
|
71
|
+
channel: params.channel,
|
|
72
|
+
code: params.code,
|
|
73
|
+
});
|
|
74
|
+
return response.data;
|
|
75
|
+
};
|
|
76
|
+
const externalResetPassword = async (params) => {
|
|
77
|
+
const path = '/external-reset';
|
|
78
|
+
const response = await makeRequest('POST', path, {
|
|
79
|
+
identification_number: params.identificationNumber,
|
|
80
|
+
birthdate: date_fns_1.format(params.birthdate, 'yyyy-MM-dd'),
|
|
81
|
+
password: params.password,
|
|
82
|
+
email_code: params.emailCode,
|
|
83
|
+
telephone_code: params.phoneCode,
|
|
84
|
+
});
|
|
85
|
+
return response.data;
|
|
86
|
+
};
|
|
87
|
+
return {
|
|
88
|
+
externalLogin: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.externalLoginParams]), schemas_1.doc24Schemas.externalLoginResponse, externalLogin),
|
|
89
|
+
preExternalEnrollment: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.preExternalEnrollmentParams]), zod_1.void(), preExternalEnrollment),
|
|
90
|
+
externalEnrollment: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.externalEnrollmentParams]), schemas_1.doc24Schemas.externalLoginResponse, externalEnrollment),
|
|
91
|
+
sendExternalVerificationCode: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.sendExternalVerificationCodeParams]), zod_1.void(), sendExternalVerificationCode),
|
|
92
|
+
verifyExternalVerificationCode: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.verifyExternalVerificationCodeParams]), zod_1.any(), verifyExternalVerificationCode),
|
|
93
|
+
externalResetPassword: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.externalResetPasswordParams]), zod_1.any(), externalResetPassword),
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
exports.getExternalMethods = getExternalMethods;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getBaseSdk = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const request_1 = require("../request");
|
|
6
|
+
const validation_1 = require("../request/validation");
|
|
7
|
+
const schemas_1 = require("../schemas");
|
|
8
|
+
const utils_1 = require("../utils");
|
|
9
|
+
const diagnostica_1 = require("./diagnostica");
|
|
10
|
+
const user_1 = require("./user");
|
|
11
|
+
const external_1 = require("./external");
|
|
12
|
+
const getBaseSdk = async (url, credentials) => {
|
|
13
|
+
const makeRequest = await request_1.getRequestFactory(url, credentials);
|
|
14
|
+
const diagnosticaMethods = diagnostica_1.getDiagnosticaMethods(makeRequest);
|
|
15
|
+
const externalMethods = external_1.getExternalMethods(makeRequest);
|
|
16
|
+
const userMethods = user_1.getUserMethods(makeRequest, url, credentials);
|
|
17
|
+
const baseSdk = {
|
|
18
|
+
...diagnosticaMethods,
|
|
19
|
+
...externalMethods,
|
|
20
|
+
...userMethods,
|
|
21
|
+
getProfessional: validation_1.validateFunction(zod_1.tuple([zod_1.number()]), schemas_1.doc24Schemas.professional, async (professionalId) => {
|
|
22
|
+
const path = `/professional/${professionalId}`;
|
|
23
|
+
const response = await makeRequest('GET', path);
|
|
24
|
+
const raw = response.data;
|
|
25
|
+
return {
|
|
26
|
+
id: raw.professional_id,
|
|
27
|
+
firstName: raw.name,
|
|
28
|
+
lastName: raw.lastname,
|
|
29
|
+
birthdate: utils_1.parseDate(raw.birthdate),
|
|
30
|
+
gender: raw.gender.toLowerCase(),
|
|
31
|
+
email: raw.email,
|
|
32
|
+
phone: raw.phone,
|
|
33
|
+
logoUrl: raw.image,
|
|
34
|
+
matriculation: raw.matriculation,
|
|
35
|
+
specialties: raw.specialties.map((s) => ({
|
|
36
|
+
id: s.specialty_id,
|
|
37
|
+
description: s.specialty,
|
|
38
|
+
})),
|
|
39
|
+
degree: raw.degree,
|
|
40
|
+
languages: raw.languages.map((l) => l.languages),
|
|
41
|
+
resume: {
|
|
42
|
+
link: raw.resume_link,
|
|
43
|
+
brief: raw.resume_brief,
|
|
44
|
+
},
|
|
45
|
+
consultation_value: raw.consultation_value
|
|
46
|
+
};
|
|
47
|
+
}),
|
|
48
|
+
getAvailableScheduleClinics: validation_1.validateFunction(zod_1.tuple([]), schemas_1.doc24Schemas.availableScheduleClinics, async () => {
|
|
49
|
+
const path = `/schedule/clinics`;
|
|
50
|
+
const response = await makeRequest('GET', path);
|
|
51
|
+
const mapSpeciality = (s) => ({
|
|
52
|
+
id: s.id_especialidad,
|
|
53
|
+
description: s.especialidad,
|
|
54
|
+
});
|
|
55
|
+
const mapSpecialityER = (s) => ({
|
|
56
|
+
id: s.specialty_id,
|
|
57
|
+
description: s.specialty,
|
|
58
|
+
});
|
|
59
|
+
const mapped = {
|
|
60
|
+
specialties: response.data.specialties.map(mapSpeciality),
|
|
61
|
+
specialtiesER: response.data.specialties_er.map(mapSpecialityER),
|
|
62
|
+
professionals: response.data.professionals.map((p) => ({
|
|
63
|
+
id: p.id_profesional,
|
|
64
|
+
fullName: p.denominacion,
|
|
65
|
+
clinicId: p.id_consultorio,
|
|
66
|
+
specialties: p.especialidades.map(mapSpeciality),
|
|
67
|
+
})),
|
|
68
|
+
};
|
|
69
|
+
return mapped;
|
|
70
|
+
}),
|
|
71
|
+
};
|
|
72
|
+
return baseSdk;
|
|
73
|
+
};
|
|
74
|
+
exports.getBaseSdk = getBaseSdk;
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { RequestMaker } from '../request';
|
|
2
|
+
import { Doc24 } from '../types';
|
|
3
|
+
export declare const getUserMethods: (makeRequest: RequestMaker, url: string, credentials: Doc24.SdkCredentials) => {
|
|
4
|
+
declareUser: (params: {
|
|
5
|
+
user: {
|
|
6
|
+
identificationType?: number | undefined;
|
|
7
|
+
identificationValue?: string | undefined;
|
|
8
|
+
gender?: "m" | "f" | "o" | undefined;
|
|
9
|
+
phone?: string | undefined;
|
|
10
|
+
firstName: string;
|
|
11
|
+
lastName: string;
|
|
12
|
+
countryId: string;
|
|
13
|
+
birthdate: Date;
|
|
14
|
+
email: string;
|
|
15
|
+
};
|
|
16
|
+
} & {
|
|
17
|
+
code?: string | undefined;
|
|
18
|
+
channel?: "1" | "2" | undefined;
|
|
19
|
+
}) => Promise<{
|
|
20
|
+
askCode: true;
|
|
21
|
+
userInfo: {
|
|
22
|
+
phone: string;
|
|
23
|
+
email: string;
|
|
24
|
+
};
|
|
25
|
+
} | {
|
|
26
|
+
patientId: number | null;
|
|
27
|
+
askCode: false;
|
|
28
|
+
userId: number;
|
|
29
|
+
}>;
|
|
30
|
+
getUserId: (user: {
|
|
31
|
+
identificationType?: number | undefined;
|
|
32
|
+
identificationValue?: string | undefined;
|
|
33
|
+
gender?: "m" | "f" | "o" | undefined;
|
|
34
|
+
phone?: string | undefined;
|
|
35
|
+
firstName: string;
|
|
36
|
+
lastName: string;
|
|
37
|
+
countryId: string;
|
|
38
|
+
birthdate: Date;
|
|
39
|
+
email: string;
|
|
40
|
+
}) => Promise<number>;
|
|
41
|
+
sendVerificationCode: (params: {
|
|
42
|
+
identificationType: number;
|
|
43
|
+
identificationValue: string;
|
|
44
|
+
channel: "1" | "2";
|
|
45
|
+
}) => Promise<void>;
|
|
46
|
+
getUserInstance: (user: number | {
|
|
47
|
+
identificationType?: number | undefined;
|
|
48
|
+
identificationValue?: string | undefined;
|
|
49
|
+
gender?: "m" | "f" | "o" | undefined;
|
|
50
|
+
phone?: string | undefined;
|
|
51
|
+
firstName: string;
|
|
52
|
+
lastName: string;
|
|
53
|
+
countryId: string;
|
|
54
|
+
birthdate: Date;
|
|
55
|
+
email: string;
|
|
56
|
+
}) => Promise<any>;
|
|
57
|
+
enroll: (params: {
|
|
58
|
+
gender?: "m" | "f" | "o" | undefined;
|
|
59
|
+
firstName: string;
|
|
60
|
+
lastName: string;
|
|
61
|
+
birthdate: Date;
|
|
62
|
+
email: string;
|
|
63
|
+
identificationNumber: string;
|
|
64
|
+
startDate: Date;
|
|
65
|
+
plan: string;
|
|
66
|
+
}) => Promise<void>;
|
|
67
|
+
getCoverageInfo: (identificationValue: string) => Promise<{
|
|
68
|
+
gender?: "m" | "f" | "o" | undefined;
|
|
69
|
+
firstName: string | null;
|
|
70
|
+
lastName: string | null;
|
|
71
|
+
birthdate: Date;
|
|
72
|
+
email: string | null;
|
|
73
|
+
identificationNumber: string;
|
|
74
|
+
plan: string | null;
|
|
75
|
+
financerId: number | null;
|
|
76
|
+
defaultAffiliationId: number | null;
|
|
77
|
+
credentialNumber: string | null;
|
|
78
|
+
financerPlanId: number | null;
|
|
79
|
+
brand: number | null;
|
|
80
|
+
holderIdentificationNumber: string | null;
|
|
81
|
+
copaymentValue: number | null;
|
|
82
|
+
mobilePhone: string | null;
|
|
83
|
+
company: string | null;
|
|
84
|
+
dischargeDate: Date | null;
|
|
85
|
+
leavingDate: Date | null;
|
|
86
|
+
identificacion_tributaria: string | null;
|
|
87
|
+
deregistrationDate: Date | null;
|
|
88
|
+
authorizationCode: string | null;
|
|
89
|
+
authorizationCodeExpiration: Date | null;
|
|
90
|
+
} | null>;
|
|
91
|
+
};
|