Skip to content

Commit 6f9a2f5

Browse files
authored
OptimoRoute - new components (#19068)
* new components * pnpm-lock.yaml * updates * updates * update * fix typo
1 parent f0e72d9 commit 6f9a2f5

File tree

11 files changed

+664
-7
lines changed

11 files changed

+664
-7
lines changed
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
import optimoroute from "../../optimoroute.app.mjs";
2+
3+
export default {
4+
key: "optimoroute-create-order",
5+
name: "Create Order",
6+
description: "Create a new order. [See the documentation](https://optimoroute.com/api/#create-order)",
7+
type: "action",
8+
version: "0.0.1",
9+
annotations: {
10+
destructiveHint: false,
11+
openWorldHint: true,
12+
readOnlyHint: false,
13+
},
14+
props: {
15+
optimoroute,
16+
type: {
17+
type: "string",
18+
label: "Type",
19+
description: "The type of order to create",
20+
options: [
21+
{
22+
label: "Delivery",
23+
value: "D",
24+
},
25+
{
26+
label: "Pickup",
27+
value: "P",
28+
},
29+
{
30+
label: "Task",
31+
value: "T",
32+
},
33+
],
34+
},
35+
date: {
36+
type: "string",
37+
label: "Date",
38+
description: "YYYY-MM-DD format, for example `2013-12-20`",
39+
},
40+
address: {
41+
type: "string",
42+
label: "Address",
43+
description: "The full address including the country, for example `393 Hanover St, Boston, MA 02113, US`",
44+
},
45+
orderNo: {
46+
type: "string",
47+
label: "Order Number",
48+
description: "A user specified order identifier, also displayed in the web application",
49+
},
50+
priority: {
51+
type: "string",
52+
label: "Priority",
53+
description: "The priority of the order",
54+
options: [
55+
{
56+
label: "Low",
57+
value: "L",
58+
},
59+
{
60+
label: "Medium",
61+
value: "M",
62+
},
63+
{
64+
label: "High",
65+
value: "H",
66+
},
67+
{
68+
label: "Critical",
69+
value: "C",
70+
},
71+
],
72+
},
73+
email: {
74+
type: "string",
75+
label: "Email",
76+
description: "The customer email",
77+
optional: true,
78+
},
79+
phone: {
80+
type: "string",
81+
label: "Phone",
82+
description: "The customer phone number",
83+
optional: true,
84+
},
85+
notes: {
86+
type: "string",
87+
label: "Notes",
88+
description: "A note that will accompany the driver's instructions",
89+
optional: true,
90+
},
91+
},
92+
async run({ $ }) {
93+
const response = await this.optimoroute.createOrder({
94+
$,
95+
data: {
96+
operation: "CREATE",
97+
type: this.type,
98+
date: this.date,
99+
location: {
100+
address: this.address,
101+
},
102+
orderNo: this.orderNo,
103+
priority: this.priority,
104+
email: this.email,
105+
phone: this.phone,
106+
notes: this.notes,
107+
},
108+
});
109+
$.export("$summary", `Successfully created order with ID: ${response.id}`);
110+
return response;
111+
},
112+
};
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import optimoroute from "../../optimoroute.app.mjs";
2+
3+
export default {
4+
key: "optimoroute-get-mobile-events",
5+
name: "Get Mobile Events",
6+
description: "Get mobile events from Optimoroute. [See the documentation](https://optimoroute.com/api/#get-mobile-events)",
7+
version: "0.0.1",
8+
type: "action",
9+
annotations: {
10+
destructiveHint: false,
11+
openWorldHint: true,
12+
readOnlyHint: true,
13+
},
14+
props: {
15+
optimoroute,
16+
afterTag: {
17+
propDefinition: [
18+
optimoroute,
19+
"afterTag",
20+
],
21+
},
22+
},
23+
async run({ $ }) {
24+
const response = await this.optimoroute.getMobileEvents({
25+
$,
26+
params: {
27+
after_tag: this.afterTag,
28+
},
29+
});
30+
$.export("$summary", `Mobile events found: ${response?.events?.length}`);
31+
return response;
32+
},
33+
};
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
import optimoroute from "../../optimoroute.app.mjs";
2+
3+
export default {
4+
key: "optimoroute-get-routes",
5+
name: "Get Routes",
6+
description: "Get routes from Optimoroute. [See the documentation](https://optimoroute.com/api/#get-routes)",
7+
version: "0.0.1",
8+
type: "action",
9+
annotations: {
10+
destructiveHint: false,
11+
openWorldHint: true,
12+
readOnlyHint: true,
13+
},
14+
props: {
15+
optimoroute,
16+
date: {
17+
type: "string",
18+
label: "Date",
19+
description: "Queried date. YYYY-MM-DD format, for example `2013-12-20`",
20+
},
21+
driverExternalId: {
22+
type: "string",
23+
label: "Driver External ID",
24+
description: "Optionally filter by drivers external identifier",
25+
optional: true,
26+
},
27+
driverSerial: {
28+
type: "string",
29+
label: "Driver Serial",
30+
description: "Optionally filter by Serial number of the Driver",
31+
optional: true,
32+
},
33+
vehicleRegistration: {
34+
type: "string",
35+
label: "Vehicle Registration",
36+
description: "Optionally filter by Vehicle registration",
37+
optional: true,
38+
},
39+
includeRoutePolyline: {
40+
type: "boolean",
41+
label: "Include Route Polyline",
42+
description: "Optional property to include route polyline in the output",
43+
optional: true,
44+
},
45+
includeRouteStartEnd: {
46+
type: "boolean",
47+
label: "Include Route Start End",
48+
description: "Optional property to include the route's start and end locations in the output",
49+
optional: true,
50+
},
51+
},
52+
async run({ $ }) {
53+
const response = await this.optimoroute.getRoutes({
54+
$,
55+
params: {
56+
date: this.date,
57+
driverExternalId: this.driverExternalId,
58+
driverSerial: this.driverSerial,
59+
vehicleRegistration: this.vehicleRegistration,
60+
includeRoutePolyline: this.includeRoutePolyline,
61+
includeRouteStartEnd: this.includeRouteStartEnd,
62+
},
63+
});
64+
$.export("$summary", `Routes found: ${response.routes.length}`);
65+
return response;
66+
},
67+
};
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
import optimoroute from "../../optimoroute.app.mjs";
2+
3+
export default {
4+
key: "optimoroute-search-orders",
5+
name: "Search Orders",
6+
description: "Search for orders in Optimoroute. [See the documentation](https://optimoroute.com/api/#search-orders)",
7+
version: "0.0.1",
8+
type: "action",
9+
annotations: {
10+
destructiveHint: false,
11+
openWorldHint: true,
12+
readOnlyHint: true,
13+
},
14+
props: {
15+
optimoroute,
16+
from: {
17+
type: "string",
18+
label: "From",
19+
description: "From date. YYYY-MM-DD format, for example `2013-12-20`. The range can span at most 35 days, i.e. 5 weeks",
20+
},
21+
to: {
22+
type: "string",
23+
label: "To",
24+
description: "To date. YYYY-MM-DD format, for example `2013-12-20`. The range can span at most 35 days, i.e. 5 weeks",
25+
},
26+
includeOrderData: {
27+
type: "boolean",
28+
label: "Include Order Data",
29+
description: "Include order data in the response",
30+
optional: true,
31+
},
32+
includeScheduleInformation: {
33+
type: "boolean",
34+
label: "Include Schedule Information",
35+
description: "Include schedule information in the response",
36+
optional: true,
37+
},
38+
afterTag: {
39+
propDefinition: [
40+
optimoroute,
41+
"afterTag",
42+
],
43+
},
44+
},
45+
async run({ $ }) {
46+
const response = await this.optimoroute.searchOrders({
47+
$,
48+
data: {
49+
dateRange: {
50+
from: this.from,
51+
to: this.to,
52+
},
53+
includeOrderData: this.includeOrderData,
54+
includeScheduleInformation: this.includeScheduleInformation,
55+
after_tag: this.afterTag,
56+
},
57+
});
58+
$.export("$summary", `Orders found: ${response?.orders?.length}`);
59+
return response;
60+
},
61+
};

0 commit comments

Comments
 (0)