Skip to content

Commit 1792820

Browse files
committed
selected fields
1 parent 702fcf4 commit 1792820

File tree

2 files changed

+9
-14
lines changed

2 files changed

+9
-14
lines changed

README.md

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,15 @@ Lists available categories.
5656
#### Categories Parameters
5757

5858
- `category` (optional): Filter by category name(s) - comma-separated list
59+
- `client` (optional): Filter by client type (e.g., `mobile`, `desktop`) - defaults to `mobile`
5960
- `onlyname` (optional): If present, returns only category names
6061
- `fields` (optional): Comma-separated list of fields to include in the response (see [Field Selection API Documentation](#field-selection-api-documentation) for details)
6162

6263
#### Categories Response
6364

6465
```bash
6566
curl --request GET \
66-
--url 'https://d{{HOST}}/v1/categories?category=Domain%20parking%2CCI'
67+
--url 'https://{{HOST}}/v1/categories?category=Domain%20parking%2CCI&client=desktop'
6768
```
6869

6970
```json
@@ -74,10 +75,7 @@ curl --request GET \
7475
"Jenkins",
7576
"TeamCity"
7677
],
77-
"origins": {
78-
"mobile": 22,
79-
"desktop": 35
80-
},
78+
"origins": 22,
8179
"category": "CI"
8280
},
8381
{
@@ -86,10 +84,7 @@ curl --request GET \
8684
"Cloudflare",
8785
"Arsys Domain Parking"
8886
],
89-
"origins": {
90-
"mobile": 14,
91-
"desktop": 8
92-
},
87+
"origins": 14,
9388
"category": "Domain parking"
9489
}
9590
]
@@ -588,7 +583,7 @@ The categories and technologies endpoints now support custom field selection, al
588583
- `category` - Category name
589584
- `description` - Category description
590585
- `technologies` - Array of technology names in the category
591-
- `origins` - Array of origin companies/organizations
586+
- `origins` - Number of origins
592587
593588
Get only category names:
594589
@@ -608,7 +603,7 @@ GET /v1/categories?fields=category,description
608603
- `category` - Category name
609604
- `description` - Technology description
610605
- `icon` - Icon filename
611-
- `origins` - Array of origin companies/organizations
606+
- `origins` - Dictionary with origins per client
612607
613608
Get only technology names and categories:
614609
@@ -643,7 +638,7 @@ GET /v1/technologies?category=JavaScript%20Frameworks&fields=technology,icon
643638
644639
- `technology` - Technology name
645640
- `version` - Version name
646-
- `origins` - Mobile and desktop origins
641+
- `origins` - Dictionary with origins per client
647642
648643
Get only technology and version names:
649644

src/controllers/categoriesController.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const listCategories = async (req, res) => {
88
const queryBuilder = async (params) => {
99
/*
1010
// Validate parameters
11-
const supportedParams = ['category', 'onlyname', 'fields'];
11+
const supportedParams = ['category', 'onlyname', 'fields', 'client'];
1212
const providedParams = Object.keys(params);
1313
const unsupportedParams = providedParams.filter(param => !supportedParams.includes(param));
1414
@@ -42,7 +42,7 @@ const listCategories = async (req, res) => {
4242
if (isOnlyNames) {
4343
query = query.select('category');
4444
} else if (hasCustomFields) {
45-
const requestedFields = params.fields.split(',').map(f => f.trim());
45+
const requestedFields = params.fields.split(',').map(f => f.trim()) || ['category', 'description', 'technologies', 'origins'];
4646
query = query.select(...requestedFields);
4747
}
4848

0 commit comments

Comments
 (0)