manager-app/manager_api_new/lib/api/authentication_api.dart
Thomas Fransolet bb4d4fe2d5 Écran Statistiques refondu + Guide IA + onboarding (auth, abonnement) + i18n FR/EN/NL
Statistiques — refonte complète, aucun changement backend
  statistics_screen.dart réécrit (+1832) : barres horizontales monochromes à la place
  des barres verticales tronquées et des deux anneaux, barre de filtres unique avec les
  volumes par canal, règle mono-canal, 4 KPI portant chacun leur variation, bandeau
  « à retenir », courbe en aire avec bandes de week-end. La période précédente s'obtient
  en rappelant le même endpoint.
  statistics_report.dart : export PDF généré côté client (paquet pdf Dart), il partage
  les valeurs calculées de l'écran — un chiffre ne peut pas diverger entre l'écran et le
  document envoyé à la commune. Deux puces du sommaire promettaient des données
  inexistantes (parcours terminés, questions au guide IA), retirées.
  ⚠️ Jamais ouvert dans un navigateur. Cases de test : test-plan.md §8bis / §8ter.

Guide IA
  Screens/GuideIa/guide_ia_screen.dart — onglet Configuration. Menu conditionné à
  isAssistant, le même drapeau que la garde d'AiController. L'onglet « Ce que demandent
  vos visiteurs » n'est pas dans ce commit : le schéma backend est prêt, l'UI non.

Onboarding self-service
  Screens/Auth/ (mot de passe oublié, définition du mot de passe),
  Screens/Billing/subscription_screen.dart, ai_quota_hint.dart.
  ⚠️ Aucun parcours joué de bout en bout — test-plan.md §18.

Parcours guidés
  progression_mode.dart : 9 booléens sur 3 niveaux remplacés par 3 questions.
  Popups GuidedPath / GuidedStep / QuizQuestion mises à jour en conséquence.

Client API (manager_api_new) — édité À LA MAIN, ne pas relancer la génération
  onboarding_api.dart, authentication_api.dart (+80), instance_dto (champs Guide*),
  guided_step / quiz_question_guided_step (flags morts retirés).
  Le // @dart=2.18 manquant dans onboarding_api.dart cassait les 3 apps Flutter d'un
  coup — corrigé ici.

i18n : ~180 clés par langue (FR/EN/NL) + fichiers générés.
Tests : progression_mode_test, statistics_report_test (le second a attrapé deux
plantages qui seraient sortis au premier clic).

flutter build web . flutter analyze : 68 erreurs, toutes dans les fichiers modèle
orphelins de manager_api_new — dette connue, pas une régression, ces fichiers ne sont
pas dans le graphe de compilation.
2026-08-09 22:14:37 +02:00

263 lines
7.4 KiB
Dart

