repzo 1.0.30 → 1.0.31
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/index.d.ts +7 -0
- package/lib/index.js +18 -0
- package/lib/types/index.d.ts +328 -0
- package/package.json +1 -1
- package/src/index.ts +42 -0
- package/src/types/index.ts +342 -0
- package/test.ts +8 -0
- package/test.js +0 -11
package/lib/index.d.ts
CHANGED
|
@@ -193,6 +193,13 @@ export default class Repzo {
|
|
|
193
193
|
create: (body: Service.QuickConvertToPdf.Create.Body) => Promise<Service.QuickConvertToPdf.Create.Result>;
|
|
194
194
|
remove: (id: Service.QuickConvertToPdf.Remove.ID) => Promise<Service.QuickConvertToPdf.Remove.Result>;
|
|
195
195
|
};
|
|
196
|
+
visit: {
|
|
197
|
+
_path: string;
|
|
198
|
+
find: (params?: Service.Visit.Find.Params) => Promise<Service.Visit.Find.Result>;
|
|
199
|
+
get: (id: Service.Visit.Get.ID, params?: Service.Visit.Get.Params) => Promise<Service.Visit.Get.Result>;
|
|
200
|
+
create: (body: Service.Visit.Create.Body) => Promise<Service.Visit.Create.Result>;
|
|
201
|
+
update: (id: Service.Visit.Update.ID, body: Service.Visit.Update.Body) => Promise<Service.Visit.Update.Result>;
|
|
202
|
+
};
|
|
196
203
|
invoice: {
|
|
197
204
|
_path: string;
|
|
198
205
|
find: (params?: Service.FullInvoice.Find.Params) => Promise<Service.FullInvoice.Find.Result>;
|
package/lib/index.js
CHANGED
|
@@ -506,6 +506,24 @@ export default class Repzo {
|
|
|
506
506
|
return res;
|
|
507
507
|
},
|
|
508
508
|
};
|
|
509
|
+
this.visit = {
|
|
510
|
+
_path: "/visit",
|
|
511
|
+
find: async (params) => {
|
|
512
|
+
let res = await this._fetch(this.svAPIEndpoint, this.visit._path, params);
|
|
513
|
+
return res;
|
|
514
|
+
},
|
|
515
|
+
get: async (id, params) => {
|
|
516
|
+
return await this._fetch(this.svAPIEndpoint, this.visit._path + `/${id}`, params);
|
|
517
|
+
},
|
|
518
|
+
create: async (body) => {
|
|
519
|
+
let res = await this._create(this.svAPIEndpoint, this.visit._path, body);
|
|
520
|
+
return res;
|
|
521
|
+
},
|
|
522
|
+
update: async (id, body) => {
|
|
523
|
+
let res = await this._update(this.svAPIEndpoint, this.visit._path + `/${id}`, body);
|
|
524
|
+
return res;
|
|
525
|
+
},
|
|
526
|
+
};
|
|
509
527
|
this.invoice = {
|
|
510
528
|
_path: "/fullinvoices",
|
|
511
529
|
find: async (params) => {
|
package/lib/types/index.d.ts
CHANGED
|
@@ -16,6 +16,13 @@ export interface Headers {
|
|
|
16
16
|
Accept: string;
|
|
17
17
|
[key: string]: string;
|
|
18
18
|
}
|
|
19
|
+
interface ActivityComment {
|
|
20
|
+
time: number;
|
|
21
|
+
user_name: string;
|
|
22
|
+
user_id: string;
|
|
23
|
+
user_type: string;
|
|
24
|
+
comment: string;
|
|
25
|
+
}
|
|
19
26
|
interface AdminCreator {
|
|
20
27
|
_id: string;
|
|
21
28
|
type: "admin";
|
|
@@ -89,6 +96,15 @@ interface ClientLocationPopulated {
|
|
|
89
96
|
interface FormPopulated {
|
|
90
97
|
name: string;
|
|
91
98
|
}
|
|
99
|
+
interface VisitMeta {
|
|
100
|
+
geo_fence_setting_visit_start: boolean;
|
|
101
|
+
geo_fence_setting_visit_end: boolean;
|
|
102
|
+
geo_fence_setting_radius: number;
|
|
103
|
+
offline_mode: boolean;
|
|
104
|
+
start_visit_in_fence: boolean;
|
|
105
|
+
end_visit_in_fence: boolean;
|
|
106
|
+
client_verified: boolean;
|
|
107
|
+
}
|
|
92
108
|
interface thumbnailStoragePopulated {
|
|
93
109
|
_id: string;
|
|
94
110
|
createdAt: string;
|
|
@@ -224,6 +240,11 @@ export interface MediaDoc {
|
|
|
224
240
|
region: string;
|
|
225
241
|
time: number;
|
|
226
242
|
}
|
|
243
|
+
export interface GeoTag {
|
|
244
|
+
lat: number;
|
|
245
|
+
lng: number;
|
|
246
|
+
formatted_address: string;
|
|
247
|
+
}
|
|
227
248
|
export declare namespace Service {
|
|
228
249
|
namespace Client {
|
|
229
250
|
interface Financials {
|
|
@@ -2471,6 +2492,313 @@ export declare namespace Service {
|
|
|
2471
2492
|
}
|
|
2472
2493
|
export {};
|
|
2473
2494
|
}
|
|
2495
|
+
namespace Visit {
|
|
2496
|
+
export interface VisitSchema {
|
|
2497
|
+
geoPoint: {
|
|
2498
|
+
type: "Point";
|
|
2499
|
+
coordinates: number[];
|
|
2500
|
+
};
|
|
2501
|
+
start_geo_tag: GeoTag;
|
|
2502
|
+
end_geo_tag: GeoTag;
|
|
2503
|
+
route: string;
|
|
2504
|
+
time: number;
|
|
2505
|
+
user: Rep.RepSchema;
|
|
2506
|
+
tags: Tag.TagBody[];
|
|
2507
|
+
client: string;
|
|
2508
|
+
client_name: string;
|
|
2509
|
+
client_location_verified?: boolean;
|
|
2510
|
+
user_name?: string;
|
|
2511
|
+
visit_id: string;
|
|
2512
|
+
sync_id?: string;
|
|
2513
|
+
start_time: number;
|
|
2514
|
+
end_time: number;
|
|
2515
|
+
business_day_rep?: string;
|
|
2516
|
+
business_day: string;
|
|
2517
|
+
call_start_time?: number;
|
|
2518
|
+
call_end_time?: number;
|
|
2519
|
+
call_total_time?: number;
|
|
2520
|
+
total_time: number;
|
|
2521
|
+
platform: string;
|
|
2522
|
+
version_name: string;
|
|
2523
|
+
battery_level: number;
|
|
2524
|
+
device_brand?: string;
|
|
2525
|
+
device_os?: string;
|
|
2526
|
+
device_os_version?: string;
|
|
2527
|
+
device_model?: string;
|
|
2528
|
+
time_zone?: string;
|
|
2529
|
+
identifier?: number;
|
|
2530
|
+
device_id?: string;
|
|
2531
|
+
device_unique_id?: string;
|
|
2532
|
+
type?: string;
|
|
2533
|
+
notes?: string[];
|
|
2534
|
+
photos?: string[];
|
|
2535
|
+
forms?: string[];
|
|
2536
|
+
teams?: string[];
|
|
2537
|
+
tasks?: string[];
|
|
2538
|
+
audits?: string[];
|
|
2539
|
+
network_state?: number;
|
|
2540
|
+
distance?: number;
|
|
2541
|
+
start_distance?: number;
|
|
2542
|
+
end_distance?: number;
|
|
2543
|
+
delta_distance?: number;
|
|
2544
|
+
start_out_of_geofence?: boolean;
|
|
2545
|
+
end_out_of_geofence?: boolean;
|
|
2546
|
+
start_accuracy?: number;
|
|
2547
|
+
end_accuracy?: number;
|
|
2548
|
+
closed_by_system?: boolean;
|
|
2549
|
+
meta: VisitMeta;
|
|
2550
|
+
lines?: string[];
|
|
2551
|
+
client_geo_location: {
|
|
2552
|
+
type: {
|
|
2553
|
+
lat: Number;
|
|
2554
|
+
lng: Number;
|
|
2555
|
+
};
|
|
2556
|
+
};
|
|
2557
|
+
geofencing_radius?: number;
|
|
2558
|
+
availability?: string[];
|
|
2559
|
+
selected_product_lines: Line.LineSchema[];
|
|
2560
|
+
workorder: Workorder.WorkorderSchema;
|
|
2561
|
+
asset?: string;
|
|
2562
|
+
asset_unit?: string;
|
|
2563
|
+
auto_closed_by_geofence?: boolean;
|
|
2564
|
+
auto_closed_by_geofence_reason: "out_of_geofence" | "low_accuracy" | "location_turned_off";
|
|
2565
|
+
company_namespace: string[];
|
|
2566
|
+
}
|
|
2567
|
+
export interface CreateBody {
|
|
2568
|
+
geoPoint: {
|
|
2569
|
+
type: "Point";
|
|
2570
|
+
coordinates: number[];
|
|
2571
|
+
};
|
|
2572
|
+
start_geo_tag: GeoTag;
|
|
2573
|
+
route: string;
|
|
2574
|
+
time: number;
|
|
2575
|
+
user: Rep.RepSchema;
|
|
2576
|
+
tags: Tag.TagBody[];
|
|
2577
|
+
client: string;
|
|
2578
|
+
client_name: string;
|
|
2579
|
+
client_location_verified?: boolean;
|
|
2580
|
+
user_name?: string;
|
|
2581
|
+
visit_id: string;
|
|
2582
|
+
sync_id?: string;
|
|
2583
|
+
start_time: number;
|
|
2584
|
+
business_day_rep?: string;
|
|
2585
|
+
business_day: string;
|
|
2586
|
+
platform: string;
|
|
2587
|
+
version_name: string;
|
|
2588
|
+
battery_level: number;
|
|
2589
|
+
device_brand?: string;
|
|
2590
|
+
device_os?: string;
|
|
2591
|
+
device_os_version?: string;
|
|
2592
|
+
device_model?: string;
|
|
2593
|
+
time_zone?: string;
|
|
2594
|
+
identifier?: number;
|
|
2595
|
+
device_id?: string;
|
|
2596
|
+
device_unique_id?: string;
|
|
2597
|
+
type?: string;
|
|
2598
|
+
network_state?: number;
|
|
2599
|
+
distance?: number;
|
|
2600
|
+
start_distance?: number;
|
|
2601
|
+
start_accuracy?: number;
|
|
2602
|
+
meta: VisitMeta;
|
|
2603
|
+
lines?: string[];
|
|
2604
|
+
client_geo_location: {
|
|
2605
|
+
type: {
|
|
2606
|
+
lat: Number;
|
|
2607
|
+
lng: Number;
|
|
2608
|
+
};
|
|
2609
|
+
};
|
|
2610
|
+
geofencing_radius?: number;
|
|
2611
|
+
availability?: string[];
|
|
2612
|
+
workorder: Workorder.WorkorderSchema;
|
|
2613
|
+
asset?: string;
|
|
2614
|
+
asset_unit?: string;
|
|
2615
|
+
company_namespace: string[];
|
|
2616
|
+
}
|
|
2617
|
+
export interface UpdateBody {
|
|
2618
|
+
geoPoint?: {
|
|
2619
|
+
type: "Point";
|
|
2620
|
+
coordinates: number[];
|
|
2621
|
+
};
|
|
2622
|
+
end_geo_tag?: GeoTag;
|
|
2623
|
+
route?: string;
|
|
2624
|
+
time?: number;
|
|
2625
|
+
user?: Rep.RepSchema;
|
|
2626
|
+
tags?: Tag.TagBody[];
|
|
2627
|
+
client?: string;
|
|
2628
|
+
client_name?: string;
|
|
2629
|
+
client_location_verified?: boolean;
|
|
2630
|
+
user_name?: string;
|
|
2631
|
+
visit_id?: string;
|
|
2632
|
+
sync_id?: string;
|
|
2633
|
+
end_time?: number;
|
|
2634
|
+
business_day_rep?: string;
|
|
2635
|
+
business_day?: string;
|
|
2636
|
+
call_start_time?: number;
|
|
2637
|
+
call_end_time?: number;
|
|
2638
|
+
call_total_time?: number;
|
|
2639
|
+
total_time?: number;
|
|
2640
|
+
platform?: string;
|
|
2641
|
+
version_name?: string;
|
|
2642
|
+
battery_level?: number;
|
|
2643
|
+
device_brand?: string;
|
|
2644
|
+
device_os?: string;
|
|
2645
|
+
device_os_version?: string;
|
|
2646
|
+
device_model?: string;
|
|
2647
|
+
time_zone?: string;
|
|
2648
|
+
identifier?: number;
|
|
2649
|
+
device_id?: string;
|
|
2650
|
+
device_unique_id?: string;
|
|
2651
|
+
type?: string;
|
|
2652
|
+
notes?: string[];
|
|
2653
|
+
photos?: string[];
|
|
2654
|
+
forms?: string[];
|
|
2655
|
+
teams?: string[];
|
|
2656
|
+
tasks?: string[];
|
|
2657
|
+
audits?: string[];
|
|
2658
|
+
network_state?: number;
|
|
2659
|
+
distance?: number;
|
|
2660
|
+
end_distance?: number;
|
|
2661
|
+
delta_distance?: number;
|
|
2662
|
+
end_out_of_geofence?: boolean;
|
|
2663
|
+
end_accuracy?: number;
|
|
2664
|
+
closed_by_system?: boolean;
|
|
2665
|
+
meta: VisitMeta;
|
|
2666
|
+
lines?: string[];
|
|
2667
|
+
client_geo_location?: {
|
|
2668
|
+
type: {
|
|
2669
|
+
lat: Number;
|
|
2670
|
+
lng: Number;
|
|
2671
|
+
};
|
|
2672
|
+
};
|
|
2673
|
+
geofencing_radius?: number;
|
|
2674
|
+
availability?: string[];
|
|
2675
|
+
selected_product_lines?: Line.LineSchema[];
|
|
2676
|
+
workorder?: Workorder.WorkorderSchema;
|
|
2677
|
+
asset?: string;
|
|
2678
|
+
asset_unit?: string;
|
|
2679
|
+
auto_closed_by_geofence?: boolean;
|
|
2680
|
+
auto_closed_by_geofence_reason?: "out_of_geofence" | "low_accuracy" | "location_turned_off";
|
|
2681
|
+
company_namespace: string[];
|
|
2682
|
+
}
|
|
2683
|
+
type VisitSchemaWithPopulatedKeys = {
|
|
2684
|
+
notes: {
|
|
2685
|
+
content: string;
|
|
2686
|
+
geo_tag: GeoTag;
|
|
2687
|
+
time: number;
|
|
2688
|
+
platform: string;
|
|
2689
|
+
version_name: string;
|
|
2690
|
+
battery_level: number;
|
|
2691
|
+
comments: ActivityComment[];
|
|
2692
|
+
};
|
|
2693
|
+
tasks: {
|
|
2694
|
+
start_photo: string;
|
|
2695
|
+
end_photo: string;
|
|
2696
|
+
start_media: MediaDoc;
|
|
2697
|
+
end_media: MediaDoc;
|
|
2698
|
+
geo_tag: GeoTag;
|
|
2699
|
+
time: number;
|
|
2700
|
+
platform: string;
|
|
2701
|
+
version_name: string;
|
|
2702
|
+
battery_level: number;
|
|
2703
|
+
start_time: number;
|
|
2704
|
+
end_time: number;
|
|
2705
|
+
total_time: number;
|
|
2706
|
+
comments: ActivityComment[];
|
|
2707
|
+
};
|
|
2708
|
+
photos: {
|
|
2709
|
+
photo: string;
|
|
2710
|
+
media: MediaDoc;
|
|
2711
|
+
geo_tag: GeoTag;
|
|
2712
|
+
caption: string;
|
|
2713
|
+
time: number;
|
|
2714
|
+
platform: string;
|
|
2715
|
+
version_name: string;
|
|
2716
|
+
battery_level: number;
|
|
2717
|
+
comments: ActivityComment[];
|
|
2718
|
+
};
|
|
2719
|
+
forms: {
|
|
2720
|
+
results: {
|
|
2721
|
+
[key: string]: any;
|
|
2722
|
+
};
|
|
2723
|
+
form_id: string;
|
|
2724
|
+
geo_tag: GeoTag;
|
|
2725
|
+
time: number;
|
|
2726
|
+
platform: string;
|
|
2727
|
+
version_name: string;
|
|
2728
|
+
battery_level: number;
|
|
2729
|
+
comments: ActivityComment[];
|
|
2730
|
+
};
|
|
2731
|
+
audits: {
|
|
2732
|
+
audits: {
|
|
2733
|
+
inventories: {
|
|
2734
|
+
media: MediaDoc;
|
|
2735
|
+
};
|
|
2736
|
+
};
|
|
2737
|
+
geo_tag: GeoTag;
|
|
2738
|
+
time: number;
|
|
2739
|
+
platform: string;
|
|
2740
|
+
version_name: string;
|
|
2741
|
+
battery_level: number;
|
|
2742
|
+
comments: ActivityComment[];
|
|
2743
|
+
};
|
|
2744
|
+
availability: {
|
|
2745
|
+
products_available: {
|
|
2746
|
+
product_id: Pick<Product.ProductSchema, "_id">;
|
|
2747
|
+
available: boolean;
|
|
2748
|
+
};
|
|
2749
|
+
media: MediaDoc;
|
|
2750
|
+
geo_tag: GeoTag;
|
|
2751
|
+
time: number;
|
|
2752
|
+
platform: string;
|
|
2753
|
+
version_name: string;
|
|
2754
|
+
battery_level: number;
|
|
2755
|
+
comment: ActivityComment[];
|
|
2756
|
+
};
|
|
2757
|
+
tags: string | Tag.TagSchema;
|
|
2758
|
+
};
|
|
2759
|
+
export namespace Find {
|
|
2760
|
+
type Params = DefaultPaginationQueryParams & {
|
|
2761
|
+
user?: string;
|
|
2762
|
+
from_time?: number;
|
|
2763
|
+
to_time?: number;
|
|
2764
|
+
client?: string;
|
|
2765
|
+
route?: string;
|
|
2766
|
+
teams?: string[];
|
|
2767
|
+
company_namespace?: string;
|
|
2768
|
+
tags?: string[];
|
|
2769
|
+
CLIENT_TAGS?: string[];
|
|
2770
|
+
AREA_TAGS?: string;
|
|
2771
|
+
availability?: string[];
|
|
2772
|
+
visit_id?: string;
|
|
2773
|
+
from_total_time?: number;
|
|
2774
|
+
to_total_time?: number;
|
|
2775
|
+
closed_by_system?: boolean;
|
|
2776
|
+
};
|
|
2777
|
+
interface Result extends DefaultPaginationResult {
|
|
2778
|
+
data: VisitSchema[];
|
|
2779
|
+
absolute_total: number;
|
|
2780
|
+
page_total: number;
|
|
2781
|
+
}
|
|
2782
|
+
}
|
|
2783
|
+
type PopulatedKeys = "notes" | "tasks" | "photos" | "forms" | "audits" | "tags" | "availability";
|
|
2784
|
+
export namespace Create {
|
|
2785
|
+
type Body = CreateBody;
|
|
2786
|
+
type Result = VisitSchema;
|
|
2787
|
+
}
|
|
2788
|
+
export namespace Get {
|
|
2789
|
+
type ID = string;
|
|
2790
|
+
interface Params {
|
|
2791
|
+
populatedKeys?: PopulatedKeys[];
|
|
2792
|
+
}
|
|
2793
|
+
type Result = VisitSchemaWithPopulatedKeys;
|
|
2794
|
+
}
|
|
2795
|
+
export namespace Update {
|
|
2796
|
+
type ID = string;
|
|
2797
|
+
type Body = UpdateBody;
|
|
2798
|
+
type Result = VisitSchema;
|
|
2799
|
+
}
|
|
2800
|
+
export {};
|
|
2801
|
+
}
|
|
2474
2802
|
namespace Workorder {
|
|
2475
2803
|
export interface WorkorderSchema {
|
|
2476
2804
|
_id: string;
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -1259,6 +1259,7 @@ export default class Repzo {
|
|
|
1259
1259
|
);
|
|
1260
1260
|
},
|
|
1261
1261
|
};
|
|
1262
|
+
|
|
1262
1263
|
quickConvertToPdf = {
|
|
1263
1264
|
_path: "/quick-convert-to-pdf",
|
|
1264
1265
|
find: async (
|
|
@@ -1301,6 +1302,47 @@ export default class Repzo {
|
|
|
1301
1302
|
return res;
|
|
1302
1303
|
},
|
|
1303
1304
|
};
|
|
1305
|
+
visit = {
|
|
1306
|
+
_path: "/visit",
|
|
1307
|
+
find: async (
|
|
1308
|
+
params?: Service.Visit.Find.Params
|
|
1309
|
+
): Promise<Service.Visit.Find.Result> => {
|
|
1310
|
+
let res: Service.Visit.Find.Result = await this._fetch(
|
|
1311
|
+
this.svAPIEndpoint,
|
|
1312
|
+
this.visit._path,
|
|
1313
|
+
params
|
|
1314
|
+
);
|
|
1315
|
+
return res;
|
|
1316
|
+
},
|
|
1317
|
+
get: async (
|
|
1318
|
+
id: Service.Visit.Get.ID,
|
|
1319
|
+
params?: Service.Visit.Get.Params
|
|
1320
|
+
): Promise<Service.Visit.Get.Result> => {
|
|
1321
|
+
return await this._fetch(
|
|
1322
|
+
this.svAPIEndpoint,
|
|
1323
|
+
this.visit._path + `/${id}`,
|
|
1324
|
+
params
|
|
1325
|
+
);
|
|
1326
|
+
},
|
|
1327
|
+
create: async (
|
|
1328
|
+
body: Service.Visit.Create.Body
|
|
1329
|
+
): Promise<Service.Visit.Create.Result> => {
|
|
1330
|
+
let res = await this._create(this.svAPIEndpoint, this.visit._path, body);
|
|
1331
|
+
return res;
|
|
1332
|
+
},
|
|
1333
|
+
|
|
1334
|
+
update: async (
|
|
1335
|
+
id: Service.Visit.Update.ID,
|
|
1336
|
+
body: Service.Visit.Update.Body
|
|
1337
|
+
): Promise<Service.Visit.Update.Result> => {
|
|
1338
|
+
let res: Service.Visit.Update.Result = await this._update(
|
|
1339
|
+
this.svAPIEndpoint,
|
|
1340
|
+
this.visit._path + `/${id}`,
|
|
1341
|
+
body
|
|
1342
|
+
);
|
|
1343
|
+
return res;
|
|
1344
|
+
},
|
|
1345
|
+
};
|
|
1304
1346
|
invoice = {
|
|
1305
1347
|
_path: "/fullinvoices",
|
|
1306
1348
|
find: async (
|
package/src/types/index.ts
CHANGED
|
@@ -16,6 +16,14 @@ export interface Headers {
|
|
|
16
16
|
[key: string]: string;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
+
interface ActivityComment {
|
|
20
|
+
time: number;
|
|
21
|
+
user_name: string;
|
|
22
|
+
user_id: string;
|
|
23
|
+
user_type: string;
|
|
24
|
+
comment: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
19
27
|
interface AdminCreator {
|
|
20
28
|
_id: string;
|
|
21
29
|
type: "admin";
|
|
@@ -90,6 +98,15 @@ interface ClientLocationPopulated {
|
|
|
90
98
|
interface FormPopulated {
|
|
91
99
|
name: string;
|
|
92
100
|
}
|
|
101
|
+
interface VisitMeta {
|
|
102
|
+
geo_fence_setting_visit_start: boolean;
|
|
103
|
+
geo_fence_setting_visit_end: boolean;
|
|
104
|
+
geo_fence_setting_radius: number;
|
|
105
|
+
offline_mode: boolean;
|
|
106
|
+
start_visit_in_fence: boolean;
|
|
107
|
+
end_visit_in_fence: boolean;
|
|
108
|
+
client_verified: boolean;
|
|
109
|
+
}
|
|
93
110
|
interface thumbnailStoragePopulated {
|
|
94
111
|
_id: string;
|
|
95
112
|
createdAt: string;
|
|
@@ -113,6 +130,7 @@ interface thumbnailStoragePopulated {
|
|
|
113
130
|
| " images"
|
|
114
131
|
| "zip";
|
|
115
132
|
}
|
|
133
|
+
|
|
116
134
|
interface MediaPopulated {
|
|
117
135
|
_id: string;
|
|
118
136
|
media_type:
|
|
@@ -342,6 +360,12 @@ export interface MediaDoc {
|
|
|
342
360
|
region: string;
|
|
343
361
|
time: number;
|
|
344
362
|
}
|
|
363
|
+
|
|
364
|
+
export interface GeoTag {
|
|
365
|
+
lat: number;
|
|
366
|
+
lng: number;
|
|
367
|
+
formatted_address: string;
|
|
368
|
+
}
|
|
345
369
|
// <reference path = "vehicle.ts" />
|
|
346
370
|
export namespace Service {
|
|
347
371
|
export namespace Client {
|
|
@@ -2708,6 +2732,324 @@ export namespace Service {
|
|
|
2708
2732
|
}
|
|
2709
2733
|
}
|
|
2710
2734
|
|
|
2735
|
+
export namespace Visit {
|
|
2736
|
+
export interface VisitSchema {
|
|
2737
|
+
geoPoint: {
|
|
2738
|
+
type: "Point";
|
|
2739
|
+
coordinates: number[];
|
|
2740
|
+
};
|
|
2741
|
+
start_geo_tag: GeoTag;
|
|
2742
|
+
end_geo_tag: GeoTag;
|
|
2743
|
+
route: string;
|
|
2744
|
+
time: number;
|
|
2745
|
+
user: Rep.RepSchema;
|
|
2746
|
+
tags: Tag.TagBody[];
|
|
2747
|
+
client: string;
|
|
2748
|
+
client_name: string;
|
|
2749
|
+
client_location_verified?: boolean;
|
|
2750
|
+
user_name?: string;
|
|
2751
|
+
visit_id: string;
|
|
2752
|
+
sync_id?: string;
|
|
2753
|
+
start_time: number;
|
|
2754
|
+
end_time: number;
|
|
2755
|
+
business_day_rep?: string;
|
|
2756
|
+
business_day: string;
|
|
2757
|
+
call_start_time?: number;
|
|
2758
|
+
call_end_time?: number;
|
|
2759
|
+
call_total_time?: number;
|
|
2760
|
+
total_time: number;
|
|
2761
|
+
platform: string;
|
|
2762
|
+
version_name: string;
|
|
2763
|
+
battery_level: number;
|
|
2764
|
+
device_brand?: string;
|
|
2765
|
+
device_os?: string;
|
|
2766
|
+
device_os_version?: string;
|
|
2767
|
+
device_model?: string;
|
|
2768
|
+
time_zone?: string;
|
|
2769
|
+
identifier?: number;
|
|
2770
|
+
device_id?: string;
|
|
2771
|
+
device_unique_id?: string;
|
|
2772
|
+
type?: string;
|
|
2773
|
+
notes?: string[];
|
|
2774
|
+
photos?: string[];
|
|
2775
|
+
forms?: string[];
|
|
2776
|
+
teams?: string[];
|
|
2777
|
+
tasks?: string[];
|
|
2778
|
+
audits?: string[];
|
|
2779
|
+
network_state?: number;
|
|
2780
|
+
distance?: number;
|
|
2781
|
+
start_distance?: number;
|
|
2782
|
+
end_distance?: number;
|
|
2783
|
+
delta_distance?: number;
|
|
2784
|
+
start_out_of_geofence?: boolean;
|
|
2785
|
+
end_out_of_geofence?: boolean;
|
|
2786
|
+
start_accuracy?: number;
|
|
2787
|
+
end_accuracy?: number;
|
|
2788
|
+
closed_by_system?: boolean;
|
|
2789
|
+
meta: VisitMeta;
|
|
2790
|
+
lines?: string[];
|
|
2791
|
+
client_geo_location: {
|
|
2792
|
+
type: {
|
|
2793
|
+
lat: Number;
|
|
2794
|
+
lng: Number;
|
|
2795
|
+
};
|
|
2796
|
+
};
|
|
2797
|
+
geofencing_radius?: number;
|
|
2798
|
+
availability?: string[];
|
|
2799
|
+
selected_product_lines: Line.LineSchema[];
|
|
2800
|
+
workorder: Workorder.WorkorderSchema;
|
|
2801
|
+
asset?: string;
|
|
2802
|
+
asset_unit?: string;
|
|
2803
|
+
auto_closed_by_geofence?: boolean;
|
|
2804
|
+
auto_closed_by_geofence_reason:
|
|
2805
|
+
| "out_of_geofence"
|
|
2806
|
+
| "low_accuracy"
|
|
2807
|
+
| "location_turned_off";
|
|
2808
|
+
company_namespace: string[];
|
|
2809
|
+
}
|
|
2810
|
+
export interface CreateBody {
|
|
2811
|
+
geoPoint: {
|
|
2812
|
+
type: "Point";
|
|
2813
|
+
coordinates: number[];
|
|
2814
|
+
};
|
|
2815
|
+
start_geo_tag: GeoTag;
|
|
2816
|
+
route: string;
|
|
2817
|
+
time: number;
|
|
2818
|
+
user: Rep.RepSchema;
|
|
2819
|
+
tags: Tag.TagBody[];
|
|
2820
|
+
client: string;
|
|
2821
|
+
client_name: string;
|
|
2822
|
+
client_location_verified?: boolean;
|
|
2823
|
+
user_name?: string;
|
|
2824
|
+
visit_id: string;
|
|
2825
|
+
sync_id?: string;
|
|
2826
|
+
start_time: number;
|
|
2827
|
+
business_day_rep?: string;
|
|
2828
|
+
business_day: string;
|
|
2829
|
+
platform: string;
|
|
2830
|
+
version_name: string;
|
|
2831
|
+
battery_level: number;
|
|
2832
|
+
device_brand?: string;
|
|
2833
|
+
device_os?: string;
|
|
2834
|
+
device_os_version?: string;
|
|
2835
|
+
device_model?: string;
|
|
2836
|
+
time_zone?: string;
|
|
2837
|
+
identifier?: number;
|
|
2838
|
+
device_id?: string;
|
|
2839
|
+
device_unique_id?: string;
|
|
2840
|
+
type?: string;
|
|
2841
|
+
network_state?: number;
|
|
2842
|
+
distance?: number;
|
|
2843
|
+
start_distance?: number;
|
|
2844
|
+
start_accuracy?: number;
|
|
2845
|
+
meta: VisitMeta;
|
|
2846
|
+
lines?: string[];
|
|
2847
|
+
client_geo_location: {
|
|
2848
|
+
type: {
|
|
2849
|
+
lat: Number;
|
|
2850
|
+
lng: Number;
|
|
2851
|
+
};
|
|
2852
|
+
};
|
|
2853
|
+
geofencing_radius?: number;
|
|
2854
|
+
availability?: string[];
|
|
2855
|
+
workorder: Workorder.WorkorderSchema;
|
|
2856
|
+
asset?: string;
|
|
2857
|
+
asset_unit?: string;
|
|
2858
|
+
company_namespace: string[];
|
|
2859
|
+
}
|
|
2860
|
+
export interface UpdateBody {
|
|
2861
|
+
geoPoint?: {
|
|
2862
|
+
type: "Point";
|
|
2863
|
+
coordinates: number[];
|
|
2864
|
+
};
|
|
2865
|
+
end_geo_tag?: GeoTag;
|
|
2866
|
+
route?: string;
|
|
2867
|
+
time?: number;
|
|
2868
|
+
user?: Rep.RepSchema;
|
|
2869
|
+
tags?: Tag.TagBody[];
|
|
2870
|
+
client?: string;
|
|
2871
|
+
client_name?: string;
|
|
2872
|
+
client_location_verified?: boolean;
|
|
2873
|
+
user_name?: string;
|
|
2874
|
+
visit_id?: string;
|
|
2875
|
+
sync_id?: string;
|
|
2876
|
+
end_time?: number;
|
|
2877
|
+
business_day_rep?: string;
|
|
2878
|
+
business_day?: string;
|
|
2879
|
+
call_start_time?: number;
|
|
2880
|
+
call_end_time?: number;
|
|
2881
|
+
call_total_time?: number;
|
|
2882
|
+
total_time?: number;
|
|
2883
|
+
platform?: string;
|
|
2884
|
+
version_name?: string;
|
|
2885
|
+
battery_level?: number;
|
|
2886
|
+
device_brand?: string;
|
|
2887
|
+
device_os?: string;
|
|
2888
|
+
device_os_version?: string;
|
|
2889
|
+
device_model?: string;
|
|
2890
|
+
time_zone?: string;
|
|
2891
|
+
identifier?: number;
|
|
2892
|
+
device_id?: string;
|
|
2893
|
+
device_unique_id?: string;
|
|
2894
|
+
type?: string;
|
|
2895
|
+
notes?: string[];
|
|
2896
|
+
photos?: string[];
|
|
2897
|
+
forms?: string[];
|
|
2898
|
+
teams?: string[];
|
|
2899
|
+
tasks?: string[];
|
|
2900
|
+
audits?: string[];
|
|
2901
|
+
network_state?: number;
|
|
2902
|
+
distance?: number;
|
|
2903
|
+
end_distance?: number;
|
|
2904
|
+
delta_distance?: number;
|
|
2905
|
+
end_out_of_geofence?: boolean;
|
|
2906
|
+
end_accuracy?: number;
|
|
2907
|
+
closed_by_system?: boolean;
|
|
2908
|
+
meta: VisitMeta;
|
|
2909
|
+
lines?: string[];
|
|
2910
|
+
client_geo_location?: {
|
|
2911
|
+
type: {
|
|
2912
|
+
lat: Number;
|
|
2913
|
+
lng: Number;
|
|
2914
|
+
};
|
|
2915
|
+
};
|
|
2916
|
+
geofencing_radius?: number;
|
|
2917
|
+
availability?: string[];
|
|
2918
|
+
selected_product_lines?: Line.LineSchema[];
|
|
2919
|
+
workorder?: Workorder.WorkorderSchema;
|
|
2920
|
+
asset?: string;
|
|
2921
|
+
asset_unit?: string;
|
|
2922
|
+
auto_closed_by_geofence?: boolean;
|
|
2923
|
+
auto_closed_by_geofence_reason?:
|
|
2924
|
+
| "out_of_geofence"
|
|
2925
|
+
| "low_accuracy"
|
|
2926
|
+
| "location_turned_off";
|
|
2927
|
+
company_namespace: string[];
|
|
2928
|
+
}
|
|
2929
|
+
type VisitSchemaWithPopulatedKeys = {
|
|
2930
|
+
notes: {
|
|
2931
|
+
content: string;
|
|
2932
|
+
geo_tag: GeoTag;
|
|
2933
|
+
time: number;
|
|
2934
|
+
platform: string;
|
|
2935
|
+
version_name: string;
|
|
2936
|
+
battery_level: number;
|
|
2937
|
+
comments: ActivityComment[];
|
|
2938
|
+
};
|
|
2939
|
+
tasks: {
|
|
2940
|
+
start_photo: string;
|
|
2941
|
+
end_photo: string;
|
|
2942
|
+
start_media: MediaDoc;
|
|
2943
|
+
end_media: MediaDoc;
|
|
2944
|
+
geo_tag: GeoTag;
|
|
2945
|
+
time: number;
|
|
2946
|
+
platform: string;
|
|
2947
|
+
version_name: string;
|
|
2948
|
+
battery_level: number;
|
|
2949
|
+
start_time: number;
|
|
2950
|
+
end_time: number;
|
|
2951
|
+
total_time: number;
|
|
2952
|
+
comments: ActivityComment[];
|
|
2953
|
+
};
|
|
2954
|
+
photos: {
|
|
2955
|
+
photo: string;
|
|
2956
|
+
media: MediaDoc;
|
|
2957
|
+
geo_tag: GeoTag;
|
|
2958
|
+
caption: string;
|
|
2959
|
+
time: number;
|
|
2960
|
+
platform: string;
|
|
2961
|
+
version_name: string;
|
|
2962
|
+
battery_level: number;
|
|
2963
|
+
comments: ActivityComment[];
|
|
2964
|
+
};
|
|
2965
|
+
forms: {
|
|
2966
|
+
results: { [key: string]: any };
|
|
2967
|
+
form_id: string;
|
|
2968
|
+
geo_tag: GeoTag;
|
|
2969
|
+
time: number;
|
|
2970
|
+
platform: string;
|
|
2971
|
+
version_name: string;
|
|
2972
|
+
battery_level: number;
|
|
2973
|
+
comments: ActivityComment[];
|
|
2974
|
+
};
|
|
2975
|
+
audits: {
|
|
2976
|
+
audits: {
|
|
2977
|
+
inventories: {
|
|
2978
|
+
media: MediaDoc;
|
|
2979
|
+
};
|
|
2980
|
+
};
|
|
2981
|
+
geo_tag: GeoTag;
|
|
2982
|
+
time: number;
|
|
2983
|
+
platform: string;
|
|
2984
|
+
version_name: string;
|
|
2985
|
+
battery_level: number;
|
|
2986
|
+
comments: ActivityComment[];
|
|
2987
|
+
};
|
|
2988
|
+
availability: {
|
|
2989
|
+
products_available: {
|
|
2990
|
+
product_id: Pick<Product.ProductSchema, "_id">;
|
|
2991
|
+
available: boolean;
|
|
2992
|
+
};
|
|
2993
|
+
media: MediaDoc;
|
|
2994
|
+
geo_tag: GeoTag;
|
|
2995
|
+
time: number;
|
|
2996
|
+
platform: string;
|
|
2997
|
+
version_name: string;
|
|
2998
|
+
battery_level: number;
|
|
2999
|
+
comment: ActivityComment[];
|
|
3000
|
+
};
|
|
3001
|
+
tags: string | Tag.TagSchema;
|
|
3002
|
+
};
|
|
3003
|
+
export namespace Find {
|
|
3004
|
+
export type Params = DefaultPaginationQueryParams & {
|
|
3005
|
+
user?: string;
|
|
3006
|
+
from_time?: number;
|
|
3007
|
+
to_time?: number;
|
|
3008
|
+
client?: string;
|
|
3009
|
+
route?: string;
|
|
3010
|
+
teams?: string[];
|
|
3011
|
+
company_namespace?: string;
|
|
3012
|
+
tags?: string[];
|
|
3013
|
+
CLIENT_TAGS?: string[];
|
|
3014
|
+
AREA_TAGS?: string;
|
|
3015
|
+
availability?: string[];
|
|
3016
|
+
visit_id?: string;
|
|
3017
|
+
from_total_time?: number;
|
|
3018
|
+
to_total_time?: number;
|
|
3019
|
+
closed_by_system?: boolean;
|
|
3020
|
+
};
|
|
3021
|
+
export interface Result extends DefaultPaginationResult {
|
|
3022
|
+
data: VisitSchema[];
|
|
3023
|
+
absolute_total: number;
|
|
3024
|
+
page_total: number;
|
|
3025
|
+
}
|
|
3026
|
+
}
|
|
3027
|
+
type PopulatedKeys =
|
|
3028
|
+
| "notes"
|
|
3029
|
+
| "tasks"
|
|
3030
|
+
| "photos"
|
|
3031
|
+
| "forms"
|
|
3032
|
+
| "audits"
|
|
3033
|
+
| "tags"
|
|
3034
|
+
| "availability";
|
|
3035
|
+
export namespace Create {
|
|
3036
|
+
export type Body = CreateBody;
|
|
3037
|
+
export type Result = VisitSchema;
|
|
3038
|
+
}
|
|
3039
|
+
export namespace Get {
|
|
3040
|
+
export type ID = string;
|
|
3041
|
+
export interface Params {
|
|
3042
|
+
populatedKeys?: PopulatedKeys[];
|
|
3043
|
+
}
|
|
3044
|
+
export type Result = VisitSchemaWithPopulatedKeys;
|
|
3045
|
+
}
|
|
3046
|
+
export namespace Update {
|
|
3047
|
+
export type ID = string;
|
|
3048
|
+
export type Body = UpdateBody;
|
|
3049
|
+
export type Result = VisitSchema;
|
|
3050
|
+
}
|
|
3051
|
+
}
|
|
3052
|
+
|
|
2711
3053
|
export namespace Workorder {
|
|
2712
3054
|
export interface WorkorderSchema {
|
|
2713
3055
|
_id: string;
|
package/test.ts
ADDED
package/test.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import Repzo from "./lib/index.js";
|
|
2
|
-
// import Repzo from "repzo"
|
|
3
|
-
let repzo = new Repzo("qOIWZDYSjObf5W1Pti3efUM1D6S9vaqk8I_GoxOLnas");
|
|
4
|
-
let workorders = await repzo.workorder.get("63832c86180e66bcde05a49c")
|
|
5
|
-
console.log(workorders);
|
|
6
|
-
// let clients = repzo.client.find({ search: "Mecca" });
|
|
7
|
-
// console.log(clients);
|
|
8
|
-
// repzo.client.create({ name: "kf" });
|
|
9
|
-
// repzo.headers["ho"] = "faf";
|
|
10
|
-
// repzo.client.update("", {});
|
|
11
|
-
// repzo.
|