@integraciones_doc24/sdk 1.5.1 → 1.6.0

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/README.md CHANGED
@@ -80,7 +80,7 @@ type BaseSdk = {
80
80
  getAvailableScheduleClinics: () => Promise<AvailableScheduleClinics>;
81
81
  enroll: (params: EnrollmentParams) => Promise<void>;
82
82
  getCoverageInfo: (identificationValue: string) => Promise<CoverageInfo>;
83
- getVerificationCode: (params: getVerificationCodeParams) => Promise<void>;
83
+ getVerificationCode: (params: VerificationCodeParams) => Promise<void>;
84
84
  getDiagnosticaHistory: (
85
85
  patient: DiagnosticaPatientFilter,
86
86
  from: Date,
@@ -6,14 +6,12 @@ const zod_1 = require("zod");
6
6
  const validation_1 = require("../request/validation");
7
7
  const schemas_1 = require("../schemas");
8
8
  const getDiagnosticaMethods = (makeRequest) => {
9
- const getDiagnosticaHistory = validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.diagnosticaPatientFilter, zod_1.date(), zod_1.date()]), schemas_1.doc24Schemas.diagnosticaHistoryAppointment.array(), async (patient, from, to) => {
9
+ const getDiagnosticaHistory = async (patient, from, to) => {
10
10
  const path = '/history-diagnostica';
11
11
  const response = await makeRequest('POST', path, {
12
12
  patient: {
13
13
  gender: patient.gender,
14
- id_type: patient.identificationType === 'ndi'
15
- ? 'DNI'
16
- : patient.identificationType,
14
+ id_type: patient.identificationType,
17
15
  id_value: patient.identificationValue,
18
16
  },
19
17
  dateFrom: from.toISOString(),
@@ -26,12 +24,8 @@ const getDiagnosticaMethods = (makeRequest) => {
26
24
  exams: i.exams,
27
25
  deepLink: i.deeplink,
28
26
  }));
29
- });
30
- const getDiagnosticaDeepLink = validation_1.validateFunction(zod_1.tuple([
31
- zod_1.string(),
32
- schemas_1.doc24Schemas.diagnosticaUser,
33
- schemas_1.doc24Schemas.diagnosticaPatient,
34
- ]), schemas_1.doc24Schemas.diagnosticaDeepLinkResponse, async (kiosk, user, patient) => {
27
+ };
28
+ const getDiagnosticaDeepLink = async (kiosk, user, patient) => {
35
29
  const path = '/deeplink-diagnostica';
36
30
  const response = await makeRequest('POST', path, {
37
31
  kiosk,
@@ -42,12 +36,8 @@ const getDiagnosticaMethods = (makeRequest) => {
42
36
  if (data.forwarding_required)
43
37
  return { forwardingRequired: true, deepLink: data.deeplink };
44
38
  return { forwardingRequired: false };
45
- });
46
- const getDiagnosticaAccess = validation_1.validateFunction(zod_1.tuple([
47
- zod_1.string(),
48
- schemas_1.doc24Schemas.diagnosticaUser,
49
- schemas_1.doc24Schemas.diagnosticaPatient,
50
- ]), zod_1.void(), async (kiosk, user, patient) => {
39
+ };
40
+ const getDiagnosticaAccess = async (kiosk, user, patient) => {
51
41
  const path = '/access-diagnostica';
52
42
  await makeRequest('POST', path, {
53
43
  kiosk,
@@ -55,8 +45,20 @@ const getDiagnosticaMethods = (makeRequest) => {
55
45
  patient: mapPatientData(patient),
56
46
  });
57
47
  return;
58
- });
59
- return { getDiagnosticaHistory, getDiagnosticaDeepLink, getDiagnosticaAccess };
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
+ };
60
62
  };
61
63
  exports.getDiagnosticaMethods = getDiagnosticaMethods;
62
64
  const mapPatientData = (patient) => {
@@ -0,0 +1,23 @@
1
+ import { RequestMaker } from '../request';
2
+ export declare const getExternalMethods: (makeRequest: RequestMaker) => {
3
+ externalLogin: (params: {
4
+ password: string;
5
+ user: string;
6
+ }) => Promise<any>;
7
+ preExternalEnrollment: (params: {
8
+ birthdate: Date;
9
+ phone: string;
10
+ email: string;
11
+ identificationNumber: string;
12
+ }) => Promise<any>;
13
+ externalEnrollment: (params: {
14
+ birthdate: Date;
15
+ phone: string;
16
+ email: string;
17
+ identificationNumber: string;
18
+ } & {
19
+ emailCode: string;
20
+ phoneCode: string;
21
+ password: string;
22
+ }) => Promise<any>;
23
+ };
@@ -0,0 +1,53 @@
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 === 'F' ? 'f' : 'm',
20
+ email: info.email,
21
+ phone: info.telephone,
22
+ };
23
+ };
24
+ const preExternalEnrollment = async (params) => {
25
+ const path = '/pre-external-enrollment';
26
+ const response = 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 response.data;
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
+ email_code: params.emailCode,
42
+ telephone_code: params.phoneCode,
43
+ password: params.password,
44
+ });
45
+ return response.data;
46
+ };
47
+ return {
48
+ externalLogin: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.externalLoginParams]), schemas_1.doc24Schemas.externalLoginResponse, externalLogin),
49
+ preExternalEnrollment: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.preExternalEnrollmentParams]), zod_1.any(), preExternalEnrollment),
50
+ externalEnrollment: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.externalEnrollmentParams]), zod_1.any(), externalEnrollment),
51
+ };
52
+ };
53
+ exports.getExternalMethods = getExternalMethods;
@@ -8,12 +8,15 @@ const schemas_1 = require("../schemas");
8
8
  const utils_1 = require("../utils");
