Files
softplayer-web/lib/api/grpc/test_service.dart
Nikolai Rodionov 3102296735
All checks were successful
ci/woodpecker/push/build Pipeline was successful
Update protos
Signed-off-by: Nikolai Rodionov <iam@allanger.xyz>
2026-05-11 12:15:12 +02:00

46 lines
1.0 KiB
Dart

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 TestAuthGrpc {
final GrpcWebClientChannel channel;
late TestServiceClient serviceStub;
TestAuthGrpc({required this.channel});
void init() {
serviceStub = TestServiceClient(channel);
}
Future<void> pong() async {
final request = PongRequest();
try {
final response = await serviceStub.pong(request);
log(response.toString());
} catch (e) {
rethrow;
}
}
}
class TestNoAuthGrpc {
final GrpcWebClientChannel channel;
late PublicTestServiceClient serviceStub;
TestNoAuthGrpc({required this.channel});
void init() {
serviceStub = PublicTestServiceClient(channel);
}
Future<void> ping() async {
final request = PingRequest();
try {
final response = await serviceStub.ping(request);
log(response.toString());
} catch (e) {
rethrow;
}
}
}