@integraciones_doc24/sdk 0.39.3 → 0.39.5

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 +93 -83
  2. package/package.json +1 -1
  3. package/lib/baseSdk/diagnostica.d.ts +0 -54
  4. package/lib/baseSdk/diagnostica.js +0 -81
  5. package/lib/baseSdk/external.d.ts +0 -177
  6. package/lib/baseSdk/external.js +0 -96
  7. package/lib/baseSdk/index.d.ts +0 -2
  8. package/lib/baseSdk/index.js +0 -73
  9. package/lib/baseSdk/user.d.ts +0 -91
  10. package/lib/baseSdk/user.js +0 -133
  11. package/lib/index.d.ts +0 -364
  12. package/lib/index.js +0 -22
  13. package/lib/request/index.d.ts +0 -3
  14. package/lib/request/index.js +0 -26
  15. package/lib/request/token.d.ts +0 -2
  16. package/lib/request/token.js +0 -34
  17. package/lib/request/validation.d.ts +0 -10
  18. package/lib/request/validation.js +0 -28
  19. package/lib/schemas.d.ts +0 -1810
  20. package/lib/schemas.js +0 -418
  21. package/lib/types.d.ts +0 -145
  22. package/lib/types.js +0 -2
  23. package/lib/userSdk/chat.d.ts +0 -57
  24. package/lib/userSdk/chat.js +0 -98
  25. package/lib/userSdk/external.d.ts +0 -34
  26. package/lib/userSdk/external.js +0 -71
  27. package/lib/userSdk/index.d.ts +0 -2
  28. package/lib/userSdk/index.js +0 -30
  29. package/lib/userSdk/patients.d.ts +0 -38
  30. package/lib/userSdk/patients.js +0 -65
  31. package/lib/userSdk/schedule.d.ts +0 -46
  32. package/lib/userSdk/schedule.js +0 -80
  33. package/lib/userSdk/specialties.d.ts +0 -7
  34. package/lib/userSdk/specialties.js +0 -19
  35. package/lib/userSdk/videoVisit.d.ts +0 -113
  36. package/lib/userSdk/videoVisit.js +0 -154
  37. package/lib/utils.d.ts +0 -2
  38. package/lib/utils.js +0 -16
  39. package/lib/webhook/index.d.ts +0 -2
  40. package/lib/webhook/index.js +0 -55
  41. package/lib/webhook/responses.d.ts +0 -35
  42. package/lib/webhook/responses.js +0 -42
  43. package/lib/webhook/token.d.ts +0 -2
  44. package/lib/webhook/token.js +0 -23
