app/lib/common/grpc/party_room_server.dart

49 lines
1.5 KiB
Dart
Raw Normal View History

2024-01-07 14:57:49 +08:00
import 'package:fixnum/fixnum.dart';
import 'package:grpc/grpc.dart';
import 'package:starcitizen_doctor/generated/grpc/party_room_server/index.pbgrpc.dart';
class PartyRoomGrpcServer {
static const clientVersion = 0;
static final _channel = ClientChannel(
"127.0.0.1",
port: 39399,
options: ChannelOptions(
credentials: const ChannelCredentials.insecure(),
codecRegistry:
CodecRegistry(codecs: const [GzipCodec(), IdentityCodec()]),
),
);
static final _indexService = IndexServiceClient(_channel);
static Future<PingData> pingServer() async {
final r = await _indexService.pingServer(PingData(
data: "PING", clientVersion: Int64.parseInt(clientVersion.toString())));
2024-01-07 18:52:06 +08:00
return r;
}
static Future<RoomTypesData> getRoomTypes() async {
final r = await _indexService.getRoomTypes(Empty());
2024-01-07 14:57:49 +08:00
return r;
}
2024-01-13 13:54:32 +08:00
static Future<RoomListData> getRoomList(RoomListPageReqData req) async {
return await _indexService.getRoomList(req);
}
2024-01-13 17:29:41 +08:00
2024-01-13 20:00:06 +08:00
static Future<RoomData> createRoom(RoomData roomData) async {
return await _indexService.createRoom(roomData);
2024-01-13 17:29:41 +08:00
}
2024-01-14 20:47:15 +08:00
static Future<RoomData?> touchUserRoom(String userName, String deviceUUID) {
return _indexService
.touchUser(PreUser(userName: userName, deviceUUID: deviceUUID));
}
static ResponseStream<RoomUpdateMessage> joinRoom(
String roomID, String userName, String deviceUUID) {
return _indexService.joinRoom(
PreUser(roomID: roomID, userName: userName, deviceUUID: deviceUUID));
}
2024-01-07 14:57:49 +08:00
}