-
Notifications
You must be signed in to change notification settings - Fork 724
/
GHContentSearchBuilder.java
136 lines (122 loc) · 2.94 KB
/
GHContentSearchBuilder.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
package org.kohsuke.github;
/**
* Search code for {@link GHContent}.
*
* @author Kohsuke Kawaguchi
* @see GitHub#searchContent() GitHub#searchContent()
*/
public class GHContentSearchBuilder extends GHSearchBuilder<GHContent> {
GHContentSearchBuilder(GitHub root) {
super(root, ContentSearchResult.class);
}
/**
* Search terms.
*/
public GHContentSearchBuilder q(String term) {
super.q(term);
return this;
}
/**
* In gh content search builder.
*
* @param v
* the v
* @return the gh content search builder
*/
public GHContentSearchBuilder in(String v) {
return q("in:" + v);
}
/**
* Language gh content search builder.
*
* @param v
* the v
* @return the gh content search builder
*/
public GHContentSearchBuilder language(String v) {
return q("language:" + v);
}
/**
* Fork gh content search builder.
*
* @param v
* the v
* @return the gh content search builder
*/
public GHContentSearchBuilder fork(String v) {
return q("fork:" + v);
}
/**
* Size gh content search builder.
*
* @param v
* the v
* @return the gh content search builder
*/
public GHContentSearchBuilder size(String v) {
return q("size:" + v);
}
/**
* Path gh content search builder.
*
* @param v
* the v
* @return the gh content search builder
*/
public GHContentSearchBuilder path(String v) {
return q("path:" + v);
}
/**
* Filename gh content search builder.
*
* @param v
* the v
* @return the gh content search builder
*/
public GHContentSearchBuilder filename(String v) {
return q("filename:" + v);
}
/**
* Extension gh content search builder.
*
* @param v
* the v
* @return the gh content search builder
*/
public GHContentSearchBuilder extension(String v) {
return q("extension:" + v);
}
/**
* User gh content search builder.
*
* @param v
* the v
* @return the gh content search builder
*/
public GHContentSearchBuilder user(String v) {
return q("user:" + v);
}
/**
* Repo gh content search builder.
*
* @param v
* the v
* @return the gh content search builder
*/
public GHContentSearchBuilder repo(String v) {
return q("repo:" + v);
}
private static class ContentSearchResult extends SearchResult<GHContent> {
private GHContent[] items;
@Override
GHContent[] getItems(GitHub root) {
for (GHContent item : items)
item.wrap(root);
return items;
}
}
@Override
protected String getApiUrl() {
return "/search/code";
}
}