9
9
  const diagnostica_1 = require("./diagnostica");
10
10
  const user_1 = require("./user");
11
+ const external_1 = require("./external");
11
12
  const getBaseSdk = async (url, credentials) => {
12
13
  const makeRequest = await request_1.getRequestFactory(url, credentials);
13
14
  const diagnosticaMethods = diagnostica_1.getDiagnosticaMethods(makeRequest);
15
+ const externalMethods = external_1.getExternalMethods(makeRequest);
14
16
  const userMethods = user_1.getUserMethods(makeRequest, url, credentials);
15
17
  const baseSdk = {
16
18
  ...diagnosticaMethods,
19
+ ...externalMethods,
17
20
  ...userMethods,
18
21
  getProfessional: validation_1.validateFunction(zod_1.tuple([zod_1.number()]), schemas_1.doc24Schemas.professional, async (professionalId) => {
19
22
  const path = `/professional/${professionalId}`;
@@ -120,7 +120,7 @@ const getUserMethods = (makeRequest, url, credentials) => {
120
120
  return {
121
121
  declareUser: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.declareUserParams]), schemas_1.doc24Schemas.declareUserResponse, declareUser),
122
122
  getUserId: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.user]), zod_1.number(), getUserId),
123
- getVerificationCode: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.getVerificationCodeParams]), zod_1.void(), getVerificationCode),
123
+ getVerificationCode: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.verificationCodeParams]), zod_1.void(), getVerificationCode),
124
124
  getUserInstance: validation_1.validateFunction(zod_1.tuple([zod_1.union([schemas_1.doc24Schemas.user, zod_1.number()])]),
125
125
  // TODO: validate?
126
126
  zod_1.any(), getUserInstance),
package/lib/index.d.ts CHANGED
@@ -186,5 +186,25 @@ export declare const doc24Sdk: (params: Doc24.SdkParams) => Promise<{
186
186
  gender: "m" | "f";
187
187
  birthday: Date;
188
188
  }) => Promise<void>;
189
+ externalLogin: (params: {
190
+ password: string;
191
+ user: string;
192
+ }) => Promise<any>;
193
+ preExternalEnrollment: (params: {
194
+ birthdate: Date;
195
+ phone: string;
196
+ email: string;
197
+ identificationNumber: string;
198
+ }) => Promise<any>;
199
+ externalEnrollment: (params: {
200
+ birthdate: Date;
201
+ phone: string;
202
+ email: string;
203
+ identificationNumber: string;
204
+ } & {
205
+ emailCode: string;
206
+ phoneCode: string;
207
+ password: string;
208
+ }) => Promise<any>;
189
209
  }>;
