@rinse-dental/open-dental 0.0.6 → 0.1.1

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 (48) hide show
  1. package/dist/api/appointments.d.ts +196 -0
  2. package/dist/api/appointments.d.ts.map +1 -0
  3. package/dist/api/appointments.js +253 -8
  4. package/dist/api/commlogs.d.ts +28 -0
  5. package/dist/api/commlogs.d.ts.map +1 -0
  6. package/dist/api/commlogs.js +48 -0
  7. package/dist/api/index.d.ts +3 -0
  8. package/dist/api/index.d.ts.map +1 -0
  9. package/dist/api/patients.d.ts +113 -0
  10. package/dist/api/patients.d.ts.map +1 -0
  11. package/dist/api/patients.js +149 -6
  12. package/dist/api/procedureLog.d.ts +117 -0
  13. package/dist/api/procedureLog.d.ts.map +1 -0
  14. package/dist/api/procedureLog.js +177 -0
  15. package/dist/index.d.ts +2 -0
  16. package/dist/index.d.ts.map +1 -0
  17. package/dist/openDental.d.ts +19 -0
  18. package/dist/openDental.d.ts.map +1 -0
  19. package/dist/types/appointmentType.d.ts +226 -0
  20. package/dist/types/appointmentType.d.ts.map +1 -0
  21. package/dist/types/commlogType.d.ts +28 -0
  22. package/dist/types/commlogType.d.ts.map +1 -0
  23. package/dist/types/commlogType.js +2 -0
  24. package/dist/types/patientTypes.d.ts +205 -0
  25. package/dist/types/patientTypes.d.ts.map +1 -0
  26. package/dist/types/patientTypes.js +2 -0
  27. package/dist/types/procedurelogTypes.d.ts +108 -0
  28. package/dist/types/procedurelogTypes.d.ts.map +1 -0
  29. package/dist/types/procedurelogTypes.js +3 -0
  30. package/dist/utils/errorHandler.d.ts +1 -0
  31. package/dist/utils/errorHandler.d.ts.map +1 -0
  32. package/dist/utils/httpClient.d.ts +46 -0
  33. package/dist/utils/httpClient.d.ts.map +1 -0
  34. package/dist/utils/httpClient.js +25 -33
  35. package/package.json +1 -1
  36. package/src/api/appointments.ts +323 -26
  37. package/src/api/commlogs.ts +63 -0
  38. package/src/api/patients.ts +192 -13
  39. package/src/api/procedureLog.ts +230 -0
  40. package/src/openDental.ts +4 -4
  41. package/src/types/appointmentType.ts +249 -0
  42. package/src/types/commlogType.ts +28 -0
  43. package/src/types/patientTypes.ts +209 -0
  44. package/src/types/procedurelogTypes.ts +119 -0
  45. package/src/utils/httpClient.ts +27 -31
  46. package/tsconfig.json +4 -1
  47. package/src/utils/types.ts +0 -134
  48. /package/dist/{utils/types.js → types/appointmentType.js} +0 -0
