13 lines
No EOL
447 B
Dart
13 lines
No EOL
447 B
Dart
import 'dart:convert';
|
|
|
|
import 'package:contacts_plus_plus/api_client.dart';
|
|
import 'package:contacts_plus_plus/models/user.dart';
|
|
|
|
class UserApi {
|
|
static Future<Iterable<User>> searchUsers(ApiClient client, {required String needle}) async {
|
|
final response = await client.get("/users?name=$needle");
|
|
ApiClient.checkResponse(response);
|
|
final data = jsonDecode(response.body) as List;
|
|
return data.map((e) => User.fromMap(e));
|
|
}
|
|
} |