61 lines
1.8 KiB
Dart
61 lines
1.8 KiB
Dart
// ignore_for_file: avoid_print
|
|
|
|
import 'package:flutter_dotenv/flutter_dotenv.dart';
|
|
import 'package:web_flutter_tank_appwrite_app/services/ptv_api_simple.dart';
|
|
|
|
/// Quick Test der PTV API Simple Integration
|
|
void main() async {
|
|
print('🚀 PTV API SIMPLE TEST START 🚀');
|
|
|
|
try {
|
|
// Lade .env
|
|
await dotenv.load(fileName: ".env");
|
|
print('✅ .env Datei geladen');
|
|
|
|
// Test Service Info
|
|
PtvApiServiceSimple.printServiceInfo();
|
|
|
|
// Connection Test
|
|
print('\n🧪 CONNECTION TEST 🧪');
|
|
final connectionOk = await PtvApiServiceSimple.testApiConnection();
|
|
print('🔗 Verbindung: ${connectionOk ? "OK" : "FEHLER"}');
|
|
|
|
if (connectionOk) {
|
|
print('\n📍 API TEST MIT BEISPIELKOORDINATEN 📍');
|
|
|
|
// Test mit Traun Koordinaten
|
|
final result = await PtvApiServiceSimple.getLocationsByPosition(
|
|
latitude: 48.208282,
|
|
longitude: 14.214758,
|
|
);
|
|
|
|
if (result != null) {
|
|
print('✅ API Response erhalten');
|
|
|
|
// Verwende Utility-Funktionen
|
|
final address = PtvApiUtils.getFormattedAddress(result);
|
|
final coords = PtvApiUtils.getCoordinates(result);
|
|
final quality = PtvApiUtils.getQualityLevel(result);
|
|
|
|
print('📝 Adresse: $address');
|
|
print('📍 Koordinaten: ${coords?['latitude']}, ${coords?['longitude']}');
|
|
print('⭐ Qualität: $quality');
|
|
|
|
print('\n📄 Komplette Info:');
|
|
print(PtvApiUtils.formatLocationInfo(result));
|
|
|
|
} else {
|
|
print('❌ Keine API Response - prüfe API Key in .env');
|
|
}
|
|
|
|
} else {
|
|
print('❌ API Connection Test fehlgeschlagen');
|
|
print('⚠️ Prüfe PTVE_API_KEY in .env Datei');
|
|
}
|
|
|
|
} catch (e) {
|
|
print('❌ Test Exception: $e');
|
|
}
|
|
|
|
print('\n🚀 TEST ABGESCHLOSSEN 🚀');
|
|
} |