-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New Components - tripadvisor_content_api #11403
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
Changes from 11 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
000dfbe
tripadvisor_content_api init
lcaresia d9b3e30
Added actons
lcaresia d3331d6
Merge remote-tracking branch 'origin/master' into issue-11268
lcaresia 9a86c01
Update components/tripadvisor_content_api/actions/location-reviews/lo…
lcaresia fcc4519
Update components/tripadvisor_content_api/actions/location-search/loc…
lcaresia 597da73
Update components/tripadvisor_content_api/tripadvisor_content_api.app…
lcaresia aa5ab48
Update components/tripadvisor_content_api/tripadvisor_content_api.app…
lcaresia 1f910d2
Update components/tripadvisor_content_api/tripadvisor_content_api.app…
lcaresia a55ebc9
Update components/tripadvisor_content_api/tripadvisor_content_api.app…
lcaresia cd018f5
Bump package.json version
lcaresia 80b81c4
Remove redundant prop
vunguyenhung bca8cf1
Remove redundant prop
vunguyenhung 8f57c9f
Revert "Remove redundant prop"
vunguyenhung 7e61c2d
Revert "Remove redundant prop"
vunguyenhung 716956d
Merge remote-tracking branch 'origin/master' into issue-11268
lcaresia e57e1ac
Fixing file name
lcaresia 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
37 changes: 37 additions & 0 deletions
37
components/tripadvisor_content_api/actions/location-details/location-details.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,37 @@ | ||
| import app from "../../tripadvisor_content_api.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "tripadvisor_content_api-get-location-details", | ||
| name: "Get Location Details", | ||
| description: "Returns comprehensive information about a location. [See the documentation](https://tripadvisor-content-api.readme.io/reference/getlocationdetails)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| app, | ||
| searchQuery: { | ||
| propDefinition: [ | ||
| app, | ||
| "searchQuery", | ||
| ], | ||
| }, | ||
| locationId: { | ||
| propDefinition: [ | ||
| app, | ||
| "locationId", | ||
| (c) => ({ | ||
| searchQuery: c.searchQuery, | ||
| }), | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.app.getLocationDetails({ | ||
| $, | ||
| locationId: this.locationId, | ||
| }); | ||
|
|
||
| $.export("$summary", `Successfully returned the details for location '${response.name}'`); | ||
|
|
||
| return response; | ||
| }, | ||
| }; | ||
31 changes: 31 additions & 0 deletions
31
components/tripadvisor_content_api/actions/location-reviews/location-reviews.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,31 @@ | ||
| import app from "../../tripadvisor_content_api.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "tripadvisor_content_api-location-reviews", | ||
| name: "Get Location Reviews", | ||
| description: "Returns up to 5 of the most recent reviews for a specific location. [See the documentation](https://tripadvisor-content-api.readme.io/reference/getlocationreviews)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| app, | ||
| locationId: { | ||
| propDefinition: [ | ||
| app, | ||
| "locationId", | ||
| (c) => ({ | ||
| searchQuery: c.searchQuery, | ||
| }), | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.app.getLocationReviews({ | ||
| $, | ||
| locationId: this.locationId, | ||
| }); | ||
|
|
||
| $.export("$summary", `Successfully listed ${response.data.length} of the most recent reviews for the specified location`); | ||
|
|
||
| return response; | ||
| }, | ||
| }; |
44 changes: 44 additions & 0 deletions
44
components/tripadvisor_content_api/actions/location-search/location-search.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,44 @@ | ||
| import app from "../../tripadvisor_content_api.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "tripadvisor_content_api-location-search", | ||
| name: "Search Locations", | ||
| description: "Returns up to 10 locations found by the given search query. [See the documentation](https://tripadvisor-content-api.readme.io/reference/searchforlocations)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| app, | ||
| searchQuery: { | ||
| propDefinition: [ | ||
| app, | ||
| "searchQuery", | ||
| ], | ||
| }, | ||
| category: { | ||
| propDefinition: [ | ||
| app, | ||
| "category", | ||
| ], | ||
| }, | ||
| address: { | ||
| propDefinition: [ | ||
| app, | ||
| "address", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.app.searchLocations({ | ||
| $, | ||
| params: { | ||
| searchQuery: this.searchQuery, | ||
| category: this.category, | ||
| address: this.address, | ||
| }, | ||
| }); | ||
|
|
||
| $.export("$summary", `Found ${response.data.length} location(s)`); | ||
|
|
||
| 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
89 changes: 85 additions & 4 deletions
89
components/tripadvisor_content_api/tripadvisor_content_api.app.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 |
|---|---|---|
| @@ -1,11 +1,92 @@ | ||
| import { axios } from "@pipedream/platform"; | ||
|
|
||
| export default { | ||
| type: "app", | ||
| app: "tripadvisor_content_api", | ||
| propDefinitions: {}, | ||
| propDefinitions: { | ||
| locationId: { | ||
| type: "string", | ||
| label: "Location ID", | ||
| description: "The ID of the location", | ||
| async options({ searchQuery }) { | ||
| const { data: resources } = await this.searchLocations({ | ||
| params: { | ||
| searchQuery, | ||
| }, | ||
| }); | ||
| return resources.map(({ | ||
| location_id, name, | ||
| }) => ({ | ||
| value: location_id, | ||
| label: name, | ||
| })); | ||
| }, | ||
| }, | ||
| searchQuery: { | ||
| type: "string", | ||
| label: "Search Query", | ||
| description: "The search query to find locations", | ||
| }, | ||
| address: { | ||
| type: "string", | ||
| label: "Location Address", | ||
| description: "The address of the location", | ||
| optional: true, | ||
| }, | ||
| category: { | ||
| type: "string", | ||
| label: "Location Category", | ||
| description: "The category of the location", | ||
| optional: true, | ||
| options: [ | ||
| "hotels", | ||
| "attractions", | ||
| "restaurants", | ||
| "geos", | ||
| ], | ||
| }, | ||
| }, | ||
| methods: { | ||
| // this.$auth contains connected account data | ||
| authKeys() { | ||
| console.log(Object.keys(this.$auth)); | ||
| _baseUrl() { | ||
| return "https://api.content.tripadvisor.com/api/v1"; | ||
| }, | ||
| _makeRequest(opts = {}) { | ||
| const { | ||
| $ = this, | ||
| path, | ||
| params, | ||
| ...otherOpts | ||
| } = opts; | ||
| return axios($, { | ||
| ...otherOpts, | ||
| url: this._baseUrl() + path, | ||
| params: { | ||
| ...params, | ||
| key: `${this.$auth.api_key}`, | ||
| }, | ||
| }); | ||
| }, | ||
| getLocationDetails({ | ||
| locationId, ...args | ||
| }) { | ||
| return this._makeRequest({ | ||
| ...args, | ||
| path: `/location/${locationId}/details`, | ||
| }); | ||
| }, | ||
| getLocationReviews({ | ||
| locationId, ...args | ||
| }) { | ||
| return this._makeRequest({ | ||
| ...args, | ||
| path: `/location/${locationId}/reviews`, | ||
| }); | ||
| }, | ||
| searchLocations(args = {}) { | ||
| return this._makeRequest({ | ||
| ...args, | ||
| path: "/location/search", | ||
| }); | ||
| }, | ||
| }, | ||
| }; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.