Files
apidash/lib/importer/importer.dart
2025-03-26 05:54:05 +05:30

22 lines
672 B
Dart

import 'package:apidash/consts.dart';
import 'package:apidash_core/apidash_core.dart';
class Importer {
Future<List<(String?, HttpRequestModel)>?> getHttpRequestModelList(
ImportFormat fileType,
String content,
) async {
return switch (fileType) {
ImportFormat.curl => CurlIO()
.getHttpRequestModelList(content)
?.map((t) => (null, t))
.toList(),
ImportFormat.postman => PostmanIO().getHttpRequestModelList(content),
ImportFormat.insomnia => InsomniaIO().getHttpRequestModelList(content),
ImportFormat.har => HarParserIO().getHttpRequestModelList(content),
};
}
}
final kImporter = Importer();