@integraciones_doc24/sdk 0.28.0 → 0.29.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/baseSdk.js CHANGED
@@ -79,6 +79,21 @@ const getBaseSdk = async (url, credentials) => {
79
79
  };
80
80
  return mapped;
81
81
  }),
82
+ enroll: validation_1.validateFunction(zod_1.tuple([schemas_1.doc24Schemas.enrollmentParams]), zod_1.void(), async (params) => {
83
+ const path = `/enrollment`;
84
+ await makeRequest('POST', path, {
85
+ user_data: {
86
+ firstname: params.firstName,
87
+ lastname: params.lastName,
88
+ gender: params.gender.toUpperCase(),
89
+ identification_number: params.identificationNumber,
90
+ birthdate: date_fns_1.format(params.birthdate, 'yyyy-MM-dd'),
91
+ email: params.email,
92
+ plan: params.plan,
93
+ start_date: date_fns_1.format(params.startDate, 'yyyy-MM-dd'),
94
+ },
95
+ });
96
+ }),
82
97
  };
83
98
  return baseSdk;
84
99
  };
package/lib/index.d.ts CHANGED
@@ -66,5 +66,15 @@ export declare const doc24Sdk: (params: Doc24.SdkParams) => Promise<{
66
66
  }[];
67
67
  }[];
68
68
  }>;
69
+ enroll: (params: {
70
+ firstName: string;
71
+ lastName: string;
72
+ birthdate: Date;
73
+ gender: "m" | "f";
74
+ email: string;
75
+ startDate: Date;
76
+ identificationNumber: string;
77
+ plan: string;
78
+ }) => Promise<void>;
69
79
  }>;
70
80
  export type { Doc24 } from './types';
package/lib/schemas.d.ts CHANGED
@@ -897,4 +897,32 @@ export declare const doc24Schemas: {
897
897
  id: number;
898
898
  userType: "patient" | "professional";
899
899
  }>;
900
+ enrollmentParams: import("zod").ZodObject<{
901
+ firstName: import("zod").ZodString;
902
+ lastName: import("zod").ZodString;
903
+ gender: import("zod").ZodEnum<["m", "f"]>;
904
+ identificationNumber: import("zod").ZodString;
905
+ birthdate: import("zod").ZodDate;
906
+ email: import("zod").ZodString;
907
+ plan: import("zod").ZodString;
908
+ startDate: import("zod").ZodDate;
909
+ }, "strip", import("zod").ZodTypeAny, {
910
+ firstName: string;
911
+ lastName: string;
912
+ birthdate: Date;
913
+ gender: "m" | "f";
914
+ email: string;
915
+ startDate: Date;
916
+ identificationNumber: string;
917
+ plan: string;
918
+ }, {
919
+ firstName: string;
920
+ lastName: string;
921
+ birthdate: Date;
922
+ gender: "m" | "f";
923
+ email: string;
924
+ startDate: Date;
925
+ identificationNumber: string;
926
+ plan: string;
927
+ }>;
900
928
  };
package/lib/schemas.js CHANGED
@@ -114,6 +114,16 @@ const chatPost = zod_1.object({
114
114
  message: zod_1.string(),
115
115
  date: zod_1.date(),
116
116
  });
117
+ const enrollmentParams = zod_1.object({
118
+ firstName: zod_1.string(),
119
+ lastName: zod_1.string(),
120
+ gender: gender,
121
+ identificationNumber: zod_1.string(),
122
+ birthdate: zod_1.date(),
123
+ email: zod_1.string().email(),
124
+ plan: zod_1.string(),
125
+ startDate: zod_1.date(),
126
+ });
117
127
  exports.doc24Schemas = {
118
128
  identificationType,
119
129
  sdkCredentials,
@@ -222,4 +232,5 @@ exports.doc24Schemas = {
222
232
  availableChatroom,
223
233
  chatDetails,
224
234
  chatPost,
235
+ enrollmentParams,
225
236
  };
package/lib/types.d.ts CHANGED
@@ -23,11 +23,13 @@ export declare namespace Doc24 {
23
23
  type ChatParameters = TypeOf<typeof doc24Schemas.chatParameters>;
24
24
  type ChatDetails = TypeOf<typeof doc24Schemas.chatDetails>;
25
25
  type ChatPost = TypeOf<typeof doc24Schemas.chatPost>;
26
+ type EnrollmentParams = TypeOf<typeof doc24Schemas.enrollmentParams>;
26
27
  type BaseSdk = {
27
28
  declareUser: (user: User) => Promise<number>;
28
29
  getUserInstance: (user: User | number) => Promise<UserSdk>;
29
30
  getProfessional: (professionalId: number) => Promise<Professional>;
30
31
  getAvailableScheduleClinics: () => Promise<AvailableScheduleClinics>;
32
+ enroll: (params: EnrollmentParams) => Promise<void>;
31
33
  };
32
34
  type UserSdk = {
33
35
  declarePatient: (patient: Patient) => Promise<number>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@integraciones_doc24/sdk",
3
- "version": "0.28.0",
3
+ "version": "0.29.0",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {