Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import app from "../../tomtom.app.mjs";

export default {
key: "tomtom-autocomplete-search",
name: "Autocomplete Search",
description: "Get search terms based on the provided query. [See the documentation](https://developer.tomtom.com/search-api/documentation/autocomplete-service/autocomplete)",
version: "0.0.1",
annotations: {
openWorldHint: true,
destructiveHint: false,
readOnlyHint: true,
},
type: "action",
props: {
app,
query: {
propDefinition: [
app,
"query",
],
},
language: {
propDefinition: [
app,
"language",
],
},
extension: {
propDefinition: [
app,
"extension",
],
},
},
async run({ $ }) {
const response = await this.app.autocompleteSearch({
$,
extension: this.extension,
query: this.query,
params: {
language: this.language,
},
});
$.export("$summary", "Successfully retrieved " + response.results.length + " results");
return response;
},
};
61 changes: 61 additions & 0 deletions components/tomtom/actions/nearby-search/nearby-search.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import app from "../../tomtom.app.mjs";

export default {
key: "tomtom-nearby-search",
name: "Nearby Search",
description: "Get Points of Interest around your current location. [See the documentation](https://developer.tomtom.com/search-api/documentation/search-service/search-service)",
version: "0.0.1",
annotations: {
destructiveHint: false,
openWorldHint: true,
readOnlyHint: true,
},
type: "action",
props: {
app,
language: {
propDefinition: [
app,
"language",
],
},
lat: {
propDefinition: [
app,
"lat",
],
},
lon: {
propDefinition: [
app,
"lon",
],
},
radius: {
propDefinition: [
app,
"radius",
],
},
limit: {
propDefinition: [
app,
"limit",
],
},
},
Comment on lines +14 to +46
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Add the missing extension property.

The action doesn't define an extension prop, but the app.nearbySearch method (line 80 in tomtom.app.mjs) requires it to construct the API path. Without it, the extension will be undefined, resulting in an invalid API URL.

Add the extension prop to match the autocomplete-search pattern:

     limit: {
       propDefinition: [
         app,
         "limit",
       ],
     },
+    extension: {
+      propDefinition: [
+        app,
+        "extension",
+      ],
+    },
   },

And pass it to the method call:

   async run({ $ }) {
     const response = await this.app.nearbySearch({
       $,
+      extension: this.extension,
       params: {
         language: this.language,

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In components/tomtom/actions/nearby-search/nearby-search.mjs around lines 14 to
46, the action is missing an extension prop which app.nearbySearch
(tomtom.app.mjs line ~80) requires to build the API path; add an extension prop
entry matching the existing pattern (use propDefinition: [app, "extension"] like
the autocomplete-search implementation) and then ensure the extension value is
passed into the call to app.nearbySearch where nearby-search invokes it so the
API URL is constructed with the extension provided.

async run({ $ }) {
const response = await this.app.nearbySearch({
$,
params: {
language: this.language,
lat: this.lat,
lon: this.lon,
radius: this.radius,
limit: this.limit,
},
});
$.export("$summary", "Successfully retrieved " + response.results.length + " results");
return response;
},
};
68 changes: 68 additions & 0 deletions components/tomtom/actions/poi-search/poi-search.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import app from "../../tomtom.app.mjs";

export default {
key: "tomtom-poi-search",
name: "POI Search",
description: "Search for Points of Interest. [See the documentation](https://developer.tomtom.com/search-api/documentation/search-service/points-of-interest-search)",
version: "0.0.1",
annotations: {
destructiveHint: false,
openWorldHint: true,
readOnlyHint: true,
},
type: "action",
props: {
app,
query: {
propDefinition: [
app,
"query",
],
},
language: {
propDefinition: [
app,
"language",
],
},
lat: {
propDefinition: [
app,
"lat",
],
},
lon: {
propDefinition: [
app,
"lon",
],
},
radius: {
propDefinition: [
app,
"radius",
],
},
limit: {
propDefinition: [
app,
"limit",
],
},
},
Comment on lines +14 to +52
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Add the missing extension property.

Similar to the nearby-search action, this action doesn't define an extension prop, but the app.poiSearch method (line 89 in tomtom.app.mjs) requires it to construct the API path. Without it, the extension will be undefined, resulting in an invalid API URL.

Add the extension prop:

     limit: {
       propDefinition: [
         app,
         "limit",
       ],
     },
+    extension: {
+      propDefinition: [
+        app,
+        "extension",
+      ],
+    },
   },

And pass it to the method call:

   async run({ $ }) {
     const response = await this.app.poiSearch({
       $,
+      extension: this.extension,
       query: this.query,
       params: {

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In components/tomtom/actions/poi-search/poi-search.mjs around lines 14 to 52,
the props object is missing the required extension property which
tomtom.app.mjs's app.poiSearch expects to build the API path; add an extension
prop entry mirroring the nearby-search action (propDefinition: [app,
"extension"]) and then update the call-site that invokes app.poiSearch to pass
the extension argument so the API URL is constructed correctly.

async run({ $ }) {
const response = await this.app.poiSearch({
$,
query: this.query,
params: {
language: this.language,
lat: this.lat,
lon: this.lon,
radius: this.radius,
limit: this.limit,
},
});
$.export("$summary", "Successfully retrieved " + response.results.length + " results");
return response;
},
};
Loading
Loading