//
// AUTO-GENERATED FILE, DO NOT MODIFY!
//
// @dart=2.18
// ignore_for_file: unused_element, unused_import
// ignore_for_file: always_put_required_named_parameters_first
// ignore_for_file: constant_identifier_names
// ignore_for_file: lines_longer_than_80_chars
part of openapi.api;
class AuthenticationApi {
AuthenticationApi([ApiClient? apiClient])
: apiClient = apiClient ?? defaultApiClient;
final ApiClient apiClient;
/// Performs an HTTP 'POST /api/Authentication/Token' operation and returns the [Response].
/// Parameters:
///
/// * [String] grantType:
///
/// * [String] username:
///
/// * [String] password:
///
/// * [String] clientId:
///
/// * [String] clientSecret:
Future<Response> authenticationAuthenticateWithFormWithHttpInfo({
String? grantType,
String? username,
String? password,
String? clientId,
String? clientSecret,
}) async {
// ignore: prefer_const_declarations
final path = r'/api/Authentication/Token';
// ignore: prefer_final_locals
Object? postBody;
final queryParams = <QueryParam>[];
final headerParams = <String, String>{};
final formParams = <String, String>{};
const contentTypes = <String>['multipart/form-data'];
bool hasFields = false;
final mp = MultipartRequest('POST', Uri.parse(path));
if (grantType != null) {
hasFields = true;
mp.fields[r'grant_type'] = parameterToString(grantType);
}
if (username != null) {
hasFields = true;
mp.fields[r'username'] = parameterToString(username);
}
if (password != null) {
hasFields = true;
mp.fields[r'password'] = parameterToString(password);
}
if (clientId != null) {
hasFields = true;
mp.fields[r'client_id'] = parameterToString(clientId);
}
if (clientSecret != null) {
hasFields = true;
mp.fields[r'client_secret'] = parameterToString(clientSecret);
}
if (hasFields) {
postBody = mp;
}
return apiClient.invokeAPI(
path,
'POST',
queryParams,
postBody,
headerParams,
formParams,
contentTypes.isEmpty ? null : contentTypes.first,
);
}
/// Parameters:
///
/// * [String] grantType:
///
/// * [String] username:
///
/// * [String] password:
///
/// * [String] clientId:
///
/// * [String] clientSecret:
Future<TokenDTO?> authenticationAuthenticateWithForm({
String? grantType,
String? username,
String? password,
String? clientId,
String? clientSecret,
}) async {
final response = await authenticationAuthenticateWithFormWithHttpInfo(
grantType: grantType,
username: username,
password: password,
clientId: clientId,
clientSecret: clientSecret,
);
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
}
// When a remote server returns no body with a status of 204, we shall not decode it.
// At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
// FormatException when trying to decode an empty string.
if (response.body.isNotEmpty &&
response.statusCode != HttpStatus.noContent) {
return await apiClient.deserializeAsync(
await _decodeBodyBytes(response),
'TokenDTO',
) as TokenDTO;
}
return null;
}
/// Performs an HTTP 'POST /api/Authentication/Authenticate' operation and returns the [Response].
/// Parameters:
///
/// * [LoginDTO] loginDTO (required):
Future<Response> authenticationAuthenticateWithJsonWithHttpInfo(
LoginDTO loginDTO,
) async {
// ignore: prefer_const_declarations
final path = r'/api/Authentication/Authenticate';
// ignore: prefer_final_locals
Object? postBody = loginDTO;
final queryParams = <QueryParam>[];
final headerParams = <String, String>{};
final formParams = <String, String>{};
const contentTypes = <String>['application/json'];
return apiClient.invokeAPI(
path,
'POST',
queryParams,
postBody,
headerParams,
formParams,
contentTypes.isEmpty ? null : contentTypes.first,
);
}
/// Parameters:
///
/// * [LoginDTO] loginDTO (required):
Future<TokenDTO?> authenticationAuthenticateWithJson(
LoginDTO loginDTO,
) async {
final response = await authenticationAuthenticateWithJsonWithHttpInfo(
loginDTO,
);
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
}
// When a remote server returns no body with a status of 204, we shall not decode it.
// At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
// FormatException when trying to decode an empty string.
if (response.body.isNotEmpty &&
response.statusCode != HttpStatus.noContent) {
return await apiClient.deserializeAsync(
await _decodeBodyBytes(response),
'TokenDTO',
) as TokenDTO;
}
return null;
}
/// Manually added (not generated) — mirrors AuthenticationController.ForgotPassword.
/// Performs an HTTP 'POST /api/Authentication/forgot-password' operation.
Future<Response> authenticationForgotPasswordWithHttpInfo(
String email,
) async {
// ignore: prefer_const_declarations
final path = r'/api/Authentication/forgot-password';
// ignore: prefer_final_locals
Object? postBody = <String, dynamic>{'email': email};
final queryParams = <QueryParam>[];
final headerParams = <String, String>{};
final formParams = <String, String>{};
const contentTypes = <String>['application/json'];
return apiClient.invokeAPI(
path,
'POST',
queryParams,
postBody,
headerParams,
formParams,
contentTypes.isEmpty ? null : contentTypes.first,
);
}
Future<void> authenticationForgotPassword(String email) async {
final response = await authenticationForgotPasswordWithHttpInfo(email);
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
}
}
/// Manually added (not generated) — mirrors AuthenticationController.SetPassword.
/// Performs an HTTP 'POST /api/Authentication/set-password' operation.
Future<Response> authenticationSetPasswordWithHttpInfo({
required String token,
required String newPassword,
}) async {
// ignore: prefer_const_declarations
final path = r'/api/Authentication/set-password';
// ignore: prefer_final_locals
Object? postBody = <String, dynamic>{
'token': token,
'newPassword': newPassword,
};
final queryParams = <QueryParam>[];
final headerParams = <String, String>{};
final formParams = <String, String>{};
const contentTypes = <String>['application/json'];
return apiClient.invokeAPI(
path,
'POST',
queryParams,
postBody,
headerParams,
formParams,
contentTypes.isEmpty ? null : contentTypes.first,
);
}
Future<void> authenticationSetPassword({
required String token,
required String newPassword,
}) async {
final response = await authenticationSetPasswordWithHttpInfo(
token: token,
newPassword: newPassword,
);
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
}
}
}