mirror of
https://gitlab.com/comunic/comunicmobile
synced 2025-06-19 00:05:16 +00:00
Created inline user picker
This commit is contained in:
31
lib/helpers/search_helper.dart
Normal file
31
lib/helpers/search_helper.dart
Normal file
@ -0,0 +1,31 @@
|
||||
import 'package:comunic/helpers/users_helper.dart';
|
||||
import 'package:comunic/lists/users_list.dart';
|
||||
import 'package:comunic/models/api_request.dart';
|
||||
import 'package:comunic/utils/list_utils.dart';
|
||||
|
||||
/// Search helper
|
||||
///
|
||||
/// @author Pierre HUBERT
|
||||
|
||||
class SearchHelper {
|
||||
|
||||
/// Search for user. This method returns information about the target users
|
||||
///
|
||||
/// Returns information about the target users or null if an error occurred
|
||||
Future<UsersList> searchUser(String query) async {
|
||||
// Execute the query on the server
|
||||
final response = await APIRequest(
|
||||
uri: "user/search",
|
||||
needLogin: true,
|
||||
args: {
|
||||
"query": query
|
||||
}
|
||||
).exec();
|
||||
|
||||
if (response.code != 200) return null;
|
||||
|
||||
return await UsersHelper().getUsersInfo(
|
||||
listToIntList(response.getArray()));
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user