forked from isamplesorg/isamplesorg.github.io
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.qmd
More file actions
67 lines (57 loc) · 1.83 KB
/
index.qmd
File metadata and controls
67 lines (57 loc) · 1.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
---
title: "Tutorials: Overview"
---
Here's where we park our various tutorials!
Get the OpenAPI spec.
```{ojs}
//| echo: true
// Get the OpenAPI specification and display detailed endpoint information
viewof apiEndpointDetails = {
// Show loading indicator
const loadingElement = html`<div>Loading API endpoints...</div>`;
document.body.appendChild(loadingElement);
try {
const OPENAPI_URL = 'https://central.isample.xyz/isamples_central/openapi.json';
// Fetch the OpenAPI spec
const response = await fetch(OPENAPI_URL);
if (!response.ok) throw new Error(`Failed to fetch API spec: ${response.status}`);
const apiSpec = await response.json();
// Extract detailed information about each endpoint
const endpointDetails = [];
for (const [path, pathMethods] of Object.entries(apiSpec.paths)) {
for (const [method, details] of Object.entries(pathMethods)) {
endpointDetails.push({
endpoint: path,
method: method.toUpperCase(),
summary: details.summary || '',
operationId: details.operationId || '',
tags: (details.tags || []).join(', '),
parameters: (details.parameters || [])
.map(p => `${p.name} (${p.required ? 'required' : 'optional'})`)
.join(', ')
});
}
}
// Create a table with the detailed endpoint information
return Inputs.table(
endpointDetails,
{
label: "iSamples API Endpoints Details",
width: {
endpoint: 150,
method: 80,
summary: 200,
operationId: 200,
tags: 100,
parameters: 300
}
}
);
} catch (error) {
return html`<div style="color: red">Error fetching API endpoints: ${error.message}</div>`;
} finally {
// Remove loading indicator
loadingElement.remove();
}
}
```