mirror of
https://github.com/foss42/apidash.git
synced 2025-05-21 00:09:55 +08:00
26 lines
766 B
Dart
26 lines
766 B
Dart
import '../models/models.dart';
|
|
|
|
List<(String?, Resource)> getRequestsFromInsomniaCollection(
|
|
InsomniaCollection? ic) =>
|
|
getItemByTypeFromInsomniaCollection(ic, ResourceType.request.name);
|
|
|
|
List<(String?, Resource)> getEnvironmentsFromInsomniaCollection(
|
|
InsomniaCollection? ic) =>
|
|
getItemByTypeFromInsomniaCollection(ic, ResourceType.environment.name);
|
|
|
|
List<(String?, Resource)> getItemByTypeFromInsomniaCollection(
|
|
InsomniaCollection? ic,
|
|
String type,
|
|
) {
|
|
if (ic?.resources == null || ic!.resources!.length == 0) {
|
|
return [];
|
|
}
|
|
List<(String?, Resource)> requests = [];
|
|
for (var item in ic.resources!) {
|
|
if (item.type != null && item.type == type) {
|
|
requests.add((item.name, item));
|
|
}
|
|
}
|
|
return requests;
|
|
}
|