7
7
import com .zaneli .qiita .model .request .SearchRequest ;
8
8
import com .zaneli .qiita .model .response .ItemDetail ;
9
9
import com .zaneli .qiita .model .response .ItemInfo ;
10
+ import com .zaneli .qiita .model .response .PageableResponse ;
10
11
import com .zaneli .qiita .model .response .RateLimit ;
11
12
import com .zaneli .qiita .model .response .TagInfo ;
12
13
import com .zaneli .qiita .model .response .TokenInfo ;
@@ -28,56 +29,60 @@ public void setToken(String token) {
28
29
executor .setToken (token );
29
30
}
30
31
32
+ public void setPerPage (int perPage ) {
33
+ executor .setPerPage (perPage );
34
+ }
35
+
31
36
public TokenInfo authorize (AuthRequest req ) throws IOException , QiitaException {
32
37
return executor .postFormValue ("auth" , req .createParams (), TokenInfo .class );
33
38
}
34
39
35
40
public RateLimit getRateLimit () throws IOException , QiitaException {
36
- return executor .getSingleContent ("rate_limit" , RateLimit .class );
41
+ return executor .getContent ("rate_limit" , RateLimit .class );
37
42
}
38
43
39
44
public UserInfo getOwnInfo () throws IOException , QiitaException {
40
- return executor .getSingleContent ("user" , UserInfo .class );
45
+ return executor .getContent ("user" , UserInfo .class );
41
46
}
42
47
43
48
public UserInfo getUserInfo (String userName ) throws IOException , QiitaException {
44
- return executor .getSingleContent ("users/" + userName , UserInfo .class );
49
+ return executor .getContent ("users/" + userName , UserInfo .class );
45
50
}
46
51
47
- public ItemInfo [] getUserItems (String userName ) throws IOException , QiitaException {
48
- return executor .getMultiContents ("users/" + userName + "/items" , ItemInfo [].class );
52
+ public PageableResponse < ItemInfo > getUserItems (String userName ) throws IOException , QiitaException {
53
+ return executor .getPageableContents ("users/" + userName + "/items" , ItemInfo [].class );
49
54
}
50
55
51
- public ItemInfo [] getUserStocks (String userName ) throws IOException , QiitaException {
52
- return executor .getMultiContents ("users/" + userName + "/stocks" , ItemInfo [].class );
56
+ public PageableResponse < ItemInfo > getUserStocks (String userName ) throws IOException , QiitaException {
57
+ return executor .getPageableContents ("users/" + userName + "/stocks" , ItemInfo [].class );
53
58
}
54
59
55
- public User [] getFollowingUsers (String userName ) throws IOException , QiitaException {
56
- return executor .getMultiContents ("users/" + userName + "/following_users" , User [].class );
60
+ public PageableResponse < User > getFollowingUsers (String userName ) throws IOException , QiitaException {
61
+ return executor .getPageableContents ("users/" + userName + "/following_users" , User [].class );
57
62
}
58
63
59
- public TagInfo [] getFollowingTags (String userName ) throws IOException , QiitaException {
60
- return executor .getMultiContents ("users/" + userName + "/following_tags" , TagInfo [].class );
64
+ public PageableResponse < TagInfo > getFollowingTags (String userName ) throws IOException , QiitaException {
65
+ return executor .getPageableContents ("users/" + userName + "/following_tags" , TagInfo [].class );
61
66
}
62
67
63
- public ItemInfo [] getTagItems (String tagName ) throws IOException , QiitaException {
64
- return executor .getMultiContents ("tags/" + tagName + "/items" , ItemInfo [].class );
68
+ public PageableResponse < ItemInfo > getTagItems (String tagName ) throws IOException , QiitaException {
69
+ return executor .getPageableContents ("tags/" + tagName + "/items" , ItemInfo [].class );
65
70
}
66
71
67
- public TagInfo [] getTags () throws IOException , QiitaException {
68
- return executor .getMultiContents ("tags" , TagInfo [].class );
72
+ public PageableResponse < TagInfo > getTags () throws IOException , QiitaException {
73
+ return executor .getPageableContents ("tags" , TagInfo [].class );
69
74
}
70
75
71
- public ItemInfo [] searchItems (SearchRequest req ) throws IOException , QiitaException {
72
- return executor .getMultiContents ("search" , req .createParams (), ItemInfo [].class );
76
+ public PageableResponse < ItemInfo > searchItems (SearchRequest req ) throws IOException , QiitaException {
77
+ return executor .getPageableContents ("search" , req .createParams (), ItemInfo [].class );
73
78
}
74
79
75
- public ItemInfo [] getNewItems () throws IOException , QiitaException {
76
- return executor .getMultiContents ("items" , ItemInfo [].class );
80
+ public PageableResponse < ItemInfo > getNewItems () throws IOException , QiitaException {
81
+ return executor .getPageableContents ("items" , ItemInfo [].class );
77
82
}
78
83
79
- public ItemInfo [] getOwnStocks () throws IOException , QiitaException {
80
- return executor .getMultiContents ("stocks" , ItemInfo [].class );
84
+ public PageableResponse < ItemInfo > getOwnStocks () throws IOException , QiitaException {
85
+ return executor .getPageableContents ("stocks" , ItemInfo [].class );
81
86
}
82
87
83
88
public ItemInfo createItem (ItemRequest req ) throws IOException , QiitaException {
@@ -93,7 +98,7 @@ public void deleteItem(String uuid) throws IOException, QiitaException {
93
98
}
94
99
95
100
public ItemDetail getSpecificItem (String uuid ) throws IOException , QiitaException {
96
- return executor .getSingleContent ("items/" + uuid , ItemDetail .class );
101
+ return executor .getContent ("items/" + uuid , ItemDetail .class );
97
102
}
98
103
99
104
public void stockItem (String uuid ) throws IOException , QiitaException {
0 commit comments