File Coverage

blib/lib/WebService/Qiita/V2/Client/Methods.pm
Criterion Covered Total %
statement 13 128 10.1
branch 0 6 0.0
condition n/a
subroutine 5 61 8.2
pod 0 58 0.0
total 18 253 7.1


line stmt bran cond sub pod time code
1             package WebService::Qiita::V2::Client::Methods;
2 5     5   27 use strict;
  5         8  
  5         109  
3 5     5   22 use warnings;
  5         8  
  5         122  
4 5     5   1817 use parent 'WebService::Qiita::V2::Client::Base';
  5         1225  
  5         32  
5              
6             # https://qiita.com/api/v2/docs#get-apiv2oauthauthorize
7             sub authorize {
8 0     0 0 0 my ($self, $params, $args) = @_;
9 0         0 $self->get("oauth/authorize", $params, $args);
10             }
11              
12             # https://qiita.com/api/v2/docs#post-apiv2access_tokens
13             sub create_access_token {
14 0     0 0 0 my ($self, $params, $args) = @_;
15 0         0 $self->post("access_tokens", $params, $args);
16             }
17              
18             # https://qiita.com/api/v2/docs#delete-apiv2access_tokensaccess_token
19             sub delete_access_token {
20 0     0 0 0 my ($self, $token, $args) = @_;
21 0         0 $self->delete("access_tokens/$token", undef, $args);
22             }
23              
24             # https://qiita.com/api/v2/docs#delete-apiv2commentscomment_id
25             sub delete_comment {
26 0     0 0 0 my ($self, $comment_id, $args) = @_;
27 0         0 $self->delete("comments/$comment_id", undef, $args);
28             }
29              
30             # https://qiita.com/api/v2/docs#get-apiv2commentscomment_id
31             sub get_comment {
32 0     0 0 0 my ($self, $comment_id, $args) = @_;
33 0         0 $self->get("comments/$comment_id", undef, $args);
34             }
35              
36             # https://qiita.com/api/v2/docs#patch-apiv2commentscomment_id
37             sub update_comment {
38 0     0 0 0 my ($self, $comment_id, $comment, $args) = @_;
39 0         0 $self->patch("comments/$comment_id", { body => $comment }, $args);
40             }
41              
42             # https://qiita.com/api/v2/docs#get-apiv2itemsitem_idcomments
43             sub get_item_comments {
44 0     0 0 0 my ($self, $item_id, $args) = @_;
45 0         0 $self->get("items/$item_id/comments", undef, $args);
46             }
47              
48             # https://qiita.com/api/v2/docs#post-apiv2itemsitem_idcomments
49             sub add_comment {
50 0     0 0 0 my ($self, $item_id, $comment, $args) = @_;
51 0         0 $self->post("items/$item_id/comments", { body => $comment }, $args);
52             }
53              
54             # https://qiita.com/api/v2/docs#post-apiv2itemsitem_idtaggings
55             sub add_tag {
56 0     0 0 0 my ($self, $item_id, $params, $args) = @_;
57 0         0 $self->post("items/$item_id/taggings", $params, $args);
58             }
59              
60             # https://qiita.com/api/v2/docs#delete-apiv2itemsitem_idtaggingstagging_id
61             sub delete_tag {
62 0     0 0 0 my ($self, $item_id, $tagging_id, $args) = @_;
63 0         0 $self->delete("items/$item_id/taggings/$tagging_id", undef, $args);
64             }
65              
66             # https://qiita.com/api/v2/docs#get-apiv2tags
67             sub get_tags {
68 0     0 0 0 my ($self, $params, $args) = @_;
69 0         0 $self->get("tags", $params, $args);
70             }
71              
72             # https://qiita.com/api/v2/docs#get-apiv2tagstag_id
73             sub get_tag {
74 0     0 0 0 my ($self, $tag_id, $args) = @_;
75 0         0 $self->get("tags/$tag_id", undef, $args);
76             }
77              
78             # https://qiita.com/api/v2/docs#get-apiv2usersuser_idfollowing_tags
79             sub get_following_tags {
80 0     0 0 0 my ($self, $user_id, $params, $args) = @_;
81 0         0 $self->get("users/$user_id/following_tags", $params, $args);
82             }
83              
84             # https://qiita.com/api/v2/docs#delete-apiv2tagstag_idfollowing
85             sub unfollow_tag {
86 0     0 0 0 my ($self, $tag_id, $args) = @_;
87 0         0 $self->delete("tags/$tag_id/following", undef, $args);
88             }
89              
90             # https://qiita.com/api/v2/docs#get-apiv2tagstag_idfollowing
91             sub is_tag_following {
92 0     0 0 0 my ($self, $tag_id, $args) = @_;
93 0         0 my $code = $self->get_response_code("tags/$tag_id/following", undef, $args);
94 0 0       0 return $code == 204 ? 1 : 0;
95             }
96              
97             # https://qiita.com/api/v2/docs#put-apiv2tagstag_idfollowing
98             sub follow_tag {
99 0     0 0 0 my ($self, $tag_id, $args) = @_;
100 0         0 $self->put("tags/$tag_id/following", undef, $args);
101             }
102              
103             # https://qiita.com/api/v2/docs#get-apiv2teams
104             sub get_teams {
105 0     0 0 0 my ($self, $args) = @_;
106 0         0 $self->get("teams", undef, $args);
107             }
108              
109             # https://qiita.com/api/v2/docs#get-apiv2templates
110             sub get_templates {
111 0     0 0 0 my ($self, $params, $args) = @_;
112 0         0 $self->get("templates", $params, $args);
113             }
114              
115             # https://qiita.com/api/v2/docs#delete-apiv2templatestemplate_id
116             sub delete_template {
117 0     0 0 0 my ($self, $template_id, $args) = @_;
118 0         0 $self->delete("templates/$template_id", undef, $args);
119             }
120              
121             # https://qiita.com/api/v2/docs#get-apiv2templatestemplate_id
122             sub get_template {
123 0     0 0 0 my ($self, $template_id, $args) = @_;
124 0         0 $self->get("templates/$template_id", undef, $args);
125             }
126              
127             # https://qiita.com/api/v2/docs#post-apiv2templates
128             sub add_template {
129 0     0 0 0 my ($self, $params, $args) = @_;
130 0         0 $self->post("templates", $params, $args);
131             }
132              
133             # https://qiita.com/api/v2/docs#patch-apiv2templatestemplate_id
134             sub update_template {
135 0     0 0 0 my ($self, $template_id, $params, $args) = @_;
136 0         0 $self->patch("templates/$template_id", $params, $args);
137             }
138              
139             # https://qiita.com/api/v2/docs#get-apiv2projects
140             sub get_projects {
141 0     0 0 0 my ($self, $params, $args) = @_;
142 0         0 $self->get("projects", $params, $args);
143             }
144              
145             # https://qiita.com/api/v2/docs#post-apiv2projects
146             sub add_project {
147 0     0 0 0 my ($self, $params, $args) = @_;
148 0         0 $self->post("projects", $params, $args);
149             }
150              
151             # https://qiita.com/api/v2/docs#delete-apiv2projectsproject_id
152             sub delete_project {
153 0     0 0 0 my ($self, $project_id, $args) = @_;
154 0         0 $self->delete("projects/$project_id", undef, $args);
155             }
156              
157             # https://qiita.com/api/v2/docs#get-apiv2projectsproject_id
158             sub get_project {
159 0     0 0 0 my ($self, $project_id, $args) = @_;
160 0         0 $self->get("projects/$project_id", undef, $args);
161             }
162              
163             # https://qiita.com/api/v2/docs#patch-apiv2projectsproject_id
164             sub update_project {
165 0     0 0 0 my ($self, $project_id, $params, $args) = @_;
166 0         0 $self->patch("projects/$project_id", $params, $args);
167             }
168              
169             # https://qiita.com/api/v2/docs#get-apiv2itemsitem_idstockers
170             sub get_item_stockers {
171 0     0 0 0 my ($self, $item_id, $params, $args) = @_;
172 0         0 $self->get("items/$item_id/stockers", $params, $args);
173             }
174              
175             # https://qiita.com/api/v2/docs#get-apiv2users
176             sub get_users {
177 0     0 0 0 my ($self, $params, $args) = @_;
178 0         0 $self->get("users", $params, $args);
179             }
180              
181             # https://qiita.com/api/v2/docs#get-apiv2usersuser_id
182             sub get_user {
183 1     1 0 3 my ($self, $user_id, $args) = @_;
184 1         7 $self->get("users/$user_id", undef, $args);
185             }
186              
187             # https://qiita.com/api/v2/docs#get-apiv2usersuser_idfollowees
188             sub get_followees {
189 0     0 0 0 my ($self, $user_id, $params, $args) = @_;
190 0         0 $self->get("users/$user_id/followees", $params, $args);
191             }
192              
193             # https://qiita.com/api/v2/docs#get-apiv2usersuser_idfollowers
194             sub get_followers {
195 0     0 0 0 my ($self, $user_id, $params, $args) = @_;
196 0         0 $self->get("users/$user_id/followers", $params, $args);
197             }
198              
199             # https://qiita.com/api/v2/docs#delete-apiv2usersuser_idfollowing
200             sub unfollow_user {
201 0     0 0 0 my ($self, $user_id, $args) = @_;
202 0         0 $self->delete("users/$user_id/following", undef, $args);
203             }
204              
205             # https://qiita.com/api/v2/docs#get-apiv2usersuser_idfollowing
206             sub is_user_following {
207 0     0 0 0 my ($self, $user_id, $args) = @_;
208 0         0 my $code = $self->get_response_code("users/$user_id/following", undef, $args);
209 0 0       0 return $code == 204 ? 1 : 0;
210             }
211              
212             # https://qiita.com/api/v2/docs#put-apiv2usersuser_idfollowing
213             sub follow_user {
214 0     0 0 0 my ($self, $user_id, $args) = @_;
215 0         0 $self->put("users/$user_id/following", undef, $args);
216             }
217              
218             # https://qiita.com/api/v2/docs#post-apiv2expanded_templates
219             sub expanded_templates {
220 0     0 0 0 my ($self, $params, $args) = @_;
221 0         0 $self->post("expanded_templates", $params, $args);
222             }
223              
224             # https://qiita.com/api/v2/docs#get-apiv2authenticated_useritems
225             sub get_authenticated_user_items {
226 0     0 0 0 my ($self, $params, $args) = @_;
227 0         0 $self->get("authenticated_user/items", $params, $args);
228             }
229              
230             # https://qiita.com/api/v2/docs#get-apiv2items
231             sub get_items {
232 0     0 0 0 my ($self, $params, $args) = @_;
233 0         0 $self->get("items", $params, $args);
234             }
235              
236             # https://qiita.com/api/v2/docs#post-apiv2items
237             sub add_item {
238 0     0 0 0 my ($self, $params, $args) = @_;
239 0         0 $self->post("items", $params, $args);
240             }
241              
242             # https://qiita.com/api/v2/docs#delete-apiv2itemsitem_id
243             sub delete_item {
244 0     0 0 0 my ($self, $item_id, $args) = @_;
245 0         0 $self->delete("items/$item_id", undef, $args);
246             }
247              
248             # https://qiita.com/api/v2/docs#get-apiv2itemsitem_id
249             sub get_item {
250 0     0 0 0 my ($self, $item_id, $args) = @_;
251 0         0 $self->get("items/$item_id", undef, $args);
252             }
253              
254             # https://qiita.com/api/v2/docs#patch-apiv2itemsitem_id
255             sub update_item {
256 0     0 0 0 my ($self, $item_id, $params, $args) = @_;
257 0         0 $self->patch("items/$item_id", $params, $args);
258             }
259              
260             # https://qiita.com/api/v2/docs#put-apiv2itemsitem_idstock
261             sub stock {
262 0     0 0 0 my ($self, $item_id, $args) = @_;
263 0         0 $self->put("items/$item_id/stock", undef, $args);
264             }
265              
266             # https://qiita.com/api/v2/docs#delete-apiv2itemsitem_idstock
267             sub unstock {
268 0     0 0 0 my ($self, $item_id, $args) = @_;
269 0         0 $self->delete("items/$item_id/stock", undef, $args);
270             }
271             # https://qiita.com/api/v2/docs#get-apiv2itemsitem_idstock
272             sub is_stock {
273 0     0 0 0 my ($self, $item_id, $args) = @_;
274 0         0 my $code = $self->get_response_code("items/$item_id/stock", undef, $args);
275 0 0       0 return $code == 204 ? 1 : 0;
276             }
277              
278             # https://qiita.com/api/v2/docs#get-apiv2tagstag_iditems
279             sub get_tagged_items {
280 0     0 0 0 my ($self, $tag_id, $params, $args) = @_;
281 0         0 $self->get("tags/$tag_id/items", $params, $args);
282             }
283              
284             # https://qiita.com/api/v2/docs#get-apiv2usersuser_iditems
285             sub get_user_items {
286 0     0 0 0 my ($self, $user_id, $params, $args) = @_;
287 0         0 $self->get("users/$user_id/items", $params, $args);
288             }
289              
290             # https://qiita.com/api/v2/docs#get-apiv2usersuser_idstocks
291             sub get_user_stocks {
292 0     0 0 0 my ($self, $user_id, $params, $args) = @_;
293 0         0 $self->get("users/$user_id/stocks", $params, $args);
294             }
295              
296             # https://qiita.com/api/v2/docs#post-apiv2commentscomment_idreactions
297             sub add_reaction_to_comment {
298 0     0 0 0 my ($self, $comment_id, $params, $args) = @_;
299 0         0 $self->post("comments/$comment_id/reactions", $params, $args);
300             }
301              
302             # https://qiita.com/api/v2/docs#post-apiv2itemsitem_idreactions
303             sub add_reaction_to_item {
304 0     0 0 0 my ($self, $item_id, $params, $args) = @_;
305 0         0 $self->post("items/$item_id/reactions", $params, $args);
306             }
307              
308             # https://qiita.com/api/v2/docs#post-apiv2projectsproject_idreactions
309             sub add_reaction_to_project {
310 0     0 0 0 my ($self, $project_id, $params, $args) = @_;
311 0         0 $self->post("projects/$project_id/reactions", $params, $args);
312             }
313              
314             # https://qiita.com/api/v2/docs#delete-apiv2commentscomment_idreactionsreaction_name
315             sub remove_reaction_from_comment {
316 0     0 0 0 my ($self, $comment_id, $reaction_name, $args) = @_;
317 0         0 $self->delete("comments/$comment_id/reactions/$reaction_name", undef, $args);
318             }
319              
320             # https://qiita.com/api/v2/docs#delete-apiv2itemsitem_idreactionsreaction_name
321             sub remove_reaction_from_item {
322 0     0 0 0 my ($self, $item_id, $reaction_name, $args) = @_;
323 0         0 $self->delete("items/$item_id/reactions/$reaction_name", undef, $args);
324             }
325              
326             # https://qiita.com/api/v2/docs#delete-apiv2projectsproject_idreactionsreaction_name
327             sub remove_reaction_from_project {
328 0     0 0 0 my ($self, $project_id, $reaction_name, $args) = @_;
329 0         0 $self->delete("projects/$project_id/reactions/$reaction_name", undef, $args);
330             }
331              
332             # https://qiita.com/api/v2/docs#get-apiv2commentscomment_idreactions
333             sub get_reactions_of_comment {
334 0     0 0 0 my ($self, $comment_id, $args) = @_;
335 0         0 $self->get("comments/$comment_id/reactions", undef, $args);
336             }
337              
338             # https://qiita.com/api/v2/docs#get-apiv2itemsitem_idreactions
339             sub get_reactions_of_item {
340 0     0 0 0 my ($self, $item_id, $args) = @_;
341 0         0 $self->get("items/$item_id/reactions", undef, $args);
342             }
343              
344             # https://qiita.com/api/v2/docs#get-apiv2projectsproject_idreactions
345             sub get_reactions_of_project {
346 0     0 0 0 my ($self, $project_id, $args) = @_;
347 0         0 $self->get("projects/$project_id/reactions", undef, $args);
348             }
349              
350             # https://qiita.com/api/v2/docs#get-apiv2authenticated_user
351             sub get_authenticated_user {
352 3     3 0 7 my ($self, $args) = @_;
353 3         15 $self->get("authenticated_user", undef, $args);
354             }
355              
356             1;