@integraciones_doc24/sdk 1.15.10 → 1.15.12

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 (44) hide show
  1. package/README.md +202 -202
  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 +74 -73
  8. package/lib/baseSdk/user.d.ts +91 -91
  9. package/lib/baseSdk/user.js +136 -136
  10. package/lib/index.d.ts +365 -364
  11. package/lib/index.js +22 -22
  12. package/lib/request/index.d.ts +3 -3
  13. package/lib/request/index.js +26 -26
  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 +1822 -1813
  19. package/lib/schemas.js +421 -419
  20. package/lib/types.d.ts +146 -146
  21. package/lib/types.js +2 -2
  22. package/lib/userSdk/chat.d.ts +57 -57
  23. package/lib/userSdk/chat.js +98 -98
  24. package/lib/userSdk/external.d.ts +34 -34
  25. package/lib/userSdk/external.js +72 -72
  26. package/lib/userSdk/index.d.ts +2 -2
  27. package/lib/userSdk/index.js +30 -30
  28. package/lib/userSdk/patients.d.ts +38 -38
  29. package/lib/userSdk/patients.js +67 -67
  30. package/lib/userSdk/schedule.d.ts +47 -47
  31. package/lib/userSdk/schedule.js +81 -81
  32. package/lib/userSdk/specialties.d.ts +7 -7
  33. package/lib/userSdk/specialties.js +19 -19
  34. package/lib/userSdk/videoVisit.d.ts +115 -113
  35. package/lib/userSdk/videoVisit.js +155 -154
  36. package/lib/utils.d.ts +2 -2
  37. package/lib/utils.js +16 -16
  38. package/lib/webhook/index.d.ts +2 -2
  39. package/lib/webhook/index.js +56 -56
  40. package/lib/webhook/responses.d.ts +35 -35
  41. package/lib/webhook/responses.js +42 -42
  42. package/lib/webhook/token.d.ts +2 -2
  43. package/lib/webhook/token.js +23 -23
  44. package/package.json +36 -36
