@integraciones_doc24/sdk 0.41.0 → 0.42.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/lib/schemas.d.ts CHANGED
@@ -1451,4 +1451,62 @@ export declare const doc24Schemas: {
1451
1451
  identificationType: "dni" | "ndi" | "passport" | "credential" | "nn" | "cpf" | "rg" | "rut" | "cuit";
1452
1452
  identificationValue: string;
1453
1453
  }>;
1454
+ videoCallLink: import("zod").ZodObject<{
1455
+ deeplink: import("zod").ZodString;
1456
+ codigo: import("zod").ZodNullable<import("zod").ZodString>;
1457
+ }, "strip", import("zod").ZodTypeAny, {
1458
+ deeplink: string;
1459
+ codigo: string | null;
1460
+ }, {
1461
+ deeplink: string;
1462
+ codigo: string | null;
1463
+ }>;
1464
+ videoCallLinkResponse: import("zod").ZodObject<{
1465
+ data: import("zod").ZodObject<{
1466
+ code: import("zod").ZodLiteral<200>;
1467
+ message: import("zod").ZodLiteral<"OK">;
1468
+ link: import("zod").ZodObject<{
1469
+ deeplink: import("zod").ZodString;
1470
+ codigo: import("zod").ZodNullable<import("zod").ZodString>;
1471
+ }, "strip", import("zod").ZodTypeAny, {
1472
+ deeplink: string;
1473
+ codigo: string | null;
1474
+ }, {
1475
+ deeplink: string;
1476
+ codigo: string | null;
1477
+ }>;
1478
+ }, "strip", import("zod").ZodTypeAny, {
1479
+ code: 200;
1480
+ message: "OK";
1481
+ link: {
1482
+ deeplink: string;
1483
+ codigo: string | null;
1484
+ };
1485
+ }, {
1486
+ code: 200;
1487
+ message: "OK";
1488
+ link: {
1489
+ deeplink: string;
1490
+ codigo: string | null;
1491
+ };
1492
+ }>;
1493
+ }, "strip", import("zod").ZodTypeAny, {
1494
+ data: {
1495
+ code: 200;
1496
+ message: "OK";
1497
+ link: {
1498
+ deeplink: string;
1499
+ codigo: string | null;
1500
+ };
1501
+ };
1502
+ }, {
1503
+ data: {
1504
+ code: 200;
1505
+ message: "OK";
1506
+ link: {
1507
+ deeplink: string;
1508
+ codigo: string | null;
1509
+ };
1510
+ };
1511
+ }>;
1454
1512
  };
package/lib/schemas.js CHANGED
@@ -186,6 +186,17 @@ const oldIdentificaiton = zod_1.object({
186
186
  identificationType,
187
187
  identificationValue: zod_1.string(),
188
188
  });
189
+ const videoCallLink = zod_1.object({
190
+ deeplink: zod_1.string().url(),
191
+ codigo: zod_1.string().nullable(),
192
+ });
193
+ const videoCallLinkResponse = zod_1.object({
194
+ data: zod_1.object({
195
+ code: zod_1.literal(200),
196
+ message: zod_1.literal('OK'),
197
+ link: videoCallLink,
198
+ }),
199
+ });
189
200
  const consultation = zod_1.object({
190
201
  id_consulta: zod_1.number(),
191
202
  tipo_consulta: zod_1.string(),
@@ -404,4 +415,6 @@ exports.doc24Schemas = {
404
415
  diagnosticaDeepLinkResponse,
405
416
  coverageInfo,
406
417
  oldIdentificaiton,
418
+ videoCallLink,
419
+ videoCallLinkResponse,
407
420
  };
package/lib/types.d.ts CHANGED
@@ -32,6 +32,7 @@ export declare namespace Doc24 {
32
32
  type DiagnosticaHistoryAppointment = TypeOf<typeof doc24Schemas.diagnosticaHistoryAppointment>;
33
33
  type DiagnosticaDeepLinkResponse = TypeOf<typeof doc24Schemas.diagnosticaDeepLinkResponse>;
34
34
  type OldIdentificaiton = TypeOf<typeof doc24Schemas.oldIdentificaiton>;
35
+ type VideoCallLink = TypeOf<typeof doc24Schemas.videoCallLink>;
35
36
  type BaseSdk = {
36
37
  declareUser: (user: User) => Promise<number>;
37
38
  getUserInstance: (user: User | number) => Promise<UserSdk>;
@@ -65,6 +66,7 @@ export declare namespace Doc24 {
65
66
  getChatPosts: (chatId: number) => Promise<ChatPost[]>;
66
67
  cancelChat: (chatId: number) => Promise<void>;
67
68
  sendChatMessage: (chatId: number, message: string) => Promise<number>;
69
+ getVideoCallLink: (vcToken: string, name: string) => Promise<VideoCallLink>;
68
70
  userId: number;
69
71
  };
70
72
  namespace Webhook {
@@ -108,4 +108,8 @@ export declare const getVideoVisitMethods: (makeRequest: RequestMaker) => {
108
108
  vcToken: string;
109
109
  consultationId: number;
110
110
  }[]>;
111
+ getVideoCallLink: (vcToken: string, name: string) => Promise<{
112
+ deeplink: string;
113
+ codigo: string | null;
114
+ }>;
111
115
  };
@@ -113,6 +113,22 @@ const getVideoVisitMethods = (makeRequest) => {
113
113
  const response = await makeRequest('GET', path);
114
114
  return response.data.link;
115
115
  });
116
+ const getVideoCallLink = validation_1.validateFunction(zod_1.tuple([zod_1.string(), zod_1.string()]), schemas_1.doc24Schemas.videoCallLink, async (vcToken, name) => {
117
+ try {
118
+ const path = `/attend-video-visit`;
119
+ const response = await makeRequest('POST', path, {
120
+ vc_token: vcToken,
121
+ name,
122
+ });
123
+ const parsedResponse = schemas_1.doc24Schemas.videoCallLinkResponse.safeParse(response);
124
+ if (!parsedResponse.success)
125
+ throw new Error('Invalid telecommand link response');
126
+ return parsedResponse.data.data.link;
127
+ }
128
+ catch (error) {
129
+ throw new Error('Error getting telecommand link');
130
+ }
131
+ });
116
132
  return {
117
133
  scheduleVideoVisit,
118
134
  cancelVideoVisit,
@@ -121,6 +137,7 @@ const getVideoVisitMethods = (makeRequest) => {
121
137
  getVideoVisitDetails,
122
138
  getVideoVisitLink,
123
139
  getActiveVideoVisits,
140
+ getVideoCallLink,
124
141
  };
125
142
  };
126
143
  exports.getVideoVisitMethods = getVideoVisitMethods;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@integraciones_doc24/sdk",
3
- "version": "0.41.0",
3
+ "version": "0.42.0",
4
4
  "publishConfig": {
5
5
  "tag": "0.x"
6
6
  },