@@ -0,0 +1,196 @@
1
+ import HttpClient from "../utils/httpClient";
2
+ import { Appointment, AppointmentSlot, GetAppointmentParams, GetASAPParams, GetSlotsParams, GetSlotsWebSchedParams, GetWebSchedAppointmentsParams, CreateNewAppointmentParams, CreatePlannedAppointmentParams, SchedulePlannedAppointmentParams, ScheduleWebSchedAppointmentParams, UpdateAppointmentParams, BreakAppointmentParams, ConfirmAppointmentParams } from "../types/appointmentType";
3
+ export default class Appointments {
4
+ private httpClient;
5
+ constructor(httpClient: HttpClient);
6
+ /**
7
+ * Fetch a single appointment by its ID.
8
+ * @param {number} AptNum - The unique identifier for the appointment.
9
+ * @returns {Promise<Appointment>} - The appointment object.
10
+ * @throws {Error} - If `AptNum` is not provided.
11
+ */
12
+ getAppointment(AptNum: number): Promise<Appointment>;
13
+ /**
14
+ * Fetch multiple appointments with optional filtering and pagination.
15
+ * @param {Object} params - The parameters for filtering and pagination.
16
+ * @param {number} [params.PatNum] - Filter by patient number.
17
+ * @param {"Scheduled" | "Complete" | "UnschedList" | "ASAP" | "Broken" | "Planned" | "PtNote" | "PtNoteCompleted"} [params.AptStatus] - Filter by appointment status.
18
+ * @param {number} [params.Op] - Filter by operatory number.
19
+ * @param {string} [params.date] - Search for a specific day in "yyyy-MM-dd" format.
20
+ * @param {string} [params.dateStart] - Start date for date range in "yyyy-MM-dd" format.
21
+ * @param {string} [params.dateEnd] - End date for date range in "yyyy-MM-dd" format.
22
+ * @param {number} [params.ClinicNum] - Filter by clinic number.
23
+ * @param {string} [params.DateTStamp] - Return only appointments updated after this timestamp.
24
+ * @param {number} [params.Offset] - Pagination offset for results.
25
+ * @returns {Promise<Appointment[]>} - A list of appointments.
26
+ */
27
+ getAppointments({ PatNum, AptStatus, Op, date, dateStart, dateEnd, ClinicNum, DateTStamp, Offset, }?: GetAppointmentParams): Promise<Appointment[]>;
28
+ /**
29
+ * Fetch ASAP appointments.
30
+ * @param {Object} params - Parameters for fetching ASAP appointments.
31
+ * @param {number} params.ClinicNum - Required: Clinic number. Use 0 for appointments not attached to clinics.
32
+ * @param {number} [params.ProvNum] - Optional: Provider number.
33
+ * @returns {Promise<Appointment[]>} - A list of ASAP appointments.
34
+ * @throws {Error} - If `ClinicNum` is not provided.
35
+ */
36
+ getASAPappointments(params: GetASAPParams): Promise<Appointment[]>;
37
+ /**
38
+ * Fetch available appointment slots.
39
+ * @param {Object} params - Parameters for filtering slots.
40
+ * @param {string} [params.date] - Search for a specific day in "yyyy-MM-dd" format.
41
+ * @param {string} [params.dateStart] - Start date for date range in "yyyy-MM-dd" format.
42
+ * @param {string} [params.dateEnd] - End date for date range in "yyyy-MM-dd" format.
43
+ * @param {number} [params.lengthMinutes] - Ignore slots shorter than this length.
44
+ * @param {number} [params.ProvNum] - Provider number.
45
+ * @param {number} [params.OpNum] - Operatory number.
46
+ * @returns {Promise<AppointmentSlot[]>} - A list of available slots.
47
+ */
48
+ getSlots(params?: GetSlotsParams): Promise<AppointmentSlot[]>;
49
+ /**
50
+ * Fetch WebSched appointment slots.
51
+ * @param {Object} params - Parameters for filtering WebSched slots.
52
+ * @param {string} [params.date] - Search for a specific day in "yyyy-MM-dd" format.
53
+ * @param {string} [params.dateStart] - Start date for date range in "yyyy-MM-dd" format.
54
+ * @param {string} [params.dateEnd] - End date for date range in "yyyy-MM-dd" format.
55
+ * @param {number} params.ClinicNum - Required: Clinic number.
56
+ * @param {number} [params.defNumApptType] - Appointment type definition number.
57
+ * @param {"true" | "false"} [params.isNewPatient] - Indicates if the slot is for a new patient.
58
+ * @returns {Promise<AppointmentSlot[]>} - A list of WebSched slots.
59
+ * @throws {Error} - If `ClinicNum` is not provided.
60
+ */
61
+ getSlotsWebSched(params: GetSlotsWebSchedParams): Promise<AppointmentSlot[]>;
62
+ /**
63
+ * Fetch WebSched appointments.
64
+ * @param {Object} params - Parameters for fetching WebSched appointments.
65
+ * @param {string} [params.date] - Search for a specific day in "yyyy-MM-dd" format.
66
+ * @param {string} [params.dateStart] - Start date for date range in "yyyy-MM-dd" format.
67
+ * @param {string} [params.dateEnd] - End date for date range in "yyyy-MM-dd" format.
68
+ * @param {string} [params.DateTStamp] - Return only appointments updated after this timestamp.
69
+ * @param {number} [params.ClinicNum] - Clinic number.
70
+ * @returns {Promise<Appointment[]>} - A list of WebSched appointments.
71
+ */
72
+ getWebSchedAppointments(params?: GetWebSchedAppointmentsParams): Promise<Appointment[]>;
73
+ /**
74
+ * Create a new appointment.
75
+ * @param {Object} data - Data for the new appointment.
76
+ * @param {number} data.PatNum - Required: Patient number.
77
+ * @param {number} data.Op - Required: Operatory number.
78
+ * @param {string} data.AptDateTime - Required: Appointment start time in "yyyy-MM-dd HH:mm:ss" format.
79
+ * @param {"Scheduled" | "Complete" | "UnschedList" | "PtNote" | "PtNoteCompleted"} [data.AptStatus="Scheduled"] - Optional: Appointment status. Default is "Scheduled".
80
+ * @param {string} [data.Pattern="/XX/"] - Optional: Time pattern in 5-minute increments. Default is "/XX/" (20 minutes).
81
+ * @param {number} [data.Confirmed] - Optional: Confirmation status definition number.
82
+ * @param {string} [data.Note] - Optional: Appointment notes.
83
+ * @param {number} [data.ProvNum] - Optional: Provider number.
84
+ * @param {number} [data.ProvHyg=0] - Optional: Hygienist provider number. Default is 0.
85
+ * @param {number} [data.ClinicNum] - Optional: Clinic number.
86
+ * @param {"true" | "false"} [data.IsHygiene="false"] - Optional: Indicates if the appointment is for hygiene. Default is "false".
87
+ * @param {"true" | "false"} [data.IsNewPatient="false"] - Optional: Indicates if the patient is new. Default is "false".
88
+ * @param {"Normal" | "ASAP"} [data.Priority="Normal"] - Optional: Appointment priority. Default is "Normal".
89
+ * @param {number} [data.AppointmentTypeNum=0] - Optional: Appointment type number. Default is 0.
90
+ * @param {string} [data.colorOverride] - Optional: Custom color in "R,G,B" format.
91
+ * @param {string} [data.PatternSecondary] - Optional: Secondary time pattern.
92
+ * @returns {Promise<Appointment>} - The created appointment.
93
+ * @throws {Error} - If required fields are missing.
94
+ */
95
+ createNewAppointment(data: CreateNewAppointmentParams): Promise<Appointment>;
96
+ /**
97
+ * Create a planned appointment.
98
+ * @param {Object} data - Data for the planned appointment.
99
+ * @param {number} data.PatNum - Required: Patient number.
100
+ * @param {number} [data.AppointmentTypeNum] - Optional: Appointment type number.
101
+ * @param {number[]} [data.procNums] - Optional: Array of procedure numbers. At least one of `AppointmentTypeNum` or `procNums` is required.
102
+ * @param {string} [data.Pattern="/XX/"] - Optional: Time pattern in 5-minute increments. Default is "/XX/" (20 minutes).
103
+ * @param {number} [data.Confirmed] - Optional: Confirmation status definition number.
104
+ * @param {string} [data.Note] - Optional: Appointment notes.
105
+ * @param {number} [data.ProvNum] - Optional: Provider number.
106
+ * @param {number} [data.ProvHyg=0] - Optional: Hygienist provider number. Default is 0.
107
+ * @param {number} [data.ClinicNum] - Optional: Clinic number.
108
+ * @param {"true" | "false"} [data.IsHygiene="false"] - Optional: Indicates if the appointment is for hygiene. Default is "false".
109
+ * @param {"true" | "false"} [data.IsNewPatient="false"] - Optional: Indicates if the patient is new. Default is "false".
110
+ * @param {"Normal" | "ASAP"} [data.Priority="Normal"] - Optional: Appointment priority. Default is "Normal".
111
+ * @param {string} [data.PatternSecondary] - Optional: Secondary time pattern.
112
+ * @returns {Promise<Appointment>} - The created planned appointment.
113
+ * @throws {Error} - If required fields are missing.
114
+ */
115
+ createPlannedAppointment(data: CreatePlannedAppointmentParams): Promise<Appointment>;
116
+ /**
117
+ * Schedule a planned appointment.
118
+ * @param {Object} data - Data for scheduling the planned appointment.
119
+ * @param {number} data.AptNum - Required: The appointment number with Planned status.
120
+ * @param {string} data.AptDateTime - Required: Start time for the appointment in "yyyy-MM-dd HH:mm:ss" format.
121
+ * @param {number} data.ProvNum - Required: The provider number for the appointment.
122
+ * @param {number} data.Op - Required: The operatory number for the appointment.
123
+ * @param {number} [data.Confirmed] - Optional: Confirmation status definition number.
124
+ * @param {string} [data.Note] - Optional: Notes for the appointment. Will overwrite any existing note.
125
+ * @returns {Promise<Appointment>} - The scheduled appointment.
126
+ * @throws {Error} - If required fields are missing.
127
+ */
128
+ schedulePlannedAppointment(data: SchedulePlannedAppointmentParams): Promise<Appointment>;
129
+ /**
130
+ * Schedule a WebSched appointment.
131
+ * @param {Object} data - Data for scheduling the WebSched appointment.
132
+ * @param {number} data.PatNum - Required: Patient number.
133
+ * @param {string} data.DateTimeStart - Required: The start time of the appointment in "yyyy-MM-dd HH:mm:ss" format.
134
+ * @param {string} data.DateTimeEnd - Required: The end time of the appointment in "yyyy-MM-dd HH:mm:ss" format.
135
+ * @param {number} data.ProvNum - Required: Provider number associated with the appointment slot.
136
+ * @param {number} data.OpNum - Required: Operatory number associated with the appointment slot.
137
+ * @param {number} data.defNumApptType - Required: Appointment type definition number.
138
+ * @returns {Promise<Appointment>} - The scheduled WebSched appointment.
139
+ * @throws {Error} - If required fields are missing.
140
+ */
141
+ scheduleWebSchedAppointment(data: ScheduleWebSchedAppointmentParams): Promise<Appointment>;
142
+ /**
143
+ * Update an existing appointment.
144
+ * @param {Object} data - Data for updating the appointment.
145
+ * @param {number} data.AptNum - Required: The unique identifier of the appointment to update.
146
+ * @param {"Scheduled" | "Complete" | "UnschedList" | "Broken" | "Planned" | "PtNote" | "PtNoteCompleted"} [data.AptStatus] - Optional: Updated status of the appointment.
147
+ * @param {string} [data.Pattern] - Optional: Updated time pattern in 5-minute increments.
148
+ * @param {number} [data.Confirmed] - Optional: Updated confirmation status definition number.
149
+ * @param {number} [data.Op] - Optional: Updated operatory number.
150
+ * @param {string} [data.Note] - Optional: Updated notes for the appointment. Will overwrite existing notes.
151
+ * @param {number} [data.ProvNum] - Optional: Updated provider number.
152
+ * @param {number} [data.ProvHyg] - Optional: Updated hygienist provider number.
153
+ * @param {string} [data.AptDateTime] - Optional: Updated appointment start time in "yyyy-MM-dd HH:mm:ss" format.
154
+ * @param {number} [data.ClinicNum] - Optional: Updated clinic number.
155
+ * @param {"true" | "false"} [data.IsHygiene] - Optional: Indicates if the appointment is for hygiene.
156
+ * @param {"true" | "false"} [data.IsNewPatient] - Optional: Indicates if the appointment is for a new patient.
157
+ * @param {"Normal" | "ASAP"} [data.Priority] - Optional: Updated priority of the appointment.
158
+ * @param {number} [data.AppointmentTypeNum] - Optional: Updated appointment type number.
159
+ * @param {number} [data.UnschedStatus] - Optional: Updated unscheduled status definition number.
160
+ * @param {string} [data.colorOverride] - Optional: Updated custom color in "R,G,B" format.
161
+ * @param {string} [data.PatternSecondary] - Optional: Updated secondary time pattern.
162
+ * @returns {Promise<Appointment>} - The updated appointment.
163
+ * @throws {Error} - If `AptNum` is missing.
164
+ */
165
+ updateAppointment(data: UpdateAppointmentParams): Promise<Appointment>;
166
+ /**
167
+ * Break an existing appointment.
168
+ * Only appointments with an AptStatus of "Scheduled" can be broken.
169
+ * @param {Object} data - Data for breaking the appointment.
170
+ * @param {number} data.AptNum - Required: The unique identifier of the appointment to break.
171
+ * @param {"true" | "false"} data.sendToUnscheduledList - Required: Indicates if the appointment should be added to the Unscheduled List.
172
+ * @param {"Missed" | "Cancelled"} [data.breakType] - Optional: Reason for breaking the appointment.
173
+ * @returns {Promise<void>} - Resolves when the appointment is successfully broken.
174
+ * @throws {Error} - If required fields are missing.
175
+ */
176
+ breakAppointment(data: BreakAppointmentParams): Promise<void>;
177
+ /**
178
+ * Update the note for an existing appointment.
179
+ * @param {number} AptNum - Required: The unique identifier of the appointment to update.
180
+ * @param {string} Note - Required: The new note content for the appointment.
181
+ * @returns {Promise<void>} - Resolves when the note is successfully updated.
182
+ * @throws {Error} - If required fields are missing.
183
+ */
184
+ updateAppointmentNote(AptNum: number, Note: string): Promise<void>;
185
+ /**
186
+ * Confirm an existing appointment.
187
+ * @param {Object} data - Data for confirming the appointment.
188
+ * @param {number} data.AptNum - Required: The unique identifier of the appointment to confirm.
189
+ * @param {string} [data.confirmVal] - Optional: Confirmation value, e.g., "Sent", "Confirmed".
190
+ * @param {number} [data.defNum] - Optional: Confirmation definition number.
191
+ * @returns {Promise<void>} - Resolves when the appointment is successfully confirmed.
192
+ * @throws {Error} - If required fields are missing.
193
+ */
194
+ confirmAppointment(data: ConfirmAppointmentParams): Promise<void>;
195
+ }
196
+ //# sourceMappingURL=appointments.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"appointments.d.ts","sourceRoot":"","sources":["../../src/api/appointments.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EACL,WAAW,EACX,eAAe,EACf,oBAAoB,EACpB,aAAa,EACb,cAAc,EACd,sBAAsB,EACtB,6BAA6B,EAC7B,0BAA0B,EAC1B,8BAA8B,EAC9B,gCAAgC,EAChC,iCAAiC,EACjC,uBAAuB,EACvB,sBAAsB,EACtB,wBAAwB,EACzB,MAAM,0BAA0B,CAAC;AAElC,MAAM,CAAC,OAAO,OAAO,YAAY;IAC/B,OAAO,CAAC,UAAU,CAAa;gBAEnB,UAAU,EAAE,UAAU;IAIlC;;;;;OAKG;IACU,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC;IAOnE;;;;;;;;;;;;;OAaG;IACU,eAAe,CAAC,EACzB,MAAM,EACN,SAAS,EACT,EAAE,EACF,IAAI,EACJ,SAAS,EACT,OAAO,EACP,SAAS,EACT,UAAU,EACV,MAAM,GACP,GAAE,oBAAyB,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAgBrD;;;;;;;OAOG;IACU,mBAAmB,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAO/E;;;;;;;;;;OAUG;IACU,QAAQ,CAAC,MAAM,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;IAI1E;;;;;;;;;;;OAWG;IACU,gBAAgB,CAAC,MAAM,EAAE,sBAAsB,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;IAOzF;;;;;;;;;OASG;IACU,uBAAuB,CAClC,MAAM,CAAC,EAAE,6BAA6B,GACrC,OAAO,CAAC,WAAW,EAAE,CAAC;IAIzB;;;;;;;;;;;;;;;;;;;;;OAqBG;IACY,oBAAoB,CAAC,IAAI,EAAE,0BAA0B,GAAG,OAAO,CAAC,WAAW,CAAC;IAS3F;;;;;;;;;;;;;;;;;;OAkBG;IACU,wBAAwB,CAAC,IAAI,EAAE,8BAA8B,GAAG,OAAO,CAAC,WAAW,CAAC;IASjG;;;;;;;;;;;OAWG;IACU,0BAA0B,CACrC,IAAI,EAAE,gCAAgC,GACrC,OAAO,CAAC,WAAW,CAAC;IAQvB;;;;;;;;;;;OAWG;IACU,2BAA2B,CACtC,IAAI,EAAE,iCAAiC,GACtC,OAAO,CAAC,WAAW,CAAC;IAiBvB;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACU,iBAAiB,CAAC,IAAI,EAAE,uBAAuB,GAAG,OAAO,CAAC,WAAW,CAAC;IAQnF;;;;;;;;;OASG;IACU,gBAAgB,CAAC,IAAI,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC;IAQ1E;;;;;;OAMG;IACU,qBAAqB,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAQ/E;;;;;;;;OAQG;IACU,kBAAkB,CAAC,IAAI,EAAE,wBAAwB,GAAG,OAAO,CAAC,IAAI,CAAC;CAQ/E"}
@@ -6,25 +6,270 @@ class Appointments {
6
6
  this.httpClient = httpClient;
7
7
  }
