File tree Expand file tree Collapse file tree 2 files changed +66
-15
lines changed
functions/categories/libs Expand file tree Collapse file tree 2 files changed +66
-15
lines changed Original file line number Diff line number Diff line change @@ -54,6 +54,61 @@ Returns a JSON object with the following schema:
54
54
]
55
55
```
56
56
57
+ ### ` GET /categories `
58
+
59
+ This endpoint can return a full list of categories names or a categories with all the associated technologies
60
+
61
+ #### Parameters
62
+
63
+ The following parameters can be used to filter the data:
64
+
65
+ - ` category ` (` required ` ): A comma-separated string representing the category name(s).
66
+ - ` onlyname ` (optional): A string 'true' or 'false'.
67
+
68
+ #### Response
69
+
70
+ ``` bash
71
+ curl --request GET \
72
+ --url ' https://dev-gw-2vzgiib6.uk.gateway.dev/v1/categories?category=Domain%20parking%2CCI'
73
+ ```
74
+
75
+ ``` json
76
+ [
77
+ {
78
+ "technologies" : [
79
+ " Arsys Domain Parking"
80
+ ],
81
+ "origins" : 11 ,
82
+ "category" : " Domain parking"
83
+ },
84
+ {
85
+ "technologies" : [
86
+ " Jenkins" ,
87
+ " TeamCity"
88
+ ],
89
+ "origins" : 20 ,
90
+ "category" : " CI"
91
+ }
92
+ ]
93
+ ```
94
+
95
+ ``` bash
96
+ curl --request GET \
97
+ --url ' https://dev-gw-2vzgiib6.uk.gateway.dev/v1/categories?onlyname=true'
98
+ ```
99
+
100
+ ``` json
101
+ [
102
+ " Blogs" ,
103
+ " LMS" ,
104
+ " CI" ,
105
+ " Cross border ecommerce" ,
106
+ " Cart abandonment" ,
107
+ " Domain parking" ,
108
+ ...
109
+ ]
110
+
111
+ ```
57
112
58
113
### ` GET /technologies `
59
114
Original file line number Diff line number Diff line change @@ -11,28 +11,24 @@ def list_data(params):
11
11
12
12
query = ref
13
13
14
- if 'technology' in params :
15
- params_array = convert_to_array (params ['technology' ])
16
- query = query .where ('technology' , 'in' , params_array )
17
-
18
- if 'category' in params :
19
- params_array = convert_to_array (params ['category' ])
20
- query = query .where ('category' , 'in' , params_array )
21
-
22
- documents = query .stream ()
23
-
24
14
data = []
25
15
26
16
if 'onlyname' in params :
17
+ documents = query .stream ()
27
18
28
19
for doc in documents :
29
- item = doc .to_dict ()
30
- if 'category' in item :
31
- data .append (item ['category' ])
20
+ item = doc .to_dict ()
21
+ if 'category' in item :
22
+ data .append (item ['category' ])
32
23
33
24
else :
34
25
35
- for doc in documents :
36
- data .append (doc .to_dict ())
26
+ if 'category' in params :
27
+ category_array = convert_to_array (params ['category' ])
28
+
29
+ for category in category_array :
30
+ results = DB .collection (u'categories' ).where ("category" , "==" , category ).stream ()
31
+ for doc in results :
32
+ data .append (doc .to_dict ())
37
33
38
34
return Result (result = data )
You can’t perform that action at this time.
0 commit comments