import 'dart:developer';

import 'package:grpc/grpc_web.dart';
import 'package:softplayer_dart_proto/src/test/v1/test_v1.pb.dart';
import 'package:softplayer_dart_proto/src/test/v1/test_v1.pbgrpc.dart';

class TestNoAuthGrpc {
  final GrpcWebClientChannel channel;
  late TestNoAuthServiceClient serviceStub;
  TestNoAuthGrpc({required this.channel});

  void init() {
    serviceStub = TestNoAuthServiceClient(channel);
  }

  Future<void> ping() async {
    final request = PingRequest();
    try {
      final response = await serviceStub.ping(request);
      log(response.toString());
    } catch (e) {
      rethrow;
    }
  }
}
