-
Notifications
You must be signed in to change notification settings - Fork 5.6k
OptimoRoute - new components #19068
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
OptimoRoute - new components #19068
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
112 changes: 112 additions & 0 deletions
112
components/optimoroute/actions/create-order/create-order.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,112 @@ | ||
| import optimoroute from "../../optimoroute.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "optimoroute-create-order", | ||
| name: "Create Order", | ||
| description: "Create a new order. [See the documentation](https://optimoroute.com/api/#create-order)", | ||
| type: "action", | ||
| version: "0.0.1", | ||
| annotations: { | ||
| destructiveHint: false, | ||
| openWorldHint: true, | ||
| readOnlyHint: false, | ||
| }, | ||
| props: { | ||
| optimoroute, | ||
| type: { | ||
| type: "string", | ||
| label: "Type", | ||
| description: "The type of order to create", | ||
| options: [ | ||
| { | ||
| label: "Delivery", | ||
| value: "D", | ||
| }, | ||
| { | ||
| label: "Pickup", | ||
| value: "P", | ||
| }, | ||
| { | ||
| label: "Task", | ||
| value: "T", | ||
| }, | ||
| ], | ||
| }, | ||
| date: { | ||
| type: "string", | ||
| label: "Date", | ||
| description: "YYYY-MM-DD format, for example `2013-12-20`", | ||
| }, | ||
| address: { | ||
| type: "string", | ||
| label: "Address", | ||
| description: "The full address including the country, for example `393 Hanover St, Boston, MA 02113, US`", | ||
| }, | ||
| orderNo: { | ||
| type: "string", | ||
| label: "Order Number", | ||
| description: "A user specified order identifier, also displayed in the web application", | ||
| }, | ||
| priority: { | ||
| type: "string", | ||
| label: "Priority", | ||
| description: "The priority of the order", | ||
| options: [ | ||
| { | ||
| label: "Low", | ||
| value: "L", | ||
| }, | ||
| { | ||
| label: "Medium", | ||
| value: "M", | ||
| }, | ||
| { | ||
| label: "High", | ||
| value: "H", | ||
| }, | ||
| { | ||
| label: "Critical", | ||
| value: "C", | ||
| }, | ||
| ], | ||
| }, | ||
| email: { | ||
| type: "string", | ||
| label: "Email", | ||
| description: "The customer email", | ||
| optional: true, | ||
| }, | ||
| phone: { | ||
| type: "string", | ||
| label: "Phone", | ||
| description: "The customer phone number", | ||
| optional: true, | ||
| }, | ||
| notes: { | ||
| type: "string", | ||
| label: "Notes", | ||
| description: "A note that will accompany the driver's instructions", | ||
| optional: true, | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.optimoroute.createOrder({ | ||
| $, | ||
| data: { | ||
| operation: "CREATE", | ||
| type: this.type, | ||
| date: this.date, | ||
| location: { | ||
| address: this.address, | ||
| }, | ||
| orderNo: this.orderNo, | ||
| priority: this.priority, | ||
| email: this.email, | ||
| phone: this.phone, | ||
| notes: this.notes, | ||
| }, | ||
| }); | ||
| $.export("$summary", `Successfully created order with ID: ${response.id}`); | ||
| return response; | ||
| }, | ||
| }; | ||
33 changes: 33 additions & 0 deletions
33
components/optimoroute/actions/get-mobile-events/get-mobile-events.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| import optimoroute from "../../optimoroute.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "optimoroute-get-mobile-events", | ||
| name: "Get Mobile Events", | ||
| description: "Get mobile events from Optimoroute. [See the documentation](https://optimoroute.com/api/#get-mobile-events)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| annotations: { | ||
| destructiveHint: false, | ||
| openWorldHint: true, | ||
| readOnlyHint: true, | ||
| }, | ||
| props: { | ||
| optimoroute, | ||
| afterTag: { | ||
| propDefinition: [ | ||
| optimoroute, | ||
| "afterTag", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.optimoroute.getMobileEvents({ | ||
| $, | ||
| params: { | ||
| after_tag: this.afterTag, | ||
| }, | ||
| }); | ||
| $.export("$summary", `Mobile events found: ${response?.events?.length}`); | ||
| return response; | ||
| }, | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| import optimoroute from "../../optimoroute.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "optimoroute-get-routes", | ||
| name: "Get Routes", | ||
| description: "Get routes from Optimoroute. [See the documentation](https://optimoroute.com/api/#get-routes)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| annotations: { | ||
| destructiveHint: false, | ||
| openWorldHint: true, | ||
| readOnlyHint: true, | ||
| }, | ||
| props: { | ||
| optimoroute, | ||
| date: { | ||
| type: "string", | ||
| label: "Date", | ||
| description: "Queried date. YYYY-MM-DD format, for example `2013-12-20`", | ||
| }, | ||
| driverExternalId: { | ||
| type: "string", | ||
| label: "Driver External ID", | ||
| description: "Optionally filter by drivers external identifier", | ||
| optional: true, | ||
| }, | ||
| driverSerial: { | ||
| type: "string", | ||
| label: "Driver Serial", | ||
| description: "Optionally filter by Serial number of the Driver", | ||
| optional: true, | ||
| }, | ||
| vehicleRegistration: { | ||
| type: "string", | ||
| label: "Vehicle Registration", | ||
| description: "Optionally filter by Vehicle registration", | ||
| optional: true, | ||
| }, | ||
| includeRoutePolyline: { | ||
| type: "boolean", | ||
| label: "Include Route Polyline", | ||
| description: "Optional property to include route polyline in the output", | ||
| optional: true, | ||
| }, | ||
| includeRouteStartEnd: { | ||
| type: "boolean", | ||
| label: "Include Route Start End", | ||
| description: "Optional property to include the route's start and end locations in the output", | ||
| optional: true, | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.optimoroute.getRoutes({ | ||
| $, | ||
| params: { | ||
| date: this.date, | ||
| driverExternalId: this.driverExternalId, | ||
| driverSerial: this.driverSerial, | ||
| vehicleRegistration: this.vehicleRegistration, | ||
| includeRoutePolyline: this.includeRoutePolyline, | ||
| includeRouteStartEnd: this.includeRouteStartEnd, | ||
| }, | ||
| }); | ||
| $.export("$summary", `Routes found: ${response.routes.length}`); | ||
| return response; | ||
| }, | ||
| }; |
61 changes: 61 additions & 0 deletions
61
components/optimoroute/actions/search-orders/search-orders.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| import optimoroute from "../../optimoroute.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "optimoroute-search-orders", | ||
| name: "Search Orders", | ||
| description: "Search for orders in Optimoroute. [See the documentation](https://optimoroute.com/api/#search-orders)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| annotations: { | ||
| destructiveHint: false, | ||
| openWorldHint: true, | ||
| readOnlyHint: true, | ||
| }, | ||
| props: { | ||
| optimoroute, | ||
| from: { | ||
| type: "string", | ||
| label: "From", | ||
| description: "From date. YYYY-MM-DD format, for example `2013-12-20`. The range can span at most 35 days, i.e. 5 weeks", | ||
| }, | ||
| to: { | ||
| type: "string", | ||
| label: "To", | ||
| description: "To date. YYYY-MM-DD format, for example `2013-12-20`. The range can span at most 35 days, i.e. 5 weeks", | ||
| }, | ||
| includeOrderData: { | ||
| type: "boolean", | ||
| label: "Include Order Data", | ||
| description: "Include order data in the response", | ||
| optional: true, | ||
| }, | ||
| includeScheduleInformation: { | ||
| type: "boolean", | ||
| label: "Include Schedule Information", | ||
| description: "Include schedule information in the response", | ||
| optional: true, | ||
| }, | ||
| afterTag: { | ||
| propDefinition: [ | ||
| optimoroute, | ||
| "afterTag", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.optimoroute.searchOrders({ | ||
| $, | ||
| data: { | ||
| dateRange: { | ||
| from: this.from, | ||
| to: this.to, | ||
| }, | ||
| includeOrderData: this.includeOrderData, | ||
| includeScheduleInformation: this.includeScheduleInformation, | ||
| after_tag: this.afterTag, | ||
| }, | ||
| }); | ||
| $.export("$summary", `Orders found: ${response?.orders?.length}`); | ||
| return response; | ||
| }, | ||
| }; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.