@integraciones_doc24/sdk 1.11.0 → 1.12.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 +12 -2
- package/lib/types.d.ts +1 -0
- package/lib/userSdk/patients.d.ts +1 -0
- package/lib/userSdk/patients.js +6 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -72,7 +72,7 @@ type SdkParams = {
|
|
|
72
72
|
url: string;
|
|
73
73
|
credentials: SdkCredentials;
|
|
74
74
|
};
|
|
75
|
-
type BaseSdk = {
|
|
75
|
+
export type BaseSdk = {
|
|
76
76
|
declareUser: (params: DeclareUserParams) => Promise<DeclareUserResponse>;
|
|
77
77
|
getUserId: (user: User) => Promise<number>;
|
|
78
78
|
getUserInstance: (user: User | number) => Promise<UserSdk>;
|
|
@@ -110,6 +110,15 @@ type BaseSdk = {
|
|
|
110
110
|
params: VerifyExternalVerificationCodeParams,
|
|
111
111
|
) => Promise<any>;
|
|
112
112
|
externalResetPassword: (params: ExternalResetPasswordParams) => Promise<any>;
|
|
113
|
+
getExternalStudiesHistoryLink: (patient: ExternalPatient) => Promise<string>;
|
|
114
|
+
getExternalAppointmentsLink: (
|
|
115
|
+
identificationValue: string,
|
|
116
|
+
birthdate: Date,
|
|
117
|
+
) => Promise<string>;
|
|
118
|
+
getExternalAppointments: () => Promise<ExternalAppointment[]>;
|
|
119
|
+
cancelExternalAppointment: (
|
|
120
|
+
appointmentId: ExternalAppointment,
|
|
121
|
+
) => Promise<void>;
|
|
113
122
|
};
|
|
114
123
|
|
|
115
124
|
type RequestHandlerParams = {
|
|
@@ -143,11 +152,12 @@ app.all('/doc24', async (req, res) => {
|
|
|
143
152
|
Most of the methods need a user specified, so `getUserInstance` returns an instance of `UserSdk` with them.
|
|
144
153
|
|
|
145
154
|
```ts
|
|
146
|
-
type UserSdk = {
|
|
155
|
+
export type UserSdk = {
|
|
147
156
|
declarePatient: (
|
|
148
157
|
params: DeclarePatientParams,
|
|
149
158
|
) => Promise<DeclarePatientResponse>;
|
|
150
159
|
getPatientId: (patient: Patient) => Promise<number>;
|
|
160
|
+
deletePatient: (patientId: number) => Promise<void>;
|
|
151
161
|
getSpecialties: (
|
|
152
162
|
mode: SpecialtyMode,
|
|
153
163
|
language: string,
|
package/lib/types.d.ts
CHANGED
|
@@ -70,6 +70,7 @@ export declare namespace Doc24 {
|
|
|
70
70
|
type UserSdk = {
|
|
71
71
|
declarePatient: (params: DeclarePatientParams) => Promise<DeclarePatientResponse>;
|
|
72
72
|
getPatientId: (patient: Patient) => Promise<number>;
|
|
73
|
+
deletePatient: (patientId: number) => Promise<void>;
|
|
73
74
|
getSpecialties: (mode: SpecialtyMode, language: string) => Promise<Specialty[]>;
|
|
74
75
|
getScheduleDates: (patientId: number, filter?: ScheduleAvailabilityFilter) => Promise<Date[]>;
|
|
75
76
|
getSchedule: (patientId: number, specialtyId: number, filter?: ScheduleFilter) => Promise<AvailableAppointment[]>;
|
package/lib/userSdk/patients.js
CHANGED
|
@@ -52,9 +52,15 @@ const getPatientMethods = (makeRequest) => {
|
|
|
52
52
|
});
|
|
53
53
|
return response.data.patient_id;
|
|
54
54
|
};
|
|
55
|
+
const deletePatient = async (patientId) => {
|
|
56
|
+
const path = `/patient/${patientId}`;
|
|
57
|
+
const response = await makeRequest('DELETE', path);
|
|
58
|
+
return response.data;
|
|
59
|
+
};
|
|
55
60
|
return {
|
|
56
61
|
declarePatient: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.declarePatientParams]), schemas_1.doc24Schemas.declarePatientResponse, declarePatient),
|
|
57
62
|
getPatientId: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.patient]), zod_1.number(), getPatientId),
|
|
63
|
+
deletePatient: validation_1.validateFunction(zod_1.tuple([zod_1.number()]), zod_1.void(), deletePatient),
|
|
58
64
|
};
|
|
59
65
|
};
|
|
60
66
|
exports.getPatientMethods = getPatientMethods;
|