line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#This software is Copyright (c) 2017-2018 by faraco. |
2
|
|
|
|
|
|
|
# |
3
|
|
|
|
|
|
|
#This is free software, licensed under: |
4
|
|
|
|
|
|
|
# |
5
|
|
|
|
|
|
|
# The MIT (X11) License |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
package WebService::Pixabay; |
8
|
|
|
|
|
|
|
$WebService::Pixabay::VERSION = '2.2.3'; |
9
|
|
|
|
|
|
|
# ABSTRACT: Perl 5 interface to Pixabay API. |
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
15811
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
23
|
|
12
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
19
|
|
13
|
|
|
|
|
|
|
|
14
|
1
|
|
|
1
|
|
4
|
use Moo; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
15
|
1
|
|
|
1
|
|
222
|
use Function::Parameters; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
10
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
with 'WebService::Client'; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# api_key |
20
|
|
|
|
|
|
|
has api_key => ( |
21
|
|
|
|
|
|
|
is => 'ro', |
22
|
|
|
|
|
|
|
required => 1 |
23
|
|
|
|
|
|
|
); |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
has '+base_url' => ( default => 'https://pixabay.com/api/' ); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
method image_search( |
28
|
|
|
|
|
|
|
: $q = "yellow flower", |
29
|
|
|
|
|
|
|
: $lang = "en", |
30
|
|
|
|
|
|
|
: $id = "", |
31
|
|
|
|
|
|
|
: $response_group = "image_details", |
32
|
|
|
|
|
|
|
: $image_type = "all", |
33
|
|
|
|
|
|
|
: $orientation = "all", |
34
|
|
|
|
|
|
|
: $category = "", |
35
|
|
|
|
|
|
|
: $min_width = 0, |
36
|
|
|
|
|
|
|
: $min_height = 0, |
37
|
|
|
|
|
|
|
: $editors_choice = "false", |
38
|
|
|
|
|
|
|
: $safesearch = "false", |
39
|
|
|
|
|
|
|
: $order = "popular", |
40
|
|
|
|
|
|
|
: $page = 1, |
41
|
|
|
|
|
|
|
: $per_page = 20, |
42
|
|
|
|
|
|
|
: $callback = "", |
43
|
|
|
|
|
|
|
: $pretty = "false" |
44
|
|
|
|
|
|
|
) |
45
|
0
|
0
|
0
|
0
|
1
|
|
{ |
|
0
|
0
|
|
|
|
|
|
|
0
|
0
|
|
|
|
|
|
|
0
|
0
|
|
|
|
|
|
|
0
|
0
|
|
|
|
|
|
|
0
|
0
|
|
|
|
|
|
|
0
|
0
|
|
|
|
|
|
|
0
|
0
|
|
|
|
|
|
|
0
|
0
|
|
|
|
|
|
|
0
|
0
|
|
|
|
|
|
|
0
|
0
|
|
|
|
|
|
|
0
|
0
|
|
|
|
|
|
|
0
|
0
|
|
|
|
|
|
|
0
|
0
|
|
|
|
|
|
|
0
|
0
|
|
|
|
|
|
|
0
|
0
|
|
|
|
|
|
|
0
|
0
|
|
|
|
|
|
|
0
|
0
|
|
|
|
|
|
|
0
|
0
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
46
|
0
|
|
|
|
|
|
return $self->get( "?key=" |
47
|
|
|
|
|
|
|
. $self->api_key |
48
|
|
|
|
|
|
|
. "&q=$q&lang=$lang&id=$id&response_group=$response_group&image_type=$image_type" |
49
|
|
|
|
|
|
|
. "&orientation=$orientation&category=$category&min_width=$min_width&mind_height=$min_height" |
50
|
|
|
|
|
|
|
. "&editors_choice=$editors_choice&safesearch=$safesearch&order=$order&page=$page" |
51
|
|
|
|
|
|
|
. "&per_page=$per_page&callback=$callback&pretty=$pretty" ); |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
method video_search( |
55
|
|
|
|
|
|
|
: $q = "yellow flower", |
56
|
|
|
|
|
|
|
: $lang = "en", |
57
|
|
|
|
|
|
|
: $id = "", |
58
|
|
|
|
|
|
|
: $video_type = "all", |
59
|
|
|
|
|
|
|
: $category = "", |
60
|
|
|
|
|
|
|
: $min_width = 0, |
61
|
|
|
|
|
|
|
: $min_height = 0, |
62
|
|
|
|
|
|
|
: $editors_choice = "false", |
63
|
|
|
|
|
|
|
: $safesearch = "false", |
64
|
|
|
|
|
|
|
: $order = "popular", |
65
|
|
|
|
|
|
|
: $page = 1, |
66
|
|
|
|
|
|
|
: $per_page = 20, |
67
|
|
|
|
|
|
|
: $callback = "", |
68
|
|
|
|
|
|
|
: $pretty = "false" |
69
|
|
|
|
|
|
|
) |
70
|
0
|
0
|
0
|
0
|
1
|
|
{ |
|
0
|
0
|
|
|
|
|
|
|
0
|
0
|
|
|
|
|
|
|
0
|
0
|
|
|
|
|
|
|
0
|
0
|
|
|
|
|
|
|
0
|
0
|
|
|
|
|
|
|
0
|
0
|
|
|
|
|
|
|
0
|
0
|
|
|
|
|
|
|
0
|
0
|
|
|
|
|
|
|
0
|
0
|
|
|
|
|
|
|
0
|
0
|
|
|
|
|
|
|
0
|
0
|
|
|
|
|
|
|
0
|
0
|
|
|
|
|
|
|
0
|
0
|
|
|
|
|
|
|
0
|
0
|
|
|
|
|
|
|
0
|
0
|
|
|
|
|
|
|
0
|
0
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
71
|
0
|
|
|
|
|
|
return $self->get( "videos/?key=" |
72
|
|
|
|
|
|
|
. $self->api_key |
73
|
|
|
|
|
|
|
. "&q=$q&lang=$lang&id=$id&video_type=$video_type" |
74
|
|
|
|
|
|
|
. "&category=$category&min_width=$min_width&mind_height=$min_height" |
75
|
|
|
|
|
|
|
. "&editors_choice=$editors_choice&safesearch=$safesearch&order=$order&page=$page" |
76
|
|
|
|
|
|
|
. "&per_page=$per_page&callback=$callback&pretty=$pretty" ); |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
1; |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
__END__ |