repzo 1.0.24 → 1.0.25

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "repzo",
3
- "version": "1.0.24",
3
+ "version": "1.0.25",
4
4
  "description": "Repzo TypeScript SDK",
5
5
  "main": "./lib/index.js",
6
6
  "type": "module",
package/src/index.ts CHANGED
@@ -1236,7 +1236,29 @@ export default class Repzo {
1236
1236
  return res;
1237
1237
  },
1238
1238
  };
1239
-
1239
+ workorder = {
1240
+ _path: "/workorder",
1241
+ find: async (
1242
+ params?: Service.Workorder.Find.Params
1243
+ ): Promise<Service.Workorder.Find.Result> => {
1244
+ let res: Service.Workorder.Find.Result = await this._fetch(
1245
+ this.svAPIEndpoint,
1246
+ this.workorder._path,
1247
+ params
1248
+ );
1249
+ return res;
1250
+ },
1251
+ get: async (
1252
+ id: Service.Workorder.Get.ID,
1253
+ params?: Service.Workorder.Get.Params
1254
+ ): Promise<Service.Workorder.Get.Result> => {
1255
+ return await this._fetch(
1256
+ this.svAPIEndpoint,
1257
+ this.workorder._path + `/${id}`,
1258
+ params
1259
+ );
1260
+ },
1261
+ };
1240
1262
  invoice = {
1241
1263
  _path: "/fullinvoices",
1242
1264
  find: async (
@@ -72,13 +72,82 @@ interface Check {
72
72
  disabled?: boolean;
73
73
  }
74
74
 
75
+ interface AssetUnitsPopulated {
76
+ name: string;
77
+ cover_photo: MediaPopulated;
78
+ }
79
+ interface AssetsPopulated {
80
+ name: string;
81
+ cover_photo: MediaPopulated;
82
+ }
83
+ interface RepresentativesPopulated {
84
+ name: string;
85
+ _id: string;
86
+ }
87
+ interface ClientLocationPopulated {
88
+ name: string;
89
+ }
90
+ interface FormPopulated {
91
+ name: string;
92
+ }
93
+ interface thumbnailStoragePopulated {
94
+ _id: string;
95
+ createdAt: string;
96
+ ContentType: string;
97
+ mime_type: string;
98
+ publicUrl: string;
99
+ type_name: "FileAttachment" | "ImageAttachment";
100
+ file_name: string;
101
+ media_id: string;
102
+ media_type:
103
+ | "csv"
104
+ | "json"
105
+ | "image"
106
+ | "pdf"
107
+ | " ppt"
108
+ | "pptx"
109
+ | "xls"
110
+ | "xlsx"
111
+ | "doc"
112
+ | "docx"
113
+ | " images"
114
+ | "zip";
115
+ }
116
+ interface MediaPopulated {
117
+ _id: string;
118
+ media_type:
119
+ | "csv"
120
+ | "json"
121
+ | "image"
122
+ | "pdf"
123
+ | " ppt"
124
+ | "pptx"
125
+ | "xls"
126
+ | "xlsx"
127
+ | "doc"
128
+ | "docx"
129
+ | " images"
130
+ | "zip";
131
+ mime_type: string;
132
+ publicUrl: string;
133
+ file_name: string;
134
+ type_name: "FileAttachment" | "ImageAttachment";
135
+ media_id: string;
136
+ ContentType: string;
137
+ createdAt: string;
138
+ updatedAt: string;
139
+ thumbnails: thumbnailStoragePopulated;
140
+ }
141
+
75
142
  export interface DefaultPaginationQueryParams {
76
143
  per_page?: number;
77
144
  page?: number;
78
145
  sort?: string;
79
146
  sortPageOrder?: "asc" | "dsc";
80
147
  }
81
-
148
+ interface WorkorderCategoryPopulated {
149
+ name: string;
150
+ }
82
151
  export interface DefaultPaginationResult {
83
152
  total_result: number;
84
153
  current_count: number;
@@ -92,6 +161,76 @@ export interface DefaultPaginationResult {
92
161
  path: string;
93
162
  data: any[];
94
163
  }
164
+ export interface List {
165
+ client: string | { _id: string };
166
+ note?: string;
167
+ route?: string;
168
+ calendar: string;
169
+ }
170
+ export interface Build {
171
+ day: string;
172
+ list: List[];
173
+ start_date?: number | undefined;
174
+ }
175
+ export type Calendar = CalendarWeekly | CalendarWeeklyGroup;
176
+ export interface Route {
177
+ disabled: boolean;
178
+ list: List[];
179
+ _id: string;
180
+ }
181
+ export type Priority = 0 | 1 | 2 | 3;
182
+ export type WorkorderStatus =
183
+ | "open"
184
+ | "done"
185
+ | "cancelled"
186
+ | "inprogress"
187
+ | "onhold";
188
+
189
+ export type Priority_human = "none" | "low" | "medium" | "high";
190
+ export type Day =
191
+ | "Sun"
192
+ | "Mon"
193
+ | "Tue"
194
+ | "Wed"
195
+ | "Thu"
196
+ | "Fri"
197
+ | "Sat"
198
+ | string;
199
+ export interface WeeklyDetails {
200
+ every: number;
201
+ days: Day[];
202
+ }
203
+ export interface CalendarWeekly {
204
+ type: "weekly";
205
+ disabled: boolean;
206
+ startsAt: string;
207
+ endsAt: string;
208
+ details: WeeklyDetails;
209
+ occurrences: number;
210
+ routes: Route[];
211
+ clients: string[] | string;
212
+ note?: string;
213
+ _id: string;
214
+ }
215
+ export interface DaysGroup {
216
+ days: Day[];
217
+ }
218
+ export interface WeeklyGroupDetails {
219
+ daysGroups: DaysGroup[];
220
+ groupSize: number;
221
+ }
222
+ export interface CalendarWeeklyGroup {
223
+ type: "weeklyGroup";
224
+ disabled: boolean;
225
+ startsAt: string;
226
+ endsAt: string;
227
+ details: WeeklyGroupDetails;
228
+ occurrences: number;
229
+ routes: Route[];
230
+ clients: string[] | string;
231
+ note?: string;
232
+ _id: string;
233
+ }
95
234
 
96
235
  // <reference path = "vehicle.ts" />
97
236
  export namespace Service {
@@ -2459,6 +2598,205 @@ export namespace Service {
2459
2598
  }
2460
2599
  }
2461
2600
 
2601
+ export namespace Workorder {
2602
+ export interface WorkorderSchema {
2603
+ _id: string;
2604
+ creator?: AdminCreator | RepCreator | ClientCreator;
2605
+ editor?: AdminCreator | RepCreator | ClientCreator;
2606
+ name?: string;
2607
+ local_name?: string;
2608
+ description?: string;
2609
+ disabled: boolean;
2610
+ integration_meta?: { [key: string]: any };
2611
+ status: WorkorderStatus;
2612
+ assets?: string[];
2613
+ asset_units?: string[];
2614
+ workorder_categories: string[];
2615
+ due_date?: number;
2616
+ start_date?: number;
2617
+ client_location: string;
2618
+ priority?: Priority;
2619
+ priority_human?: Priority_human;
2620
+ client: string;
2621
+ client_name: string;
2622
+ workorder_request?: string;
2623
+ createdAt?: Date;
2624
+ updatedAt?: Date;
2625
+ company_namespace: string[];
2626
+ serial_number?: SerialNumber;
2627
+ assigned_to?: string[];
2628
+ forms?: string[];
2629
+ time: number;
2630
+ is_overdue: boolean;
2631
+ opened_at: number;
2632
+ done_at: number;
2633
+ cancelled_at: number;
2634
+ inprogress_at: number;
2635
+ done_by?: AdminCreator | RepCreator | ClientCreator;
2636
+ cancelled_by?: AdminCreator | RepCreator | ClientCreator;
2637
+ opened_by?: AdminCreator | RepCreator | ClientCreator;
2638
+ inprogress_by?: AdminCreator | RepCreator | ClientCreator;
2639
+ build: Build[];
2640
+ calendars: Calendar[];
2641
+ builtAt: number;
2642
+ due_date_day: string;
2643
+ last_done_at: number;
2644
+ last_done_by: AdminCreator | RepCreator | ClientCreator;
2645
+ resolve_time: number;
2646
+ sync_id: string;
2647
+ startsAt: string;
2648
+ endsAt: string;
2649
+ teams_populated?: Pick<Team.TeamSchema, "name">;
2650
+ client_populated?: Pick<Client.ClientSchema, "client_code" | "name">;
2651
+ asset_units_populated?: AssetUnitsPopulated[];
2652
+ assets_populated?: AssetsPopulated[];
2653
+ assigned_to_populated?: RepresentativesPopulated;
2654
+ client_location_populated?: ClientLocationPopulated;
2655
+ workorder_categories_populated?: WorkorderCategoryPopulated[];
2656
+ forms_populated?: FormPopulated[];
2657
+ media_populated?: MediaPopulated;
2658
+ cover_photo_populated?: MediaPopulated;
2659
+ }
2660
+ interface CreateBody {
2661
+ company_namespace: string[];
2662
+ creator?: AdminCreator | RepCreator | ClientCreator;
2663
+ name: string;
2664
+ local_name?: string;
2665
+ description?: string;
2666
+ disabled?: boolean;
2667
+ integration_meta?: { [key: string]: any };
2668
+ status: WorkorderStatus;
2669
+ assets?: string[];
2670
+ asset_units?: string[];
2671
+ workorder_categories: string[];
2672
+ due_date?: number;
2673
+ start_date?: number;
2674
+ client_location: string;
2675
+ priority?: Priority;
2676
+ priority_human?: Priority_human;
2677
+ client: string;
2678
+ client_name?: string;
2679
+ serial_number?: SerialNumber;
2680
+ workorder_request?: string;
2681
+ assigned_to?: string[];
2682
+ forms?: string[];
2683
+ calendars: Calendar[];
2684
+ parent_repeating_workorder?: string;
2685
+ due_date_day?: string;
2686
+ last_done_at: number;
2687
+ last_done_by: AdminCreator | RepCreator | ClientCreator;
2688
+ resolve_time: number;
2689
+ sync_id: string;
2690
+ opened_at: number;
2691
+ time: number;
2692
+ opened_by: AdminCreator | RepCreator | ClientCreator;
2693
+ }
2694
+ interface UpdateBody {
2695
+ company_namespace: string[];
2696
+ _id?: string;
2697
+ creator?: AdminCreator | RepCreator | ClientCreator;
2698
+ editor?: AdminCreator | RepCreator | ClientCreator;
2699
+ name?: string;
2700
+ local_name?: string;
2701
+ description?: string;
2702
+ disabled?: boolean;
2703
+ integration_meta?: { [key: string]: any };
2704
+ status: WorkorderStatus;
2705
+ assets?: string[];
2706
+ asset_units?: string[];
2707
+ workorder_categories: string[];
2708
+ due_date?: number;
2709
+ start_date?: number;
2710
+ client_location: string;
2711
+ priority?: Priority;
2712
+ priority_human?: Priority_human;
2713
+ client: string;
2714
+ client_name?: string;
2715
+ workorder_request?: string;
2716
+ createdAt?: Date;
2717
+ updatedAt?: Date;
2718
+ serial_number?: SerialNumber;
2719
+ assigned_to?: string[];
2720
+ forms?: string[];
2721
+ time: number;
2722
+ is_overdue: boolean;
2723
+ opened_at: number;
2724
+ done_at: number;
2725
+ cancelled_at: number;
2726
+ inprogress_at: number;
2727
+ done_by?: AdminCreator | RepCreator | ClientCreator;
2728
+ cancelled_by?: AdminCreator | RepCreator | ClientCreator;
2729
+ opened_by?: AdminCreator | RepCreator | ClientCreator;
2730
+ inprogress_by?: AdminCreator | RepCreator | ClientCreator;
2731
+ calendars: Calendar[];
2732
+ parent_repeating_workorder?: string;
2733
+ due_date_day?: string;
2734
+ last_done_at: number;
2735
+ last_done_by: AdminCreator | RepCreator | ClientCreator;
2736
+ resolve_time: number;
2737
+ sync_id?: string;
2738
+ }
2739
+ type SortingKeys =
2740
+ | "due_date"
2741
+ | "priority"
2742
+ | "updatedAt"
2743
+ | "createdAt"
2744
+ | "from_updatedAt"
2745
+ | "to_updatedAt"
2746
+ | "_id";
2747
+ type PopulatedKeys =
2748
+ | "client"
2749
+ | "asset_units"
2750
+ | "assets"
2751
+ | "assigned_to"
2752
+ | "client_location"
2753
+ | "workorder_categories"
2754
+ | "forms"
2755
+ | "media"
2756
+ | "cover_photo"
2757
+ | "teams";
2758
+ export namespace Find {
2759
+ export type Params = DefaultPaginationQueryParams & {
2760
+ name?: string;
2761
+ _id?: string;
2762
+ assigned_to?: string[];
2763
+ priority?: Priority;
2764
+ priority_human?: Priority_human;
2765
+ status?: WorkorderStatus;
2766
+ workorder_categories?: string[];
2767
+ client_location?: string;
2768
+ client?: string;
2769
+ assets?: string[];
2770
+ asset_units?: string[];
2771
+ due_date?: number;
2772
+ start_date?: number;
2773
+ forms?: string[];
2774
+ from_createdAt?: number;
2775
+ to_createdAt?: number;
2776
+ from_updatedAt?: number;
2777
+ to_updatedAt?: number;
2778
+ from_start_date?: number;
2779
+ to_start_date?: number;
2780
+ from_due_date?: number;
2781
+ to_due_date?: number;
2782
+ teams?: string[];
2783
+ };
2784
+ export interface Result extends DefaultPaginationResult {
2785
+ data: WorkorderSchema[];
2786
+ absolute_total: number;
2787
+ page_total: number;
2788
+ }
2789
+ }
2790
+ export namespace Get {
2791
+ export type ID = string;
2792
+ export interface Params {
2793
+ populatedKeys?: PopulatedKeys[];
2794
+ sortPage?: SortingKeys;
2795
+ }
2796
+ export type Result = WorkorderSchema;
2797
+ }
2798
+ }
2799
+
2462
2800
  export namespace FullInvoice {
2463
2801
  export interface InvoiceSchema {
2464
2802
  _id: string;