11// Endpoints data
22const endpoints = [
33 {
4- endpoint : '/health' ,
5- method : 'GET' ,
6- description : 'Health check endpoint' ,
7- status : 'active' ,
4+ endpoints : [
5+ {
6+ endpoint : '/health' ,
7+ method : 'GET' ,
8+ description : 'Health check endpoint' ,
9+ status : 'active' ,
10+ } ,
11+ ] ,
812 } ,
913 {
10- endpoint : '/api/v1/auth/register' ,
11- method : 'POST' ,
12- description : 'Register a new user account' ,
13- status : 'active' ,
14+ name : 'Authentication' ,
15+ endpoints : [
16+ {
17+ endpoint : '/api/v1/auth/register' ,
18+ method : 'POST' ,
19+ description : 'Register a new user account' ,
20+ status : 'active' ,
21+ } ,
22+ {
23+ endpoint : '/api/v1/auth/login' ,
24+ method : 'POST' ,
25+ description : 'Login with email and password' ,
26+ status : 'active' ,
27+ } ,
28+ {
29+ endpoint : '/api/v1/auth/logout' ,
30+ method : 'POST' ,
31+ description : 'Logout the current user' ,
32+ status : 'active' ,
33+ } ,
34+ {
35+ endpoint : '/api/v1/auth/google' ,
36+ method : 'GET' ,
37+ description : 'Login with Google OAuth' ,
38+ status : 'inactive' ,
39+ } ,
40+ ] ,
1441 } ,
1542 {
16- endpoint : '/api/v1/auth/login' ,
17- method : 'POST' ,
18- description : 'Login with email and password' ,
19- status : 'active' ,
43+ name : 'Workspaces' ,
44+ endpoints : [
45+ {
46+ endpoint : '/api/v1/workspaces' ,
47+ method : 'POST' ,
48+ description : 'Create a new workspace' ,
49+ status : 'active' ,
50+ } ,
51+ {
52+ endpoint : '/api/v1/workspaces' ,
53+ method : 'GET' ,
54+ description : 'Fetch all workspaces for the authenticated user' ,
55+ status : 'active' ,
56+ } ,
57+ {
58+ endpoint : '/api/v1/workspaces/{workspace_id}' ,
59+ method : 'GET' ,
60+ description :
61+ 'Fetch a specific workspace for the authenticated user' ,
62+ status : 'active' ,
63+ } ,
64+ {
65+ endpoint : '/api/v1/workspaces/{workspace_id}' ,
66+ method : 'PUT' ,
67+ description :
68+ 'Update a specific workspace for the authenticated user' ,
69+ status : 'active' ,
70+ } ,
71+ {
72+ endpoint : '/api/v1/workspaces/{workspace_id}' ,
73+ method : 'DELETE' ,
74+ description :
75+ 'Delete a specific workspace for the authenticated user' ,
76+ status : 'active' ,
77+ } ,
78+ {
79+ endpoint :
80+ '/api/v1/workspaces/{workspace_id}/projects?page=1&page_size=20' ,
81+ method : 'GET' ,
82+ description :
83+ 'Fetch projects for a specific workspace for the authenticated user' ,
84+ status : 'active' ,
85+ } ,
86+ ] ,
2087 } ,
21- ,
2288 {
23- endpoint : '/api/v1/auth/logout' ,
24- method : 'POST' ,
25- description : 'Logout the current user' ,
26- status : 'active' ,
89+ name : 'Projects' ,
90+ endpoints : [
91+ {
92+ endpoint : '/api/v1/projects/' ,
93+ method : 'POST' ,
94+ description : 'Create a new project for the specific workspace.' ,
95+ status : 'active' ,
96+ } ,
97+ {
98+ endpoint : '/api/v1/projects/{project_id}' ,
99+ method : 'GET' ,
100+ description :
101+ 'Fetch a specific project for the authenticated user' ,
102+ status : 'active' ,
103+ } ,
104+ {
105+ endpoint : '/api/v1/projects/{project_id}' ,
106+ method : 'PUT' ,
107+ description :
108+ 'Update a specific project for the authenticated user' ,
109+ status : 'active' ,
110+ } ,
111+ {
112+ endpoint : '/api/v1/projects/{project_id}' ,
113+ method : 'DELETE' ,
114+ description :
115+ 'Delete a specific project for the authenticated user' ,
116+ status : 'active' ,
117+ } ,
118+ {
119+ endpoint :
120+ '/api/v1/projects/{project_id}/tasks?status=todo&priority=high&page=1&page_size=20' ,
121+ method : 'GET' ,
122+ description :
123+ 'Fetch tasks for a specific project for the authenticated user' ,
124+ status : 'active' ,
125+ } ,
126+ ] ,
27127 } ,
28128 {
29- endpoint : '/api/v1/auth/google' ,
30- method : 'GET' ,
31- description : 'Login with Google OAuth' ,
32- status : 'active' ,
129+ name : 'Tasks' ,
130+ endpoints : [
131+ {
132+ endpoint : '/api/v1/tasks' ,
133+ method : 'POST' ,
134+ description : 'Create a new task for project.' ,
135+ status : 'active' ,
136+ } ,
137+ {
138+ endpoint : '/api/v1/tasks/{task_id}' ,
139+ method : 'PUT' ,
140+ description :
141+ 'Update a specific task for the authenticated user' ,
142+ status : 'active' ,
143+ } ,
144+ {
145+ endpoint : '/api/v1/tasks/{task_id}' ,
146+ method : 'DELETE' ,
147+ description :
148+ 'Delete a specific task for the authenticated user' ,
149+ status : 'active' ,
150+ } ,
151+ ] ,
33152 } ,
34153] ;
35154
@@ -52,6 +171,19 @@ function getStatusClass(status) {
52171 return statusLower === 'active' ? 'active' : 'inactive' ;
53172}
54173
174+ // Function to get subtle background color for each group
175+ function getGroupColor ( groupName ) {
176+ const groupLower = ( groupName || 'General' ) . toLowerCase ( ) ;
177+ const colorMap = {
178+ general : '#f9fafb' ,
179+ authentication : '#f3e8ff' ,
180+ workspaces : '#ecfdf5' ,
181+ projects : '#eff6ff' ,
182+ tasks : '#fffbeb' ,
183+ } ;
184+ return colorMap [ groupLower ] || '#f9fafb' ;
185+ }
186+
55187// Function to render table rows
56188function renderTable ( ) {
57189 const tbody = document . querySelector ( '.endpoints-table tbody' ) ;
@@ -64,35 +196,48 @@ function renderTable() {
64196 // Clear existing rows
65197 tbody . innerHTML = '' ;
66198
67- // Loop through endpoints and create rows
68- endpoints . forEach ( ( item ) => {
69- const row = document . createElement ( 'tr' ) ;
199+ // Loop through grouped endpoints and create rows
200+ endpoints . forEach ( ( group ) => {
201+ const groupName = group . name || 'General' ;
202+ const groupEndpoints = Array . isArray ( group . endpoints )
203+ ? group . endpoints
204+ : [ ] ;
205+
206+ if ( groupEndpoints . length === 0 ) {
207+ return ;
208+ }
209+
210+ groupEndpoints . forEach ( ( item ) => {
211+ const row = document . createElement ( 'tr' ) ;
212+ row . style . backgroundColor = getGroupColor ( groupName ) ;
213+
214+ const groupCell = document . createElement ( 'td' ) ;
215+ groupCell . textContent = groupName ;
216+ row . appendChild ( groupCell ) ;
70217
71- // Create cells
72- const endpointCell = document . createElement ( 'td' ) ;
73- endpointCell . innerHTML = `<code>${ item . endpoint } </code>` ;
218+ const endpointCell = document . createElement ( 'td' ) ;
219+ endpointCell . innerHTML = `<code>${ item . endpoint } </code>` ;
74220
75- const methodCell = document . createElement ( 'td' ) ;
76- const methodClass = getMethodClass ( item . method ) ;
77- methodCell . innerHTML = `<span class="method-badge ${ methodClass } ">${ item . method . toUpperCase ( ) } </span>` ;
221+ const methodCell = document . createElement ( 'td' ) ;
222+ const methodClass = getMethodClass ( item . method ) ;
223+ methodCell . innerHTML = `<span class="method-badge ${ methodClass } ">${ item . method . toUpperCase ( ) } </span>` ;
78224
79- const descriptionCell = document . createElement ( 'td' ) ;
80- descriptionCell . textContent = item . description ;
225+ const descriptionCell = document . createElement ( 'td' ) ;
226+ descriptionCell . textContent = item . description ;
81227
82- const statusCell = document . createElement ( 'td' ) ;
83- const statusClass = getStatusClass ( item . status ) ;
84- const statusText =
85- item . status . charAt ( 0 ) . toUpperCase ( ) + item . status . slice ( 1 ) ;
86- statusCell . innerHTML = `<span class="status-badge ${ statusClass } ">${ statusText } </span>` ;
228+ const statusCell = document . createElement ( 'td' ) ;
229+ const statusClass = getStatusClass ( item . status ) ;
230+ const statusText =
231+ item . status . charAt ( 0 ) . toUpperCase ( ) + item . status . slice ( 1 ) ;
232+ statusCell . innerHTML = `<span class="status-badge ${ statusClass } ">${ statusText } </span>` ;
87233
88- // Append cells to row
89- row . appendChild ( endpointCell ) ;
90- row . appendChild ( methodCell ) ;
91- row . appendChild ( descriptionCell ) ;
92- row . appendChild ( statusCell ) ;
234+ row . appendChild ( endpointCell ) ;
235+ row . appendChild ( methodCell ) ;
236+ row . appendChild ( descriptionCell ) ;
237+ row . appendChild ( statusCell ) ;
93238
94- // Append row to tbody
95- tbody . appendChild ( row ) ;
239+ tbody . appendChild ( row ) ;
240+ } ) ;
96241 } ) ;
97242}
98243
0 commit comments