@rinse-dental/open-dental 1.7.1 → 2.0.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.
Files changed (46) hide show
  1. package/.vscode/settings.json +0 -3
  2. package/dist/api/appointments.d.ts +2 -1
  3. package/dist/api/appointments.d.ts.map +1 -1
  4. package/dist/api/appointments.js +11 -9
  5. package/dist/api/discountPlanSubs.d.ts +1 -1
  6. package/dist/api/discountPlanSubs.d.ts.map +1 -1
  7. package/dist/api/discountPlanSubs.js +1 -1
  8. package/dist/api/discountPlans.d.ts +62 -0
  9. package/dist/api/discountPlans.d.ts.map +1 -0
  10. package/dist/api/discountPlans.js +113 -0
  11. package/dist/api/fees.d.ts +18 -0
  12. package/dist/api/fees.d.ts.map +1 -0
  13. package/dist/api/fees.js +29 -0
  14. package/dist/api/index.d.ts +3 -0
  15. package/dist/api/index.d.ts.map +1 -1
  16. package/dist/api/index.js +7 -1
  17. package/dist/api/treatplanattaches.d.ts +34 -0
  18. package/dist/api/treatplanattaches.d.ts.map +1 -0
  19. package/dist/api/treatplanattaches.js +52 -0
  20. package/dist/openDental.d.ts +15 -0
  21. package/dist/openDental.d.ts.map +1 -1
  22. package/dist/openDental.js +30 -0
  23. package/dist/types/DiscountPlanTypes.d.ts +67 -0
  24. package/dist/types/DiscountPlanTypes.d.ts.map +1 -0
  25. package/dist/types/DiscountPlanTypes.js +2 -0
  26. package/dist/types/appointmentTypes.d.ts +1 -0
  27. package/dist/types/appointmentTypes.d.ts.map +1 -1
  28. package/dist/types/feeTypes.d.ts +46 -0
  29. package/dist/types/feeTypes.d.ts.map +1 -0
  30. package/dist/types/feeTypes.js +2 -0
  31. package/dist/types/treatPlanAttachTypes.d.ts +37 -0
  32. package/dist/types/treatPlanAttachTypes.d.ts.map +1 -0
  33. package/dist/types/treatPlanAttachTypes.js +2 -0
  34. package/package.json +3 -3
  35. package/release.sh +4 -2
  36. package/src/api/appointments.ts +11 -8
  37. package/src/api/discountPlanSubs.ts +1 -2
  38. package/src/api/discountPlans.ts +159 -0
  39. package/src/api/fees.ts +43 -0
  40. package/src/api/index.ts +3 -0
  41. package/src/api/treatplanattaches.ts +67 -0
  42. package/src/openDental.ts +33 -0
  43. package/src/types/DiscountPlanTypes.ts +70 -0
  44. package/src/types/appointmentTypes.ts +1 -0
  45. package/src/types/feeTypes.ts +49 -0
  46. package/src/types/treatPlanAttachTypes.ts +39 -0
