-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New Components - geoapify #15537
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
New Components - geoapify #15537
Changes from all commits
Commits
Show all changes
3 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
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
components/geoapify/actions/get-ip-location/get-ip-location.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,28 @@ | ||
| import geoapify from "../../geoapify.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "geoapify-get-ip-location", | ||
| name: "Get IP Location", | ||
| description: "Retrieves geographical coordinates for a given IP address. [See the documentation](https://apidocs.geoapify.com/docs/ip-geolocation/)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| geoapify, | ||
| ipAddress: { | ||
| type: "string", | ||
| label: "IP Address", | ||
| description: "The IP address to lookup", | ||
| optional: true, | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.geoapify.geolocateIP({ | ||
| $, | ||
| params: { | ||
| ipAddress: this.ipAddress, | ||
| }, | ||
| }); | ||
| $.export("$summary", `Retrieved location for IP: ${response.ip}`); | ||
| return response; | ||
| }, | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }; | ||
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,70 @@ | ||
| import geoapify from "../../geoapify.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "geoapify-get-route", | ||
| name: "Get Route", | ||
| description: "Calculates a route between two sets of latitude and longitude points. [See the documentation](https://apidocs.geoapify.com/docs/routing/)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| geoapify, | ||
| fromLatitude: { | ||
| type: "string", | ||
| label: "From Latitude", | ||
| description: "The latitude of the starting point", | ||
| }, | ||
| fromLongitude: { | ||
| type: "string", | ||
| label: "From Longitude", | ||
| description: "The longitude of the starting point", | ||
| }, | ||
| toLatitude: { | ||
| type: "string", | ||
| label: "To Latitude", | ||
| description: "The latitude of the destination point", | ||
| }, | ||
| toLongitude: { | ||
| type: "string", | ||
| label: "To Longitude", | ||
| description: "The longitude of the destination point", | ||
| }, | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| mode: { | ||
| propDefinition: [ | ||
| geoapify, | ||
| "mode", | ||
| ], | ||
| }, | ||
| type: { | ||
| propDefinition: [ | ||
| geoapify, | ||
| "routeOptimizationType", | ||
| ], | ||
| }, | ||
| units: { | ||
| propDefinition: [ | ||
| geoapify, | ||
| "units", | ||
| ], | ||
| }, | ||
| format: { | ||
| propDefinition: [ | ||
| geoapify, | ||
| "format", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const route = await this.geoapify.calculateRoute({ | ||
| $, | ||
| params: { | ||
| waypoints: `${this.fromLatitude},${this.fromLongitude}|${this.toLatitude},${this.toLongitude}`, | ||
| mode: this.mode, | ||
| type: this.type, | ||
| units: this.units, | ||
| format: this.format, | ||
| }, | ||
| }); | ||
| $.export("$summary", "Route calculated successfully"); | ||
| return route; | ||
| }, | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }; | ||
41 changes: 41 additions & 0 deletions
41
components/geoapify/actions/search-address/search-address.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,41 @@ | ||
| import geoapify from "../../geoapify.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "geoapify-search-address", | ||
| name: "Search Address", | ||
| description: "Retrieves geocoding information for a given address. [See the documentation](https://apidocs.geoapify.com/docs/geocoding/forward-geocoding/)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| geoapify, | ||
| address: { | ||
| type: "string", | ||
| label: "Address", | ||
| description: "The address to search. E.g. `44 Montgomery St., San Francisco, CA 94104`", | ||
| }, | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| type: { | ||
| propDefinition: [ | ||
| geoapify, | ||
| "locationType", | ||
| ], | ||
| }, | ||
| format: { | ||
| propDefinition: [ | ||
| geoapify, | ||
| "format", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.geoapify.geocodeAddress({ | ||
| $, | ||
| params: { | ||
| text: this.address, | ||
| type: this.type, | ||
| format: this.format, | ||
| }, | ||
| }); | ||
| $.export("$summary", `Successfully retrieved geocoding information for address: ${this.address}`); | ||
| return response; | ||
| }, | ||
michelle0927 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }; | ||
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,54 @@ | ||
| const LOCATION_TYPES = [ | ||
| "country", | ||
| "state", | ||
| "city", | ||
| "postcode", | ||
| "street", | ||
| "amenity", | ||
| "locality", | ||
| ]; | ||
|
|
||
| const FORMATS = [ | ||
| "json", | ||
| "xml", | ||
| "geojson", | ||
| ]; | ||
|
|
||
| const TRANSPORTATION_MODES = [ | ||
| "drive", | ||
| "light_truck", | ||
| "medium_truck", | ||
| "truck", | ||
| "heavy_truck", | ||
| "truck_dangerous_goods", | ||
| "long_truck", | ||
| "bus", | ||
| "scooter", | ||
| "motorcycle", | ||
| "bicycle", | ||
| "mountain_bike", | ||
| "road_bike", | ||
| "walk", | ||
| "hike", | ||
| "transit", | ||
| "approximated_transit", | ||
| ]; | ||
|
|
||
| const ROUTE_OPTIMIZATION_TYPES = [ | ||
| "balanced", | ||
| "short", | ||
| "less_maneuvers", | ||
| ]; | ||
|
|
||
| const UNITS = [ | ||
| "metric", | ||
| "imperial", | ||
| ]; | ||
|
|
||
| export default { | ||
| LOCATION_TYPES, | ||
| FORMATS, | ||
| TRANSPORTATION_MODES, | ||
| ROUTE_OPTIMIZATION_TYPES, | ||
| UNITS, | ||
| }; |
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 |
|---|---|---|
| @@ -1,11 +1,81 @@ | ||
| import { axios } from "@pipedream/platform"; | ||
| import constants from "./common/constants.mjs"; | ||
|
|
||
| export default { | ||
| type: "app", | ||
| app: "geoapify", | ||
| propDefinitions: {}, | ||
| propDefinitions: { | ||
| locationType: { | ||
| type: "string", | ||
| label: "Type", | ||
| description: "The location type. If set to `locality`, returns administrative areas including postcodes, districts, cities, counties, and states.", | ||
| options: constants.LOCATION_TYPES, | ||
| optional: true, | ||
| }, | ||
| format: { | ||
| type: "string", | ||
| label: "Format", | ||
| description: "The format of the response, default value is `geojson`", | ||
| options: constants.FORMATS, | ||
| optional: true, | ||
| }, | ||
| mode: { | ||
| type: "string", | ||
| label: "Mode", | ||
| description: "The mode of transportation", | ||
| options: constants.TRANSPORTATION_MODES, | ||
| }, | ||
| routeOptimizationType: { | ||
| type: "string", | ||
| label: "Type", | ||
| description: "The route optimization type", | ||
| options: constants.ROUTE_OPTIMIZATION_TYPES, | ||
| optional: true, | ||
| }, | ||
| units: { | ||
| type: "string", | ||
| label: "Units", | ||
| description: "Distance units for the calculated route, the default value is `metric`", | ||
| options: constants.UNITS, | ||
| optional: true, | ||
| }, | ||
| }, | ||
| methods: { | ||
| // this.$auth contains connected account data | ||
| authKeys() { | ||
| console.log(Object.keys(this.$auth)); | ||
| _baseUrl() { | ||
| return "https://api.geoapify.com/v1"; | ||
| }, | ||
| _makeRequest({ | ||
| $ = this, | ||
| path, | ||
| params, | ||
| ...otherOpts | ||
| }) { | ||
| return axios($, { | ||
| ...otherOpts, | ||
| url: `${this._baseUrl()}${path}`, | ||
| params: { | ||
| ...params, | ||
| apiKey: this.$auth.api_key, | ||
| }, | ||
| }); | ||
| }, | ||
| geocodeAddress(opts = {}) { | ||
| return this._makeRequest({ | ||
| path: "/geocode/search", | ||
| ...opts, | ||
| }); | ||
| }, | ||
| calculateRoute(opts = {}) { | ||
| return this._makeRequest({ | ||
| path: "/routing", | ||
| ...opts, | ||
| }); | ||
| }, | ||
| geolocateIP(opts = {}) { | ||
| return this._makeRequest({ | ||
| path: "/ipinfo", | ||
| ...opts, | ||
| }); | ||
| }, | ||
| }, | ||
| }; | ||
| }; |
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 |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| { | ||
| "name": "@pipedream/geoapify", | ||
| "version": "0.0.1", | ||
| "version": "0.1.0", | ||
| "description": "Pipedream Geoapify Components", | ||
| "main": "geoapify.app.mjs", | ||
| "keywords": [ | ||
|
|
@@ -11,5 +11,8 @@ | |
| "author": "Pipedream <[email protected]> (https://pipedream.com/)", | ||
| "publishConfig": { | ||
| "access": "public" | ||
| }, | ||
| "dependencies": { | ||
| "@pipedream/platform": "^3.0.3" | ||
| } | ||
| } | ||
| } | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.