|
| 1 | +import { parseObjectEntries } from "../../common/utils.mjs"; |
| 2 | +import dataforseo from "../../dataforseo.app.mjs"; |
| 3 | + |
| 4 | +export default { |
| 5 | + key: "dataforseo-search-business-listings", |
| 6 | + name: "Search Business Listings", |
| 7 | + description: |
| 8 | + "Get information about business entities listed on Google Maps. [See the documentation](https://docs.dataforseo.com/v3/business_data/business_listings/search/live/)", |
| 9 | + version: "0.0.1", |
| 10 | + type: "action", |
| 11 | + methods: { |
| 12 | + searchBusinessListings(args = {}) { |
| 13 | + return this._makeRequest({ |
| 14 | + path: "/business_data/business_listings/search/live", |
| 15 | + method: "post", |
| 16 | + ...args, |
| 17 | + }); |
| 18 | + }, |
| 19 | + }, |
| 20 | + props: { |
| 21 | + dataforseo, |
| 22 | + categories: { |
| 23 | + type: "string[]", |
| 24 | + label: "Business Categories", |
| 25 | + description: "Up to 10 categories used to search for business listings.", |
| 26 | + optional: true, |
| 27 | + }, |
| 28 | + description: { |
| 29 | + type: "string", |
| 30 | + label: "Description", |
| 31 | + description: |
| 32 | + "Description of the business entity for which the results are collected", |
| 33 | + optional: true, |
| 34 | + }, |
| 35 | + title: { |
| 36 | + type: "string", |
| 37 | + label: "Title", |
| 38 | + description: |
| 39 | + "Title of the business entity for which the results are collected", |
| 40 | + optional: true, |
| 41 | + }, |
| 42 | + locationCoordinate: { |
| 43 | + type: "string", |
| 44 | + label: "Location Coordinates", |
| 45 | + description: |
| 46 | + "The location to search, in the format `latitude,longitude,radius` where radius is specified in kilometers. Example: `53.476225,-2.243572,200`", |
| 47 | + optional: true, |
| 48 | + }, |
| 49 | + tag: { |
| 50 | + propDefinition: [ |
| 51 | + dataforseo, |
| 52 | + "tag", |
| 53 | + ], |
| 54 | + }, |
| 55 | + additionalOptions: { |
| 56 | + propDefinition: [ |
| 57 | + dataforseo, |
| 58 | + "additionalOptions", |
| 59 | + ], |
| 60 | + description: |
| 61 | + "Additional parameters to send in the request. [See the documentation](https://docs.dataforseo.com/v3/business_data/business_listings/search/live/) for all available parameters. Values will be parsed as JSON where applicable.", |
| 62 | + }, |
| 63 | + }, |
| 64 | + async run({ $ }) { |
| 65 | + const response = await this.getBacklinksHistory({ |
| 66 | + $, |
| 67 | + data: [ |
| 68 | + { |
| 69 | + categories: this.categories, |
| 70 | + description: this.description, |
| 71 | + title: this.title, |
| 72 | + location_coordinate: this.locationCoordinate, |
| 73 | + tag: this.tag, |
| 74 | + ...parseObjectEntries(this.additionalOptions), |
| 75 | + }, |
| 76 | + ], |
| 77 | + }); |
| 78 | + $.export("$summary", "Successfully retrieved business listings"); |
| 79 | + return response; |
| 80 | + }, |
| 81 | +}; |
0 commit comments