@@ -0,0 +1,67 @@
1
+ import HttpClient from "../utils/httpClient";
2
+ import {
3
+ TreatPlanAttach,
4
+ GetTreatPlanAttachesParams,
5
+ CreateTreatPlanAttachesParams,
6
+ UpdateTreatPlanAttachesParams,
7
+ } from "../types/treatPlanAttachTypes";
8
+
9
+ export default class TreatPlanAttaches {
10
+ private httpClient: HttpClient;
11
+
12
+ constructor(httpClient: HttpClient) {
13
+ this.httpClient = httpClient;
14
+ }
15
+
16
+ /**
17
+ * Get a list of TreatPlanAttaches that meet a set of search criteria.
18
+ * @param {Object} params - The parameters for filtering and pagination.
19
+ * @param {string} params.TreatPlanNum - treatplan.TreatPlanNum
20
+ * @param {number} [params.Offset] - Pagination offset. Default 0
21
+ * @returns {Promise<TreatPlanAttach[]>} - An array of TreatPlanAttach objects.
22
+ */
23
+ public async getTreatPlanAttaches({
24
+ TreatPlanNum,
25
+ Offset,
26
+ }: GetTreatPlanAttachesParams = {}): Promise<TreatPlanAttach[]> {
27
+ const params = {
28
+ TreatPlanNum,
29
+ Offset,
30
+ };
31
+
32
+ return this.httpClient.get<TreatPlanAttach[]>("/treatplanattaches", params);
33
+ }
34
+
35
+ /**
36
+ * Create a new TreatPlanAttaches.
37
+ * @param {Object} data - Data for the new TreatPlanAttaches object.
38
+ * @param {number} data.TreatPlanNum - Required. FK to treatplan.TreatPlanNum.
39
+ * @param {number} data.ProcNum - Required. FK to procedurelog.ProcNum.
40
+ * @param {string} [data.Priority] - Optional. definition.DefNum where definition.Category=20. Default 0.
41
+ * @returns {Promise<TreatPlanAttach>} - The created TreatPlanAttaches object.
42
+ * @throws {Error} - If required fields are missing.
43
+ */
44
+ public async createTreatmentPlan(data: CreateTreatPlanAttachesParams): Promise<TreatPlanAttach> {
45
+ if (!data.TreatPlanNum || !data.ProcNum) {
46
+ throw new Error("TreatPlanNum and ProcNum are required.");
47
+ }
48
+
49
+ return this.httpClient.post<TreatPlanAttach>("/treatplanattaches", data);
50
+ }
51
+
52
+ /**
53
+ * Update a TreatPlanAttaches.
54
+ * @param {Object} data - Data for the treatplan.
55
+ * @param {number} data.TreatPlanAttachNum - Required in URL, Primary key.
56
+ * @param {string} data.Priority - Required. definition.DefNum where definition.Category=20.
57
+ * @returns {Promise<TreatPlanAttach>} - The updated TreatPlanAttaches object.
58
+ * @throws {Error} - If required fields are missing.
59
+ */
60
+ public async updateTreatmentPlan(data: UpdateTreatPlanAttachesParams): Promise<TreatPlanAttach> {
61
+ if (!data.TreatPlanAttachNum || !data.Priority) {
62
+ throw new Error("TreatPlanAttachNum and Priority are required.");
63
+ }
64
+
65
+ return this.httpClient.put<TreatPlanAttach>(`/treatplanattaches/${data.TreatPlanAttachNum}`, data);
66
+ }
67
+ }
package/src/openDental.ts CHANGED
@@ -7,12 +7,14 @@ import Patients from "./api/patients";
7
7
  import ProcedureLogs from "./api/procedureLog";
8
8
  import Recalls from "./api/recalls";
9
9
  import TreatmentPlans from "./api/treatplans";
10
+ import TreatmentPlanAttaches from "./api/treatplanattaches";
10
11
  import Schedules from "./api/schedules";
11
12
  import Providers from "./api/providers";
12
13
  import Operatories from "./api/operatories";
13
14
  import Payments from "./api/payments";
14
15
  import PaySplits from "./api/paySplits";
15
16
  import Definitions from "./api/definitions";
17
+ import DiscountPlans from "./api/discountPlans";
16
18
  import DiscountPlanSubs from "./api/discountPlanSubs";
17
19
  import FamilyModules from "./api/familyModules";
18
20
  import InsSubs from "./api/insSubs";
@@ -25,6 +27,7 @@ import Benefits from "./api/benefits";
25
27
  import ClaimProcs from "./api/claimProcs";
26
28
  import Adjustments from "./api/adjustments";
27
29
  import ProcedureCodes from "./api/procedureCodes";
30
+ import Fees from "./api/fees";
28
31
 
29
32
  class OpenDental {
30
33
  private static httpClient: HttpClient;
@@ -124,6 +127,16 @@ class OpenDental {
124
127
  return new TreatmentPlans(this.httpClient);
125
128
  }
126
129
 
130
+ /**
131
+ * Create a new instance of the TreatmentPlanAttaches API.
132
+ */
133
+ public static TreatmentPlanAttaches() {
134
+ if (!this.httpClient) {
135
+ throw new Error("OpenDental not initialized. Call OpenDental.initialize() first.");
136
+ }
137
+ return new TreatmentPlanAttaches(this.httpClient);
138
+ }
139
+
127
140
  /**
128
141
  * Create a new instance of the Schedules API.
129
142
  */
@@ -174,6 +187,16 @@ class OpenDental {
174
187
  return new Definitions(this.httpClient);
175
188
  }
176
189
 
190
+ /**
191
+ * Create a new instance of the DiscountPlans API.
192
+ */
193
+ public static DiscountPlans() {
194
+ if (!this.httpClient) {
195
+ throw new Error("OpenDental not initialized. Call OpenDental.initialize() first.");
196
+ }
197
+ return new DiscountPlans(this.httpClient);
198
+ }
199
+
177
200
  /**
178
201
  * Create a new instance of the DiscountPlanSubs API.
179
202
  */
@@ -304,6 +327,16 @@ class OpenDental {
304
327
  return new PaySplits(this.httpClient);
305
328
  }
306
329
 
330
+ /**
331
+ * Create a new instance of the Fees API.
332
+ */
333
+ public static Fees() {
334
+ if (!this.httpClient) {
335
+ throw new Error("OpenDental not initialized. Call OpenDental.initialize() first.");
336
+ }
337
+ return new Fees(this.httpClient);
338
+ }
339
+
307
340
  }
