@@ -6,24 +6,44 @@ import org.json4s.JArray
6
6
sealed abstract class SearchSort (val name : String ) {
7
7
override def toString = name
8
8
}
9
- object SearchSort {
10
- // for serachRepositories
9
+
10
+ object SearchRepositorySort {
11
11
case object stars extends SearchSort (" stars" )
12
12
case object forks extends SearchSort (" forks" )
13
13
case object updated extends SearchSort (" updated" )
14
14
15
- // for searchCode
15
+ val values = Array (stars, forks, updated)
16
+
17
+ def fromString (str : String ) = values.filter(_.name == str).head
18
+ }
19
+
20
+ object SearchCodeSort {
16
21
case object indexed extends SearchSort (" indexed" )
17
22
18
- // for searchIssues
19
- case object comments extends SearchSort (" comments" )
20
- case object created extends SearchSort (" created" )
21
- // case object updated extends SearchSort("updated")
23
+ val values = Array (indexed)
24
+
25
+ def fromString (str : String ) = values.filter(_.name == str).head
26
+ }
27
+
28
+ object SearchIssueSort {
29
+ case object created extends IssueSort (" created" )
30
+ case object updated extends IssueSort (" updated" )
31
+ case object comments extends IssueSort (" comments" )
22
32
23
- // for searchUser
33
+ val values = Array (created, updated, comments)
34
+
35
+ def fromString (str : String ) = values.filter(_.name == str).head
36
+ }
37
+
38
+
39
+ object SearchUserSort {
24
40
case object followers extends SearchSort (" followers" )
25
41
case object repositories extends SearchSort (" repositories" )
26
42
case object joined extends SearchSort (" joined" )
43
+
44
+ val values = Array (followers, repositories, joined)
45
+
46
+ def fromString (str : String ) = values.filter(_.name == str).head
27
47
}
28
48
29
49
case class SearchInput (
0 commit comments