File Coverage

blib/lib/WebService/Qiita/V2/Client/Methods.pm
Criterion Covered Total %
statement 9 9 100.0
branch n/a
condition n/a
subroutine 3 3 100.0
pod n/a
total 12 12 100.0


line stmt bran cond sub pod time code
1             package WebService::Qiita::V2::Client::Methods;
2 4     4   24 use strict;
  4         8  
  4         101  
3 4     4   18 use warnings;
  4         9  
  4         107  
4 4     4   1181 use parent 'WebService::Qiita::V2::Client::Base';
  4         1074  
  4         19  
5              
6             # https://qiita.com/api/v2/docs#get-apiv2oauthauthorize
7             sub authorize {
8             my ($self, $params, $args) = @_;
9             $self->get("oauth/authorize", $params, $args);
10             }
11              
12             # https://qiita.com/api/v2/docs#post-apiv2access_tokens
13             sub create_access_token {
14             my ($self, $params, $args) = @_;
15             $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             my ($self, $token, $args) = @_;
21             $self->delete("access_tokens/$token", undef, $args);
22             }
23              
24             # https://qiita.com/api/v2/docs#delete-apiv2commentscomment_id
25             sub delete_comment {
26             my ($self, $comment_id, $args) = @_;
27             $self->delete("comments/$comment_id", undef, $args);
28             }
29              
30             # https://qiita.com/api/v2/docs#get-apiv2commentscomment_id
31             sub get_comment {
32             my ($self, $comment_id, $args) = @_;
33             $self->get("comments/$comment_id", undef, $args);
34             }
35              
36             # https://qiita.com/api/v2/docs#patch-apiv2commentscomment_id
37             sub update_comment {
38             my ($self, $comment_id, $comment, $args) = @_;
39             $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             my ($self, $item_id, $args) = @_;
45             $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             my ($self, $item_id, $comment, $args) = @_;
51             $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             my ($self, $item_id, $params, $args) = @_;
57             $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             my ($self, $item_id, $tagging_id, $args) = @_;
63             $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             my ($self, $params, $args) = @_;
69             $self->get("tags", $params, $args);
70             }
71              
72             # https://qiita.com/api/v2/docs#get-apiv2tagstag_id
73             sub get_tag {
74             my ($self, $tag_id, $args) = @_;
75             $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             my ($self, $user_id, $params, $args) = @_;
81             $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             my ($self, $tag_id, $args) = @_;
87             $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             my ($self, $tag_id, $args) = @_;
93             my $code = $self->get_response_code("tags/$tag_id/following", undef, $args);
94             return $code == 204 ? 1 : 0;
95             }
96              
97             # https://qiita.com/api/v2/docs#put-apiv2tagstag_idfollowing
98             sub follow_tag {
99             my ($self, $tag_id, $args) = @_;
100             $self->put("tags/$tag_id/following", undef, $args);
101             }
102              
103             # https://qiita.com/api/v2/docs#get-apiv2teams
104             sub get_teams {
105             my ($self, $args) = @_;
106             $self->get("teams", undef, $args);
107             }
108              
109             # https://qiita.com/api/v2/docs#get-apiv2templates
110             sub get_templates {
111             my ($self, $params, $args) = @_;
112             $self->get("templates", $params, $args);
113             }
114              
115             # https://qiita.com/api/v2/docs#delete-apiv2templatestemplate_id
116             sub delete_template {
117             my ($self, $template_id, $args) = @_;
118             $self->delete("templates/$template_id", undef, $args);
119             }
120              
121             # https://qiita.com/api/v2/docs#get-apiv2templatestemplate_id
122             sub get_template {
123             my ($self, $template_id, $args) = @_;
124             $self->get("templates/$template_id", undef, $args);
125             }
126              
127             # https://qiita.com/api/v2/docs#post-apiv2templates
128             sub add_template {
129             my ($self, $params, $args) = @_;
130             $self->post("templates", $params, $args);
131             }
132              
133             # https://qiita.com/api/v2/docs#patch-apiv2templatestemplate_id
134             sub update_template {
135             my ($self, $template_id, $params, $args) = @_;
136             $self->patch("templates/$template_id", $params, $args);
137             }
138              
139             # https://qiita.com/api/v2/docs#get-apiv2projects
140             sub get_projects {
141             my ($self, $params, $args) = @_;
142             $self->get("projects", $params, $args);
143             }
144              
145             # https://qiita.com/api/v2/docs#post-apiv2projects
146             sub add_project {
147             my ($self, $params, $args) = @_;
148             $self->post("projects", $params, $args);
149             }
150              
151             # https://qiita.com/api/v2/docs#delete-apiv2projectsproject_id
152             sub delete_project {
153             my ($self, $project_id, $args) = @_;
154             $self->delete("projects/$project_id", undef, $args);
155             }
156              
157             # https://qiita.com/api/v2/docs#get-apiv2projectsproject_id
158             sub get_project {
159             my ($self, $project_id, $args) = @_;
160             $self->get("projects/$project_id", undef, $args);
161             }
162              
163             # https://qiita.com/api/v2/docs#patch-apiv2projectsproject_id
164             sub update_project {
165             my ($self, $project_id, $params, $args) = @_;
166             $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             my ($self, $item_id, $params, $args) = @_;
172             $self->get("items/$item_id/stockers", $params, $args);
173             }
174              
175             # https://qiita.com/api/v2/docs#get-apiv2users
176             sub get_users {
177             my ($self, $params, $args) = @_;
178             $self->get("users", $params, $args);
179             }
180              
181             # https://qiita.com/api/v2/docs#get-apiv2usersuser_id
182             sub get_user {
183             my ($self, $user_id, $args) = @_;
184             $self->get("users/$user_id", undef, $args);
185             }
186              
187             # https://qiita.com/api/v2/docs#get-apiv2usersuser_idfollowees
188             sub get_followees {
189             my ($self, $user_id, $params, $args) = @_;
190             $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             my ($self, $user_id, $params, $args) = @_;
196             $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             my ($self, $user_id, $args) = @_;
202             $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             my ($self, $user_id, $args) = @_;
208             my $code = $self->get_response_code("users/$user_id/following", undef, $args);
209             return $code == 204 ? 1 : 0;
210             }
211              
212             # https://qiita.com/api/v2/docs#put-apiv2usersuser_idfollowing
213             sub follow_user {
214             my ($self, $user_id, $args) = @_;
215             $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             my ($self, $params, $args) = @_;
221             $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             my ($self, $params, $args) = @_;
227             $self->get("authenticated_user/items", $params, $args);
228             }
229              
230             # https://qiita.com/api/v2/docs#get-apiv2items
231             sub get_items {
232             my ($self, $params, $args) = @_;
233             $self->get("items", $params, $args);
234             }
235              
236             # https://qiita.com/api/v2/docs#post-apiv2items
237             sub add_item {
238             my ($self, $params, $args) = @_;
239             $self->post("items", $params, $args);
240             }
241              
242             # https://qiita.com/api/v2/docs#delete-apiv2itemsitem_id
243             sub delete_item {
244             my ($self, $item_id, $args) = @_;
245             $self->delete("items/$item_id", undef, $args);
246             }
247              
248             # https://qiita.com/api/v2/docs#get-apiv2itemsitem_id
249             sub get_item {
250             my ($self, $item_id, $args) = @_;
251             $self->get("items/$item_id", undef, $args);
252             }
253              
254             # https://qiita.com/api/v2/docs#patch-apiv2itemsitem_id
255             sub update_item {
256             my ($self, $item_id, $params, $args) = @_;
257             $self->patch("items/$item_id", $params, $args);
258             }
259              
260             # https://qiita.com/api/v2/docs#put-apiv2itemsitem_idstock
261             sub stock {
262             my ($self, $item_id, $args) = @_;
263             $self->put("items/$item_id/stock", undef, $args);
264             }
265              
266             # https://qiita.com/api/v2/docs#delete-apiv2itemsitem_idstock
267             sub unstock {
268             my ($self, $item_id, $args) = @_;
269             $self->delete("items/$item_id/stock", undef, $args);
270             }
271             # https://qiita.com/api/v2/docs#get-apiv2itemsitem_idstock
272             sub is_stock {
273             my ($self, $item_id, $args) = @_;
274             my $code = $self->get_response_code("items/$item_id/stock", undef, $args);
275             return $code == 204 ? 1 : 0;
276             }
277              
278             # https://qiita.com/api/v2/docs#get-apiv2tagstag_iditems
279             sub get_tagged_items {
280             my ($self, $tag_id, $params, $args) = @_;
281             $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             my ($self, $user_id, $params, $args) = @_;
287             $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             my ($self, $user_id, $params, $args) = @_;
293             $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             my ($self, $comment_id, $params, $args) = @_;
299             $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             my ($self, $item_id, $params, $args) = @_;
305             $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             my ($self, $project_id, $params, $args) = @_;
311             $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             my ($self, $comment_id, $reaction_name, $args) = @_;
317             $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             my ($self, $item_id, $reaction_name, $args) = @_;
323             $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             my ($self, $project_id, $reaction_name, $args) = @_;
329             $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             my ($self, $comment_id, $args) = @_;
335             $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             my ($self, $item_id, $args) = @_;
341             $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             my ($self, $project_id, $args) = @_;
347             $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             my ($self, $args) = @_;
353             $self->get("authenticated_user", undef, $args);
354             }
355              
356             1;