mirror of
https://github.com/foss42/apidash.git
synced 2025-08-24 21:17:22 +08:00
22 lines
672 B
Dart
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();
|