8
8
  /**
9
- * Fetch a specific appointment by its ID.
10
- * @param {number} AptNum - The ID of the appointment.
11
- * @returns {Promise<Appointment>} - The appointment data.
9
+ * Fetch a single appointment by its ID.
10
+ * @param {number} AptNum - The unique identifier for the appointment.
11
+ * @returns {Promise<Appointment>} - The appointment object.
12
12
  * @throws {Error} - If `AptNum` is not provided.
13
- */
13
+ */
14
14
  async getAppointment(AptNum) {
15
15
  if (!AptNum) {
16
16
  throw new Error("AptNum is required.");
17
17
  }
18
18
  return this.httpClient.get(`/appointments/${AptNum}`);
19
19
  }
20
- async getAppointments(params) {
20
+ /**
21
+ * Fetch multiple appointments with optional filtering and pagination.
22
+ * @param {Object} params - The parameters for filtering and pagination.
23
+ * @param {number} [params.PatNum] - Filter by patient number.
24
+ * @param {"Scheduled" | "Complete" | "UnschedList" | "ASAP" | "Broken" | "Planned" | "PtNote" | "PtNoteCompleted"} [params.AptStatus] - Filter by appointment status.
25
+ * @param {number} [params.Op] - Filter by operatory number.
26
+ * @param {string} [params.date] - Search for a specific day in "yyyy-MM-dd" format.
27
+ * @param {string} [params.dateStart] - Start date for date range in "yyyy-MM-dd" format.
28
+ * @param {string} [params.dateEnd] - End date for date range in "yyyy-MM-dd" format.
29
+ * @param {number} [params.ClinicNum] - Filter by clinic number.
30
+ * @param {string} [params.DateTStamp] - Return only appointments updated after this timestamp.
31
+ * @param {number} [params.Offset] - Pagination offset for results.
32
+ * @returns {Promise<Appointment[]>} - A list of appointments.
33
+ */
34
+ async getAppointments({ PatNum, AptStatus, Op, date, dateStart, dateEnd, ClinicNum, DateTStamp, Offset, } = {}) {
35
+ const params = {
36
+ PatNum,
37
+ AptStatus,
38
+ Op,
39
+ date,
40
+ dateStart,
41
+ dateEnd,
42
+ ClinicNum,
43
+ DateTStamp,
44
+ Offset,
45
+ };
21
46
  return this.httpClient.get("/appointments", params);
22
47
  }
23
- async createAppointment(data) {
24
- if (!data) {
25
- throw new Error("Appointment data is required.");
48
+ /**
49
+ * Fetch ASAP appointments.
50
+ * @param {Object} params - Parameters for fetching ASAP appointments.
51
+ * @param {number} params.ClinicNum - Required: Clinic number. Use 0 for appointments not attached to clinics.
52
+ * @param {number} [params.ProvNum] - Optional: Provider number.
53
+ * @returns {Promise<Appointment[]>} - A list of ASAP appointments.
54
+ * @throws {Error} - If `ClinicNum` is not provided.
55
+ */
56
+ async getASAPappointments(params) {
57
+ if (!params.ClinicNum) {
58
+ throw new Error("ClinicNum is required when Clinics are enabled.");
59
+ }
60
+ return this.httpClient.get("/appointments/asap", params);
61
+ }
62
+ /**
63
+ * Fetch available appointment slots.
64
+ * @param {Object} params - Parameters for filtering slots.
65
+ * @param {string} [params.date] - Search for a specific day in "yyyy-MM-dd" format.
66
+ * @param {string} [params.dateStart] - Start date for date range in "yyyy-MM-dd" format.
67
+ * @param {string} [params.dateEnd] - End date for date range in "yyyy-MM-dd" format.
68
+ * @param {number} [params.lengthMinutes] - Ignore slots shorter than this length.
69
+ * @param {number} [params.ProvNum] - Provider number.
70
+ * @param {number} [params.OpNum] - Operatory number.
71
+ * @returns {Promise<AppointmentSlot[]>} - A list of available slots.
72
+ */
73
+ async getSlots(params) {
74
+ return this.httpClient.get("/appointments/slots", params);
75
+ }
76
+ /**
77
+ * Fetch WebSched appointment slots.
78
+ * @param {Object} params - Parameters for filtering WebSched slots.
79
+ * @param {string} [params.date] - Search for a specific day in "yyyy-MM-dd" format.
80
+ * @param {string} [params.dateStart] - Start date for date range in "yyyy-MM-dd" format.
81
+ * @param {string} [params.dateEnd] - End date for date range in "yyyy-MM-dd" format.
82
+ * @param {number} params.ClinicNum - Required: Clinic number.
83
+ * @param {number} [params.defNumApptType] - Appointment type definition number.
84
+ * @param {"true" | "false"} [params.isNewPatient] - Indicates if the slot is for a new patient.
85
+ * @returns {Promise<AppointmentSlot[]>} - A list of WebSched slots.
86
+ * @throws {Error} - If `ClinicNum` is not provided.
87
+ */
88
+ async getSlotsWebSched(params) {
89
+ if (!params.ClinicNum) {
90
+ throw new Error("ClinicNum is required when Clinics are enabled.");
91
+ }
92
+ return this.httpClient.get("/appointments/slotswebsched", params);
93
+ }
94
+ /**
95
+ * Fetch WebSched appointments.
96
+ * @param {Object} params - Parameters for fetching WebSched appointments.
97
+ * @param {string} [params.date] - Search for a specific day in "yyyy-MM-dd" format.
98
+ * @param {string} [params.dateStart] - Start date for date range in "yyyy-MM-dd" format.
99
+ * @param {string} [params.dateEnd] - End date for date range in "yyyy-MM-dd" format.
100
+ * @param {string} [params.DateTStamp] - Return only appointments updated after this timestamp.
101
+ * @param {number} [params.ClinicNum] - Clinic number.
102
+ * @returns {Promise<Appointment[]>} - A list of WebSched appointments.
103
+ */
104
+ async getWebSchedAppointments(params) {
105
+ return this.httpClient.get("/appointments/websched", params);
106
+ }
107
+ /**
108
+ * Create a new appointment.
109
+ * @param {Object} data - Data for the new appointment.
110
+ * @param {number} data.PatNum - Required: Patient number.
111
+ * @param {number} data.Op - Required: Operatory number.
112
+ * @param {string} data.AptDateTime - Required: Appointment start time in "yyyy-MM-dd HH:mm:ss" format.
113
+ * @param {"Scheduled" | "Complete" | "UnschedList" | "PtNote" | "PtNoteCompleted"} [data.AptStatus="Scheduled"] - Optional: Appointment status. Default is "Scheduled".
114
+ * @param {string} [data.Pattern="/XX/"] - Optional: Time pattern in 5-minute increments. Default is "/XX/" (20 minutes).
115
+ * @param {number} [data.Confirmed] - Optional: Confirmation status definition number.
116
+ * @param {string} [data.Note] - Optional: Appointment notes.
117
+ * @param {number} [data.ProvNum] - Optional: Provider number.
118
+ * @param {number} [data.ProvHyg=0] - Optional: Hygienist provider number. Default is 0.
119
+ * @param {number} [data.ClinicNum] - Optional: Clinic number.
120
+ * @param {"true" | "false"} [data.IsHygiene="false"] - Optional: Indicates if the appointment is for hygiene. Default is "false".
121
+ * @param {"true" | "false"} [data.IsNewPatient="false"] - Optional: Indicates if the patient is new. Default is "false".
122
+ * @param {"Normal" | "ASAP"} [data.Priority="Normal"] - Optional: Appointment priority. Default is "Normal".
123
+ * @param {number} [data.AppointmentTypeNum=0] - Optional: Appointment type number. Default is 0.
124
+ * @param {string} [data.colorOverride] - Optional: Custom color in "R,G,B" format.
125
+ * @param {string} [data.PatternSecondary] - Optional: Secondary time pattern.
126
+ * @returns {Promise<Appointment>} - The created appointment.
127
+ * @throws {Error} - If required fields are missing.
128
+ */
129
+ async createNewAppointment(data) {
130
+ if (!data.PatNum || !data.Op || !data.AptDateTime) {
131
+ throw new Error("PatNum, Op, and AptDateTime are required.");
26
132
  }
27
133
  return this.httpClient.post("/appointments", data);
28
134
  }
135
+ /**
136
+ * Create a planned appointment.
137
+ * @param {Object} data - Data for the planned appointment.
138
+ * @param {number} data.PatNum - Required: Patient number.
139
+ * @param {number} [data.AppointmentTypeNum] - Optional: Appointment type number.
140
+ * @param {number[]} [data.procNums] - Optional: Array of procedure numbers. At least one of `AppointmentTypeNum` or `procNums` is required.
141
+ * @param {string} [data.Pattern="/XX/"] - Optional: Time pattern in 5-minute increments. Default is "/XX/" (20 minutes).
142
+ * @param {number} [data.Confirmed] - Optional: Confirmation status definition number.
143
+ * @param {string} [data.Note] - Optional: Appointment notes.
144
+ * @param {number} [data.ProvNum] - Optional: Provider number.
145
+ * @param {number} [data.ProvHyg=0] - Optional: Hygienist provider number. Default is 0.
146
+ * @param {number} [data.ClinicNum] - Optional: Clinic number.
147
+ * @param {"true" | "false"} [data.IsHygiene="false"] - Optional: Indicates if the appointment is for hygiene. Default is "false".
148
+ * @param {"true" | "false"} [data.IsNewPatient="false"] - Optional: Indicates if the patient is new. Default is "false".
149
+ * @param {"Normal" | "ASAP"} [data.Priority="Normal"] - Optional: Appointment priority. Default is "Normal".
150
+ * @param {string} [data.PatternSecondary] - Optional: Secondary time pattern.
151
+ * @returns {Promise<Appointment>} - The created planned appointment.
152
+ * @throws {Error} - If required fields are missing.
153
+ */
154
+ async createPlannedAppointment(data) {
155
+ if (!data.PatNum || (!data.AppointmentTypeNum && (!data.procNums || data.procNums.length === 0))) {
156
+ throw new Error("PatNum and either AppointmentTypeNum or procNums are required.");
157
+ }
158
+ return this.httpClient.post("/appointments/planned", data);
159
+ }
160
+ /**
161
+ * Schedule a planned appointment.
162
+ * @param {Object} data - Data for scheduling the planned appointment.
163
+ * @param {number} data.AptNum - Required: The appointment number with Planned status.
164
+ * @param {string} data.AptDateTime - Required: Start time for the appointment in "yyyy-MM-dd HH:mm:ss" format.
165
+ * @param {number} data.ProvNum - Required: The provider number for the appointment.
166
+ * @param {number} data.Op - Required: The operatory number for the appointment.
167
+ * @param {number} [data.Confirmed] - Optional: Confirmation status definition number.
168
+ * @param {string} [data.Note] - Optional: Notes for the appointment. Will overwrite any existing note.
169
+ * @returns {Promise<Appointment>} - The scheduled appointment.
170
+ * @throws {Error} - If required fields are missing.
171
+ */
172
+ async schedulePlannedAppointment(data) {
173
+ if (!data.AptNum || !data.AptDateTime || !data.ProvNum || !data.Op) {
174
+ throw new Error("AptNum, AptDateTime, ProvNum, and Op are required.");
175
+ }
176
+ return this.httpClient.post("/appointments/scheduleplanned", data);
177
+ }
178
+ /**
179
+ * Schedule a WebSched appointment.
180
+ * @param {Object} data - Data for scheduling the WebSched appointment.
181
+ * @param {number} data.PatNum - Required: Patient number.
182
+ * @param {string} data.DateTimeStart - Required: The start time of the appointment in "yyyy-MM-dd HH:mm:ss" format.
183
+ * @param {string} data.DateTimeEnd - Required: The end time of the appointment in "yyyy-MM-dd HH:mm:ss" format.
184
+ * @param {number} data.ProvNum - Required: Provider number associated with the appointment slot.
185
+ * @param {number} data.OpNum - Required: Operatory number associated with the appointment slot.
186
+ * @param {number} data.defNumApptType - Required: Appointment type definition number.
187
+ * @returns {Promise<Appointment>} - The scheduled WebSched appointment.
188
+ * @throws {Error} - If required fields are missing.
189
+ */
190
+ async scheduleWebSchedAppointment(data) {
191
+ if (!data.PatNum ||
192
+ !data.DateTimeStart ||
193
+ !data.DateTimeEnd ||
194
+ !data.ProvNum ||
195
+ !data.OpNum ||
196
+ !data.defNumApptType) {
197
+ throw new Error("PatNum, DateTimeStart, DateTimeEnd, ProvNum, OpNum, and defNumApptType are required.");
198
+ }
199
+ return this.httpClient.post("/appointments/websched", data);
200
+ }
201
+ /**
202
+ * Update an existing appointment.
203
+ * @param {Object} data - Data for updating the appointment.
204
+ * @param {number} data.AptNum - Required: The unique identifier of the appointment to update.
205
+ * @param {"Scheduled" | "Complete" | "UnschedList" | "Broken" | "Planned" | "PtNote" | "PtNoteCompleted"} [data.AptStatus] - Optional: Updated status of the appointment.
206
+ * @param {string} [data.Pattern] - Optional: Updated time pattern in 5-minute increments.
207
+ * @param {number} [data.Confirmed] - Optional: Updated confirmation status definition number.
208
+ * @param {number} [data.Op] - Optional: Updated operatory number.
209
+ * @param {string} [data.Note] - Optional: Updated notes for the appointment. Will overwrite existing notes.
210
+ * @param {number} [data.ProvNum] - Optional: Updated provider number.
211
+ * @param {number} [data.ProvHyg] - Optional: Updated hygienist provider number.
212
+ * @param {string} [data.AptDateTime] - Optional: Updated appointment start time in "yyyy-MM-dd HH:mm:ss" format.
213
+ * @param {number} [data.ClinicNum] - Optional: Updated clinic number.
214
+ * @param {"true" | "false"} [data.IsHygiene] - Optional: Indicates if the appointment is for hygiene.
215
+ * @param {"true" | "false"} [data.IsNewPatient] - Optional: Indicates if the appointment is for a new patient.
216
+ * @param {"Normal" | "ASAP"} [data.Priority] - Optional: Updated priority of the appointment.
217
+ * @param {number} [data.AppointmentTypeNum] - Optional: Updated appointment type number.
218
+ * @param {number} [data.UnschedStatus] - Optional: Updated unscheduled status definition number.
219
+ * @param {string} [data.colorOverride] - Optional: Updated custom color in "R,G,B" format.
220
+ * @param {string} [data.PatternSecondary] - Optional: Updated secondary time pattern.
221
+ * @returns {Promise<Appointment>} - The updated appointment.
222
+ * @throws {Error} - If `AptNum` is missing.
223
+ */
224
+ async updateAppointment(data) {
225
+ if (!data.AptNum) {
226
+ throw new Error("AptNum is required.");
227
+ }
228
+ return this.httpClient.put(`/appointments/${data.AptNum}`, data);
229
+ }
230
+ /**
231
+ * Break an existing appointment.
232
+ * Only appointments with an AptStatus of "Scheduled" can be broken.
233
+ * @param {Object} data - Data for breaking the appointment.
234
+ * @param {number} data.AptNum - Required: The unique identifier of the appointment to break.
235
+ * @param {"true" | "false"} data.sendToUnscheduledList - Required: Indicates if the appointment should be added to the Unscheduled List.
236
+ * @param {"Missed" | "Cancelled"} [data.breakType] - Optional: Reason for breaking the appointment.
237
+ * @returns {Promise<void>} - Resolves when the appointment is successfully broken.
238
+ * @throws {Error} - If required fields are missing.
239
+ */
240
+ async breakAppointment(data) {
241
+ if (!data.AptNum || !data.sendToUnscheduledList) {
242
+ throw new Error("AptNum and sendToUnscheduledList are required.");
243
+ }
244
+ return this.httpClient.put(`/appointments/${data.AptNum}/break`, data);
245
+ }
246
+ /**
247
+ * Update the note for an existing appointment.
248
+ * @param {number} AptNum - Required: The unique identifier of the appointment to update.
249
+ * @param {string} Note - Required: The new note content for the appointment.
250
+ * @returns {Promise<void>} - Resolves when the note is successfully updated.
251
+ * @throws {Error} - If required fields are missing.
252
+ */
253
+ async updateAppointmentNote(AptNum, Note) {
254
+ if (!AptNum || !Note) {
255
+ throw new Error("AptNum and Note are required.");
256
+ }
257
+ return this.httpClient.put(`/appointments/${AptNum}/note`, { Note });
258
+ }
259
+ /**
260
+ * Confirm an existing appointment.
261
+ * @param {Object} data - Data for confirming the appointment.
262
+ * @param {number} data.AptNum - Required: The unique identifier of the appointment to confirm.
263
+ * @param {string} [data.confirmVal] - Optional: Confirmation value, e.g., "Sent", "Confirmed".
264
+ * @param {number} [data.defNum] - Optional: Confirmation definition number.
265
+ * @returns {Promise<void>} - Resolves when the appointment is successfully confirmed.
266
+ * @throws {Error} - If required fields are missing.
267
+ */
268
+ async confirmAppointment(data) {
269
+ if (!data.AptNum || (!data.confirmVal && !data.defNum)) {
270
+ throw new Error("AptNum and either confirmVal or defNum are required.");
271
+ }
272
+ return this.httpClient.put(`/appointments/${data.AptNum}/confirm`, data);
273
+ }
29
274
  }
30
275
  exports.default = Appointments;
@@ -0,0 +1,28 @@
1
+ import HttpClient from "../utils/httpClient";
2
+ import { CommLog, CreateCommLogParams } from "../types/commlogType";
3
+ export default class CommLogs {
4
+ private httpClient;
5
+ constructor(httpClient: HttpClient);
6
+ /**
7
+ * Fetch communication logs for a specific patient.
8
+ * @param {number} PatNum - Required: The unique identifier for the patient.
9
+ * @returns {Promise<CommLog[]>} - A list of communication logs for the patient.
10
+ * @throws {Error} - If `PatNum` is not provided or the API returns an error.
11
+ */
12
+ getCommLogs(PatNum: number): Promise<CommLog[]>;
13
+ /**
14
+ * Create a new communication log.
15
+ * @param {CreateCommLogParams} params - The details of the communication log to create.
16
+ * @param {number} params.PatNum - Required: The unique identifier for the patient.
17
+ * @param {string} params.CommDateTime - Required: Date and time of the communication in "yyyy-MM-dd HH:mm:ss" format.
18
+ * @param {"None" | "Email" | "Mail" | "Phone" | "In Person" | "Text" | "Email and Text" | "Phone and Text"} params.Mode_ - Required: Mode of communication.
19
+ * @param {string} params.Note - Required: Detailed note about the communication.
20
+ * @param {number} [params.CommType] - Optional: Type of communication: definition.DefNum where definition.Category=25.
21
+ * @param {string} [params.commType] - Optional: Human-readable description of the communication type.
22
+ * @param {"Sent" | "Received" | "Neither"} [params.SentOrReceived] - Optional: Direction of communication.
23
+ * @returns {Promise<CommLog>} - The created communication log.
24
+ * @throws {Error} - If required fields are missing or the API returns an error.
25
+ */
26
+ createCommLog({ PatNum, CommDateTime, Mode_, Note, CommType, commType, SentOrReceived, }: CreateCommLogParams): Promise<CommLog>;
27
+ }
28
+ //# sourceMappingURL=commlogs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"commlogs.d.ts","sourceRoot":"","sources":["../../src/api/commlogs.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAEpE,MAAM,CAAC,OAAO,OAAO,QAAQ;IAC3B,OAAO,CAAC,UAAU,CAAa;gBAEnB,UAAU,EAAE,UAAU;IAIlC;;;;;OAKG;IACU,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAQ5D;;;;;;;;;;;;OAYG;IACU,aAAa,CAAC,EACzB,MAAM,EACN,YAAY,EACZ,KAAK,EACL,IAAI,EACJ,QAAQ,EACR,QAAQ,EACR,cAAc,GACf,EAAE,mBAAmB,GAAG,OAAO,CAAC,OAAO,CAAC;CAiB1C"}
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ class CommLogs {
4
+ httpClient;
5
+ constructor(httpClient) {
6
+ this.httpClient = httpClient;
7
+ }
8
+ /**
9
+ * Fetch communication logs for a specific patient.
10
+ * @param {number} PatNum - Required: The unique identifier for the patient.
11
+ * @returns {Promise<CommLog[]>} - A list of communication logs for the patient.
12
+ * @throws {Error} - If `PatNum` is not provided or the API returns an error.
13
+ */
14
+ async getCommLogs(PatNum) {
15
+ if (!PatNum || typeof PatNum !== "number") {
16
+ throw new Error("Invalid parameter: PatNum must be a valid number.");
17
+ }
18
+ return this.httpClient.get("/commlogs", { PatNum });
19
+ }
20
+ /**
21
+ * Create a new communication log.
22
+ * @param {CreateCommLogParams} params - The details of the communication log to create.
23
+ * @param {number} params.PatNum - Required: The unique identifier for the patient.
24
+ * @param {string} params.CommDateTime - Required: Date and time of the communication in "yyyy-MM-dd HH:mm:ss" format.
25
+ * @param {"None" | "Email" | "Mail" | "Phone" | "In Person" | "Text" | "Email and Text" | "Phone and Text"} params.Mode_ - Required: Mode of communication.
26
+ * @param {string} params.Note - Required: Detailed note about the communication.
27
+ * @param {number} [params.CommType] - Optional: Type of communication: definition.DefNum where definition.Category=25.
28
+ * @param {string} [params.commType] - Optional: Human-readable description of the communication type.
29
+ * @param {"Sent" | "Received" | "Neither"} [params.SentOrReceived] - Optional: Direction of communication.
30
+ * @returns {Promise<CommLog>} - The created communication log.
31
+ * @throws {Error} - If required fields are missing or the API returns an error.
32
+ */
33
+ async createCommLog({ PatNum, CommDateTime, Mode_, Note, CommType, commType, SentOrReceived, }) {
34
+ if (!PatNum || !CommDateTime || !Mode_ || !Note) {
35
+ throw new Error("Invalid data: PatNum, CommDateTime, Mode_, and Note are required.");
36
+ }
37
+ return this.httpClient.post("/commlogs", {
38
+ PatNum,
39
+ CommDateTime,
40
+ Mode_,
41
+ Note,
42
+ CommType,
43
+ commType,
44
+ SentOrReceived,
45
+ });
46
+ }
47
+ }
48
+ exports.default = CommLogs;
@@ -0,0 +1,3 @@
1
+ export { default as Patients } from "./patients";
2
+ export { default as Appointments } from "./appointments";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,gBAAgB,CAAC"}