package/README.md CHANGED
@@ -1,202 +1,202 @@
1
- # @integraciones_doc24/sdk
2
-
3
- Node.JS library for accessing doc24 api
4
-
5
- ## Installation
6
-
7
- `npm i @integraciones_doc24/sdk`
8
-
9
- ## Usage
10
-
11
- ```ts
12
- import {doc24Sdk} from '@integraciones_doc24/sdk';
13
-
14
- const getBaseSdk = () =>
15
- doc24Sdk({
16
- url: 'https://tapi.doc24.com.ar/ws/sdk',
17
- credentials: {
18
- iss: 'myissuer',
19
- key: 'mysecret',
20
- },
21
- });
22
-
23
- const getSpecialities = async (user) => {
24
- const baseSdk = await getBaseSdk();
25
-
26
- const userSdk = await baseSdk.getUserInstance(user);
27
-
28
- return await userSdk.getSpecialties('instant', 'ES');
29
- };
30
-
31
- const getRequestHandler = async () => {
32
- const baseSdk = await getBaseSdk();
33
- return baseSdk.getRequestHandler({
34
- credentials: {
35
- iss: 'doc24issuer',
36
- key: 'doc24secret',
37
- },
38
- baseAddress: 'http://myaddress.com/route/to/webhook',
39
- eventHandlers: {
40
- onAppointmentStatusChange: ({id, status, changeDate}) => {
41
- console.log({id, status, changeDate});
42
- },
43
- onConsultationStatusChange: ({
44
- id,
45
- invitationId,
46
- status,
47
- changeDate,
48
- vcToken,
49
- }) => {
50
- console.log({id, invitationId, status, changeDate, vcToken});
51
- },
52
- onInvitationStatusChange: ({id, status, changeDate}) => {
53
- console.log({id, status, changeDate});
54
- },
55
- onChatUpdate: ({id, status, patientId, professionalId, date}) => {
56
- console.log({id, status, patientId, professionalId, date});
57
- },
58
- },
59
- });
60
- };
61
- ```
62
-
63
- The library exports the function `doc24Sdk`. It takes one parameters of type `SdkParams`, and returns a `BaseSdk`.
64
- It also returns an extra `getRequestHandler` function that takes a `RequestHandlerParams`
65
-
66
- ```ts
67
- type SdkCredentials = {
68
- iss: string;
69
- key: string;
70
- };
71
- type SdkParams = {
72
- url: string;
73
- credentials: SdkCredentials;
74
- };
75
- export type BaseSdk = {
76
- declareUser: (params: DeclareUserParams) => Promise<DeclareUserResponse>;
77
- getUserId: (user: User) => Promise<number>;
78
- getUserInstance: (user: User | number) => Promise<UserSdk>;
79
- getProfessional: (professionalId: number) => Promise<Professional>;
80
- getAvailableScheduleClinics: () => Promise<AvailableScheduleClinics>;
81
- enroll: (params: EnrollmentParams) => Promise<void>;
82
- getCoverageInfo: (identificationValue: string) => Promise<CoverageInfo>;
83
- sendVerificationCode: (params: SendVerificationCodeParams) => Promise<void>;
84
- getDiagnosticaHistory: (
85
- patient: DiagnosticaPatientFilter,
86
- from: Date,
87
- to: Date,
88
- ) => Promise<DiagnosticaHistoryAppointment[]>;
89
- getDiagnosticaDeepLink: (
90
- kiosk: string,
91
- user: DiagnosticaUser,
92
- patient: DiagnosticaPatient,
93
- ) => Promise<DiagnosticaDeepLinkResponse>;
94
- getDiagnosticaAccess: (
95
- kiosk: string,
96
- user: DiagnosticaUser,
97
- patient: DiagnosticaPatient,
98
- ) => Promise<void>;
99
- externalLogin: (
100
- params: ExternalLoginParams,
101
- ) => Promise<ExternalLoginResponse>;
102
- preExternalEnrollment: (params: PreExternalEnrollmentParams) => Promise<void>;
103
- externalEnrollment: (
104
- params: ExternalEnrollmentParams,
105
- ) => Promise<ExternalLoginResponse>;
106
- sendExternalVerificationCode: (
107
- params: SendExternalVerificationCodeParams,
108
- ) => Promise<void>;
109
- verifyExternalVerificationCode: (
110
- params: VerifyExternalVerificationCodeParams,
111
- ) => Promise<any>;
112
- externalResetPassword: (params: ExternalResetPasswordParams) => Promise<any>;
113
- getExternalStudiesHistoryLink: (
114
- patient: ExternalPatient,
115
- ) => Promise<string | null>;
116
- getExternalAppointmentsLink: (
117
- identificationValue: string,
118
- birthdate: Date,
119
- ) => Promise<string | null>;
120
- getExternalAppointments: () => Promise<ExternalAppointment[]>;
121
- cancelExternalAppointment: (
122
- appointmentId: ExternalAppointment,
123
- ) => Promise<void>;
124
- };
125
-
126
- type RequestHandlerParams = {
127
- // Credentials that doc24 should use when singing the jwt
128
- credentials: SdkCredentials;
129
- eventHandlers: Webhook.Events;
130
- // Address in which doc24 should send the requests
131
- baseAddress: string;
132
- };
133
- ```
134
-
135
- `getRequestHandler` should be called only once, and takes care of managing the webhook that receives events from doc24.
136
-
137
- ### Express example
138
-
139
- ```ts
140
- const handler = await getRequestHandler();
141
- app.all('/doc24', async (req, res) => {
142
- const response = await handler({
143
- headers: req.headers,
144
- body: req.body,
145
- query: req.query,
146
- });
147
-
148
- res.status(response.status.code).json(response.data);
149
- });
150
- ```
151
-
152
- ### UserSdk
153
-
154
- Most of the methods need a user specified, so `getUserInstance` returns an instance of `UserSdk` with them.
155
-
156
- ```ts
157
- export type UserSdk = {
158
- declarePatient: (
159
- params: DeclarePatientParams,
160
- ) => Promise<DeclarePatientResponse>;
161
- getPatientId: (patient: Patient) => Promise<number>;
162
- deletePatient: (patientId: number) => Promise<void>;
163
- getSpecialties: (
164
- mode: SpecialtyMode,
165
- language: string,
166
- ) => Promise<Specialty[]>;
167
- getScheduleDates: (
168
- patientId: number,
169
- filter?: ScheduleAvailabilityFilter,
170
- ) => Promise<Date[]>;
171
- getSchedule: (
172
- patientId: number,
173
- specialtyId: number,
174
- filter?: ScheduleFilter,
175
- ) => Promise<AvailableAppointment[]>;
176
- getAppointment: (appointmentId: number) => Promise<Appointment>;
177
- getAppointmentByVcToken: (vcToken: string) => Promise<Appointment>;
178
- scheduleVideoVisit: (params: ScheduleParameters) => Promise<string>;
179
- cancelVideoVisit: (vcToken: string) => Promise<void>;
180
- getVideoVisit: (vcToken: string, patientId: number) => Promise<VideoVisit>;
181
- getVideoVisitDetails: (vcId: number) => Promise<VideoVisitDetails>;
182
- getVideoVisitLink: (
183
- vcToken: string,
184
- patientId: number,
185
- ) => Promise<string | null>;
186
- getPatientVideoVisitHistory: (
187
- patientId: number,
188
- ) => Promise<HistoricalVideoVisit[]>;
189
- getActiveVideoVisits: () => Promise<ActiveVideoVisitData[]>;
190
- getAvailableChatrooms: (
191
- patientId: number,
192
- specialtyId: number,
193
- filter: ChatroomAvailabilityFilter,
194
- ) => Promise<AvailableChatroom[]>;
195
- createNewChat: (chatParameters: ChatParameters) => Promise<number>;
196
- getPatientChats: (patientId: number) => Promise<ChatDetails[]>;
197
- getChatPosts: (chatId: number) => Promise<ChatPost[]>;
198
- cancelChat: (chatId: number) => Promise<void>;
199
- sendChatMessage: (chatId: number, message: string) => Promise<number>;
200
- userId: number;
201
- };
202
- ```
1
+ # @integraciones_doc24/sdk
2
+
3
+ Node.JS library for accessing doc24 api
4
+
5
+ ## Installation
6
+
7
+ `npm i @integraciones_doc24/sdk`
8
+
9
+ ## Usage
10
+
11
+ ```ts
12
+ import {doc24Sdk} from '@integraciones_doc24/sdk';
13
+
14
+ const getBaseSdk = () =>
15
+ doc24Sdk({
16
+ url: 'https://tapi.doc24.com.ar/ws/sdk',
17
+ credentials: {
18
+ iss: 'myissuer',
19
+ key: 'mysecret',
20
+ },
21
+ });
22
+
23
+ const getSpecialities = async (user) => {
24
+ const baseSdk = await getBaseSdk();
25
+
26
+ const userSdk = await baseSdk.getUserInstance(user);
27
+
28
+ return await userSdk.getSpecialties('instant', 'ES');
29
+ };
30
+
31
+ const getRequestHandler = async () => {
32
+ const baseSdk = await getBaseSdk();
33
+ return baseSdk.getRequestHandler({
34
+ credentials: {
35
+ iss: 'doc24issuer',
36
+ key: 'doc24secret',
37
+ },
38
+ baseAddress: 'http://myaddress.com/route/to/webhook',
39
+ eventHandlers: {
40
+ onAppointmentStatusChange: ({id, status, changeDate}) => {
41
+ console.log({id, status, changeDate});
42
+ },
43
+ onConsultationStatusChange: ({
44
+ id,
45
+ invitationId,
46
+ status,
47
+ changeDate,
48
+ vcToken,
49
+ }) => {
50
+ console.log({id, invitationId, status, changeDate, vcToken});
51
+ },
52
+ onInvitationStatusChange: ({id, status, changeDate}) => {
53
+ console.log({id, status, changeDate});
54
+ },
55
+ onChatUpdate: ({id, status, patientId, professionalId, date}) => {
56
+ console.log({id, status, patientId, professionalId, date});
57
+ },
58
+ },
59
+ });
60
+ };
61
+ ```
62
+
63
+ The library exports the function `doc24Sdk`. It takes one parameters of type `SdkParams`, and returns a `BaseSdk`.
64
+ It also returns an extra `getRequestHandler` function that takes a `RequestHandlerParams`
65
+
66
+ ```ts
67
+ type SdkCredentials = {
68
+ iss: string;
69
+ key: string;
70
+ };
71
+ type SdkParams = {
72
+ url: string;
73
+ credentials: SdkCredentials;
74
+ };
75
+ export type BaseSdk = {
76
+ declareUser: (params: DeclareUserParams) => Promise<DeclareUserResponse>;
77
+ getUserId: (user: User) => Promise<number>;
78
+ getUserInstance: (user: User | number) => Promise<UserSdk>;
79
+ getProfessional: (professionalId: number) => Promise<Professional>;
80
+ getAvailableScheduleClinics: () => Promise<AvailableScheduleClinics>;
81
+ enroll: (params: EnrollmentParams) => Promise<void>;
82
+ getCoverageInfo: (identificationValue: string) => Promise<CoverageInfo>;
83
+ sendVerificationCode: (params: SendVerificationCodeParams) => Promise<void>;
84
+ getDiagnosticaHistory: (
85
+ patient: DiagnosticaPatientFilter,
86
+ from: Date,
87
+ to: Date,
88
+ ) => Promise<DiagnosticaHistoryAppointment[]>;
89
+ getDiagnosticaDeepLink: (
90
+ kiosk: string,
91
+ user: DiagnosticaUser,
92
+ patient: DiagnosticaPatient,
93
+ ) => Promise<DiagnosticaDeepLinkResponse>;
94
+ getDiagnosticaAccess: (
95
+ kiosk: string,
96
+ user: DiagnosticaUser,
97
+ patient: DiagnosticaPatient,
98
+ ) => Promise<void>;
99
+ externalLogin: (
100
+ params: ExternalLoginParams,
101
+ ) => Promise<ExternalLoginResponse>;
102
+ preExternalEnrollment: (params: PreExternalEnrollmentParams) => Promise<void>;
103
+ externalEnrollment: (
104
+ params: ExternalEnrollmentParams,
105
+ ) => Promise<ExternalLoginResponse>;
106
+ sendExternalVerificationCode: (
107
+ params: SendExternalVerificationCodeParams,
108
+ ) => Promise<void>;
109
+ verifyExternalVerificationCode: (
110
+ params: VerifyExternalVerificationCodeParams,
111
+ ) => Promise<any>;
112
+ externalResetPassword: (params: ExternalResetPasswordParams) => Promise<any>;
113
+ getExternalStudiesHistoryLink: (
114
+ patient: ExternalPatient,
115
+ ) => Promise<string | null>;
116
+ getExternalAppointmentsLink: (
117
+ identificationValue: string,
118
+ birthdate: Date,
119
+ ) => Promise<string | null>;
120
+ getExternalAppointments: () => Promise<ExternalAppointment[]>;
121
+ cancelExternalAppointment: (
122
+ appointmentId: ExternalAppointment,
123
+ ) => Promise<void>;
124
+ };
125
+
126
+ type RequestHandlerParams = {
127
+ // Credentials that doc24 should use when singing the jwt
128
+ credentials: SdkCredentials;
129
+ eventHandlers: Webhook.Events;
130
+ // Address in which doc24 should send the requests
131
+ baseAddress: string;
132
+ };
133
+ ```
134
+
135
+ `getRequestHandler` should be called only once, and takes care of managing the webhook that receives events from doc24.
136
+
137
+ ### Express example
138
+
139
+ ```ts
140
+ const handler = await getRequestHandler();
141
+ app.all('/doc24', async (req, res) => {
142
+ const response = await handler({
143
+ headers: req.headers,
144
+ body: req.body,
145
+ query: req.query,
146
+ });
147
+
148
+ res.status(response.status.code).json(response.data);
149
+ });
150
+ ```
151
+
152
+ ### UserSdk
153
+
154
+ Most of the methods need a user specified, so `getUserInstance` returns an instance of `UserSdk` with them.
155
+
156
+ ```ts
157
+ export type UserSdk = {
158
+ declarePatient: (
159
+ params: DeclarePatientParams,
160
+ ) => Promise<DeclarePatientResponse>;
161
+ getPatientId: (patient: Patient) => Promise<number>;
162
+ deletePatient: (patientId: number) => Promise<void>;
163
+ getSpecialties: (
164
+ mode: SpecialtyMode,
165
+ language: string,
166
+ ) => Promise<Specialty[]>;
167
+ getScheduleDates: (
168
+ patientId: number,
169
+ filter?: ScheduleAvailabilityFilter,
170
+ ) => Promise<Date[]>;
171
+ getSchedule: (
172
+ patientId: number,
173
+ specialtyId: number,
174
+ filter?: ScheduleFilter,
175
+ ) => Promise<AvailableAppointment[]>;
176
+ getAppointment: (appointmentId: number) => Promise<Appointment>;
177
+ getAppointmentByVcToken: (vcToken: string) => Promise<Appointment>;
178
+ scheduleVideoVisit: (params: ScheduleParameters) => Promise<string>;
179
+ cancelVideoVisit: (vcToken: string) => Promise<void>;
180
+ getVideoVisit: (vcToken: string, patientId: number) => Promise<VideoVisit>;
181
+ getVideoVisitDetails: (vcId: number) => Promise<VideoVisitDetails>;
182
+ getVideoVisitLink: (
183
+ vcToken: string,
184
+ patientId: number,
185
+ ) => Promise<string | null>;
186
+ getPatientVideoVisitHistory: (
187
+ patientId: number,
188
+ ) => Promise<HistoricalVideoVisit[]>;
189
+ getActiveVideoVisits: () => Promise<ActiveVideoVisitData[]>;
190
+ getAvailableChatrooms: (
191
+ patientId: number,
192
+ specialtyId: number,
193
+ filter: ChatroomAvailabilityFilter,
194
+ ) => Promise<AvailableChatroom[]>;
195
+ createNewChat: (chatParameters: ChatParameters) => Promise<number>;
196
+ getPatientChats: (patientId: number) => Promise<ChatDetails[]>;
197
+ getChatPosts: (chatId: number) => Promise<ChatPost[]>;
198
+ cancelChat: (chatId: number) => Promise<void>;
199
+ sendChatMessage: (chatId: number, message: string) => Promise<number>;
200
+ userId: number;
201
+ };
202
+ ```
@@ -1,54 +1,54 @@
1
- import { RequestMaker } from '../request';
2
- export declare const getDiagnosticaMethods: (makeRequest: RequestMaker) => {
3
- getDiagnosticaHistory: (patient: {
4
- gender?: "m" | "f" | "o" | undefined;
5
- identificationType: "DNI";
6
- identificationValue: string;
7
- }, from: Date, to: Date) => Promise<{
8
- date: Date;
9
- location: string;
10
- exams: string[];
11
- deepLink: string;
12
- }[]>;
13
- getDiagnosticaDeepLink: (kiosk: string, user: {
14
- gender?: "m" | "f" | "o" | undefined;
15
- firstName: string;
16
- lastName: string;
17
- identificationType: "DNI";
18
- identificationValue: string;
19
- phone: string;
20
- email: string;
21
- language: string;
22
- birthday: Date;
23
- }, patient: {
24
- gender?: "m" | "f" | "o" | undefined;
25
- firstName: string;
26
- lastName: string;
27
- identificationType: "DNI";
28
- identificationValue: string;
29
- birthday: Date;
30
- }) => Promise<{
31
- forwardingRequired: true;
32
- deepLink: string;
33
- } | {
34
- forwardingRequired: false;
35
- }>;
36
- getDiagnosticaAccess: (kiosk: string, user: {
37
- gender?: "m" | "f" | "o" | undefined;
38
- firstName: string;
39
- lastName: string;
40
- identificationType: "DNI";
41
- identificationValue: string;
42
- phone: string;
43
- email: string;
44
- language: string;
45
- birthday: Date;
46
- }, patient: {
47
- gender?: "m" | "f" | "o" | undefined;
48
- firstName: string;
49
- lastName: string;
50
- identificationType: "DNI";
51
- identificationValue: string;
52
- birthday: Date;
53
- }) => Promise<void>;
54
- };
1
+ import { RequestMaker } from '../request';
2
+ export declare const getDiagnosticaMethods: (makeRequest: RequestMaker) => {
3
+ getDiagnosticaHistory: (patient: {
4
+ gender?: "m" | "f" | "o" | undefined;
5
+ identificationType: "DNI";
6
+ identificationValue: string;
7
+ }, from: Date, to: Date) => Promise<{
8
+ date: Date;
9
+ location: string;
10
+ exams: string[];
11
+ deepLink: string;
12
+ }[]>;
13
+ getDiagnosticaDeepLink: (kiosk: string, user: {
14
+ gender?: "m" | "f" | "o" | undefined;
15
+ firstName: string;
16
+ lastName: string;
17
+ identificationType: "DNI";
18
+ identificationValue: string;
19
+ phone: string;
20
+ email: string;
21
+ language: string;
22
+ birthday: Date;
23
+ }, patient: {
24
+ gender?: "m" | "f" | "o" | undefined;
25
+ firstName: string;
26
+ lastName: string;
27
+ identificationType: "DNI";
28
+ identificationValue: string;
29
+ birthday: Date;
30
+ }) => Promise<{
31
+ forwardingRequired: true;
32
+ deepLink: string;
33
+ } | {
34
+ forwardingRequired: false;
35
+ }>;
36
+ getDiagnosticaAccess: (kiosk: string, user: {
37
+ gender?: "m" | "f" | "o" | undefined;
38
+ firstName: string;
39
+ lastName: string;
40
+ identificationType: "DNI";
41
+ identificationValue: string;
42
+ phone: string;
43
+ email: string;
44
+ language: string;
45
+ birthday: Date;
46
+ }, patient: {
47
+ gender?: "m" | "f" | "o" | undefined;
48
+ firstName: string;
49
+ lastName: string;
50
+ identificationType: "DNI";
51
+ identificationValue: string;
52
+ birthday: Date;
53
+ }) => Promise<void>;
54
+ };