Skip to content

Commit be9b680

Browse files
committed
Get Categories Aggregation
1 parent fd10bfd commit be9b680

File tree

3 files changed

+97
-19
lines changed

3 files changed

+97
-19
lines changed
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
import { parseObjectEntries } from "../../common/utils.mjs";
2+
import dataforseo from "../../dataforseo.app.mjs";
3+
4+
export default {
5+
key: "dataforseo-get-categories-aggregation",
6+
name: "Get Categories Aggregation",
7+
description:
8+
"Get information about groups of related categories and the number of entities in each category. [See the documentation](https://docs.dataforseo.com/v3/business_data/business_listings/categories_aggregation/live/)",
9+
version: "0.0.1",
10+
type: "action",
11+
methods: {
12+
getCategoriesAggregation(args = {}) {
13+
return this._makeRequest({
14+
path: "/business_data/business_listings/categories_aggregation/live",
15+
method: "post",
16+
...args,
17+
});
18+
},
19+
},
20+
props: {
21+
dataforseo,
22+
categories: {
23+
propDefinition: [
24+
dataforseo,
25+
"businessCategories",
26+
],
27+
},
28+
description: {
29+
propDefinition: [
30+
dataforseo,
31+
"description",
32+
],
33+
},
34+
title: {
35+
propDefinition: [
36+
dataforseo,
37+
"title",
38+
],
39+
},
40+
locationCoordinate: {
41+
propDefinition: [
42+
dataforseo,
43+
"locationCoordinate",
44+
],
45+
optional: true,
46+
},
47+
tag: {
48+
propDefinition: [
49+
dataforseo,
50+
"tag",
51+
],
52+
},
53+
additionalOptions: {
54+
propDefinition: [
55+
dataforseo,
56+
"additionalOptions",
57+
],
58+
description:
59+
"Additional parameters to send in the request. [See the documentation](https://docs.dataforseo.com/v3/business_data/business_listings/categories_aggregation/live/) for all available parameters. Values will be parsed as JSON where applicable.",
60+
},
61+
},
62+
async run({ $ }) {
63+
const response = await this.getCategoriesAggregation({
64+
$,
65+
data: [
66+
{
67+
categories: this.categories,
68+
description: this.description,
69+
title: this.title,
70+
location_coordinate: this.locationCoordinate,
71+
tag: this.tag,
72+
...parseObjectEntries(this.additionalOptions),
73+
},
74+
],
75+
});
76+
$.export("$summary", "Successfully retrieved categories aggregation");
77+
return response;
78+
},
79+
};

components/dataforseo/actions/search-business-listings/search-business-listings.mjs

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -20,30 +20,28 @@ export default {
2020
props: {
2121
dataforseo,
2222
categories: {
23-
type: "string[]",
24-
label: "Business Categories",
25-
description: "Up to 10 categories used to search for business listings.",
26-
optional: true,
23+
propDefinition: [
24+
dataforseo,
25+
"businessCategories",
26+
],
2727
},
2828
description: {
29-
type: "string",
30-
label: "Description",
31-
description:
32-
"Description of the business entity for which the results are collected",
33-
optional: true,
29+
propDefinition: [
30+
dataforseo,
31+
"description",
32+
],
3433
},
3534
title: {
36-
type: "string",
37-
label: "Title",
38-
description:
39-
"Title of the business entity for which the results are collected",
40-
optional: true,
35+
propDefinition: [
36+
dataforseo,
37+
"title",
38+
],
4139
},
4240
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`",
41+
propDefinition: [
42+
dataforseo,
43+
"locationCoordinate",
44+
],
4745
optional: true,
4846
},
4947
tag: {

components/dataforseo/dataforseo.app.mjs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ export default {
2323
locationCoordinate: {
2424
type: "string",
2525
label: "Location Coordinate",
26-
description: "The coordinate of the target location. It should be specified in the “latitude,longitude,radius” format, i.e.: `53.476225,-2.243572,200`",
26+
description:
27+
"The location to search, in the format `latitude,longitude,radius` where radius is specified in kilometers. Example: `53.476225,-2.243572,200`",
2728
},
2829
targetType: {
2930
type: "string",

0 commit comments

Comments
 (0)