File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed
lib/headlines-search/models Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change
1
+ /// Defines the types of models that can be searched.
2
+ enum SearchModelType {
3
+ headline,
4
+ category,
5
+ country,
6
+ source;
7
+
8
+ /// Returns a user-friendly display name for the enum value.
9
+ ///
10
+ /// This should ideally be localized using context.l10n,
11
+ /// but for simplicity in this step, we'll use direct strings.
12
+ /// TODO(Cline): Localize these display names.
13
+ String get displayName {
14
+ switch (this ) {
15
+ case SearchModelType .headline:
16
+ return 'Headlines' ;
17
+ case SearchModelType .category:
18
+ return 'Categories' ;
19
+ case SearchModelType .country:
20
+ return 'Countries' ;
21
+ case SearchModelType .source:
22
+ return 'Sources' ;
23
+ }
24
+ }
25
+
26
+ /// Returns the string representation for API query parameters.
27
+ String toJson () => name;
28
+ }
You can’t perform that action at this time.
0 commit comments