// 注册请求 class UserRegisterRequest { String email; String password; UserRegisterRequest({ required this.email, required this.password, }); factory UserRegisterRequest.fromJson(Map json) => UserRegisterRequest( email: json["email"], password: json["password"], ); Map toJson() => { "email": email, "password": password, }; } // 登录请求 class UserLoginRequest { String email; String password; UserLoginRequest({ required this.email, required this.password, }); factory UserLoginRequest.fromJson(Map json) => UserLoginRequest( email: json["email"], password: json["password"], ); Map toJson() => { "email": email, "password": password, }; } // 登录返回 class UserLoginResponse { String? accessToken; String? displayName; List? channels; UserLoginResponse({ this.accessToken, this.displayName, this.channels, }); factory UserLoginResponse.fromJson(Map json) => UserLoginResponse( accessToken: json["access_token"], displayName: json["display_name"], channels: List.from(json["channels"].map((x) => x)), ); Map toJson() => { "access_token": accessToken, "display_name": displayName, "channels": channels == null ? [] : List.from(channels!.map((x) => x)), }; }