@integraciones_doc24/sdk 0.35.0 → 0.36.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.
Files changed (98) hide show
  1. package/lib/baseSdk/diagnostica.d.ts +1 -1
  2. package/lib/baseSdk/index.js +5 -1
  3. package/lib/baseSdk/user.d.ts +1 -1
  4. package/lib/index.d.ts +3 -3
  5. package/lib/schemas.d.ts +10 -10
  6. package/lib/schemas.js +1 -1
  7. package/lib/userSdk/patients.d.ts +1 -1
  8. package/lib/utils.d.ts +1 -1
  9. package/lib/utils.js +2 -0
  10. package/package.json +4 -1
  11. package/lib/baseSdk/external.d.ts +0 -28
  12. package/lib/baseSdk/external.js +0 -73
  13. package/lib/lib/baseSdk/diagnostica.d.ts +0 -11
  14. package/lib/lib/baseSdk/diagnostica.js +0 -79
  15. package/lib/lib/baseSdk/external.d.ts +0 -15
  16. package/lib/lib/baseSdk/external.js +0 -73
  17. package/lib/lib/baseSdk/index.d.ts +0 -114
  18. package/lib/lib/baseSdk/index.js +0 -66
  19. package/lib/lib/baseSdk/user.d.ts +0 -30
  20. package/lib/lib/baseSdk/user.js +0 -88
  21. package/lib/lib/index.d.ts +0 -154
  22. package/lib/lib/index.js +0 -22
  23. package/lib/lib/request/index.d.ts +0 -2
  24. package/lib/lib/request/index.js +0 -26
  25. package/lib/lib/request/token.d.ts +0 -2
  26. package/lib/lib/request/token.js +0 -34
  27. package/lib/lib/request/validation.d.ts +0 -10
  28. package/lib/lib/request/validation.js +0 -28
  29. package/lib/lib/schemas.d.ts +0 -1138
  30. package/lib/lib/schemas.js +0 -294
  31. package/lib/lib/test.d.ts +0 -1
  32. package/lib/lib/test.js +0 -55
  33. package/lib/lib/types.d.ts +0 -1
  34. package/lib/lib/types.js +0 -2
  35. package/lib/lib/userSdk/chat.d.ts +0 -9
  36. package/lib/lib/userSdk/chat.js +0 -98
  37. package/lib/lib/userSdk/index.d.ts +0 -220
  38. package/lib/lib/userSdk/index.js +0 -27
  39. package/lib/lib/userSdk/patients.d.ts +0 -4
  40. package/lib/lib/userSdk/patients.js +0 -27
  41. package/lib/lib/userSdk/sarasas.d.ts +0 -6
  42. package/lib/lib/userSdk/sarasas.js +0 -13
  43. package/lib/lib/userSdk/schedule.d.ts +0 -15
  44. package/lib/lib/userSdk/schedule.js +0 -76
  45. package/lib/lib/userSdk/specialties.d.ts +0 -4
  46. package/lib/lib/userSdk/specialties.js +0 -19
  47. package/lib/lib/userSdk/videoVisit.d.ts +0 -72
  48. package/lib/lib/userSdk/videoVisit.js +0 -147
  49. package/lib/lib/utils.d.ts +0 -4
  50. package/lib/lib/utils.js +0 -19
  51. package/lib/lib/webhook/index.d.ts +0 -8
  52. package/lib/lib/webhook/index.js +0 -55
  53. package/lib/lib/webhook/responses.d.ts +0 -36
  54. package/lib/lib/webhook/responses.js +0 -42
  55. package/lib/lib/webhook/token.d.ts +0 -2
  56. package/lib/lib/webhook/token.js +0 -23
  57. package/lib/src/baseSdk/diagnostica.d.ts +0 -54
  58. package/lib/src/baseSdk/diagnostica.js +0 -79
  59. package/lib/src/baseSdk/index.d.ts +0 -2
  60. package/lib/src/baseSdk/index.js +0 -66
  61. package/lib/src/baseSdk/user.d.ts +0 -41
  62. package/lib/src/baseSdk/user.js +0 -88
  63. package/lib/src/index.d.ts +0 -159
  64. package/lib/src/index.js +0 -22
  65. package/lib/src/request/index.d.ts +0 -3
  66. package/lib/src/request/index.js +0 -26
  67. package/lib/src/request/token.d.ts +0 -2
  68. package/lib/src/request/token.js +0 -34
  69. package/lib/src/request/validation.d.ts +0 -10
  70. package/lib/src/request/validation.js +0 -28
  71. package/lib/src/schemas.d.ts +0 -1115
  72. package/lib/src/schemas.js +0 -294
  73. package/lib/src/types.d.ts +0 -116
  74. package/lib/src/types.js +0 -2
  75. package/lib/src/userSdk/chat.d.ts +0 -57
  76. package/lib/src/userSdk/chat.js +0 -98
  77. package/lib/src/userSdk/index.d.ts +0 -2
  78. package/lib/src/userSdk/index.js +0 -27
  79. package/lib/src/userSdk/patients.d.ts +0 -12
  80. package/lib/src/userSdk/patients.js +0 -27
  81. package/lib/src/userSdk/schedule.d.ts +0 -44
  82. package/lib/src/userSdk/schedule.js +0 -76
  83. package/lib/src/userSdk/specialties.d.ts +0 -7
  84. package/lib/src/userSdk/specialties.js +0 -19
  85. package/lib/src/userSdk/videoVisit.d.ts +0 -111
  86. package/lib/src/userSdk/videoVisit.js +0 -147
  87. package/lib/src/utils.d.ts +0 -4
  88. package/lib/src/utils.js +0 -19
  89. package/lib/src/webhook/index.d.ts +0 -2
  90. package/lib/src/webhook/index.js +0 -55
  91. package/lib/src/webhook/responses.d.ts +0 -35
  92. package/lib/src/webhook/responses.js +0 -42
  93. package/lib/src/webhook/token.d.ts +0 -2
  94. package/lib/src/webhook/token.js +0 -23
  95. package/lib/test.d.ts +0 -1
  96. package/lib/test.js +0 -55
  97. package/lib/userSdk/sarasas.d.ts +0 -6
  98. package/lib/userSdk/sarasas.js +0 -13