308
341
 
309
342
  export { OpenDental };
@@ -0,0 +1,70 @@
1
+ /**
2
+ * Represents a discount plan in the Open Dental system.
3
+ * @see https://www.opendental.com/site/apidiscountplans.html
4
+ */
5
+ export interface DiscountPlan {
6
+ DiscountPlanNum?: number; //Primary key
7
+ Description?: string; //
8
+ FeeSchedNum?: number; //
9
+ DefNum?: number; //
10
+ IsHidden?: 'true' | 'false'; //
11
+ PlanNote?: string; //
12
+ ExamFreqLimit?: number; //
13
+ XrayFreqLimit?: number; //
14
+ ProphyFreqLimit?: number; //
15
+ FluorideFreqLimit?: number; //
16
+ PerioFreqLimit?: number; //
17
+ LimitedExamFreqLimit?: number; //
18
+ PAFreqLimit?: number; //
19
+ AnnualMax?: number; //
20
+ }
21
+
22
+ /**
23
+ * Parameters for GET discount plans.
24
+ * @see https://www.opendental.com/site/apidiscountplans.html
25
+ */
26
+ export interface GetDiscountPlansParams {
27
+ Offset?: number; // Pagination offset for results
28
+ }
29
+
30
+ /**
31
+ * Parameters for creating a discount plan.
32
+ * @see https://www.opendental.com/site/apidiscountplans.html
33
+ */
34
+ export interface CreateDiscountPlanParams {
35
+ Description: string; // Required. Description of this Discount Plan.
36
+ FeeSchedNum: number; // Required. FK to feesched.FeeSchedNum.
37
+ DefNum: number; // Required. definition.DefNum where definition.Category=1 and definition.ItemValue=dp.
38
+ IsHidden?: 'true' | 'false'; // Optional. Hides a Discount Plan. Default "false".
39
+ PlanNote?: string; // Optional. Note on a Discount Plan.
40
+ ExamFreqLimit?: number; // Optional. Number of procedures allowed for a Discount Plan's Exam category. Default -1.
41
+ XrayFreqLimit?: number; // Optional. Number of procedures allowed for a Discount Plan's X-Ray category. Default -1.
42
+ ProphyFreqLimit?: number; // Optional. Number of procedures allowed for a Discount Plan's Prophy category. Default -1.
43
+ FluorideFreqLimit?: number; // Optional. Number of procedures allowed for a Discount Plan's Fluoride category. Default -1.
44
+ PerioFreqLimit?: number; // Optional. Number of procedures allowed for a Discount Plan's Periodontal category. Default -1.
45
+ LimitedExamFreqLimit?: number; // Optional. Number of procedures allowed for a Discount Plan's Limited Exam category. Default -1.
46
+ PAFreqLimit?: number; // Optional. Number of procedures allowed for a Discount Plan's Periapical X-Ray category. Default -1.
47
+ AnnualMax?: number; // Optional. Annual discount maximum for frequency limitations. Default -1, indicates no annual max limitation.
48
+ }
49
+
50
+ /**
51
+ * Parameters for updating a discount plan.
52
+ * @see https://www.opendental.com/site/apidiscountplans.html
53
+ */
54
+ export interface UpdateDiscountPlanParams {
55
+ DiscountPlanNum: number; // Required (in URL). Primary key.
56
+ Description?: string; // Optional. Description of this Discount Plan.
57
+ FeeSchedNum?: number; // Optional. FK to feesched.FeeSchedNum.
58
+ DefNum?: number; // Optional. definition.DefNum where definition.Category=1 and definition.ItemValue=dp.
59
+ IsHidden?: 'true' | 'false'; // Optional. Hides a Discount Plan. Default "false".
60
+ PlanNote?: string; // Optional. Note on a Discount Plan.
61
+ ExamFreqLimit?: number; // Optional. Number of procedures allowed for a Discount Plan's Exam category. Default -1.
62
+ XrayFreqLimit?: number; // Optional. Number of procedures allowed for a Discount Plan's X-Ray category. Default -1.
63
+ ProphyFreqLimit?: number; // Optional. Number of procedures allowed for a Discount Plan's Prophy category. Default -1.
64
+ FluorideFreqLimit?: number; // Optional. Number of procedures allowed for a Discount Plan's Fluoride category. Default -1.
65
+ PerioFreqLimit?: number; // Optional. Number of procedures allowed for a Discount Plan's Periodontal category. Default -1.
66
+ LimitedExamFreqLimit?: number; // Optional. Number of procedures allowed for a Discount Plan's Limited Exam category. Default -1.
67
+ PAFreqLimit?: number; // Optional. Number of procedures allowed for a Discount Plan's Periapical X-Ray category. Default -1.
68
+ AnnualMax?: number; // Optional. Annual discount maximum for frequency limitations. Default -1, indicates no annual max limitation.
69
+ }
70
+
@@ -54,6 +54,7 @@ export interface Appointment {
54
54
  dateEnd?: string; // End date for date range in "yyyy-MM-dd" format
55
55
  ClinicNum?: number; // Filter by clinic number
56
56
  DateTStamp?: string; // Return only appointments updated after this timestamp
57
+ AppointmentTypeNum?: number; // (Added in version 24.4.22) FK to appointmenttype.AppointmentTypeNum.
57
58
  Offset?: number; // Pagination offset for results
58
59
  }
