Skip to content

Commit 2e34677

Browse files
committed
Added actions
1 parent 7f7145f commit 2e34677

File tree

7 files changed

+522
-46
lines changed

7 files changed

+522
-46
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
import app from "../../tomtom.app.mjs";
2+
3+
export default {
4+
key: "tomtom-autocomplete-search",
5+
name: "Autocomplete Ssearch",
6+
description: "Get search terms based on the provided query. [See the documentation](https://developer.tomtom.com/search-api/documentation/autocomplete-service/autocomplete)",
7+
version: "0.0.1",
8+
annotations: {
9+
openWorldHint: true,
10+
destructiveHint: false,
11+
readOnlyHint: true,
12+
},
13+
type: "action",
14+
props: {
15+
app,
16+
query: {
17+
propDefinition: [
18+
app,
19+
"query",
20+
],
21+
},
22+
language: {
23+
propDefinition: [
24+
app,
25+
"language",
26+
],
27+
},
28+
extension: {
29+
propDefinition: [
30+
app,
31+
"extension",
32+
],
33+
},
34+
},
35+
async run({ $ }) {
36+
const response = await this.app.autocompleteSearch({
37+
$,
38+
extension: this.extension,
39+
query: this.query,
40+
params: {
41+
language: this.language,
42+
},
43+
});
44+
$.export("$summary", "Successfully retrieved " + response.results.length + " results");
45+
return response;
46+
},
47+
};
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
import app from "../../tomtom.app.mjs";
2+
3+
export default {
4+
key: "tomtom-nearby-search",
5+
name: "Nearby Search",
6+
description: "Get Points of Interest around your current location. [See the documentation](https://developer.tomtom.com/search-api/documentation/search-service/search-service)",
7+
version: "0.0.1",
8+
annotations: {
9+
destructiveHint: false,
10+
openWorldHint: true,
11+
readOnlyHint: true,
12+
},
13+
type: "action",
14+
props: {
15+
app,
16+
language: {
17+
propDefinition: [
18+
app,
19+
"language",
20+
],
21+
},
22+
lat: {
23+
propDefinition: [
24+
app,
25+
"lat",
26+
],
27+
},
28+
lon: {
29+
propDefinition: [
30+
app,
31+
"lon",
32+
],
33+
},
34+
radius: {
35+
propDefinition: [
36+
app,
37+
"radius",
38+
],
39+
},
40+
limit: {
41+
propDefinition: [
42+
app,
43+
"limit",
44+
],
45+
},
46+
},
47+
async run({ $ }) {
48+
const response = await this.app.nearbySearch({
49+
$,
50+
params: {
51+
language: this.language,
52+
lat: this.lat,
53+
lon: this.lon,
54+
radius: this.radius,
55+
limit: this.limit,
56+
},
57+
});
58+
$.export("$summary", "Successfully retrieved " + response.results.length + " results");
59+
return response;
60+
},
61+
};
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
import app from "../../tomtom.app.mjs";
2+
3+
export default {
4+
key: "tomtom-poi-search",
5+
name: "POI Search",
6+
description: "Search for Points of Interest. [See the documentation](https://developer.tomtom.com/search-api/documentation/search-service/points-of-interest-search)",
7+
version: "0.0.1",
8+
annotations: {
9+
destructiveHint: false,
10+
openWorldHint: true,
11+
readOnlyHint: true,
12+
},
13+
type: "action",
14+
props: {
15+
app,
16+
query: {
17+
propDefinition: [
18+
app,
19+
"query",
20+
],
21+
},
22+
language: {
23+
propDefinition: [
24+
app,
25+
"language",
26+
],
27+
},
28+
lat: {
29+
propDefinition: [
30+
app,
31+
"lat",
32+
],
33+
},
34+
lon: {
35+
propDefinition: [
36+
app,
37+
"lon",
38+
],
39+
},
40+
radius: {
41+
propDefinition: [
42+
app,
43+
"radius",
44+
],
45+
},
46+
limit: {
47+
propDefinition: [
48+
app,
49+
"limit",
50+
],
51+
},
52+
},
53+
async run({ $ }) {
54+
const response = await this.app.poiSearch({
55+
$,
56+
query: this.query,
57+
params: {
58+
language: this.language,
59+
lat: this.lat,
60+
lon: this.lon,
61+
radius: this.radius,
62+
limit: this.limit,
63+
},
64+
});
65+
$.export("$summary", "Successfully retrieved " + response.results.length + " results");
66+
return response;
67+
},
68+
};

0 commit comments

Comments
 (0)