@@ -1,73 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getBaseSdk = void 0;
4
- const zod_1 = require("zod");
5
- const request_1 = require("../request");
6
- const validation_1 = require("../request/validation");
7
- const schemas_1 = require("../schemas");
8
- const utils_1 = require("../utils");
9
- const diagnostica_1 = require("./diagnostica");
10
- const user_1 = require("./user");
11
- const external_1 = require("./external");
12
- const getBaseSdk = async (url, credentials) => {
13
- const makeRequest = await request_1.getRequestFactory(url, credentials);
14
- const diagnosticaMethods = diagnostica_1.getDiagnosticaMethods(makeRequest);
15
- const externalMethods = external_1.getExternalMethods(makeRequest);
16
- const userMethods = user_1.getUserMethods(makeRequest, url, credentials);
17
- const baseSdk = {
18
- ...diagnosticaMethods,
19
- ...externalMethods,
20
- ...userMethods,
21
- getProfessional: validation_1.validateFunction(zod_1.tuple([zod_1.number()]), schemas_1.doc24Schemas.professional, async (professionalId) => {
22
- const path = `/professional/${professionalId}`;
23
- const response = await makeRequest('GET', path);
24
- const raw = response.data;
25
- return {
26
- id: raw.professional_id,
27
- firstName: raw.name,
28
- lastName: raw.lastname,
29
- birthdate: utils_1.parseDate(raw.birthdate),
30
- gender: raw.gender.toLowerCase(),
31
- email: raw.email,
32
- phone: raw.phone,
33
- logoUrl: raw.image,
34
- matriculation: raw.matriculation,
35
- specialties: raw.specialties.map((s) => ({
36
- id: s.specialty_id,
37
- description: s.specialty,
38
- })),
39
- degree: raw.degree,
40
- languages: raw.languages.map((l) => l.languages),
41
- resume: {
42
- link: raw.resume_link,
43
- brief: raw.resume_brief,
44
- },
45
- };
46
- }),
47
- getAvailableScheduleClinics: validation_1.validateFunction(zod_1.tuple([]), schemas_1.doc24Schemas.availableScheduleClinics, async () => {
48
- const path = `/schedule/clinics`;
49
- const response = await makeRequest('GET', path);
50
- const mapSpeciality = (s) => ({
51
- id: s.id_especialidad,
52
- description: s.especialidad,
53
- });
54
- const mapSpecialityER = (s) => ({
55
- id: s.specialty_id,
56
- description: s.specialty,
57
- });
58
- const mapped = {
59
- specialties: response.data.specialties.map(mapSpeciality),
60
- specialtiesER: response.data.specialties_er.map(mapSpecialityER),
61
- professionals: response.data.professionals.map((p) => ({
62
- id: p.id_profesional,
63
- fullName: p.denominacion,
64
- clinicId: p.id_consultorio,
65
- specialties: p.especialidades.map(mapSpeciality),
66
- })),
67
- };
68
- return mapped;
69
- }),
70
- };
71
- return baseSdk;
72
- };
73
- exports.getBaseSdk = getBaseSdk;
@@ -1,91 +0,0 @@
1
- import { RequestMaker } from '../request';
2
- import { Doc24 } from '../types';
3
- export declare const getUserMethods: (makeRequest: RequestMaker, url: string, credentials: Doc24.SdkCredentials) => {
4
- declareUser: (params: {
5
- user: {
6
- firstName: string;
7
- lastName: string;
8
- identificationType: number;
9
- identificationValue: string;
10
- countryId: string;
11
- birthdate: Date;
12
- gender: "m" | "f";
13
- phone: string;
14
- email: string;
15
- };
16
- } & {
17
- code?: string | undefined;
18
- channel?: "1" | "2" | undefined;
19
- }) => Promise<{
20
- askCode: true;
21
- userInfo: {
22
- phone: string;
23
- email: string;
24
- };
25
- } | {
26
- patientId: number | null;
27
- askCode: false;
28
- userId: number;
29
- }>;
30
- getUserId: (user: {
31
- firstName: string;
32
- lastName: string;
33
- identificationType: number;
34
- identificationValue: string;
35
- countryId: string;
36
- birthdate: Date;
37
- gender: "m" | "f";
38
- phone: string;
39
- email: string;
40
- }) => Promise<number>;
41
- sendVerificationCode: (params: {
42
- identificationType: number;
43
- identificationValue: string;
44
- channel: "1" | "2";
45
- }) => Promise<void>;
46
- getUserInstance: (user: number | {
47
- firstName: string;
48
- lastName: string;
49
- identificationType: number;
50
- identificationValue: string;
51
- countryId: string;
52
- birthdate: Date;
53
- gender: "m" | "f";
54
- phone: string;
55
- email: string;
56
- }) => Promise<any>;
57
- enroll: (params: {
58
- firstName: string;
59
- lastName: string;
60
- birthdate: Date;
61
- gender: "m" | "f";
62
- email: string;
63
- identificationNumber: string;
64
- startDate: Date;
65
- plan: string;
66
- }) => Promise<void>;
67
- getCoverageInfo: (identificationValue: string) => Promise<{
68
- firstName: string | null;
69
- lastName: string | null;
70
- birthdate: Date;
71
- gender: "m" | "f";
72
- email: string | null;
73
- identificationNumber: string;
74
- plan: string | null;
75
- financerId: number | null;
76
- defaultAffiliationId: number | null;
77
- credentialNumber: string | null;
78
- financerPlanId: number | null;
79
- brand: number | null;
80
- holderIdentificationNumber: string | null;
81
- copaymentValue: number | null;
82
- mobilePhone: string | null;
83
- company: string | null;
84
- dischargeDate: Date | null;
85
- leavingDate: Date | null;
86
- identificacion_tributaria: string | null;
87
- deregistrationDate: Date | null;
88
- authorizationCode: string | null;
89
- authorizationCodeExpiration: Date | null;
90
- } | null>;
91
- };
@@ -1,133 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getUserMethods = 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 userSdk_1 = require("../userSdk");
9
- const utils_1 = require("../utils");
10
- const getUserMethods = (makeRequest, url, credentials) => {
11
- const declareUser = async ({ user, channel, code, }) => {
12
- const path = '/user';
13
- const mappedUser = {
14
- lastname: user.lastName,
15
- firstname: user.firstName,
16
- identification_type: user.identificationType,
17
- identification_value: user.identificationValue,
18
- birthdate: date_fns_1.format(user.birthdate, 'yyyy-MM-dd'),
19
- gender: user.gender.toUpperCase(),
20
- phone: user.phone,
21
- email: user.email,
22
- country_id: user.countryId,
23
- };
24
- const parsedChannel = channel ? parseInt(channel) : channel;
25
- const response = await makeRequest('POST', path, {
26
- user_data: mappedUser,
27
- channel: parsedChannel,
28
- code,
29
- });
30
- const data = response.data;
31
- if (data.ask_code)
32
- return { askCode: true, userInfo: data.user_info };
33
- return {
34
- askCode: false,
35
- userId: response.data.user_id,
36
- patientId: response.data.patient_id,
37
- };
38
- };
39
- const getUserId = async (user) => {
40
- const path = '/search-user';
41
- const mappedUser = {
42
- lastname: user.lastName,
43
- firstname: user.firstName,
44
- identification_type: user.identificationType,
45
- identification_value: user.identificationValue,
46
- birthdate: date_fns_1.format(user.birthdate, 'yyyy-MM-dd'),
47
- gender: user.gender.toUpperCase(),
48
- phone: user.phone,
49
- email: user.email,
50
- country_id: user.countryId,
51
- };
52
- const response = await makeRequest('POST', path, {
53
- user_data: mappedUser,
54
- });
55
- return response.data.user_id;
56
- };
57
- const sendVerificationCode = async (params) => {
58
- const path = '/send-verification-code';
59
- const mappedParams = {
60
- identification_type: params.identificationType,
61
- identification_value: params.identificationValue,
62
- channel: parseInt(params.channel),
63
- };
64
- await makeRequest('POST', path, mappedParams);
65
- };
66
- const getUserInstance = async (user) => {
67
- const userId = typeof user === 'number' ? user : await getUserId(user);
68
- return userSdk_1.userSdk(url, credentials, userId);
69
- };
70
- const enroll = async (params) => {
71
- const path = `/enrollment`;
72
- const mappedUser = {
73
- firstname: params.firstName,
74
- lastname: params.lastName,
75
- gender: params.gender.toUpperCase(),
76
- identification_number: params.identificationNumber,
77
- birthdate: date_fns_1.format(params.birthdate, 'yyyy-MM-dd'),
78
- email: params.email,
79
- plan: params.plan,
80
- start_date: date_fns_1.format(params.startDate, 'yyyy-MM-dd'),
81
- };
82
- await makeRequest('POST', path, {
83
- user_data: mappedUser,
84
- });
85
- };
86
- const getCoverageInfo = async (identificationValue) => {
87
- const path = `/info-coverage/${identificationValue}`;
88
- const response = await makeRequest('GET', path);
89
- const raw = response.data.info;
90
- if (!raw)
91
- return null;
92
- const mappedCoverageInfo = {
93
- financerId: raw.id_financiador,
94
- defaultAffiliationId: raw.id_afiliacion_default,
95
- plan: raw.plan,
96
- identificationNumber: raw.nro_documento,
97
- credentialNumber: raw.nro_credencial,
98
- lastName: raw.apellido,
99
- firstName: raw.nombre,
100
- birthdate: utils_1.parseDate(raw.fecha_nacimiento),
101
- financerPlanId: raw.id_financiador_plan,
102
- gender: raw.sexo.toLowerCase(),
103
- brand: raw.brand,
104
- holderIdentificationNumber: raw.nro_documento_titular,
105
- copaymentValue: raw.valor_copago,
106
- mobilePhone: raw.telefono_movil,
107
- company: raw.empresa,
108
- email: raw.email,
109
- dischargeDate: raw.fecha_alta ? utils_1.parseDateTime(raw.fecha_alta) : null,
110
- leavingDate: raw.fecha_baja ? utils_1.parseDateTime(raw.fecha_baja) : null,
111
- identificacion_tributaria: raw.identificacion_tributaria,
112
- deregistrationDate: raw.fecha_baja_padron
113
- ? utils_1.parseDateTime(raw.fecha_baja_padron)
114
- : null,
115
- authorizationCode: raw.codigo_autorizacion,
116
- authorizationCodeExpiration: raw.codigo_autorizacion_vencimiento
117
- ? utils_1.parseDateTime(raw.codigo_autorizacion_vencimiento)
118
- : null,
119
- };
120
- return mappedCoverageInfo;
121
- };
122
- return {
123
- declareUser: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.declareUserParams]), schemas_1.doc24Schemas.declareUserResponse, declareUser),
124
- getUserId: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.user]), zod_1.number(), getUserId),
125
- sendVerificationCode: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.sendVerificationCodeParams]), zod_1.void(), sendVerificationCode),
126
- getUserInstance: validation_1.validateFunction(zod_1.tuple([zod_1.union([schemas_1.doc24Schemas.user, zod_1.number()])]),
127
- // TODO: validate?
128
- zod_1.any(), getUserInstance),
129
- enroll: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.enrollmentParams]), zod_1.void(), enroll),
130
- getCoverageInfo: validation_1.validateFunction(zod_1.tuple([zod_1.string()]), schemas_1.doc24Schemas.coverageInfo, getCoverageInfo),
131
- };
132
- };
133
- exports.getUserMethods = getUserMethods;
package/lib/index.d.ts DELETED
@@ -1,364 +0,0 @@
1
- import { Doc24 } from './types';
2
- export declare const doc24Sdk: (params: Doc24.SdkParams) => Promise<{
3
- getRequestHandler: (params: {
4
- credentials: Doc24.SdkCredentials;
5
- eventHandlers: Doc24.Webhook.Events;
6
- baseAddress: string;
7
- }) => Promise<Doc24.Webhook.Handler>;
8
- declareUser: (params: {
9
- user: {
10
- firstName: string;
11
- lastName: string;
12
- identificationType: number;
13
- identificationValue: string;
14
- countryId: string;
15
- birthdate: Date;
16
- gender: "m" | "f";
17
- phone: string;
18
- email: string;
19
- };
20
- } & {
21
- code?: string | undefined;
22
- channel?: "1" | "2" | undefined;
23
- }) => Promise<{
24
- askCode: true;
25
- userInfo: {
26
- phone: string;
27
- email: string;
28
- };
29
- } | {
30
- patientId: number | null;
31
- askCode: false;
32
- userId: number;
33
- }>;
34
- getUserId: (user: {
35
- firstName: string;
36
- lastName: string;
37
- identificationType: number;
38
- identificationValue: string;
39
- countryId: string;
40
- birthdate: Date;
41
- gender: "m" | "f";
42
- phone: string;
43
- email: string;
44
- }) => Promise<number>;
45
- getUserInstance: (user: number | {
46
- firstName: string;
47
- lastName: string;
48
- identificationType: number;
49
- identificationValue: string;
50
- countryId: string;
51
- birthdate: Date;
52
- gender: "m" | "f";
53
- phone: string;
54
- email: string;
55
- }) => Promise<Doc24.UserSdk>;
56
- getProfessional: (professionalId: number) => Promise<{
57
- firstName: string;
58
- lastName: string;
59
- birthdate: Date;
60
- gender: "m" | "f";
61
- phone: string | null;
62
- email: string;
63
- id: number;
64
- logoUrl: string;
65
- specialties: {
66
- id: number;
67
- description: string;
68
- }[];
69
- matriculation: {
70
- number: string;
71
- type: string;
72
- }[];
73
- degree: string;
74
- languages: string[];
75
- resume: {
76
- link: string;
77
- brief: string;
78
- };
79
- }>;
80
- getAvailableScheduleClinics: () => Promise<{
81
- specialties: {
82
- id: number;
83
- description: string;
84
- }[];
85
- specialtiesER: {
86
- id: number;
87
- description: string;
88
- }[];
89
- professionals: {
90
- id: number;
91
- fullName: string;
92
- clinicId: number;
93
- specialties: {
94
- id: number;
95
- description: string;
96
- }[];
97
- }[];
98
- }>;
99
- enroll: (params: {
100
- firstName: string;
101
- lastName: string;
102
- birthdate: Date;
103
- gender: "m" | "f";
104
- email: string;
105
- identificationNumber: string;
106
- startDate: Date;
107
- plan: string;
108
- }) => Promise<void>;
109
- getCoverageInfo: (identificationValue: string) => Promise<{
110
- firstName: string | null;
111
- lastName: string | null;
112
- birthdate: Date;
113
- gender: "m" | "f";
114
- email: string | null;
115
- identificationNumber: string;
116
- plan: string | null;
117
- financerId: number | null;
118
- defaultAffiliationId: number | null;
119
- credentialNumber: string | null;
120
- financerPlanId: number | null;
121
- brand: number | null;
122
- holderIdentificationNumber: string | null;
123
- copaymentValue: number | null;
124
- mobilePhone: string | null;
125
- company: string | null;
126
- dischargeDate: Date | null;
127
- leavingDate: Date | null;
128
- identificacion_tributaria: string | null;
129
- deregistrationDate: Date | null;
130
- authorizationCode: string | null;
131
- authorizationCodeExpiration: Date | null;
132
- } | null>;
133
- sendVerificationCode: (params: {
134
- identificationType: number;
135
- identificationValue: string;
136
- channel: "1" | "2";
137
- }) => Promise<void>;
138
- getDiagnosticaHistory: (patient: {
139
- identificationType: "DNI";
140
- identificationValue: string;
141
- gender: "m" | "f";
142
- }, from: Date, to: Date) => Promise<{
143
- date: Date;
144
- location: string;
145
- exams: string[];
146
- deepLink: string;
147
- }[]>;
148
- getDiagnosticaDeepLink: (kiosk: string, user: {
149
- firstName: string;
150
- lastName: string;
151
- identificationType: "DNI";
152
- identificationValue: string;
153
- gender: "m" | "f";
154
- phone: string;
155
- email: string;
156
- language: string;
157
- birthday: Date;
158
- }, patient: {
159
- firstName: string;
160
- lastName: string;
161
- identificationType: "DNI";
162
- identificationValue: string;
163
- gender: "m" | "f";
164
- birthday: Date;
165
- }) => Promise<{
166
- forwardingRequired: true;
167
- deepLink: string;
168
- } | {
169
- forwardingRequired: false;
170
- }>;
171
- getDiagnosticaAccess: (kiosk: string, user: {
172
- firstName: string;
173
- lastName: string;
174
- identificationType: "DNI";
175
- identificationValue: string;
176
- gender: "m" | "f";
177
- phone: string;
178
- email: string;
179
- language: string;
180
- birthday: Date;
181
- }, patient: {
182
- firstName: string;
183
- lastName: string;
184
- identificationType: "DNI";
185
- identificationValue: string;
186
- gender: "m" | "f";
187
- birthday: Date;
188
- }) => Promise<void>;
189
- externalLogin: (params: {
190
- user: string;
191
- password: string;
192
- }) => Promise<{
193
- firstName: string;
194
- lastName: string;
195
- countryId: string;
196
- gender: "m" | "f";
197
- phone: string;
198
- email: string;
199
- birthday: Date;
200
- identificationNumber: string;
201
- }>;
202
- preExternalEnrollment: (params: ({
203
- birthdate: Date;
204
- identificationNumber: string;
205
- } & {
206
- phone: string;
207
- email: string;
208
- }) | ({
209
- birthdate: Date;
210
- identificationNumber: string;
211
- } & {
212
- phone?: undefined;
213
- email: string;
214
- }) | ({
215
- birthdate: Date;
216
- identificationNumber: string;
217
- } & {
218
- email?: undefined;
219
- phone: string;
220
- })) => Promise<void>;
221
- externalEnrollment: (params: ({
222
- birthdate: Date;
223
- identificationNumber: string;
224
- } & {
225
- phone: string;
226
- email: string;
227
- } & {
228
- password: string;
229
- } & {
230
- emailCode: string;
231
- phoneCode: string;
232
- }) | ({
233
- birthdate: Date;
234
- identificationNumber: string;
235
- } & {
236
- phone: string;
237
- email: string;
238
- } & {
239
- password: string;
240
- } & {
241
- phoneCode?: undefined;
242
- emailCode: string;
243
- }) | ({
244
- birthdate: Date;
245
- identificationNumber: string;
246
- } & {
247
- phone: string;
248
- email: string;
249
- } & {
250
- password: string;
251
- } & {
252
- emailCode?: undefined;
253
- phoneCode: string;
254
- }) | ({
255
- birthdate: Date;
256
- identificationNumber: string;
257
- } & {
258
- phone?: undefined;
259
- email: string;
260
- } & {
261
- password: string;
262
- } & {
263
- emailCode: string;
264
- phoneCode: string;
265
- }) | ({
266
- birthdate: Date;
267
- identificationNumber: string;
268
- } & {
269
- phone?: undefined;
270
- email: string;
271
- } & {
272
- password: string;
273
- } & {
274
- phoneCode?: undefined;
275
- emailCode: string;
276
- }) | ({
277
- birthdate: Date;
278
- identificationNumber: string;
279
- } & {
280
- phone?: undefined;
281
- email: string;
282
- } & {
283
- password: string;
284
- } & {
285
- emailCode?: undefined;
286
- phoneCode: string;
287
- }) | ({
288
- birthdate: Date;
289
- identificationNumber: string;
290
- } & {
291
- email?: undefined;
292
- phone: string;
293
- } & {
294
- password: string;
295
- } & {
296
- emailCode: string;
297
- phoneCode: string;
298
- }) | ({
299
- birthdate: Date;
300
- identificationNumber: string;
301
- } & {
302
- email?: undefined;
303
- phone: string;
304
- } & {
305
- password: string;
306
- } & {
307
- phoneCode?: undefined;
308
- emailCode: string;
309
- }) | ({
310
- birthdate: Date;
311
- identificationNumber: string;
312
- } & {
313
- email?: undefined;
314
- phone: string;
315
- } & {
316
- password: string;
317
- } & {
318
- emailCode?: undefined;
319
- phoneCode: string;
320
- })) => Promise<{
321
- firstName: string;
322
- lastName: string;
323
- countryId: string;
324
- gender: "m" | "f";
325
- phone: string;
326
- email: string;
327
- birthday: Date;
328
- identificationNumber: string;
329
- }>;
330
- sendExternalVerificationCode: (params: {
331
- birthdate: Date;
332
- channel: "1" | "2";
333
- identificationNumber: string;
334
- }) => Promise<void>;
335
- verifyExternalVerificationCode: (params: {
336
- code: string;
337
- birthdate: Date;
338
- channel: "1" | "2";
339
- identificationNumber: string;
340
- }) => Promise<any>;
341
- externalResetPassword: (params: ({
342
- birthdate: Date;
343
- password: string;
344
- identificationNumber: string;
345
- } & {
346
- emailCode: string;
347
- phoneCode: string;
348
- }) | ({
349
- birthdate: Date;
350
- password: string;
351
- identificationNumber: string;
352
- } & {
353
- phoneCode?: undefined;
354
- emailCode: string;
355
- }) | ({
356
- birthdate: Date;
357
- password: string;
358
- identificationNumber: string;
359
- } & {
360
- emailCode?: undefined;
361
- phoneCode: string;
362
- })) => Promise<any>;
363
- }>;
364
- export type { Doc24 } from './types';
package/lib/index.js DELETED
@@ -1,22 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.doc24Sdk = void 0;
4
- const webhook_1 = require("./webhook");
5
- const baseSdk_1 = require("./baseSdk");
6
- const request_1 = require("./request");
7
- const doc24Sdk = async (params) => {
8
- const baseSdk = await baseSdk_1.getBaseSdk(params.url, params.credentials);
9
- const makeRequest = await request_1.getRequestFactory(params.url, params.credentials);
10
- return {
11
- ...baseSdk,
12
- getRequestHandler: async (params) => {
13
- await makeRequest('PUT', '/webhook', {
14
- url: params.baseAddress,
15
- issuer: params.credentials.iss,
16
- secret: params.credentials.key,
17
- });
18
- return webhook_1.getRequestHandler(params.credentials, baseSdk, params.eventHandlers);
19
- },
20
- };
21
- };
22
- exports.doc24Sdk = doc24Sdk;
@@ -1,3 +0,0 @@
1
- import { Doc24 } from '../types';
2
- export declare const getRequestFactory: (url: string, credentials: Doc24.SdkCredentials, userId?: number | undefined) => Promise<RequestMaker>;
3
- export declare type RequestMaker = (method: 'POST' | 'GET' | 'PUT' | 'DELETE', path: string, body?: object) => Promise<any>;