You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A shared Dart package containing core data models for news-related entities (like headlines, sources, categories, countries), pagination, and standardized API response structures, used across the application ecosystem (Mobile App, Backend API, Web Dashboard).
7
+
A shared Dart package containing core data models for news-related entities (like headlines, sources, categories, countries), pagination, standardized API response structures, **user content preferences**, and **application configuration**, used across the application ecosystem (Mobile App, Backend API, Web Dashboard).
8
8
9
9
## Getting Started
10
10
@@ -27,7 +27,11 @@ This package provides the following core data models:
27
27
* **`Category`**: Represents a news category with an ID, name, and optional description and icon URL.
28
28
* **`Source`**: Represents a news source, including ID, name, description, URL, language, optional headquarters (`Country`), and a `SourceType` enum (e.g., `newsAgency`, `blog`).
29
29
* **`Country`**: Represents a country with an ID, ISO code, name, and flag URL.
30
-
* **`User`**: Represents an authenticated user within the system, including an `isAdmin` flag.
30
+
* **`UserContentPreferences`**: Represents a collection of user-specific content preferences, including followed countries, sources, categories, and saved headlines. This model stores full objects for these items and is subject to tiered limits based on user role.
31
+
* **`AppConfig`**: Represents the overall application configuration. This model serves as a central container for various configuration settings, including user preference limits, and is designed to be fetched and managed via the `HtDataClient`.
32
+
* **`UserPreferenceLimits`**: Defines the maximum number of items a user can follow or save, tiered by user role (Guest, Authenticated, Premium). This model is part of the `AppConfig` and is used for backend enforcement and client-side UI/UX.
33
+
* **`UserAppSettings`**: Represents a collection of user-specific application settings, unifying display preferences (`DisplaySettings`) and language selection (`AppLanguage`). This model is designed for management via a generic data client (`HtDataClient`).
34
+
* **`User`**: Represents a user within the system, including their assigned `role`.
31
35
* **`PaginatedResponse<T>`**: A generic class for handling paginated API responses, containing a list of items (`items`), a `cursor` for the next page, and a `hasMore` flag.
32
36
* **`AuthSuccessResponse`**: Represents the successful result of an authentication operation, typically containing the authenticated user details and an access token.
33
37
* **`SuccessApiResponse<T>`**: A generic wrapper for successful API responses, containing the main `data` payload (of type `T`) and optional `ResponseMetadata`.
@@ -51,6 +55,7 @@ void main() {
51
55
);
52
56
53
57
final headline = Headline(
58
+
id: 'headline-1', // Added ID for clarity in preferences example
54
59
title: 'New Gadget Announced',
55
60
description: 'A revolutionary new device changes everything.',
56
61
url: 'https://techcrunch.com/news/new-gadget',
@@ -61,6 +66,48 @@ void main() {
61
66
62
67
print('Headline: ${headline.title} from ${headline.source?.name}');
0 commit comments