This is a dart client to send requests to graphql based on network for Threefold grid.
dart pub get
dart run build_runner build
-
Ensure that initializeReflectable() is called at the beginning of your main
-
Example usage:
import 'package:graphql_client/graphql_client.dart';
import 'package:graphql_client/models.dart';
import 'graphql_client.reflectable.dart';
void main() async {
initializeReflectable();
final graphQLClient = GraphQLClient('https://graphql.dev.grid.tf/graphql');
final FarmsReturnOptions farmsReturnOptions = FarmsReturnOptions(
farmID: true,
publicIps: PublicIpsReturnOptions(ip: true),
);
final FarmsQueryOptions farmsQueryOptions = FarmsQueryOptions(
idEq: "farm-id",
);
Future<List<FarmInfo>> farms = await graphQLClient.farms.list(farmsQueryOptions, farmsReturnOptions);
for (var farm in farms) {
print(farm);
}
}