59
60
 
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Represents a fees in Open Dental
3
+ * @see https://www.opendental.com/site/apifees.html
4
+ */
5
+ export interface Fee {
6
+ FeeNum?: number; //
7
+ Amount?: number; //
8
+ FeeSched?: number; //
9
+ CodeNum?: number; //
10
+ ClinicNum?: number; //
11
+ ProvNum?: number; //
12
+ SecUserNumEntry?: number; //String in "yyyy-MM-dd" format.
13
+ SecDateEntry?: string; //
14
+ SecDateTEdit?: string; //String in "yyyy-MM-dd" format.
15
+ }
16
+
17
+ /**
18
+ * Parameters for GET Fees.
19
+ * @see https://www.opendental.com/site/apifees.html
20
+ */
21
+ export interface GetFeesParams {
22
+ FeeSched?: number; // Optional. FK to feesched.FeeSchedNum.
23
+ CodeNum?: number; // Optional. FK to procedurecode.CodeNum.
24
+ ClinicNum?: number; // Optional. FK to clinic.ClinicNum.
25
+ ProvNum?: number; // Optional. FK to provider.ProvNum.
26
+ Offset?: number; // Optional. Pagination.
27
+ }
28
+
29
+ /**
30
+ * Parameters for Create Fee.
31
+ * @see https://www.opendental.com/site/apifees.html
32
+ */
33
+ export interface CreateFeeParams {
34
+ Amount: number; // Required. The amount usually charged.
35
+ FeeSched: number; // Required. FK to feesched.FeeSchedNum.
36
+ CodeNum: number; // Required. FK to procedurecode.CodeNum.
37
+ ClinicNum?: number; // Optional. FK to clinic.ClinicNum. Default 0.
38
+ ProvNum?: number; // Optional. FK to provider.ProvNum. Default 0.
39
+ }
40
+
41
+ /**
42
+ * Parameters for Update Fee.
43
+ * @see https://www.opendental.com/site/apifees.html
44
+ */
45
+ export interface UpdateFeeParams {
46
+ FeeSched: number; // Required in the URL.
47
+ Amount?: number; // Required. The amount of the fee.
48
+ }
49
+
@@ -0,0 +1,39 @@
1
+ /**
2
+ * TreatPlanAttaches object.
3
+ * @see https://www.opendental.com/site/apitreatplanattaches.html
4
+ */
5
+ export interface TreatPlanAttach {
6
+ TreatPlanAttachNum?: number; // Primary key
7
+ TreatPlanNum?: number; // FK to treatplan.TreatPlanNum
8
+ ProcNum?: number; // FK to procedurelog.ProcNum
9
+ Priority?: number; // definition.DefNum where definition.Category=20. Default 0
10
+ priority?: string;
11
+ }
12
+
13
+ /**
14
+ * Get TreatPlanAttaches Params. Returns TreatPlanAttaches object
15
+ * @see https://www.opendental.com/site/apitreatplanattaches.html
16
+ */
17
+ export interface GetTreatPlanAttachesParams {
18
+ TreatPlanNum?: number; // FK to treatplan.TreatPlanNum
19
+ Offset?: number; //pagination
20
+ }
21
+
22
+ /**
23
+ * POST TreatPlanAttaches Params. Returns TreatPlanAttaches object
24
+ * @see https://www.opendental.com/site/apitreatplanattaches.html
25
+ */
26
+ export interface CreateTreatPlanAttachesParams {
27
+ TreatPlanNum: number; // Required. FK to treatplan.TreatPlanNum
28
+ ProcNum: number; // Required. FK to procedurelog.ProcNum
29
+ Priority?: number; // Optional. definition.DefNum where definition.Category=20. Default 0
30
+ }
31
+
32
+ /**
33
+ * PUT TreatPlanAttaches Params. Returns TreatPlanAttaches object.
34
+ * @see https://www.opendental.com/site/apitreatplanattaches.html
35
+ */
36
+ export interface UpdateTreatPlanAttachesParams {
37
+ TreatPlanAttachNum: number; // Required. Primary key
38
+ Priority: number; // Required. definition.DefNum where definition.Category=20. Default 0
39
+ }