Files
apidash/lib/importer/importer.dart
2025-02-24 11:43:52 +05:30

21 lines
598 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),
};
}
}
final kImporter = Importer();