Skip to content

Commit 9a10f2d

Browse files
committed
new components
1 parent 6647be1 commit 9a10f2d

File tree

6 files changed

+140
-156
lines changed

6 files changed

+140
-156
lines changed
Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,28 @@
11
import geoapify from "../../geoapify.app.mjs";
2-
import { axios } from "@pipedream/platform";
32

43
export default {
54
key: "geoapify-get-ip-location",
65
name: "Get IP Location",
76
description: "Retrieves geographical coordinates for a given IP address. [See the documentation](https://apidocs.geoapify.com/docs/ip-geolocation/)",
8-
version: "0.0.{{ts}}",
7+
version: "0.0.1",
98
type: "action",
109
props: {
1110
geoapify,
1211
ipAddress: {
13-
propDefinition: [
14-
geoapify,
15-
"ipAddress",
16-
],
12+
type: "string",
13+
label: "IP Address",
14+
description: "The IP address to lookup",
15+
optional: true,
1716
},
1817
},
1918
async run({ $ }) {
2019
const response = await this.geoapify.geolocateIP({
21-
ipAddress: this.ipAddress,
20+
$,
21+
params: {
22+
ipAddress: this.ipAddress,
23+
},
2224
});
23-
$.export("$summary", `Retrieved location for IP: ${this.ipAddress}`);
25+
$.export("$summary", `Retrieved location for IP: ${response.ip}`);
2426
return response;
2527
},
2628
};

components/geoapify/actions/get-route/get-route.mjs

Lines changed: 22 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,79 +1,69 @@
11
import geoapify from "../../geoapify.app.mjs";
2-
import { axios } from "@pipedream/platform";
32

43
export default {
54
key: "geoapify-get-route",
65
name: "Get Route",
76
description: "Calculates a route between two sets of latitude and longitude points. [See the documentation](https://apidocs.geoapify.com/docs/routing/)",
8-
version: "0.0.{{ts}}",
7+
version: "0.0.1",
98
type: "action",
109
props: {
1110
geoapify,
1211
fromLatitude: {
13-
propDefinition: [
14-
geoapify,
15-
"fromLatitude",
16-
],
12+
type: "string",
13+
label: "From Latitude",
14+
description: "The latitude of the starting point",
1715
},
1816
fromLongitude: {
19-
propDefinition: [
20-
geoapify,
21-
"fromLongitude",
22-
],
17+
type: "string",
18+
label: "From Longitude",
19+
description: "The longitude of the starting point",
2320
},
2421
toLatitude: {
25-
propDefinition: [
26-
geoapify,
27-
"toLatitude",
28-
],
22+
type: "string",
23+
label: "To Latitude",
24+
description: "The latitude of the destination point",
2925
},
3026
toLongitude: {
31-
propDefinition: [
32-
geoapify,
33-
"toLongitude",
34-
],
27+
type: "string",
28+
label: "To Longitude",
29+
description: "The longitude of the destination point",
3530
},
3631
mode: {
3732
propDefinition: [
3833
geoapify,
3934
"mode",
4035
],
41-
optional: true,
4236
},
4337
type: {
4438
propDefinition: [
4539
geoapify,
46-
"type",
40+
"routeOptimizationType",
4741
],
48-
optional: true,
4942
},
5043
units: {
5144
propDefinition: [
5245
geoapify,
5346
"units",
5447
],
55-
optional: true,
5648
},
5749
format: {
5850
propDefinition: [
5951
geoapify,
6052
"format",
6153
],
62-
optional: true,
6354
},
6455
},
6556
async run({ $ }) {
6657
const route = await this.geoapify.calculateRoute({
67-
fromLatitude: this.fromLatitude,
68-
fromLongitude: this.fromLongitude,
69-
toLatitude: this.toLatitude,
70-
toLongitude: this.toLongitude,
71-
mode: this.mode,
72-
type: this.type,
73-
units: this.units,
74-
format: this.format,
58+
$,
59+
params: {
60+
waypoints: `${this.fromLatitude},${this.fromLongitude}|${this.toLatitude},${this.toLongitude}`,
61+
mode: this.mode,
62+
type: this.type,
63+
units: this.units,
64+
format: this.format,
65+
},
7566
});
76-
7767
$.export("$summary", "Route calculated successfully");
7868
return route;
7969
},
Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,41 @@
11
import geoapify from "../../geoapify.app.mjs";
2-
import { axios } from "@pipedream/platform";
32

43
export default {
54
key: "geoapify-search-address",
65
name: "Search Address",
76
description: "Retrieves geocoding information for a given address. [See the documentation](https://apidocs.geoapify.com/docs/geocoding/forward-geocoding/)",
8-
version: "0.0.{{ts}}",
7+
version: "0.0.1",
98
type: "action",
109
props: {
1110
geoapify,
1211
address: {
13-
propDefinition: [
14-
"geoapify",
15-
"address",
16-
],
12+
type: "string",
13+
label: "Address",
14+
description: "The address to search. E.g. `44 Montgomery St., San Francisco, CA 94104`",
1715
},
1816
type: {
1917
propDefinition: [
20-
"geoapify",
21-
"type",
18+
geoapify,
19+
"locationType",
2220
],
2321
},
2422
format: {
2523
propDefinition: [
26-
"geoapify",
24+
geoapify,
2725
"format",
2826
],
2927
},
3028
},
3129
async run({ $ }) {
3230
const response = await this.geoapify.geocodeAddress({
33-
address: this.address,
34-
type: this.type,
35-
format: this.format,
31+
$,
32+
params: {
33+
text: this.address,
34+
type: this.type,
35+
format: this.format,
36+
},
3637
});
37-
$.export("$summary", `Successfully retrieved geocoding information for address ${this.address}`);
38+
$.export("$summary", `Successfully retrieved geocoding information for address: ${this.address}`);
3839
return response;
3940
},
4041
};
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
const LOCATION_TYPES = [
2+
"country",
3+
"state",
4+
"city",
5+
"postcode",
6+
"street",
7+
"amenity",
8+
"locality",
9+
];
10+
11+
const FORMATS = [
12+
"json",
13+
"xml",
14+
"geojson",
15+
];
16+
17+
const TRANSPORTATION_MODES = [
18+
"drive",
19+
"light_truck",
20+
"medium_truck",
21+
"truck",
22+
"heavy_truck",
23+
"truck_dangerous_goods",
24+
"long_truck",
25+
"bus",
26+
"scooter",
27+
"motorcycle",
28+
"bicycle",
29+
"mountain_bike",
30+
"road_bike",
31+
"walk",
32+
"hike",
33+
"transit",
34+
"approximated_transit",
35+
];
36+
37+
const ROUTE_OPTIMIZATION_TYPES = [
38+
"balanced",
39+
"short",
40+
"less_maneuvers",
41+
];
42+
43+
const UNITS = [
44+
"metric",
45+
"imperial",
46+
];
47+
48+
export default {
49+
LOCATION_TYPES,
50+
FORMATS,
51+
TRANSPORTATION_MODES,
52+
ROUTE_OPTIMIZATION_TYPES,
53+
UNITS,
54+
};

0 commit comments

Comments
 (0)