@@ -1,294 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.doc24Schemas = void 0;
4
- const zod_1 = require("zod");
5
- const gender = zod_1.enum(['m', 'f']);
6
- const identificationType = zod_1.enum(['ndi', 'passport', 'credential']);
7
- const sdkCredentials = zod_1.object({ iss: zod_1.string(), key: zod_1.string() });
8
- const basePersonData = zod_1.object({
9
- firstName: zod_1.string(),
10
- lastName: zod_1.string(),
11
- identificationType,
12
- identificationValue: zod_1.string(),
13
- countryId: zod_1.string(),
14
- birthdate: zod_1.date(),
15
- gender,
16
- });
17
- const specialtyMode = zod_1.enum(['appointment', 'chat', 'instant']);
18
- const specialty = zod_1.object({
19
- id: zod_1.number(),
20
- description: zod_1.string(),
21
- });
22
- const scheduleAvailabilityFilter = zod_1.object({
23
- specialtyId: zod_1.number().optional(),
24
- professionalId: zod_1.number().optional(),
25
- });
26
- const availableAppointment = zod_1.object({
27
- id: zod_1.number().or(zod_1.string()),
28
- date: zod_1.date(),
29
- clinicId: zod_1.number(),
30
- professional: zod_1.object({
31
- id: zod_1.number(),
32
- fullName: zod_1.string(),
33
- logoUrl: zod_1.string(),
34
- }),
35
- cost: zod_1.string(),
36
- specialty: specialty,
37
- type: specialtyMode,
38
- atentions: zod_1.number(),
39
- ranking: zod_1.unknown(),
40
- length: zod_1.number().nullish(),
41
- });
42
- const appointment = zod_1.object({
43
- id: zod_1.number(),
44
- professionalId: zod_1.number(),
45
- date: zod_1.date(),
46
- });
47
- const availableScheduleClinics = zod_1.object({
48
- specialties: specialty.array(),
49
- specialtiesER: specialty.array(),
50
- professionals: zod_1.object({
51
- id: zod_1.number(),
52
- fullName: zod_1.string(),
53
- clinicId: zod_1.number(),
54
- specialties: specialty.array(),
55
- }).array(),
56
- });
57
- const baseScheduleParameters = zod_1.object({
58
- patientId: zod_1.number(),
59
- specialtyId: zod_1.number(),
60
- language: zod_1.string(),
61
- details: zod_1.string(),
62
- extraInfo: zod_1.any(),
63
- });
64
- const appointmentScheduleParameters = baseScheduleParameters.extend({
65
- type: zod_1.literal('appointment'),
66
- appointmentId: zod_1.number().or(zod_1.string()),
67
- });
68
- const instantScheduleParameters = baseScheduleParameters.extend({
69
- type: zod_1.literal('instant'),
70
- });
71
- const chatroomAvailabilityFilter = zod_1.object({
72
- limit: zod_1.number().optional(),
73
- offset: zod_1.number().optional(),
74
- });
75
- const chatParameters = zod_1.object({
76
- patientId: zod_1.number(),
77
- chatroomId: zod_1.number(),
78
- language: zod_1.string(),
79
- specialtyId: zod_1.number(),
80
- });
81
- const availableChatroom = zod_1.object({
82
- id: zod_1.number(),
83
- professional: zod_1.object({
84
- id: zod_1.number(),
85
- fullName: zod_1.string(),
86
- logoUrl: zod_1.string(),
87
- }),
88
- specialty: zod_1.object({ id: zod_1.number(), description: zod_1.string() }),
89
- });
90
- const chatDetails = zod_1.object({
91
- id: zod_1.number(),
92
- chatRoomId: zod_1.number(),
93
- startDate: zod_1.date(),
94
- lastEventDate: zod_1.date(),
95
- closureDate: zod_1.date().nullable(),
96
- patient: zod_1.object({
97
- id: zod_1.number(),
98
- firstName: zod_1.string(),
99
- lastName: zod_1.string(),
100
- }),
101
- patientLastPost: zod_1.date().nullable(),
102
- professional: zod_1.object({
103
- id: zod_1.number(),
104
- fullName: zod_1.string(),
105
- logoUrl: zod_1.string(),
106
- }),
107
- professionalLastPost: zod_1.date().nullable(),
108
- specialty: zod_1.object({ id: zod_1.number(), description: zod_1.string() }),
109
- status: zod_1.string(),
110
- paymentStatus: zod_1.string(),
111
- });
112
- const chatPost = zod_1.object({
113
- id: zod_1.number(),
114
- userType: zod_1.enum(['patient', 'professional']),
115
- message: zod_1.string(),
116
- date: zod_1.date(),
117
- });
118
- const enrollmentParams = zod_1.object({
119
- firstName: zod_1.string(),
120
- lastName: zod_1.string(),
121
- gender: gender,
122
- identificationNumber: zod_1.string(),
123
- birthdate: zod_1.date(),
124
- email: zod_1.string().email(),
125
- plan: zod_1.string(),
126
- startDate: zod_1.date(),
127
- });
128
- const diagnosticaHistoryAppointment = zod_1.object({
129
- date: zod_1.date(),
130
- location: zod_1.string(),
131
- exams: zod_1.string().array(),
132
- deepLink: zod_1.string().url(),
133
- });
134
- const diagnosticaPatient = zod_1.object({
135
- firstName: zod_1.string(),
136
- lastName: zod_1.string(),
137
- birthday: zod_1.date(),
138
- identificationType: zod_1.literal('dni'),
139
- identificationValue: zod_1.string(),
140
- gender: gender,
141
- });
142
- const diagnosticaUser = diagnosticaPatient.merge(zod_1.object({
143
- phone: zod_1.string(),
144
- email: zod_1.string().email(),
145
- language: zod_1.string(),
146
- }));
147
- const diagnosticaDeepLinkResponse = zod_1.object({
148
- forwardingRequired: zod_1.literal(true),
149
- deepLink: zod_1.string().url(),
150
- }).or(zod_1.object({ forwardingRequired: zod_1.literal(false) }));
151
- const coverageInfo = zod_1.object({
152
- financerId: zod_1.number().nullable(),
153
- defaultAffiliationId: zod_1.number().nullable(),
154
- plan: zod_1.string().nullable(),
155
- identificationNumber: zod_1.string(),
156
- credentialNumber: zod_1.string().nullable(),
157
- lastName: zod_1.string().nullable(),
158
- firstName: zod_1.string().nullable(),
159
- birthdate: zod_1.date(),
160
- financerPlanId: zod_1.number().nullable(),
161
- gender,
162
- brand: zod_1.number().nullable(),
163
- holderIdentificationNumber: zod_1.string().nullable(),
164
- copaymentValue: zod_1.number().nullable(),
165
- mobilePhone: zod_1.string().nullable(),
166
- company: zod_1.string().nullable(),
167
- email: zod_1.string().email().nullable(),
168
- dischargeDate: zod_1.date().nullable(),
169
- leavingDate: zod_1.date().nullable(),
170
- identificacion_tributaria: zod_1.string().nullable(),
171
- deregistrationDate: zod_1.date().nullable(),
172
- authorizationCode: zod_1.string().nullable(),
173
- authorizationCodeExpiration: zod_1.date().nullable(),
174
- }).nullable();
175
- exports.doc24Schemas = {
176
- identificationType,
177
- sdkCredentials,
178
- sdkParams: zod_1.object({ url: zod_1.string(), credentials: sdkCredentials }),
179
- user: basePersonData.extend({ phone: zod_1.string(), email: zod_1.string() }),
180
- patient: basePersonData,
181
- specialtyMode,
182
- specialty,
183
- scheduleAvailabilityFilter,
184
- availableAppointment,
185
- availableScheduleClinics,
186
- scheduleFilter: zod_1.object({
187
- professionalId: zod_1.number().optional(),
188
- offset: zod_1.number().optional(),
189
- limit: zod_1.number().optional(),
190
- weekDay: zod_1.number().optional(),
191
- date: zod_1.date().optional(),
192
- startHour: zod_1.string().optional(),
193
- finishHour: zod_1.string().optional(),
194
- }),
195
- scheduleParameters: zod_1.union([
196
- appointmentScheduleParameters,
197
- instantScheduleParameters,
198
- ]),
199
- videoVisit: zod_1.object({
200
- id: zod_1.number().nullable(),
201
- creationDate: zod_1.date(),
202
- patientId: zod_1.number(),
203
- user: zod_1.object({
204
- id: zod_1.number(),
205
- email: zod_1.string().nullable(),
206
- phone: zod_1.string().nullable(),
207
- }),
208
- vcToken: zod_1.string(),
209
- appointment: zod_1.object({
210
- id: zod_1.number(),
211
- date: zod_1.date(),
212
- }).optional(),
213
- videoVisit: zod_1.object({
214
- id: zod_1.number(),
215
- status: zod_1.string(),
216
- }).optional(),
217
- paymentStatus: zod_1.string().optional(),
218
- atentionId: zod_1.number().optional(),
219
- }),
220
- videoVisitDetails: zod_1.object({
221
- id: zod_1.number(),
222
- status: zod_1.string(),
223
- paymentStatus: zod_1.string(),
224
- professional: zod_1.object({
225
- id: zod_1.number(),
226
- fullName: zod_1.string(),
227
- }).optional(),
228
- patient: zod_1.object({
229
- fullName: zod_1.string(),
230
- firstAccessDate: zod_1.date(),
231
- lastAccessDate: zod_1.date(),
232
- }),
233
- finishDate: zod_1.date().nullable(),
234
- retries: zod_1.number(),
235
- language: zod_1.string(),
236
- appointment: zod_1.object({ id: zod_1.number(), date: zod_1.date() }).nullable(),
237
- report: zod_1.object({
238
- motive: zod_1.string().nullable(),
239
- actualDesease: zod_1.string().nullable(),
240
- indications: zod_1.string().nullable(),
241
- alertSigns: zod_1.string().nullable(),
242
- extendedMotive: zod_1.string().nullable(),
243
- diagnose: zod_1.array(zod_1.object({ description: zod_1.string(), code: zod_1.string() })),
244
- }),
245
- pdf: zod_1.object({
246
- atention: zod_1.string().optional(),
247
- labs: zod_1.string().optional(),
248
- otherExams: zod_1.string().optional(),
249
- images: zod_1.string().optional(),
250
- medication: zod_1.array(zod_1.any()),
251
- }),
252
- files: zod_1.array(zod_1.object({ name: zod_1.string(), url: zod_1.string().url() })),
253
- }),
254
- activeVideoVisitData: zod_1.object({
255
- consultationId: zod_1.number(),
256
- patientId: zod_1.number(),
257
- vcToken: zod_1.string(),
258
- }),
259
- professional: zod_1.object({
260
- id: zod_1.number(),
261
- firstName: zod_1.string(),
262
- lastName: zod_1.string(),
263
- birthdate: zod_1.date(),
264
- gender,
265
- email: zod_1.string(),
266
- phone: zod_1.string().nullable(),
267
- logoUrl: zod_1.string(),
268
- matriculation: zod_1.array(zod_1.object({ number: zod_1.string(), type: zod_1.string() })),
269
- specialties: zod_1.array(specialty),
270
- degree: zod_1.string(),
271
- languages: zod_1.array(zod_1.string()),
272
- resume: zod_1.object({
273
- link: zod_1.string(),
274
- brief: zod_1.string(),
275
- }),
276
- }),
277
- appointment,
278
- chatroomAvailabilityFilter,
279
- chatParameters,
280
- availableChatroom,
281
- chatDetails,
282
- chatPost,
283
- enrollmentParams,
284
- diagnosticaPatientFilter: zod_1.object({
285
- gender,
286
- identificationType,
287
- identificationValue: zod_1.string(),
288
- }),
289
- diagnosticaHistoryAppointment,
290
- diagnosticaUser,
291
- diagnosticaPatient,
292
- diagnosticaDeepLinkResponse,
293
- coverageInfo,
294
- };
package/lib/lib/test.d.ts DELETED
@@ -1 +0,0 @@
1
- export var __esModule: boolean;
package/lib/lib/test.js DELETED
@@ -1,55 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const _1 = require(".");
4
- const test = async () => {
5
- try {
6
- const baseSdk = await _1.doc24Sdk({
7
- url: 'https://tapi.doc24.com.ar/ws/sdk',
8
- credentials: {
9
- iss: 'wehealthy',
10
- key: '33Ypv5jQ1VTr1KcOImdBhPnoRDqmPlYR3JWbrlUim9U=',
11
- },
12
- });
13
- const userSdk = await baseSdk.getUserInstance(15135);
14
- let res = await userSdk.declarePatient({
15
- patient: {
16
- firstName: 'Rafael Elias',
17
- lastName: 'Mian',
18
- identificationType: 'ndi',
19
- identificationValue: '37970350',
20
- countryId: 'AR',
21
- birthdate: new Date('1996-07-03'),
22
- gender: 'm',
23
- },
24
- });
25
- // let res = await baseSdk.declareUser({
26
- // user: {
27
- // firstName: 'Rafael Elias',
28
- // lastName: 'Mian',
29
- // identificationType: 'ndi',
30
- // identificationValue: '37970350',
31
- // countryId: 'AR',
32
- // birthdate: new Date('1996-07-03'),
33
- // gender: 'm',
34
- // email: 'rafaelmian35@gmail.com',
35
- // phone: '+5493764203061',
36
- // },
37
- // // channel: '1',
38
- // // code: '370356',
39
- // });
40
- console.log(res);
41
- // await new Promise((resolve) => setTimeout(resolve, 2000));
42
- // if (!res.ask_code) return res.userId;
43
- // await baseSdk.sendVerificationCode({
44
- // identificationType: 'ndi',
45
- // identificationValue: '37970350',
46
- // channel: '1',
47
- // });
48
- // console.log(res);
49
- return;
50
- }
51
- catch (e) {
52
- console.log(e);
53
- }
54
- };
55
- test();
@@ -1 +0,0 @@
1
- export var __esModule: boolean;
package/lib/lib/types.js DELETED
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,9 +0,0 @@
1
- export var __esModule: boolean;
2
- export function getChatMethods(makeRequest: any): {
3
- getAvailableChatrooms: (...params: any) => Promise<any>;
4
- createNewChat: (...params: any) => Promise<any>;
5
- getPatientChats: (...params: any) => Promise<any>;
6
- getChatPosts: (...params: any) => Promise<any>;
7
- cancelChat: (...params: any) => Promise<void>;
8
- sendChatMessage: (...params: any) => Promise<any>;
9
- };
@@ -1,98 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getChatMethods = void 0;
4
- const zod_1 = require("zod");
5
- const validation_1 = require("../request/validation");
6
- const schemas_1 = require("../schemas");
7
- const utils_1 = require("../utils");
8
- const getChatMethods = (makeRequest) => {
9
- const getAvailableChatrooms = validation_1.validateFunction(zod_1.tuple([zod_1.number(), zod_1.number(), schemas_1.doc24Schemas.chatroomAvailabilityFilter]), zod_1.array(schemas_1.doc24Schemas.availableChatroom), async (patientId, specialtyId, filter) => {
10
- const path = `/chatroom/availability/${patientId}/${specialtyId}/${JSON.stringify(filter)}`;
11
- const response = await makeRequest('GET', path);
12
- return response.data.available_chatrooms.map((r) => ({
13
- id: r.chatroom_id,
14
- professional: {
15
- id: r.professional_id,
16
- fullName: r.professional,
17
- logoUrl: r.logo,
18
- },
19
- specialty: {
20
- id: r.specialty_id,
21
- description: r.specialty,
22
- },
23
- }));
24
- });
25
- const createNewChat = validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.chatParameters]), zod_1.number(), async (parameters) => {
26
- const path = `/chatroom/visit`;
27
- const response = await makeRequest('POST', path, {
28
- chatroom_data: {
29
- patient_id: parameters.patientId,
30
- chatroom_id: parameters.chatroomId,
31
- language: parameters.language.toLocaleUpperCase(),
32
- specialty_id: parameters.specialtyId,
33
- },
34
- });
35
- return response.data.chat_id;
36
- });
37
- const getPatientChats = validation_1.validateFunction(zod_1.tuple([zod_1.number()]), zod_1.array(schemas_1.doc24Schemas.chatDetails), async (patientId) => {
38
- const path = `/chatroom/visits/${patientId}`;
39
- const response = await makeRequest('GET', path);
40
- return response.data.chatroom_visits.map((c) => ({
41
- id: c.chat_id,
42
- chatRoomId: c.chatroom_id,
43
- status: c.status,
44
- paymentStatus: c.payment_status,
45
- startDate: utils_1.parseDateTime(c.start_date),
46
- lastEventDate: utils_1.parseDateTime(c.fecha_ultimo_evento),
47
- closureDate: c.closure_date && utils_1.parseDateTime(c.closure_date),
48
- patient: {
49
- id: c.patient_id,
50
- firstName: c.patient_name,
51
- lastName: c.patient_lastname,
52
- },
53
- patientLastPost: c.patient_last_post && utils_1.parseDateTime(c.patient_last_post),
54
- professional: {
55
- id: c.professional_id,
56
- fullName: c.professional,
57
- logoUrl: c.logo,
58
- },
59
- professionalLastPost: c.professional_last_post && utils_1.parseDateTime(c.professional_last_post),
60
- specialty: {
61
- id: c.specialty_id,
62
- description: c.specialty,
63
- },
64
- }));
65
- });
66
- const getChatPosts = validation_1.validateFunction(zod_1.tuple([zod_1.number()]), zod_1.array(schemas_1.doc24Schemas.chatPost), async (chatId) => {
67
- const path = `/chatroom/visit/${chatId}`;
68
- const response = await makeRequest('GET', path);
69
- return JSON.parse(response.data.posts).map((p) => ({
70
- id: p.post_id,
71
- message: p.post,
72
- date: utils_1.parseDateTime(p.post_date),
73
- userType: p.user_type === 'P' ? 'patient' : 'professional',
74
- }));
75
- });
76
- const cancelChat = validation_1.validateFunction(zod_1.tuple([zod_1.number()]), zod_1.void(), async (chatId) => {
77
- const path = `/chatroom/visit/${chatId}`;
78
- await makeRequest('DELETE', path);
79
- return;
80
- });
81
- const sendChatMessage = validation_1.validateFunction(zod_1.tuple([zod_1.number(), zod_1.string()]), zod_1.number(), async (chatId, message) => {
82
- const path = `/chatroom/post`;
83
- const response = await makeRequest('POST', path, {
84
- chat_id: chatId,
85
- message,
86
- });
87
- return response.data.post_id;
88
- });
89
- return {
90
- getAvailableChatrooms,
91
- createNewChat,
92
- getPatientChats,
93
- getChatPosts,
94
- cancelChat,
95
- sendChatMessage,
96
- };
97
- };
98
- exports.getChatMethods = getChatMethods;
@@ -1,220 +0,0 @@
1
- export var __esModule: boolean;
2
- export function userSdk(url: any, credentials: any, userId: any): Promise<{
3
- userId: any;
4
- getAvailableChatrooms: (patientId: number, specialtyId: number, filter: {
5
- offset?: number | undefined;
6
- limit?: number | undefined;
7
- }) => Promise<{
8
- id: number;
9
- professional: {
10
- id: number;
11
- fullName: string;
12
- logoUrl: string;
13
- };
14
- specialty: {
15
- id: number;
16
- description: string;
17
- };
18
- }[]>;
19
- createNewChat: (chatParameters: {
20
- patientId: number;
21
- specialtyId: number;
22
- language: string;
23
- chatroomId: number;
24
- }) => Promise<number>;
25
- getPatientChats: (patientId: number) => Promise<{
26
- id: number;
27
- patient: {
28
- id: number;
29
- firstName: string;
30
- lastName: string;
31
- };
32
- professional: {
33
- id: number;
34
- fullName: string;
35
- logoUrl: string;
36
- };
37
- status: string;
38
- specialty: {
39
- id: number;
40
- description: string;
41
- };
42
- paymentStatus: string;
43
- chatRoomId: number;
44
- startDate: Date;
45
- lastEventDate: Date;
46
- closureDate: Date | null;
47
- patientLastPost: Date | null;
48
- professionalLastPost: Date | null;
49
- }[]>;
50
- getChatPosts: (chatId: number) => Promise<{
51
- date: Date;
52
- message: string;
53
- id: number;
54
- userType: "patient" | "professional";
55
- }[]>;
56
- cancelChat: (chatId: number) => Promise<void>;
57
- sendChatMessage: (chatId: number, message: string) => Promise<number>;
58
- scheduleVideoVisit: (params: {
59
- extraInfo?: any;
60
- type: "appointment";
61
- patientId: number;
62
- specialtyId: number;
63
- language: string;
64
- details: string;
65
- appointmentId: string | number;
66
- } | {
67
- extraInfo?: any;
68
- type: "instant";
69
- patientId: number;
70
- specialtyId: number;
71
- language: string;
72
- details: string;
73
- }) => Promise<string>;
74
- cancelVideoVisit: (vcToken: string) => Promise<void>;
75
- getVideoVisit: (vcToken: string, patientId: number) => Promise<{
76
- appointment?: {
77
- date: Date;
78
- id: number;
79
- } | undefined;
80
- videoVisit?: {
81
- id: number;
82
- status: string;
83
- } | undefined;
84
- paymentStatus?: string | undefined;
85
- atentionId?: number | undefined;
86
- id: number | null;
87
- patientId: number;
88
- creationDate: Date;
89
- user: {
90
- id: number;
91
- phone: string | null;
92
- email: string | null;
93
- };
94
- vcToken: string;
95
- }>;
96
- getPatientVideoVisitHistory: (patientId: number) => Promise<{
97
- appointment?: {
98
- date: Date;
99
- id: number;
100
- } | undefined;
101
- videoVisit?: {
102
- id: number;
103
- status: string;
104
- } | undefined;
105
- paymentStatus?: string | undefined;
106
- atentionId?: number | undefined;
107
- id: number | null;
108
- patientId: number;
109
- creationDate: Date;
110
- user: {
111
- id: number;
112
- phone: string | null;
113
- email: string | null;
114
- };
115
- vcToken: string;
116
- }[]>;
117
- getVideoVisitDetails: (vcId: number) => Promise<{
118
- professional?: {
119
- id: number;
120
- fullName: string;
121
- } | undefined;
122
- appointment: {
123
- date: Date;
124
- id: number;
125
- } | null;
126
- id: number;
127
- language: string;
128
- patient: {
129
- fullName: string;
130
- firstAccessDate: Date;
131
- lastAccessDate: Date;
132
- };
133
- status: string;
134
- paymentStatus: string;
135
- finishDate: Date | null;
136
- retries: number;
137
- report: {
138
- motive: string | null;
139
- actualDesease: string | null;
140
- indications: string | null;
141
- alertSigns: string | null;
142
- extendedMotive: string | null;
143
- diagnose: {
144
- code: string;
145
- description: string;
146
- }[];
147
- };
148
- pdf: {
149
- atention?: string | undefined;
150
- labs?: string | undefined;
151
- otherExams?: string | undefined;
152
- images?: string | undefined;
153
- medication: any[];
154
- };
155
- files: {
156
- name: string;
157
- url: string;
158
- }[];
159
- }>;
160
- getVideoVisitLink: (vcToken: string, patientId: number) => Promise<string | null>;
161
- getActiveVideoVisits: () => Promise<{
162
- patientId: number;
163
- vcToken: string;
164
- consultationId: number;
165
- }[]>;
166
- getSchedule: (patientId: number, specialtyId: number, filter?: {
167
- date?: Date | undefined;
168
- professionalId?: number | undefined;
169
- offset?: number | undefined;
170
- limit?: number | undefined;
171
- weekDay?: number | undefined;
172
- startHour?: string | undefined;
173
- finishHour?: string | undefined;
174
- } | undefined) => Promise<{
175
- length?: number | null | undefined;
176
- ranking?: unknown;
177
- date: Date;
178
- type: "appointment" | "chat" | "instant";
179
- id: string | number;
180
- professional: {
181
- id: number;
182
- fullName: string;
183
- logoUrl: string;
184
- };
185
- clinicId: number;
186
- cost: string;
187
- specialty: {
188
- id: number;
189
- description: string;
190
- };
191
- atentions: number;
192
- }[]>;
193
- getScheduleDates: (patientId: number, filter?: {
194
- specialtyId?: number | undefined;
195
- professionalId?: number | undefined;
196
- } | undefined) => Promise<Date[]>;
197
- getAppointment: (appointmentId: number) => Promise<{
198
- date: Date;
199
- id: number;
200
- professionalId: number;
201
- }>;
202
- getAppointmentByVcToken: (vcToken: string) => Promise<{
203
- date: Date;
204
- id: number;
205
- professionalId: number;
206
- }>;
207
- getSpecialties: (mode: "appointment" | "chat" | "instant", language: string) => Promise<{
208
- id: number;
209
- description: string;
210
- }[]>;
211
- declarePatient: (patient: {
212
- firstName: string;
213
- lastName: string;
214
- identificationType: "ndi" | "passport" | "credential";
215
- identificationValue: string;
216
- gender: "m" | "f";
217
- countryId: string;
218
- birthdate: Date;
219
- }) => Promise<number>;
220
- }>;