fartstack/shared_models/lib/user.dart

33 lines
928 B
Dart

import 'package:json_annotation/json_annotation.dart';
part 'user.g.dart';
typedef JoinRoomRequest = CreateUserRequest;
@JsonSerializable()
class CreateUserRequest {
final String username;
final String roomCode;
CreateUserRequest({required this.username, required this.roomCode});
factory CreateUserRequest.fromJson(Map<String, dynamic> json) => _$CreateUserRequestFromJson(json);
Map<String, dynamic> toJson() => _$CreateUserRequestToJson(this);
}
typedef JoinRoomResponse = CreateUserResponse;
@JsonSerializable()
class CreateUserResponse {
final String? token;
final String? error;
final String? uuid;
final bool success;
CreateUserResponse({required this.token, required this.uuid, required this.success, this.error});
factory CreateUserResponse.fromJson(Map<String, dynamic> json) => _$CreateUserResponseFromJson(json);
Map<String, dynamic> toJson() => _$CreateUserResponseToJson(this);
}