@integraciones_doc24/sdk 1.9.1 → 1.11.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 (245) hide show
  1. package/lib/baseSdk/external.d.ts +29 -0
  2. package/lib/baseSdk/external.js +56 -0
  3. package/lib/index.d.ts +29 -0
  4. package/lib/schemas.d.ts +127 -0
  5. package/lib/schemas.js +23 -0
  6. package/lib/types.d.ts +6 -0
  7. package/lib/userSdk/videoVisit.d.ts +4 -0
  8. package/lib/userSdk/videoVisit.js +2 -0
  9. package/package.json +1 -1
  10. package/lib/lib/baseSdk/diagnostica.d.ts +0 -11
  11. package/lib/lib/baseSdk/diagnostica.js +0 -79
  12. package/lib/lib/baseSdk/index.d.ts +0 -161
  13. package/lib/lib/baseSdk/index.js +0 -66
  14. package/lib/lib/baseSdk/user.d.ts +0 -41
  15. package/lib/lib/baseSdk/user.js +0 -130
  16. package/lib/lib/index.d.ts +0 -182
  17. package/lib/lib/index.js +0 -22
  18. package/lib/lib/lib/baseSdk/diagnostica.d.ts +0 -6
  19. package/lib/lib/lib/baseSdk/diagnostica.js +0 -79
  20. package/lib/lib/lib/baseSdk/index.d.ts +0 -51
  21. package/lib/lib/lib/baseSdk/index.js +0 -66
  22. package/lib/lib/lib/baseSdk/user.d.ts +0 -9
  23. package/lib/lib/lib/baseSdk/user.js +0 -130
  24. package/lib/lib/lib/index.d.ts +0 -168
  25. package/lib/lib/lib/index.js +0 -22
  26. package/lib/lib/lib/lib/baseSdk/diagnostica.d.ts +0 -6
  27. package/lib/lib/lib/lib/baseSdk/diagnostica.js +0 -79
  28. package/lib/lib/lib/lib/baseSdk/index.d.ts +0 -14
  29. package/lib/lib/lib/lib/baseSdk/index.js +0 -66
  30. package/lib/lib/lib/lib/baseSdk/user.d.ts +0 -9
  31. package/lib/lib/lib/lib/baseSdk/user.js +0 -130
  32. package/lib/lib/lib/lib/index.d.ts +0 -58
  33. package/lib/lib/lib/lib/index.js +0 -22
  34. package/lib/lib/lib/lib/request/index.d.ts +0 -2
  35. package/lib/lib/lib/lib/request/index.js +0 -26
  36. package/lib/lib/lib/lib/request/token.d.ts +0 -2
  37. package/lib/lib/lib/lib/request/token.js +0 -34
  38. package/lib/lib/lib/lib/request/validation.d.ts +0 -10
  39. package/lib/lib/lib/lib/request/validation.js +0 -28
  40. package/lib/lib/lib/lib/schemas.d.ts +0 -1334
  41. package/lib/lib/lib/lib/schemas.js +0 -325
  42. package/lib/lib/lib/lib/test.d.ts +0 -1
  43. package/lib/lib/lib/lib/test.js +0 -55
  44. package/lib/lib/lib/lib/types.d.ts +0 -1
  45. package/lib/lib/lib/lib/types.js +0 -2
  46. package/lib/lib/lib/lib/userSdk/chat.d.ts +0 -9
  47. package/lib/lib/lib/lib/userSdk/chat.js +0 -98
  48. package/lib/lib/lib/lib/userSdk/index.d.ts +0 -24
  49. package/lib/lib/lib/lib/userSdk/index.js +0 -27
  50. package/lib/lib/lib/lib/userSdk/patients.d.ts +0 -5
  51. package/lib/lib/lib/lib/userSdk/patients.js +0 -55
  52. package/lib/lib/lib/lib/userSdk/schedule.d.ts +0 -7
  53. package/lib/lib/lib/lib/userSdk/schedule.js +0 -76
  54. package/lib/lib/lib/lib/userSdk/specialties.d.ts +0 -4
  55. package/lib/lib/lib/lib/userSdk/specialties.js +0 -19
  56. package/lib/lib/lib/lib/userSdk/videoVisit.d.ts +0 -10
  57. package/lib/lib/lib/lib/userSdk/videoVisit.js +0 -147
  58. package/lib/lib/lib/lib/utils.d.ts +0 -4
  59. package/lib/lib/lib/lib/utils.js +0 -19
  60. package/lib/lib/lib/lib/webhook/index.d.ts +0 -8
  61. package/lib/lib/lib/lib/webhook/index.js +0 -55
  62. package/lib/lib/lib/lib/webhook/responses.d.ts +0 -36
  63. package/lib/lib/lib/lib/webhook/responses.js +0 -42
  64. package/lib/lib/lib/lib/webhook/token.d.ts +0 -2
  65. package/lib/lib/lib/lib/webhook/token.js +0 -23
  66. package/lib/lib/lib/request/index.d.ts +0 -2
  67. package/lib/lib/lib/request/index.js +0 -26
  68. package/lib/lib/lib/request/token.d.ts +0 -2
  69. package/lib/lib/lib/request/token.js +0 -34
  70. package/lib/lib/lib/request/validation.d.ts +0 -10
  71. package/lib/lib/lib/request/validation.js +0 -28
  72. package/lib/lib/lib/schemas.d.ts +0 -1334
  73. package/lib/lib/lib/schemas.js +0 -325
  74. package/lib/lib/lib/src/baseSdk/diagnostica.d.ts +0 -6
  75. package/lib/lib/lib/src/baseSdk/diagnostica.js +0 -79
  76. package/lib/lib/lib/src/baseSdk/index.d.ts +0 -51
  77. package/lib/lib/lib/src/baseSdk/index.js +0 -66
  78. package/lib/lib/lib/src/baseSdk/user.d.ts +0 -9
  79. package/lib/lib/lib/src/baseSdk/user.js +0 -130
  80. package/lib/lib/lib/src/index.d.ts +0 -169
  81. package/lib/lib/lib/src/index.js +0 -22
  82. package/lib/lib/lib/src/request/index.d.ts +0 -2
  83. package/lib/lib/lib/src/request/index.js +0 -26
  84. package/lib/lib/lib/src/request/token.d.ts +0 -2
  85. package/lib/lib/lib/src/request/token.js +0 -34
  86. package/lib/lib/lib/src/request/validation.d.ts +0 -10
  87. package/lib/lib/lib/src/request/validation.js +0 -28
  88. package/lib/lib/lib/src/schemas.d.ts +0 -1340
  89. package/lib/lib/lib/src/schemas.js +0 -325
  90. package/lib/lib/lib/src/types.d.ts +0 -1
  91. package/lib/lib/lib/src/types.js +0 -2
  92. package/lib/lib/lib/src/userSdk/chat.d.ts +0 -9
  93. package/lib/lib/lib/src/userSdk/chat.js +0 -98
  94. package/lib/lib/lib/src/userSdk/index.d.ts +0 -102
  95. package/lib/lib/lib/src/userSdk/index.js +0 -27
  96. package/lib/lib/lib/src/userSdk/patients.d.ts +0 -5
  97. package/lib/lib/lib/src/userSdk/patients.js +0 -55
  98. package/lib/lib/lib/src/userSdk/schedule.d.ts +0 -7
  99. package/lib/lib/lib/src/userSdk/schedule.js +0 -76
  100. package/lib/lib/lib/src/userSdk/specialties.d.ts +0 -4
  101. package/lib/lib/lib/src/userSdk/specialties.js +0 -19
  102. package/lib/lib/lib/src/userSdk/videoVisit.d.ts +0 -10
  103. package/lib/lib/lib/src/userSdk/videoVisit.js +0 -147
  104. package/lib/lib/lib/src/utils.d.ts +0 -4
  105. package/lib/lib/lib/src/utils.js +0 -19
  106. package/lib/lib/lib/src/webhook/index.d.ts +0 -8
  107. package/lib/lib/lib/src/webhook/index.js +0 -55
  108. package/lib/lib/lib/src/webhook/responses.d.ts +0 -36
  109. package/lib/lib/lib/src/webhook/responses.js +0 -42
  110. package/lib/lib/lib/src/webhook/token.d.ts +0 -2
  111. package/lib/lib/lib/src/webhook/token.js +0 -23
  112. package/lib/lib/lib/test.d.ts +0 -1
  113. package/lib/lib/lib/test.js +0 -55
  114. package/lib/lib/lib/types.d.ts +0 -1
  115. package/lib/lib/lib/types.js +0 -2
  116. package/lib/lib/lib/userSdk/chat.d.ts +0 -9
  117. package/lib/lib/lib/userSdk/chat.js +0 -98
  118. package/lib/lib/lib/userSdk/index.d.ts +0 -102
  119. package/lib/lib/lib/userSdk/index.js +0 -27
  120. package/lib/lib/lib/userSdk/patients.d.ts +0 -5
  121. package/lib/lib/lib/userSdk/patients.js +0 -55
  122. package/lib/lib/lib/userSdk/schedule.d.ts +0 -7
  123. package/lib/lib/lib/userSdk/schedule.js +0 -76
  124. package/lib/lib/lib/userSdk/specialties.d.ts +0 -4
  125. package/lib/lib/lib/userSdk/specialties.js +0 -19
  126. package/lib/lib/lib/userSdk/videoVisit.d.ts +0 -10
  127. package/lib/lib/lib/userSdk/videoVisit.js +0 -147
  128. package/lib/lib/lib/utils.d.ts +0 -4
  129. package/lib/lib/lib/utils.js +0 -19
  130. package/lib/lib/lib/webhook/index.d.ts +0 -8
  131. package/lib/lib/lib/webhook/index.js +0 -55
  132. package/lib/lib/lib/webhook/responses.d.ts +0 -36
  133. package/lib/lib/lib/webhook/responses.js +0 -42
  134. package/lib/lib/lib/webhook/token.d.ts +0 -2
  135. package/lib/lib/lib/webhook/token.js +0 -23
  136. package/lib/lib/request/index.d.ts +0 -2
  137. package/lib/lib/request/index.js +0 -26
  138. package/lib/lib/request/token.d.ts +0 -2
  139. package/lib/lib/request/token.js +0 -34
  140. package/lib/lib/request/validation.d.ts +0 -10
  141. package/lib/lib/request/validation.js +0 -28
  142. package/lib/lib/schemas.d.ts +0 -1334
  143. package/lib/lib/schemas.js +0 -325
  144. package/lib/lib/src/baseSdk/diagnostica.d.ts +0 -11
  145. package/lib/lib/src/baseSdk/diagnostica.js +0 -79
  146. package/lib/lib/src/baseSdk/index.d.ts +0 -162
  147. package/lib/lib/src/baseSdk/index.js +0 -66
  148. package/lib/lib/src/baseSdk/user.d.ts +0 -41
  149. package/lib/lib/src/baseSdk/user.js +0 -130
  150. package/lib/lib/src/index.d.ts +0 -183
  151. package/lib/lib/src/index.js +0 -22
  152. package/lib/lib/src/request/index.d.ts +0 -2
  153. package/lib/lib/src/request/index.js +0 -26
  154. package/lib/lib/src/request/token.d.ts +0 -2
  155. package/lib/lib/src/request/token.js +0 -34
  156. package/lib/lib/src/request/validation.d.ts +0 -10
  157. package/lib/lib/src/request/validation.js +0 -28
  158. package/lib/lib/src/schemas.d.ts +0 -1340
  159. package/lib/lib/src/schemas.js +0 -325
  160. package/lib/lib/src/types.d.ts +0 -1
  161. package/lib/lib/src/types.js +0 -2
  162. package/lib/lib/src/userSdk/chat.d.ts +0 -9
  163. package/lib/lib/src/userSdk/chat.js +0 -98
  164. package/lib/lib/src/userSdk/index.d.ts +0 -241
  165. package/lib/lib/src/userSdk/index.js +0 -27
  166. package/lib/lib/src/userSdk/patients.d.ts +0 -13
  167. package/lib/lib/src/userSdk/patients.js +0 -55
  168. package/lib/lib/src/userSdk/schedule.d.ts +0 -15
  169. package/lib/lib/src/userSdk/schedule.js +0 -76
  170. package/lib/lib/src/userSdk/specialties.d.ts +0 -4
  171. package/lib/lib/src/userSdk/specialties.js +0 -19
  172. package/lib/lib/src/userSdk/videoVisit.d.ts +0 -72
  173. package/lib/lib/src/userSdk/videoVisit.js +0 -147
  174. package/lib/lib/src/utils.d.ts +0 -4
  175. package/lib/lib/src/utils.js +0 -19
  176. package/lib/lib/src/webhook/index.d.ts +0 -8
  177. package/lib/lib/src/webhook/index.js +0 -55
  178. package/lib/lib/src/webhook/responses.d.ts +0 -36
  179. package/lib/lib/src/webhook/responses.js +0 -42
  180. package/lib/lib/src/webhook/token.d.ts +0 -2
  181. package/lib/lib/src/webhook/token.js +0 -23
  182. package/lib/lib/test.d.ts +0 -1
  183. package/lib/lib/test.js +0 -55
  184. package/lib/lib/types.d.ts +0 -1
  185. package/lib/lib/types.js +0 -2
  186. package/lib/lib/userSdk/chat.d.ts +0 -9
  187. package/lib/lib/userSdk/chat.js +0 -98
  188. package/lib/lib/userSdk/index.d.ts +0 -240
  189. package/lib/lib/userSdk/index.js +0 -27
  190. package/lib/lib/userSdk/patients.d.ts +0 -13
  191. package/lib/lib/userSdk/patients.js +0 -55
  192. package/lib/lib/userSdk/schedule.d.ts +0 -15
  193. package/lib/lib/userSdk/schedule.js +0 -76
  194. package/lib/lib/userSdk/specialties.d.ts +0 -4
  195. package/lib/lib/userSdk/specialties.js +0 -19
  196. package/lib/lib/userSdk/videoVisit.d.ts +0 -72
  197. package/lib/lib/userSdk/videoVisit.js +0 -147
  198. package/lib/lib/utils.d.ts +0 -4
  199. package/lib/lib/utils.js +0 -19
  200. package/lib/lib/webhook/index.d.ts +0 -8
  201. package/lib/lib/webhook/index.js +0 -55
  202. package/lib/lib/webhook/responses.d.ts +0 -36
  203. package/lib/lib/webhook/responses.js +0 -42
  204. package/lib/lib/webhook/token.d.ts +0 -2
  205. package/lib/lib/webhook/token.js +0 -23
  206. package/lib/src/baseSdk/diagnostica.d.ts +0 -54
  207. package/lib/src/baseSdk/diagnostica.js +0 -79
  208. package/lib/src/baseSdk/index.d.ts +0 -2
  209. package/lib/src/baseSdk/index.js +0 -66
  210. package/lib/src/baseSdk/user.d.ts +0 -89
  211. package/lib/src/baseSdk/user.js +0 -130
  212. package/lib/src/index.d.ts +0 -188
  213. package/lib/src/index.js +0 -22
  214. package/lib/src/request/index.d.ts +0 -3
  215. package/lib/src/request/index.js +0 -26
  216. package/lib/src/request/token.d.ts +0 -2
  217. package/lib/src/request/token.js +0 -34
  218. package/lib/src/request/validation.d.ts +0 -10
  219. package/lib/src/request/validation.js +0 -28
  220. package/lib/src/schemas.d.ts +0 -1311
  221. package/lib/src/schemas.js +0 -325
  222. package/lib/src/types.d.ts +0 -124
  223. package/lib/src/types.js +0 -2
  224. package/lib/src/userSdk/chat.d.ts +0 -57
  225. package/lib/src/userSdk/chat.js +0 -98
  226. package/lib/src/userSdk/index.d.ts +0 -2
  227. package/lib/src/userSdk/index.js +0 -27
  228. package/lib/src/userSdk/patients.d.ts +0 -33
  229. package/lib/src/userSdk/patients.js +0 -55
  230. package/lib/src/userSdk/schedule.d.ts +0 -44
  231. package/lib/src/userSdk/schedule.js +0 -76
  232. package/lib/src/userSdk/specialties.d.ts +0 -7
  233. package/lib/src/userSdk/specialties.js +0 -19
  234. package/lib/src/userSdk/videoVisit.d.ts +0 -111
  235. package/lib/src/userSdk/videoVisit.js +0 -147
  236. package/lib/src/utils.d.ts +0 -4
  237. package/lib/src/utils.js +0 -19
  238. package/lib/src/webhook/index.d.ts +0 -2
  239. package/lib/src/webhook/index.js +0 -55
  240. package/lib/src/webhook/responses.d.ts +0 -35
  241. package/lib/src/webhook/responses.js +0 -42
  242. package/lib/src/webhook/token.d.ts +0 -2
  243. package/lib/src/webhook/token.js +0 -23
  244. package/lib/test.d.ts +0 -1
  245. package/lib/test.js +0 -21
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,240 +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
- firstName: string;
29
- lastName: string;
30
- id: number;
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
- phone: string | null;
91
- email: string | null;
92
- id: number;
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
- phone: string | null;
112
- email: string | null;
113
- id: number;
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: (params: {
212
- code?: string | undefined;
213
- channel?: "1" | "2" | undefined;
214
- patient: {
215
- firstName: string;
216
- lastName: string;
217
- identificationType: "ndi" | "passport" | "credential";
218
- identificationValue: string;
219
- countryId: string;
220
- birthdate: Date;
221
- gender: "m" | "f";
222
- };
223
- }) => Promise<{
224
- patientId: number | null;
225
- userInfo: {
226
- phone: string;
227
- email: string;
228
- };
229
- askCode: boolean;
230
- }>;
231
- getPatientId: (patient: {
232
- firstName: string;
233
- lastName: string;
234
- identificationType: "ndi" | "passport" | "credential";
235
- identificationValue: string;
236
- countryId: string;
237
- birthdate: Date;
238
- gender: "m" | "f";
239
- }) => Promise<number>;
240
- }>;
@@ -1,27 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.userSdk = void 0;
4
- const request_1 = require("../request");
5
- const chat_1 = require("./chat");
6
- const patients_1 = require("./patients");
7
- const schedule_1 = require("./schedule");
8
- const specialties_1 = require("./specialties");
9
- const videoVisit_1 = require("./videoVisit");
10
- const userSdk = async (url, credentials, userId) => {
11
- const makeRequest = await request_1.getRequestFactory(url, credentials, userId);
12
- const patientMethods = patients_1.getPatientMethods(makeRequest);
13
- const specialtyMethods = specialties_1.getSpecialtiesMethods(makeRequest);
14
- const scheduleMethods = schedule_1.getScheduleMethods(makeRequest);
15
- const videoVisitMethods = videoVisit_1.getVideoVisitMethods(makeRequest);
16
- const chatMethods = chat_1.getChatMethods(makeRequest);
17
- const sdk = {
18
- ...patientMethods,
19
- ...specialtyMethods,
20
- ...scheduleMethods,
21
- ...videoVisitMethods,
22
- ...chatMethods,
23
- userId,
24
- };
25
- return sdk;
26
- };
27
- exports.userSdk = userSdk;
@@ -1,13 +0,0 @@
1
- export var __esModule: boolean;
2
- export function getPatientMethods(makeRequest: any): {
3
- declarePatient: (params_0?: {
4
- patient: any;
5
- channel: any;
6
- code: any;
7
- }) => Promise<{
8
- patientId: any;
9
- userInfo: any;
10
- askCode: any;
11
- }>;
12
- getPatientId: (patient?: any) => Promise<any>;
13
- };
@@ -1,55 +0,0 @@
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 utils_1 = require("../utils");
9
- const getPatientMethods = (makeRequest) => {
10
- const declarePatient = async ({ patient, channel, code, }) => {
11
- const path = '/patient';
12
- const mappedPatient = {
13
- lastname: patient.lastName,
14
- firstname: patient.firstName,
15
- identification_type: utils_1.getIdetificationTypeId(patient.identificationType),
16
- identification_value: patient.identificationValue,
17
- birthdate: date_fns_1.format(patient.birthdate, 'yyyy-MM-dd'),
18
- gender: patient.gender.toUpperCase(),
19
- country_id: patient.countryId,
20
- };
21
- const parsedChannel = channel ? parseInt(channel) : channel;
22
- const response = await makeRequest('POST', path, {
23
- user_data: mappedPatient,
24
- channel: parsedChannel,
25
- code,
26
- });
27
- const mappedResponse = {
28
- patientId: response.data.patient_id,
29
- userInfo: response.data.user_info,
30
- askCode: response.data.ask_code,
31
- };
32
- return mappedResponse;
33
- };
34
- const getPatientId = async (patient) => {
35
- const path = '/patient';
36
- const mappedPatient = {
37
- lastname: patient.lastName,
38
- firstname: patient.firstName,
39
- identification_type: utils_1.getIdetificationTypeId(patient.identificationType),
40
- identification_value: patient.identificationValue,
41
- birthdate: date_fns_1.format(patient.birthdate, 'yyyy-MM-dd'),
42
- gender: patient.gender.toUpperCase(),
43
- country_id: patient.countryId,
44
- };
45
- const response = await makeRequest('POST', path, {
46
- user_data: mappedPatient,
47
- });
48
- return response.data.user_id;
49
- };
50
- return {
51
- declarePatient: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.declarePatientParams]), schemas_1.doc24Schemas.declarePatientResponse, declarePatient),
52
- getPatientId: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.patient]), zod_1.number(), getPatientId),
53
- };
54
- };
55
- exports.getPatientMethods = getPatientMethods;
@@ -1,15 +0,0 @@
1
- export var __esModule: boolean;
2
- export function getScheduleMethods(makeRequest: any): {
3
- getSchedule: (...params: any) => Promise<any>;
4
- getScheduleDates: (...params: any) => Promise<any>;
5
- getAppointment: (...params: any) => Promise<{
6
- id: any;
7
- professionalId: any;
8
- date: Date;
9
- }>;
10
- getAppointmentByVcToken: (...params: any) => Promise<{
11
- id: any;
12
- professionalId: any;
13
- date: Date;
14
- }>;
15
- };
@@ -1,76 +0,0 @@
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 = validation_1.validateFunction(zod_1.tuple([zod_1.number(), schemas_1.doc24Schemas.scheduleAvailabilityFilter]), zod_1.array(zod_1.date()), async (patientId, filter = {}) => {
11
- const mappedFilter = {
12
- specialty_id: filter.specialtyId,
13
- professional_id: filter.professionalId,
14
- };
15
- const path = `/schedule/dates/${patientId}/${JSON.stringify(mappedFilter)}`;
16
- const response = await makeRequest('GET', path);
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 = {}) => {
20
- const mappedFilter = {
21
- id_professional: filter.professionalId,
22
- offset: filter.offset,
23
- limit: filter.limit,
24
- week_day: filter.weekDay,
25
- date: filter.date && date_fns_1.format(filter.date, 'yyyy-MM-dd'),
26
- start_hour: filter.startHour,
27
- finish_hour: filter.finishHour,
28
- };
29
- const path = `/schedule/availability/${patientId}/${specialtyId}/${JSON.stringify(mappedFilter)}`;
30
- const response = await makeRequest('GET', path);
31
- return response.data.available_appointments.map((a) => ({
32
- id: a.id,
33
- date: utils_1.parseDateTime(`${a.date} ${a.hour}`),
34
- clinicId: a.clinic,
35
- professional: {
36
- id: a.professional_id,
37
- fullName: a.professional,
38
- logoUrl: a.logo,
39
- },
40
- cost: a.cost,
41
- specialty: {
42
- id: a.specialty_id,
43
- description: a.specialty,
44
- },
45
- type: a.type === 'P' ? 'appointment' : a.type === 'T' ? 'chat' : 'instant',
46
- atentions: a.atentions,
47
- ranking: a.ranking,
48
- length: a.length,
49
- }));
50
- });
51
- const getAppointment = validation_1.validateFunction(zod_1.tuple([zod_1.number()]), schemas_1.doc24Schemas.appointment, async (appointmentId) => {
52
- const path = `/appointment/${appointmentId}`;
53
- const response = await makeRequest('GET', path);
54
- return {
55
- id: response.data.id,
56
- professionalId: response.data.professional_id,
57
- date: utils_1.parseDateTime(`${response.data.date} ${response.data.hour}`),
58
- };
59
- });
60
- const getAppointmentByVcToken = validation_1.validateFunction(zod_1.tuple([zod_1.string()]), schemas_1.doc24Schemas.appointment, async (vcToken) => {
61
- const path = `/appointmentByToken/${vcToken}`;
62
- const response = await makeRequest('GET', path);
63
- return {
64
- id: response.data.id,
65
- professionalId: response.data.professional_id,
66
- date: utils_1.parseDateTime(`${response.data.date} ${response.data.hour}`),
67
- };
68
- });
69
- return {
70
- getSchedule,
71
- getScheduleDates,
72
- getAppointment,
73
- getAppointmentByVcToken,
74
- };
75
- };
76
- exports.getScheduleMethods = getScheduleMethods;
@@ -1,4 +0,0 @@
1
- export var __esModule: boolean;
2
- export function getSpecialtiesMethods(makeRequest: any): {
3
- getSpecialties: (...params: any) => Promise<any>;
4
- };
@@ -1,19 +0,0 @@
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
- }));
16
- });
17
- return { getSpecialties };
18
- };
19
- exports.getSpecialtiesMethods = getSpecialtiesMethods;