package templates
templ APIExplorer(explorer APIExplorerData) {
if !explorer.IsLoggedIn {
if explorer.Endpoint.Method == "GET" {
{ explorer.Endpoint.Method }
} else if explorer.Endpoint.Method == "DELETE" {
{ explorer.Endpoint.Method }
} else if explorer.Endpoint.Method == "POST" {
{ explorer.Endpoint.Method }
} else {
{ explorer.Endpoint.Method }
}
{ explorer.Endpoint.Path }
Mock Data
Login to Try Real
Request Body (Example)
{ explorer.Endpoint.RequestBody }
Response (Mock)
{ explorer.Endpoint.Response }
@Icon("copy", "h-4 w-4")
Copy Request
@Icon("copy", "h-4 w-4")
Copy Response
} else {
if explorer.Endpoint.Method == "GET" {
{ explorer.Endpoint.Method }
} else if explorer.Endpoint.Method == "DELETE" {
{ explorer.Endpoint.Method }
} else if explorer.Endpoint.Method == "POST" {
{ explorer.Endpoint.Method }
} else {
{ explorer.Endpoint.Method }
}
{ explorer.Endpoint.Path }
Mock Data
Try It Out
Method
GET
POST
PUT
DELETE
Request Body
@Icon("play", "h-4 w-4")
Try It Out
@Icon("copy", "h-4 w-4")
Copy Request
@Icon("copy", "h-4 w-4")
Copy Response
@Icon("external", "h-4 w-4")
Generate cURL
}
}
// APIExplorerData holds data for the API explorer component
type APIExplorerData struct {
Endpoint EndpointInfo
IsLoggedIn bool
}
// EndpointInfo holds information about an API endpoint
type EndpointInfo struct {
Method string
Path string
RequestBody string
Response string
Description string
}