This commit is contained in:
2026-09-29 15:07:05 +02:00
parent 06fe43bba3
commit 4de305bbf4
12 changed files with 837 additions and 97 deletions

View File

@@ -6,6 +6,7 @@ import 'package:http/http.dart' as http;
import '../config/intra_config.dart';
import 'intra_api_exception.dart';
import 'intra_auth_service.dart';
import 'intra_http.dart';
class IntraUserService {
IntraUserService._();
@@ -28,7 +29,10 @@ class IntraUserService {
);
try {
final response = await http.get(uri, headers: _auth.authHeaders());
final response = await intraApiGet(
uri,
headers: _auth.authHeaders(),
);
return _parseUserListResponse(response, trimmed);
} on IntraApiException {
rethrow;
@@ -43,14 +47,7 @@ class IntraUserService {
http.Response response,
String login,
) {
if (response.statusCode == 401) {
throw const IntraUnauthorizedException();
}
if (response.statusCode != 200) {
throw IntraApiErrorException(
'Erreur API (${response.statusCode})',
);
}
ensureIntraOk(response);
final decoded = jsonDecode(response.body);
if (decoded is! List) {