1
+ import 'package:github/src/common/util/utils.dart' ;
1
2
import 'package:github/src/util.dart' ;
2
3
import 'package:meta/meta.dart' ;
3
4
4
- @immutable
5
- abstract class _EnumWithValue {
6
- final String _jsonValue;
7
- const _EnumWithValue ._(this ._jsonValue);
8
-
9
- @override
10
- String toString () => _jsonValue;
11
-
12
- String toJson () => _jsonValue;
13
-
14
- @override
15
- bool operator == (dynamic other) =>
16
- other is _EnumWithValue && _jsonValue == other._jsonValue;
17
-
18
- @override
19
- int get hashCode => _jsonValue.hashCode;
20
- }
21
-
22
- class CheckRunAnnotationLevel extends _EnumWithValue {
5
+ class CheckRunAnnotationLevel extends EnumWithValue {
23
6
static const notice = CheckRunAnnotationLevel ._('notice' );
24
7
static const warning = CheckRunAnnotationLevel ._('warning' );
25
8
static const failure = CheckRunAnnotationLevel ._('failure' );
26
9
27
- const CheckRunAnnotationLevel ._(String value) : super ._ (value);
10
+ const CheckRunAnnotationLevel ._(String value) : super (value);
28
11
29
12
factory CheckRunAnnotationLevel ._fromValue (String value) {
30
13
switch (value) {
@@ -56,15 +39,15 @@ class CheckRunAnnotationLevel extends _EnumWithValue {
56
39
bool operator >= (CheckRunAnnotationLevel other) => ! (this < other);
57
40
}
58
41
59
- class CheckRunConclusion extends _EnumWithValue {
42
+ class CheckRunConclusion extends EnumWithValue {
60
43
static const success = CheckRunConclusion ._('success' );
61
44
static const failure = CheckRunConclusion ._('failure' );
62
45
static const neutral = CheckRunConclusion ._('neutral' );
63
46
static const cancelled = CheckRunConclusion ._('cancelled' );
64
47
static const timedOut = CheckRunConclusion ._('timed_out' );
65
48
static const actionRequired = CheckRunConclusion ._('action_required' );
66
49
67
- const CheckRunConclusion ._(String value) : super ._ (value);
50
+ const CheckRunConclusion ._(String value) : super (value);
68
51
69
52
factory CheckRunConclusion ._fromValue (String value) {
70
53
for (final level in const [
@@ -75,7 +58,7 @@ class CheckRunConclusion extends _EnumWithValue {
75
58
timedOut,
76
59
actionRequired
77
60
]) {
78
- if (level._jsonValue == value) {
61
+ if (level.value == value) {
79
62
return level;
80
63
}
81
64
}
@@ -84,17 +67,17 @@ class CheckRunConclusion extends _EnumWithValue {
84
67
}
85
68
}
86
69
87
- class CheckRunStatus extends _EnumWithValue {
70
+ class CheckRunStatus extends EnumWithValue {
88
71
static const queued = CheckRunStatus ._('queued' );
89
72
static const inProgress = CheckRunStatus ._('in_progress' );
90
73
static const completed = CheckRunStatus ._('completed' );
91
- const CheckRunStatus ._(String value) : super ._ (value);
74
+ const CheckRunStatus ._(String value) : super (value);
92
75
}
93
76
94
- class CheckRunFilter extends _EnumWithValue {
77
+ class CheckRunFilter extends EnumWithValue {
95
78
static const all = CheckRunFilter ._('all' );
96
79
static const latest = CheckRunFilter ._('latest' );
97
- const CheckRunFilter ._(String value) : super ._ (value);
80
+ const CheckRunFilter ._(String value) : super (value);
98
81
}
99
82
100
83
@immutable
0 commit comments