#!/usr/bin/env node const https = require('https'); const API_DOC_URL = 'https://foodsharing.de/api/doc'; const EXPECTED_ENDPOINTS = [ { path: '/api/login', method: 'post', requestRef: '#/components/schemas/LoginRequest', responseCodes: ['200', '401', '403', '409'] }, { path: '/api/users/current/details', method: 'get', responseRef: '#/components/schemas/ProfileDetails', responseCodes: ['200', '401'] }, { path: '/api/users/{userId}/stores', method: 'get', responseCodes: ['200', '400', '401', '403', '404'] }, { path: '/api/stores/{storeId}/pickups', method: 'get', responseCodes: ['200', '401', '403'] }, { path: '/api/regions/{regionId}/stores', method: 'get', responseCodes: ['200', '401', '403'] }, { path: '/api/stores/{storeId}/details', method: 'get', responseRef: '#/components/schemas/Store', responseCodes: ['200', '401', '403', '404'] }, { path: '/api/stores/{storeId}/members', method: 'get', responseCodes: ['200', '401', '403', '404'] }, { path: '/api/stores/{storeId}/regular-pickups', method: 'get', responseCodes: ['200', '401', '403', '404'] }, { path: '/api/users/{userId}/pickups/registered', method: 'get', responseCodes: ['200', '401', '403'] }, { path: '/api/stores/{storeId}/pickups/{pickupDate}/eligibility', method: 'get', responseCodes: ['200', '401'] }, { path: '/api/stores/{storeId}/pickups/{pickupDate}/users/current', method: 'post', responseCodes: ['200', '401', '403'] }, { path: '/api/conversations', method: 'get', responseCodes: ['200', '401'] } ]; function fetchText(url) { return new Promise((resolve, reject) => { https .get(url, (res) => { if (res.statusCode && res.statusCode >= 400) { reject(new Error(`HTTP ${res.statusCode} for ${url}`)); res.resume(); return; } let data = ''; res.setEncoding('utf8'); res.on('data', (chunk) => { data += chunk; }); res.on('end', () => resolve(data)); }) .on('error', reject); }); } function extractSpec(html) { const match = html.match(/