API Endpoint List Generator
Comprehensive API Contract Manifest
Total Endpoints:
0
Service API Endpoint Catalog
Base URL: https://api.example.com/v1
Protocol: REST/JSON | Version: v1
Endpoint Summary
| Method | Path / Resource | Function / Description | Auth Required |
|---|
Generated by API Endpoint List Generator
API Context
Log New Endpoint
Define the method, path, and purpose for the API client contract.
Current Endpoint List
List is empty.
"; return; } eplData.endpoints.forEach(endpoint => { const row = document.createElement('div'); row.className = 'epl-endpoint-row'; row.innerHTML = `
[${endpoint.method}] ${endpoint.path}
(${endpoint.description})
`;
outputs.endpointListEditor.appendChild(row);
});
}
// --- 5. EVENT LISTENERS & ACTIONS ---
function attachListeners() {
// Meta Inputs
const metaInputs = Object.values(inputs).filter(i => !i.id.includes('inp-'));
metaInputs.forEach(inp => inp.addEventListener('input', renderAll));
// Add Endpoint Button
document.getElementById('btn-add-endpoint').addEventListener('click', addEndpoint);
}
function addEndpoint() {
const method = inputs.method.value;
const path = inputs.path.value.trim();
const description = inputs.description.value.trim();
const auth = inputs.auth.value;
if (!path || !description) {
alert("Path and Description are required.");
return;
}
if (eplData.endpoints.find(e => e.path === path && e.method === method)) {
alert(`Endpoint ${method} ${path} already exists.`);
return;
}
const newEndpoint = {
id: Date.now(),
method: method,
path: path,
description: description,
auth: auth
};
eplData.endpoints.push(newEndpoint);
// Clear inputs for next entry
inputs.path.value = "";
inputs.description.value = "";
renderAll();
}
window.removeEndpoint = function(id) {
if(confirm("Remove this endpoint?")) {
eplData.endpoints = eplData.endpoints.filter(e => e.id !== id);
renderAll();
}
};
// --- 6. TAB NAVIGATION ---
window.eplSwitchTab = function(tabId) {
document.querySelectorAll('.epl-tab-pane').forEach(p => p.classList.remove('active'));
document.querySelectorAll('.epl-tab-btn').forEach(b => b.classList.remove('active'));
document.getElementById(tabId).classList.add('active');
document.querySelector(`.epl-tab-btn[data-tab="${tabId}"]`).classList.add('active');
document.getElementById('endpoint-generator-tool').scrollIntoView({behavior: 'smooth'});
};
document.querySelectorAll('.epl-tab-btn').forEach(btn => {
btn.addEventListener('click', function() { eplSwitchTab(this.dataset.tab); });
});
// --- 7. PDF EXPORT ---
const btnDown = document.getElementById('epl-download-btn');
if(btnDown) {
btnDown.addEventListener('click', function() {
renderAll();
const element = document.getElementById('epl-render-area');
const filename = (inputs.apiName.value || 'API_Manifest').replace(/\s+/g,'_');
const opt = {
margin: 0.4,
filename: `${filename}_Endpoint_Manifest_${inputs.version.value}.pdf`,
image: { type: 'jpeg', quality: 0.98 },
html2canvas: { scale: 2, useCORS: true },
jsPDF: { unit: 'in', format: 'letter', orientation: 'landscape' } // Landscape for wide table
};
const origText = btnDown.innerText;
btnDown.innerText = "Generating Manifest...";
html2pdf().set(opt).from(element).save().then(() => {
btnDown.innerText = origText;
});
});
}
// Start
init();
});
