@integraciones_doc24/sdk 1.16.35 → 1.16.36

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 (46) hide show
  1. package/README.md +206 -206
  2. package/lib/baseSdk/diagnostica.d.ts +54 -54
  3. package/lib/baseSdk/diagnostica.js +82 -82
  4. package/lib/baseSdk/external.d.ts +177 -177
  5. package/lib/baseSdk/external.js +96 -96
  6. package/lib/baseSdk/index.d.ts +2 -2
  7. package/lib/baseSdk/index.js +77 -77
  8. package/lib/baseSdk/user.d.ts +112 -112
  9. package/lib/baseSdk/user.js +136 -136
  10. package/lib/index.d.ts +400 -400
  11. package/lib/index.js +22 -22
  12. package/lib/request/index.d.ts +4 -4
  13. package/lib/request/index.js +32 -32
  14. package/lib/request/token.d.ts +2 -2
  15. package/lib/request/token.js +34 -34
  16. package/lib/request/validation.d.ts +10 -10
  17. package/lib/request/validation.js +28 -28
  18. package/lib/schemas.d.ts +2549 -2543
  19. package/lib/schemas.js +559 -557
  20. package/lib/types.d.ts +173 -173
  21. package/lib/types.js +2 -2
  22. package/lib/userSdk/binah.d.ts +21 -21
  23. package/lib/userSdk/binah.js +20 -20
  24. package/lib/userSdk/chat.d.ts +57 -57
  25. package/lib/userSdk/chat.js +98 -98
  26. package/lib/userSdk/external.d.ts +34 -34
  27. package/lib/userSdk/external.js +72 -72
  28. package/lib/userSdk/index.d.ts +2 -2
  29. package/lib/userSdk/index.js +33 -33
  30. package/lib/userSdk/patients.d.ts +58 -58
  31. package/lib/userSdk/patients.js +89 -89
  32. package/lib/userSdk/schedule.d.ts +59 -59
  33. package/lib/userSdk/schedule.js +90 -90
  34. package/lib/userSdk/specialties.d.ts +19 -19
  35. package/lib/userSdk/specialties.js +48 -48
  36. package/lib/userSdk/videoVisit.d.ts +196 -194
  37. package/lib/userSdk/videoVisit.js +266 -264
  38. package/lib/utils.d.ts +4 -4
  39. package/lib/utils.js +68 -68
  40. package/lib/webhook/index.d.ts +2 -2
  41. package/lib/webhook/index.js +67 -67
  42. package/lib/webhook/responses.d.ts +35 -35
  43. package/lib/webhook/responses.js +42 -42
  44. package/lib/webhook/token.d.ts +2 -2
  45. package/lib/webhook/token.js +23 -23
  46. package/package.json +37 -37
