// AUTO-GENERATED FILE, DO NOT MODIFY! // part of openapi.api; class NotificationsApi { NotificationsApi([ApiClient? apiClient]) : apiClient = apiClient ?? defaultApiClient; final ApiClient apiClient; static const ApiVersion deleteNotificationsAddedIn = .new(1, 0, 0); static const ApiState deleteNotificationsState = .stable; static const ApiVersion getNotificationsAddedIn = .new(1, 0, 0); static const ApiState getNotificationsState = .stable; static const ApiVersion updateNotificationsAddedIn = .new(1, 0, 0); static const ApiState updateNotificationsState = .stable; static const ApiVersion deleteNotificationAddedIn = .new(1, 0, 0); static const ApiState deleteNotificationState = .stable; static const ApiVersion getNotificationAddedIn = .new(1, 0, 0); static const ApiState getNotificationState = .stable; static const ApiVersion updateNotificationAddedIn = .new(1, 0, 0); static const ApiState updateNotificationState = .stable; /// Delete notifications /// /// Delete a list of notifications at once. /// /// Available since server v1.0.0. /// /// Note: This method returns the HTTP [Response]. Future deleteNotificationsWithHttpInfo( NotificationDeleteAllDto notificationDeleteAllDto, { Future? abortTrigger, }) async { final apiPath = r'/notifications'; Object? postBody = notificationDeleteAllDto; final queryParams = []; final headerParams = {}; final formParams = {}; const contentTypes = [r'application/json']; return apiClient.invokeAPI( apiPath, r'DELETE', queryParams, postBody, headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, abortTrigger: abortTrigger, ); } /// Delete notifications /// /// Delete a list of notifications at once. /// /// Available since server v1.0.0. Future deleteNotifications( NotificationDeleteAllDto notificationDeleteAllDto, { Future? abortTrigger, }) async { final response = await deleteNotificationsWithHttpInfo(notificationDeleteAllDto, abortTrigger: abortTrigger); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); } } /// Retrieve notifications /// /// Retrieve a list of notifications. /// /// Available since server v1.0.0. /// /// Note: This method returns the HTTP [Response]. Future getNotificationsWithHttpInfo({ String? id, NotificationLevel? level, NotificationType? type, bool? unread, Future? abortTrigger, }) async { final apiPath = r'/notifications'; Object? postBody; final queryParams = []; final headerParams = {}; final formParams = {}; if (id != null) { queryParams.addAll(_queryParams('', 'id', id)); } if (level != null) { queryParams.addAll(_queryParams('', 'level', level)); } if (type != null) { queryParams.addAll(_queryParams('', 'type', type)); } if (unread != null) { queryParams.addAll(_queryParams('', 'unread', unread)); } const contentTypes = []; return apiClient.invokeAPI( apiPath, r'GET', queryParams, postBody, headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, abortTrigger: abortTrigger, ); } /// Retrieve notifications /// /// Retrieve a list of notifications. /// /// Available since server v1.0.0. Future> getNotifications({ String? id, NotificationLevel? level, NotificationType? type, bool? unread, Future? abortTrigger, }) async { final response = await getNotificationsWithHttpInfo( id: id, level: level, type: type, unread: unread, abortTrigger: abortTrigger, ); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); } if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { final responseBody = await _decodeBodyBytes(response); return (await apiClient.deserializeAsync(responseBody, r'List') as List) .cast() .toList(growable: false); } throw ApiException(response.statusCode, r'Unexpected empty response body'); } /// Update notifications /// /// Update a list of notifications. Allows to bulk-set the read status of notifications. /// /// Available since server v1.0.0. /// /// Note: This method returns the HTTP [Response]. Future updateNotificationsWithHttpInfo( NotificationUpdateAllDto notificationUpdateAllDto, { Future? abortTrigger, }) async { final apiPath = r'/notifications'; Object? postBody = notificationUpdateAllDto; final queryParams = []; final headerParams = {}; final formParams = {}; const contentTypes = [r'application/json']; return apiClient.invokeAPI( apiPath, r'PUT', queryParams, postBody, headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, abortTrigger: abortTrigger, ); } /// Update notifications /// /// Update a list of notifications. Allows to bulk-set the read status of notifications. /// /// Available since server v1.0.0. Future updateNotifications( NotificationUpdateAllDto notificationUpdateAllDto, { Future? abortTrigger, }) async { final response = await updateNotificationsWithHttpInfo(notificationUpdateAllDto, abortTrigger: abortTrigger); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); } } /// Delete a notification /// /// Delete a specific notification. /// /// Available since server v1.0.0. /// /// Note: This method returns the HTTP [Response]. Future deleteNotificationWithHttpInfo(String id, {Future? abortTrigger}) async { final apiPath = r'/notifications/{id}'.replaceAll('{id}', id); Object? postBody; final queryParams = []; final headerParams = {}; final formParams = {}; const contentTypes = []; return apiClient.invokeAPI( apiPath, r'DELETE', queryParams, postBody, headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, abortTrigger: abortTrigger, ); } /// Delete a notification /// /// Delete a specific notification. /// /// Available since server v1.0.0. Future deleteNotification(String id, {Future? abortTrigger}) async { final response = await deleteNotificationWithHttpInfo(id, abortTrigger: abortTrigger); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); } } /// Get a notification /// /// Retrieve a specific notification identified by id. /// /// Available since server v1.0.0. /// /// Note: This method returns the HTTP [Response]. Future getNotificationWithHttpInfo(String id, {Future? abortTrigger}) async { final apiPath = r'/notifications/{id}'.replaceAll('{id}', id); Object? postBody; final queryParams = []; final headerParams = {}; final formParams = {}; const contentTypes = []; return apiClient.invokeAPI( apiPath, r'GET', queryParams, postBody, headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, abortTrigger: abortTrigger, ); } /// Get a notification /// /// Retrieve a specific notification identified by id. /// /// Available since server v1.0.0. Future getNotification(String id, {Future? abortTrigger}) async { final response = await getNotificationWithHttpInfo(id, abortTrigger: abortTrigger); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); } if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), r'NotificationDto') as NotificationDto; } throw ApiException(response.statusCode, r'Unexpected empty response body'); } /// Update a notification /// /// Update a specific notification to set its read status. /// /// Available since server v1.0.0. /// /// Note: This method returns the HTTP [Response]. Future updateNotificationWithHttpInfo( String id, NotificationUpdateDto notificationUpdateDto, { Future? abortTrigger, }) async { final apiPath = r'/notifications/{id}'.replaceAll('{id}', id); Object? postBody = notificationUpdateDto; final queryParams = []; final headerParams = {}; final formParams = {}; const contentTypes = [r'application/json']; return apiClient.invokeAPI( apiPath, r'PUT', queryParams, postBody, headerParams, formParams, contentTypes.isEmpty ? null : contentTypes.first, abortTrigger: abortTrigger, ); } /// Update a notification /// /// Update a specific notification to set its read status. /// /// Available since server v1.0.0. Future updateNotification( String id, NotificationUpdateDto notificationUpdateDto, { Future? abortTrigger, }) async { final response = await updateNotificationWithHttpInfo(id, notificationUpdateDto, abortTrigger: abortTrigger); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); } if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { return await apiClient.deserializeAsync(await _decodeBodyBytes(response), r'NotificationDto') as NotificationDto; } throw ApiException(response.statusCode, r'Unexpected empty response body'); } }