190
210
  export type { Doc24 } from './types';
package/lib/schemas.d.ts CHANGED
@@ -278,8 +278,10 @@ export declare const doc24Schemas: {
278
278
  date: import("zod").ZodOptional<import("zod").ZodDate>;
279
279
  startHour: import("zod").ZodOptional<import("zod").ZodString>;
280
280
  finishHour: import("zod").ZodOptional<import("zod").ZodString>;
281
+ language: import("zod").ZodOptional<import("zod").ZodString>;
281
282
  }, "strip", import("zod").ZodTypeAny, {
282
283
  date?: Date | undefined;
284
+ language?: string | undefined;
283
285
  professionalId?: number | undefined;
284
286
  offset?: number | undefined;
285
287
  limit?: number | undefined;
@@ -288,6 +290,7 @@ export declare const doc24Schemas: {
288
290
  finishHour?: string | undefined;
289
291
  }, {
290
292
  date?: Date | undefined;
293
+ language?: string | undefined;
291
294
  professionalId?: number | undefined;
292
295
  offset?: number | undefined;
293
296
  limit?: number | undefined;
@@ -1111,7 +1114,7 @@ export declare const doc24Schemas: {
1111
1114
  authorizationCode: string | null;
1112
1115
  authorizationCodeExpiration: Date | null;
1113
1116
  }>>;
1114
- getVerificationCodeParams: import("zod").ZodObject<{
1117
+ verificationCodeParams: import("zod").ZodObject<{
1115
1118
  identificationType: import("zod").ZodNumber;
1116
1119
  identificationValue: import("zod").ZodString;
1117
1120
  channel: import("zod").ZodEnum<["1", "2"]>;
@@ -1338,4 +1341,86 @@ export declare const doc24Schemas: {
1338
1341
  code?: string | undefined;
1339
1342
  channel?: "1" | "2" | undefined;
1340
1343
  }>;
1344
+ externalLoginParams: import("zod").ZodObject<{
1345
+ user: import("zod").ZodString;
1346
+ password: import("zod").ZodString;
1347
+ }, "strip", import("zod").ZodTypeAny, {
1348
+ password: string;
1349
+ user: string;
1350
+ }, {
1351
+ password: string;
1352
+ user: string;
1353
+ }>;
1354
+ externalLoginResponse: import("zod").ZodObject<{
1355
+ firstName: import("zod").ZodString;
1356
+ lastName: import("zod").ZodString;
1357
+ countryId: import("zod").ZodString;
1358
+ birthday: import("zod").ZodDate;
1359
+ identificationNumber: import("zod").ZodString;
1360
+ gender: import("zod").ZodEnum<["m", "f"]>;
1361
+ email: import("zod").ZodString;
1362
+ phone: import("zod").ZodString;
1363
+ }, "strip", import("zod").ZodTypeAny, {
1364
+ firstName: string;
1365
+ lastName: string;
1366
+ countryId: string;
1367
+ gender: "m" | "f";
1368
+ phone: string;
1369
+ email: string;
1370
+ birthday: Date;
1371
+ identificationNumber: string;
1372
+ }, {
1373
+ firstName: string;
1374
+ lastName: string;
1375
+ countryId: string;
1376
+ gender: "m" | "f";
1377
+ phone: string;
1378
+ email: string;
1379
+ birthday: Date;
1380
+ identificationNumber: string;
1381
+ }>;
1382
+ preExternalEnrollmentParams: import("zod").ZodObject<{
1383
+ identificationNumber: import("zod").ZodString;
1384
+ birthdate: import("zod").ZodDate;
1385
+ email: import("zod").ZodString;
1386
+ phone: import("zod").ZodString;
1387
+ }, "strip", import("zod").ZodTypeAny, {
1388
+ birthdate: Date;
1389
+ phone: string;
1390
+ email: string;
1391
+ identificationNumber: string;
1392
+ }, {
1393
+ birthdate: Date;
1394
+ phone: string;
1395
+ email: string;
1396
+ identificationNumber: string;
1397
+ }>;
1398
+ externalEnrollmentParams: import("zod").ZodIntersection<import("zod").ZodObject<{
1399
+ identificationNumber: import("zod").ZodString;
1400
+ birthdate: import("zod").ZodDate;
1401
+ email: import("zod").ZodString;
1402
+ phone: import("zod").ZodString;
1403
+ }, "strip", import("zod").ZodTypeAny, {
1404
+ birthdate: Date;
1405
+ phone: string;
1406
+ email: string;
1407
+ identificationNumber: string;
1408
+ }, {
1409
+ birthdate: Date;
1410
+ phone: string;
1411
+ email: string;
1412
+ identificationNumber: string;
1413
+ }>, import("zod").ZodObject<{
1414
+ emailCode: import("zod").ZodString;
1415
+ phoneCode: import("zod").ZodString;
1416
+ password: import("zod").ZodString;
1417
+ }, "strip", import("zod").ZodTypeAny, {
1418
+ emailCode: string;
1419
+ phoneCode: string;
1420
+ password: string;
1421
+ }, {
1422
+ emailCode: string;
1423
+ phoneCode: string;
1424
+ password: string;
1425
+ }>>;
1341
1426
  };
package/lib/schemas.js CHANGED
@@ -174,7 +174,7 @@ const coverageInfo = zod_1.object({
174
174
  authorizationCode: zod_1.string().nullable(),
175
175
  authorizationCodeExpiration: zod_1.date().nullable(),
176
176
  }).nullable();
177
- const getVerificationCodeParams = zod_1.object({
177
+ const verificationCodeParams = zod_1.object({
178
178
  identificationType: zod_1.number(),
179
179
  identificationValue: zod_1.string(),
180
180
  channel: zod_1.enum(['1', '2']),
@@ -212,6 +212,27 @@ const declareUserResponse = zod_1.object({
212
212
  patientId: zod_1.number().nullable(),
213
213
  userId: zod_1.number(),
214
214
  }));
215
+ const externalLoginParams = zod_1.object({
216
+ user: zod_1.string(),
217
+ password: zod_1.string(),
218
+ });
219
+ const externalLoginResponse = zod_1.object({
220
+ firstName: zod_1.string(),
221
+ lastName: zod_1.string(),
222
+ countryId: zod_1.string(),
223
+ birthday: zod_1.date(),
224
+ identificationNumber: zod_1.string(),
225
+ gender,
226
+ email: zod_1.string().email(),
227
+ phone: zod_1.string(),
228
+ });
229
+ const preExternalEnrollmentParams = zod_1.object({
230
+ identificationNumber: zod_1.string(),
231
+ birthdate: zod_1.date(),
232
+ email: zod_1.string(),
233
+ phone: zod_1.string(),
234
+ });
235
+ const externalEnrollmentParams = preExternalEnrollmentParams.and(zod_1.object({ emailCode: zod_1.string(), phoneCode: zod_1.string(), password: zod_1.string() }));
215
236
  exports.doc24Schemas = {
216
237
  sdkCredentials,
217
238
  sdkParams: zod_1.object({ url: zod_1.string(), credentials: sdkCredentials }),
@@ -230,6 +251,7 @@ exports.doc24Schemas = {
230
251
  date: zod_1.date().optional(),
231
252
  startHour: zod_1.string().optional(),
232
253
  finishHour: zod_1.string().optional(),
254
+ language: zod_1.string().optional(),
233
255
  }),
234
256
  scheduleParameters: zod_1.union([
235
257
  appointmentScheduleParameters,
@@ -330,10 +352,14 @@ exports.doc24Schemas = {
330
352
  diagnosticaPatient,
331
353
  diagnosticaDeepLinkResponse,
332
354
  coverageInfo,
333
- getVerificationCodeParams,
355
+ verificationCodeParams,
334
356
  declareUserParams,
335
357
  declareUserResponse,
336
358
  declarePatientParams,
337
359
  declarePatientResponse,
338
360
  verificationParams,
361
+ externalLoginParams,
362
+ externalLoginResponse,
363
+ preExternalEnrollmentParams,
364
+ externalEnrollmentParams,
339
365
  };
package/lib/types.d.ts CHANGED
@@ -29,12 +29,15 @@ export declare namespace Doc24 {
29
29
  type DiagnosticaPatient = TypeOf<typeof doc24Schemas.diagnosticaPatient>;
30
30
  type DiagnosticaHistoryAppointment = TypeOf<typeof doc24Schemas.diagnosticaHistoryAppointment>;
31
31
  type DiagnosticaDeepLinkResponse = TypeOf<typeof doc24Schemas.diagnosticaDeepLinkResponse>;
32
- type getVerificationCodeParams = TypeOf<typeof doc24Schemas.getVerificationCodeParams>;
32
+ type VerificationCodeParams = TypeOf<typeof doc24Schemas.verificationCodeParams>;
33
33
  type DeclareUserParams = TypeOf<typeof doc24Schemas.declareUserParams>;
34
34
  type DeclareUserResponse = TypeOf<typeof doc24Schemas.declareUserResponse>;
35
35
  type DeclarePatientParams = TypeOf<typeof doc24Schemas.declarePatientParams>;
36
36
  type DeclarePatientResponse = TypeOf<typeof doc24Schemas.declarePatientResponse>;
37
37
  type VerificationParams = TypeOf<typeof doc24Schemas.verificationParams>;
38
+ type ExternalLoginParams = TypeOf<typeof doc24Schemas.externalLoginParams>;
39
+ type PreExternalEnrollmentParams = TypeOf<typeof doc24Schemas.preExternalEnrollmentParams>;
40
+ type ExternalEnrollmentParams = TypeOf<typeof doc24Schemas.externalEnrollmentParams>;
38
41
  type BaseSdk = {
39
42
  declareUser: (params: DeclareUserParams) => Promise<DeclareUserResponse>;
40
43
  getUserId: (user: User) => Promise<number>;
@@ -43,10 +46,13 @@ export declare namespace Doc24 {
43
46
  getAvailableScheduleClinics: () => Promise<AvailableScheduleClinics>;
44
47
  enroll: (params: EnrollmentParams) => Promise<void>;
45
48
  getCoverageInfo: (identificationValue: string) => Promise<CoverageInfo>;
46
- getVerificationCode: (params: getVerificationCodeParams) => Promise<void>;
49
+ getVerificationCode: (params: VerificationCodeParams) => Promise<void>;
47
50
  getDiagnosticaHistory: (patient: DiagnosticaPatientFilter, from: Date, to: Date) => Promise<DiagnosticaHistoryAppointment[]>;
48
51
  getDiagnosticaDeepLink: (kiosk: string, user: DiagnosticaUser, patient: DiagnosticaPatient) => Promise<DiagnosticaDeepLinkResponse>;
49
52
  getDiagnosticaAccess: (kiosk: string, user: DiagnosticaUser, patient: DiagnosticaPatient) => Promise<void>;
53
+ externalLogin: (params: ExternalLoginParams) => Promise<any>;
54
+ preExternalEnrollment: (params: PreExternalEnrollmentParams) => Promise<any>;
55
+ externalEnrollment: (params: ExternalEnrollmentParams) => Promise<any>;
50
56
  };
51
57
  type UserSdk = {
52
58
  declarePatient: (params: DeclarePatientParams) => Promise<DeclarePatientResponse>;
@@ -2,6 +2,7 @@ import { RequestMaker } from '../request';
2
2
  export declare const getScheduleMethods: (makeRequest: RequestMaker) => {
3
3
  getSchedule: (patientId: number, specialtyId: number, filter?: {
4
4
  date?: Date | undefined;
5
+ language?: string | undefined;
5
6
  professionalId?: number | undefined;
6
7
  offset?: number | undefined;
7
8
  limit?: number | undefined;
@@ -7,7 +7,7 @@ const validation_1 = require("../request/validation");
7
7
  const schemas_1 = require("../schemas");
8
8
  const utils_1 = require("../utils");
9
9
  const getScheduleMethods = (makeRequest) => {
10
- const getScheduleDates = validation_1.validateFunction(zod_1.tuple([zod_1.number(), schemas_1.doc24Schemas.scheduleAvailabilityFilter]), zod_1.array(zod_1.date()), async (patientId, filter = {}) => {
10
+ const getScheduleDates = async (patientId, filter = {}) => {
11
11
  const mappedFilter = {
12
12
  specialty_id: filter.specialtyId,
13
13
  professional_id: filter.professionalId,
@@ -15,8 +15,9 @@ const getScheduleMethods = (makeRequest) => {
15
15
  const path = `/schedule/dates/${patientId}/${JSON.stringify(mappedFilter)}`;
16
16
  const response = await makeRequest('GET', path);
17
17
  return response.data.available_dates.map((o) => utils_1.parseDate(o.date));
18
- });
19
- const 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), async (patientId, specialtyId, filter = {}) => {
18
+ };
19
+ const getSchedule = async (patientId, specialtyId, filter = {}) => {
20
+ var _a;
20
21
  const mappedFilter = {
21
22
  id_professional: filter.professionalId,
22
23
  offset: filter.offset,
@@ -25,6 +26,7 @@ const getScheduleMethods = (makeRequest) => {
25
26
  date: filter.date && date_fns_1.format(filter.date, 'yyyy-MM-dd'),
26
27
  start_hour: filter.startHour,
27
28
  finish_hour: filter.finishHour,
29
+ language: (_a = filter.language) !== null && _a !== void 0 ? _a : 'ES',
28
30
  };
29
31
  const path = `/schedule/availability/${patientId}/${specialtyId}/${JSON.stringify(mappedFilter)}`;
30
32
  const response = await makeRequest('GET', path);
@@ -47,8 +49,8 @@ const getScheduleMethods = (makeRequest) => {
47
49
  ranking: a.ranking,
48
50
  length: a.length,
49
51
  }));
50
- });
51
- const getAppointment = validation_1.validateFunction(zod_1.tuple([zod_1.number()]), schemas_1.doc24Schemas.appointment, async (appointmentId) => {
52
+ };
53
+ const getAppointment = async (appointmentId) => {
52
54
  const path = `/appointment/${appointmentId}`;
53
55
  const response = await makeRequest('GET', path);
54
56
  return {
@@ -56,8 +58,8 @@ const getScheduleMethods = (makeRequest) => {
56
58
  professionalId: response.data.professional_id,
57
59
  date: utils_1.parseDateTime(`${response.data.date} ${response.data.hour}`),
58
60
  };
59
- });
60
- const getAppointmentByVcToken = validation_1.validateFunction(zod_1.tuple([zod_1.string()]), schemas_1.doc24Schemas.appointment, async (vcToken) => {
61
+ };
62
+ const getAppointmentByVcToken = async (vcToken) => {
61
63
  const path = `/appointmentByToken/${vcToken}`;
62
64
  const response = await makeRequest('GET', path);
63
65
  return {
@@ -65,12 +67,12 @@ const getScheduleMethods = (makeRequest) => {
65
67
  professionalId: response.data.professional_id,
66
68
  date: utils_1.parseDateTime(`${response.data.date} ${response.data.hour}`),
67
69
  };
68
- });
70
+ };
69
71
  return {
70
- getSchedule,
71
- getScheduleDates,
72
- getAppointment,
73
- getAppointmentByVcToken,
72
+ 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),
73
+ getScheduleDates: validation_1.validateFunction(zod_1.tuple([zod_1.number(), schemas_1.doc24Schemas.scheduleAvailabilityFilter]), zod_1.array(zod_1.date()), getScheduleDates),
74
+ getAppointment: validation_1.validateFunction(zod_1.tuple([zod_1.number()]), schemas_1.doc24Schemas.appointment, getAppointment),
75
+ getAppointmentByVcToken: validation_1.validateFunction(zod_1.tuple([zod_1.string()]), schemas_1.doc24Schemas.appointment, getAppointmentByVcToken),
74
76
  };
75
77
  };
76
78
  exports.getScheduleMethods = getScheduleMethods;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@integraciones_doc24/sdk",
3
- "version": "1.5.1",
3
+ "version": "1.6.0",
4
4
  "publishConfig": {
5
5
  "tag": "latest"
6
6
  },