@@ -1,89 +1,89 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getPatientMethods = 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 getPatientMethods = (makeRequest) => {
9
- const declarePatient = async ({ patient, channel, code, }) => {
10
- var _a;
11
- const path = '/patient';
12
- const mappedPatient = {
13
- lastname: patient.lastName,
14
- firstname: patient.firstName,
15
- identification_type: patient.identificationType,
16
- identification_value: patient.identificationValue,
17
- birthdate: date_fns_1.format(patient.birthdate, 'yyyy-MM-dd'),
18
- gender: (_a = patient.gender) === null || _a === void 0 ? void 0 : _a.toUpperCase(),
19
- country_id: patient.countryId,
20
- emergency_contact: patient.emergencyContact,
21
- emergency_contact_phone: patient.emergencyContactPhone,
22
- credential: patient.credential,
23
- plan: patient.plan,
24
- affiliation_status: patient.affiliationStatus,
25
- localidad: patient.localidad,
26
- cod_postal: patient.codPostal,
27
- };
28
- const parsedChannel = channel ? parseInt(channel) : channel;
29
- const response = await makeRequest('POST', path, {
30
- user_data: mappedPatient,
31
- channel: parsedChannel,
32
- code,
33
- });
34
- const data = response.data;
35
- if (data.ask_code)
36
- return {
37
- userInfo: {
38
- firstName: data.user_info.firstname,
39
- lastName: data.user_info.lastname,
40
- phone: data.user_info.phone,
41
- email: data.user_info.email,
42
- },
43
- askCode: true,
44
- };
45
- return { askCode: false, patientId: data.patient_id };
46
- };
47
- const getPatientId = async (patient) => {
48
- var _a;
49
- const path = '/search-patient';
50
- const mappedPatient = {
51
- lastname: patient.lastName,
52
- firstname: patient.firstName,
53
- identification_type: patient.identificationType,
54
- identification_value: patient.identificationValue,
55
- birthdate: date_fns_1.format(patient.birthdate, 'yyyy-MM-dd'),
56
- gender: (_a = patient.gender) === null || _a === void 0 ? void 0 : _a.toUpperCase(),
57
- country_id: patient.countryId,
58
- };
59
- const response = await makeRequest('POST', path, {
60
- user_data: mappedPatient,
61
- });
62
- return response.data.patient_id;
63
- };
64
- const deletePatient = async (patientId) => {
65
- const path = `/patient/${patientId}`;
66
- await makeRequest('DELETE', path);
67
- };
68
- const getPatientPHR = async (patientId) => {
69
- const path = `/view-phr/${patientId}`;
70
- const response = await makeRequest('GET', path);
71
- return response.data.url_acceso_paciente;
72
- };
73
- const submitHealthQuiz = async ({ patientId, quiz, origen, }) => {
74
- const path = '/health-quiz-external';
75
- await makeRequest('POST', path, {
76
- id_persona: patientId,
77
- quiz,
78
- origen,
79
- });
80
- };
81
- return {
82
- declarePatient: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.declarePatientParams]), schemas_1.doc24Schemas.declarePatientResponse, declarePatient),
83
- getPatientId: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.patient]), zod_1.number(), getPatientId),
84
- deletePatient: validation_1.validateFunction(zod_1.tuple([zod_1.number()]), zod_1.void(), deletePatient),
85
- getPatientPHR: validation_1.validateFunction(zod_1.tuple([zod_1.number()]), zod_1.string(), getPatientPHR),
86
- submitHealthQuiz: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.healthQuizParams]), zod_1.void(), submitHealthQuiz),
87
- };
88
- };
89
- exports.getPatientMethods = getPatientMethods;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getPatientMethods = 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 getPatientMethods = (makeRequest) => {
9
+ const declarePatient = async ({ patient, channel, code, }) => {
10
+ var _a;
11
+ const path = '/patient';
12
+ const mappedPatient = {
13
+ lastname: patient.lastName,
14
+ firstname: patient.firstName,
15
+ identification_type: patient.identificationType,
16
+ identification_value: patient.identificationValue,
17
+ birthdate: date_fns_1.format(patient.birthdate, 'yyyy-MM-dd'),
18
+ gender: (_a = patient.gender) === null || _a === void 0 ? void 0 : _a.toUpperCase(),
19
+ country_id: patient.countryId,
20
+ emergency_contact: patient.emergencyContact,
21
+ emergency_contact_phone: patient.emergencyContactPhone,
22
+ credential: patient.credential,
23
+ plan: patient.plan,
24
+ affiliation_status: patient.affiliationStatus,
25
+ localidad: patient.localidad,
26
+ cod_postal: patient.codPostal,
27
+ };
28
+ const parsedChannel = channel ? parseInt(channel) : channel;
29
+ const response = await makeRequest('POST', path, {
30
+ user_data: mappedPatient,
31
+ channel: parsedChannel,
32
+ code,
33
+ });
34
+ const data = response.data;
35
+ if (data.ask_code)
36
+ return {
37
+ userInfo: {
38
+ firstName: data.user_info.firstname,
39
+ lastName: data.user_info.lastname,
40
+ phone: data.user_info.phone,
41
+ email: data.user_info.email,
42
+ },
43
+ askCode: true,
44
+ };
45
+ return { askCode: false, patientId: data.patient_id };
46
+ };
47
+ const getPatientId = async (patient) => {
48
+ var _a;
49
+ const path = '/search-patient';
50
+ const mappedPatient = {
51
+ lastname: patient.lastName,
52
+ firstname: patient.firstName,
53
+ identification_type: patient.identificationType,
54
+ identification_value: patient.identificationValue,
55
+ birthdate: date_fns_1.format(patient.birthdate, 'yyyy-MM-dd'),
56
+ gender: (_a = patient.gender) === null || _a === void 0 ? void 0 : _a.toUpperCase(),
57
+ country_id: patient.countryId,
58
+ };
59
+ const response = await makeRequest('POST', path, {
60
+ user_data: mappedPatient,
61
+ });
62
+ return response.data.patient_id;
63
+ };
64
+ const deletePatient = async (patientId) => {
65
+ const path = `/patient/${patientId}`;
66
+ await makeRequest('DELETE', path);
67
+ };
68
+ const getPatientPHR = async (patientId) => {
69
+ const path = `/view-phr/${patientId}`;
70
+ const response = await makeRequest('GET', path);
71
+ return response.data.url_acceso_paciente;
72
+ };
73
+ const submitHealthQuiz = async ({ patientId, quiz, origen, }) => {
74
+ const path = '/health-quiz-external';
75
+ await makeRequest('POST', path, {
76
+ id_persona: patientId,
77
+ quiz,
78
+ origen,
79
+ });
80
+ };
81
+ return {
82
+ declarePatient: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.declarePatientParams]), schemas_1.doc24Schemas.declarePatientResponse, declarePatient),
83
+ getPatientId: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.patient]), zod_1.number(), getPatientId),
84
+ deletePatient: validation_1.validateFunction(zod_1.tuple([zod_1.number()]), zod_1.void(), deletePatient),
85
+ getPatientPHR: validation_1.validateFunction(zod_1.tuple([zod_1.number()]), zod_1.string(), getPatientPHR),
86
+ submitHealthQuiz: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.healthQuizParams]), zod_1.void(), submitHealthQuiz),
87
+ };
88
+ };
89
+ exports.getPatientMethods = getPatientMethods;
@@ -1,59 +1,59 @@
1
- import { RequestMaker } from '../request';
2
- export declare const getScheduleMethods: (makeRequest: RequestMaker) => {
3
- getSchedule: (patientId: number, specialtyId: number, filter?: {
4
- date?: Date | undefined;
5
- language?: string | undefined;
6
- professionalId?: number | undefined;
7
- userTimeZone?: string | undefined;
8
- offset?: number | undefined;
9
- limit?: number | undefined;
10
- weekDay?: number | undefined;
11
- startHour?: string | undefined;
12
- finishHour?: string | undefined;
13
- showAppointmentConfiguration?: boolean | undefined;
14
- } | undefined) => Promise<{
15
- length?: number | null | undefined;
16
- address?: string | null | undefined;
17
- city?: string | null | undefined;
18
- province?: string | null | undefined;
19
- ranking?: unknown;
20
- consultation_value?: string | null | undefined;
21
- inPerson?: boolean | null | undefined;
22
- virtual?: boolean | null | undefined;
23
- addressPhone?: string | null | undefined;
24
- date: Date;
25
- type: "appointment" | "chat" | "instant";
26
- id: string | number;
27
- professional: {
28
- logoUrl?: string | null | undefined;
29
- id: number;
30
- fullName: string;
31
- };
32
- specialty: {
33
- start_age?: string | number | null | undefined;
34
- end_age?: string | number | null | undefined;
35
- authorization_code?: string | null | undefined;
36
- id: number;
37
- description: string;
38
- };
39
- clinicId: number;
40
- cost: string;
41
- atentions: number;
42
- }[]>;
43
- getScheduleDates: (patientId: number, filter?: {
44
- specialtyId?: number | undefined;
45
- language?: string | undefined;
46
- professionalId?: number | undefined;
47
- userTimeZone?: string | undefined;
48
- } | undefined) => Promise<Date[]>;
49
- getAppointment: (appointmentId: number) => Promise<{
50
- date: Date;
51
- id: number;
52
- professionalId: number;
53
- }>;
54
- getAppointmentByVcToken: (vcToken: string) => Promise<{
55
- date: Date;
56
- id: number;
57
- professionalId: number;
58
- }>;
59
- };
1
+ import { RequestMaker } from '../request';
2
+ export declare const getScheduleMethods: (makeRequest: RequestMaker) => {
3
+ getSchedule: (patientId: number, specialtyId: number, filter?: {
4
+ date?: Date | undefined;
5
+ language?: string | undefined;
6
+ professionalId?: number | undefined;
7
+ userTimeZone?: string | undefined;
8
+ offset?: number | undefined;
9
+ limit?: number | undefined;
10
+ weekDay?: number | undefined;
11
+ startHour?: string | undefined;
12
+ finishHour?: string | undefined;
13
+ showAppointmentConfiguration?: boolean | undefined;
14
+ } | undefined) => Promise<{
15
+ length?: number | null | undefined;
16
+ address?: string | null | undefined;
17
+ city?: string | null | undefined;
18
+ province?: string | null | undefined;
19
+ ranking?: unknown;
20
+ consultation_value?: string | null | undefined;
21
+ inPerson?: boolean | null | undefined;
22
+ virtual?: boolean | null | undefined;
23
+ addressPhone?: string | null | undefined;
24
+ date: Date;
25
+ type: "appointment" | "chat" | "instant";
26
+ id: string | number;
27
+ professional: {
28
+ logoUrl?: string | null | undefined;
29
+ id: number;
30
+ fullName: string;
31
+ };
32
+ specialty: {
33
+ start_age?: string | number | null | undefined;
34
+ end_age?: string | number | null | undefined;
35
+ authorization_code?: string | null | undefined;
36
+ id: number;
37
+ description: string;
38
+ };
39
+ clinicId: number;
40
+ cost: string;
41
+ atentions: number;
42
+ }[]>;
43
+ getScheduleDates: (patientId: number, filter?: {
44
+ specialtyId?: number | undefined;
45
+ language?: string | undefined;
46
+ professionalId?: number | undefined;
47
+ userTimeZone?: string | undefined;
48
+ } | undefined) => Promise<Date[]>;
49
+ getAppointment: (appointmentId: number) => Promise<{
50
+ date: Date;
51
+ id: number;
52
+ professionalId: number;
53
+ }>;
54
+ getAppointmentByVcToken: (vcToken: string) => Promise<{
55
+ date: Date;
56
+ id: number;
57
+ professionalId: number;
58
+ }>;
59
+ };
@@ -1,90 +1,90 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getScheduleMethods = 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 utils_1 = require("../utils");
9
- const getScheduleMethods = (makeRequest) => {
10
- const getScheduleDates = async (patientId, filter = {}) => {
11
- var _a;
12
- const mappedFilter = {
13
- specialty_id: filter.specialtyId,
14
- professional_id: filter.professionalId,
15
- language: (_a = filter.language) !== null && _a !== void 0 ? _a : 'ES',
16
- user_time_zone: filter.userTimeZone,
17
- };
18
- const path = `/schedule/dates/${patientId}/${JSON.stringify(mappedFilter)}`;
19
- const response = await makeRequest('GET', path);
20
- return response.data.available_dates.map((o) => utils_1.parseDate(o.date, filter.userTimeZone));
21
- };
22
- const getSchedule = async (patientId, specialtyId, filter = {}) => {
23
- var _a;
24
- const mappedFilter = {
25
- id_professional: filter.professionalId,
26
- offset: filter.offset,
27
- limit: filter.limit,
28
- week_day: filter.weekDay,
29
- date: filter.date && date_fns_1.format(filter.date, 'yyyy-MM-dd'),
30
- start_hour: filter.startHour,
31
- finish_hour: filter.finishHour,
32
- language: (_a = filter.language) !== null && _a !== void 0 ? _a : 'ES',
33
- user_time_zone: filter.userTimeZone,
34
- show_appointment_configuration: filter.showAppointmentConfiguration ? 1 : null,
35
- };
36
- const path = `/schedule/availability/${patientId}/${specialtyId}/${JSON.stringify(mappedFilter)}`;
37
- const response = await makeRequest('GET', path);
38
- return response.data.available_appointments.map((a) => ({
39
- id: a.id,
40
- date: utils_1.parseDateTime(`${a.date} ${a.hour}`, utils_1.getConvertedHourTimeZone(filter.userTimeZone, a.time_zone)),
41
- clinicId: a.clinic,
42
- professional: {
43
- id: a.professional_id,
44
- fullName: a.professional,
45
- logoUrl: a.logo,
46
- },
47
- cost: a.cost,
48
- specialty: {
49
- id: a.specialty_id,
50
- description: a.specialty,
51
- },
52
- type: a.type === 'P' ? 'appointment' : a.type === 'T' ? 'chat' : 'instant',
53
- atentions: a.atentions,
54
- ranking: a.ranking,
55
- length: a.length,
56
- consultation_value: a.consultation_value,
57
- inPerson: a.in_person,
58
- virtual: a.virtual,
59
- province: a.province,
60
- city: a.city,
61
- address: a.address,
62
- addressPhone: a.address_phone,
63
- }));
64
- };
65
- const getAppointment = async (appointmentId) => {
66
- const path = `/appointment/${appointmentId}`;
67
- const response = await makeRequest('GET', path);
68
- return {
69
- id: response.data.id,
70
- professionalId: response.data.professional_id,
71
- date: utils_1.parseDateTime(`${response.data.date} ${response.data.hour}`, response.data.time_zone),
72
- };
73
- };
74
- const getAppointmentByVcToken = async (vcToken) => {
75
- const path = `/appointmentByToken/${vcToken}`;
76
- const response = await makeRequest('GET', path);
77
- return {
78
- id: response.data.id,
79
- professionalId: response.data.professional_id,
80
- date: utils_1.parseDateTime(`${response.data.date} ${response.data.hour}`, response.data.time_zone),
81
- };
82
- };
83
- return {
84
- getSchedule: validation_1.validateFunction(zod_1.tuple([zod_1.number(), zod_1.number(), schemas_1.doc24Schemas.scheduleFilter.optional()]), zod_1.array(schemas_1.doc24Schemas.availableAppointment), getSchedule),
85
- getScheduleDates: validation_1.validateFunction(zod_1.tuple([zod_1.number(), schemas_1.doc24Schemas.scheduleAvailabilityFilter]), zod_1.array(zod_1.date()), getScheduleDates),
86
- getAppointment: validation_1.validateFunction(zod_1.tuple([zod_1.number()]), schemas_1.doc24Schemas.appointment, getAppointment),
87
- getAppointmentByVcToken: validation_1.validateFunction(zod_1.tuple([zod_1.string()]), schemas_1.doc24Schemas.appointment, getAppointmentByVcToken),
88
- };
89
- };
90
- exports.getScheduleMethods = getScheduleMethods;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getScheduleMethods = 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 utils_1 = require("../utils");
9
+ const getScheduleMethods = (makeRequest) => {
10
+ const getScheduleDates = async (patientId, filter = {}) => {
11
+ var _a;
12
+ const mappedFilter = {
13
+ specialty_id: filter.specialtyId,
14
+ professional_id: filter.professionalId,
15
+ language: (_a = filter.language) !== null && _a !== void 0 ? _a : 'ES',
16
+ user_time_zone: filter.userTimeZone,
17
+ };
18
+ const path = `/schedule/dates/${patientId}/${JSON.stringify(mappedFilter)}`;
19
+ const response = await makeRequest('GET', path);
20
+ return response.data.available_dates.map((o) => utils_1.parseDate(o.date, filter.userTimeZone));
21
+ };
22
+ const getSchedule = async (patientId, specialtyId, filter = {}) => {
23
+ var _a;
24
+ const mappedFilter = {
25
+ id_professional: filter.professionalId,
26
+ offset: filter.offset,
27
+ limit: filter.limit,
28
+ week_day: filter.weekDay,
29
+ date: filter.date && date_fns_1.format(filter.date, 'yyyy-MM-dd'),
30
+ start_hour: filter.startHour,
31
+ finish_hour: filter.finishHour,
32
+ language: (_a = filter.language) !== null && _a !== void 0 ? _a : 'ES',
33
+ user_time_zone: filter.userTimeZone,
34
+ show_appointment_configuration: filter.showAppointmentConfiguration ? 1 : null,
35
+ };
36
+ const path = `/schedule/availability/${patientId}/${specialtyId}/${JSON.stringify(mappedFilter)}`;
37
+ const response = await makeRequest('GET', path);
38
+ return response.data.available_appointments.map((a) => ({
39
+ id: a.id,
40
+ date: utils_1.parseDateTime(`${a.date} ${a.hour}`, utils_1.getConvertedHourTimeZone(filter.userTimeZone, a.time_zone)),
41
+ clinicId: a.clinic,
42
+ professional: {
43
+ id: a.professional_id,
44
+ fullName: a.professional,
45
+ logoUrl: a.logo,
46
+ },
47
+ cost: a.cost,
48
+ specialty: {
49
+ id: a.specialty_id,
50
+ description: a.specialty,
51
+ },
52
+ type: a.type === 'P' ? 'appointment' : a.type === 'T' ? 'chat' : 'instant',
53
+ atentions: a.atentions,
54
+ ranking: a.ranking,
55
+ length: a.length,
56
+ consultation_value: a.consultation_value,
57
+ inPerson: a.in_person,
58
+ virtual: a.virtual,
59
+ province: a.province,
60
+ city: a.city,
61
+ address: a.address,
62
+ addressPhone: a.address_phone,
63
+ }));
64
+ };
65
+ const getAppointment = async (appointmentId) => {
66
+ const path = `/appointment/${appointmentId}`;
67
+ const response = await makeRequest('GET', path);
68
+ return {
69
+ id: response.data.id,
70
+ professionalId: response.data.professional_id,
71
+ date: utils_1.parseDateTime(`${response.data.date} ${response.data.hour}`, response.data.time_zone),
72
+ };
73
+ };
74
+ const getAppointmentByVcToken = async (vcToken) => {
75
+ const path = `/appointmentByToken/${vcToken}`;
76
+ const response = await makeRequest('GET', path);
77
+ return {
78
+ id: response.data.id,
79
+ professionalId: response.data.professional_id,
80
+ date: utils_1.parseDateTime(`${response.data.date} ${response.data.hour}`, response.data.time_zone),
81
+ };
82
+ };
83
+ return {
84
+ getSchedule: validation_1.validateFunction(zod_1.tuple([zod_1.number(), zod_1.number(), schemas_1.doc24Schemas.scheduleFilter.optional()]), zod_1.array(schemas_1.doc24Schemas.availableAppointment), getSchedule),
85
+ getScheduleDates: validation_1.validateFunction(zod_1.tuple([zod_1.number(), schemas_1.doc24Schemas.scheduleAvailabilityFilter]), zod_1.array(zod_1.date()), getScheduleDates),
86
+ getAppointment: validation_1.validateFunction(zod_1.tuple([zod_1.number()]), schemas_1.doc24Schemas.appointment, getAppointment),
87
+ getAppointmentByVcToken: validation_1.validateFunction(zod_1.tuple([zod_1.string()]), schemas_1.doc24Schemas.appointment, getAppointmentByVcToken),
88
+ };
89
+ };
90
+ exports.getScheduleMethods = getScheduleMethods;
@@ -1,19 +1,19 @@
1
- import { RequestMaker } from '../request';
2
- export declare const getSpecialtiesMethods: (makeRequest: RequestMaker) => {
3
- getSpecialties: (mode: "appointment" | "chat" | "instant", language: string) => Promise<{
4
- start_age?: string | number | null | undefined;
5
- end_age?: string | number | null | undefined;
6
- authorization_code?: string | null | undefined;
7
- id: number;
8
- description: string;
9
- }[]>;
10
- getProfessionalsBySpecialty: (...params: any) => Promise<{
11
- logoUrl?: string | null | undefined;
12
- brief?: string | null | undefined;
13
- consultation_value?: string | number | null | undefined;
14
- degree?: string | undefined;
15
- primer_turno?: string | undefined;
16
- id: number;
17
- fullName: string;
18
- }[]>;
19
- };
1
+ import { RequestMaker } from '../request';
2
+ export declare const getSpecialtiesMethods: (makeRequest: RequestMaker) => {
3
+ getSpecialties: (mode: "appointment" | "chat" | "instant", language: string) => Promise<{
4
+ start_age?: string | number | null | undefined;
5
+ end_age?: string | number | null | undefined;
6
+ authorization_code?: string | null | undefined;
7
+ id: number;
8
+ description: string;
9
+ }[]>;
10
+ getProfessionalsBySpecialty: (...params: any) => Promise<{
11
+ logoUrl?: string | null | undefined;
12
+ brief?: string | null | undefined;
13
+ consultation_value?: string | number | null | undefined;
14
+ degree?: string | undefined;
15
+ primer_turno?: string | undefined;
16
+ id: number;
17
+ fullName: string;
18
+ }[]>;
19
+ };
@@ -1,48 +1,48 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getSpecialtiesMethods = void 0;
4
- const zod_1 = require("zod");
5
- const validation_1 = require("../request/validation");
6
- const schemas_1 = require("../schemas");
7
- const getSpecialtiesMethods = (makeRequest) => {
8
- const getSpecialties = validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.specialtyMode, zod_1.string()]), zod_1.array(schemas_1.doc24Schemas.specialty), async (mode, language) => {
9
- const type = mode === 'appointment' ? 'P' : mode === 'chat' ? 'T' : 'E';
10
- const path = `/specialties/${type}/${language.toUpperCase()}`;
11
- const response = await makeRequest('GET', path);
12
- return response.data.specialties.map((s) => ({
13
- id: s.specialty_id,
14
- description: s.specialty,
15
- start_age: s.start_age,
16
- end_age: s.end_age,
17
- authorization_code: s.authorization_code,
18
- }));
19
- });
20
- return {
21
- getSpecialties,
22
- getProfessionalsBySpecialty: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.professionalsBySpecialtyFilter]), zod_1.array(schemas_1.doc24Schemas.professionalsListItem), async (body = {}) => {
23
- var _a;
24
- const mappedBody = {
25
- specialty_id: body.specialtyId,
26
- professional_id: body.professionalId,
27
- offset: body.offset,
28
- limit: body.limit,
29
- language: (_a = body.language) !== null && _a !== void 0 ? _a : 'ES',
30
- };
31
- const path = `/professionals-by-specialty`;
32
- const response = await makeRequest('POST', path, mappedBody);
33
- const mapProfessionalResponse = (rawItem) => {
34
- return {
35
- id: rawItem.id_profesional,
36
- fullName: rawItem.denominacion,
37
- consultation_value: rawItem.consultation_value,
38
- logoUrl: rawItem.logo,
39
- primer_turno: rawItem.primer_turno,
40
- brief: rawItem.mini_cv,
41
- degree: rawItem.degree,
42
- };
43
- };
44
- return response.data.profesionales.map((o) => mapProfessionalResponse(o));
45
- }),
46
- };
47
- };
48
- exports.getSpecialtiesMethods = getSpecialtiesMethods;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getSpecialtiesMethods = void 0;
4
+ const zod_1 = require("zod");
5
+ const validation_1 = require("../request/validation");
6
+ const schemas_1 = require("../schemas");
7
+ const getSpecialtiesMethods = (makeRequest) => {
8
+ const getSpecialties = validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.specialtyMode, zod_1.string()]), zod_1.array(schemas_1.doc24Schemas.specialty), async (mode, language) => {
9
+ const type = mode === 'appointment' ? 'P' : mode === 'chat' ? 'T' : 'E';
10
+ const path = `/specialties/${type}/${language.toUpperCase()}`;
11
+ const response = await makeRequest('GET', path);
12
+ return response.data.specialties.map((s) => ({
13
+ id: s.specialty_id,
14
+ description: s.specialty,
15
+ start_age: s.start_age,
16
+ end_age: s.end_age,
17
+ authorization_code: s.authorization_code,
18
+ }));
19
+ });
20
+ return {
21
+ getSpecialties,
22
+ getProfessionalsBySpecialty: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.professionalsBySpecialtyFilter]), zod_1.array(schemas_1.doc24Schemas.professionalsListItem), async (body = {}) => {
23
+ var _a;
24
+ const mappedBody = {
25
+ specialty_id: body.specialtyId,
26
+ professional_id: body.professionalId,
27
+ offset: body.offset,
28
+ limit: body.limit,
29
+ language: (_a = body.language) !== null && _a !== void 0 ? _a : 'ES',
30
+ };
31
+ const path = `/professionals-by-specialty`;
32
+ const response = await makeRequest('POST', path, mappedBody);
33
+ const mapProfessionalResponse = (rawItem) => {
34
+ return {
35
+ id: rawItem.id_profesional,
36
+ fullName: rawItem.denominacion,
37
+ consultation_value: rawItem.consultation_value,
38
+ logoUrl: rawItem.logo,
39
+ primer_turno: rawItem.primer_turno,
40
+ brief: rawItem.mini_cv,
41
+ degree: rawItem.degree,
42
+ };
43
+ };
44
+ return response.data.profesionales.map((o) => mapProfessionalResponse(o));
45
+ }),
46
+ };
47
+ };
48
+ exports.getSpecialtiesMethods = getSpecialtiesMethods;