feat: notifications (#17701)

* feat: notifications

* UI works

* chore: pr feedback

* initial fetch and clear notification upon logging out

* fix: merge

---------

Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
This commit is contained in:
Jason Rasmussen
2025-04-28 10:36:14 -04:00
committed by GitHub
parent 23717ce981
commit 1b5fc9c665
55 changed files with 3186 additions and 196 deletions

View File

@@ -16,7 +16,54 @@ class NotificationsAdminApi {
final ApiClient apiClient;
/// Performs an HTTP 'POST /notifications/admin/templates/{name}' operation and returns the [Response].
/// Performs an HTTP 'POST /admin/notifications' operation and returns the [Response].
/// Parameters:
///
/// * [NotificationCreateDto] notificationCreateDto (required):
Future<Response> createNotificationWithHttpInfo(NotificationCreateDto notificationCreateDto,) async {
// ignore: prefer_const_declarations
final apiPath = r'/admin/notifications';
// ignore: prefer_final_locals
Object? postBody = notificationCreateDto;
final queryParams = <QueryParam>[];
final headerParams = <String, String>{};
final formParams = <String, String>{};
const contentTypes = <String>['application/json'];
return apiClient.invokeAPI(
apiPath,
'POST',
queryParams,
postBody,
headerParams,
formParams,
contentTypes.isEmpty ? null : contentTypes.first,
);
}
/// Parameters:
///
/// * [NotificationCreateDto] notificationCreateDto (required):
Future<NotificationDto?> createNotification(NotificationCreateDto notificationCreateDto,) async {
final response = await createNotificationWithHttpInfo(notificationCreateDto,);
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), 'NotificationDto',) as NotificationDto;
}
return null;
}
/// Performs an HTTP 'POST /admin/notifications/templates/{name}' operation and returns the [Response].
/// Parameters:
///
/// * [String] name (required):
@@ -24,7 +71,7 @@ class NotificationsAdminApi {
/// * [TemplateDto] templateDto (required):
Future<Response> getNotificationTemplateAdminWithHttpInfo(String name, TemplateDto templateDto,) async {
// ignore: prefer_const_declarations
final apiPath = r'/notifications/admin/templates/{name}'
final apiPath = r'/admin/notifications/templates/{name}'
.replaceAll('{name}', name);
// ignore: prefer_final_locals
@@ -68,13 +115,13 @@ class NotificationsAdminApi {
return null;
}
/// Performs an HTTP 'POST /notifications/admin/test-email' operation and returns the [Response].
/// Performs an HTTP 'POST /admin/notifications/test-email' operation and returns the [Response].
/// Parameters:
///
/// * [SystemConfigSmtpDto] systemConfigSmtpDto (required):
Future<Response> sendTestEmailAdminWithHttpInfo(SystemConfigSmtpDto systemConfigSmtpDto,) async {
// ignore: prefer_const_declarations
final apiPath = r'/notifications/admin/test-email';
final apiPath = r'/admin/notifications/test-email';
// ignore: prefer_final_locals
Object? postBody = systemConfigSmtpDto;