summary refs log tree commit diff
path: root/lib/Net/Backtype.pm
blob: 4f1896d5f94f6dc1c7c52ee7eee5b2e8881a8f76 (plain) (blame)
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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
package Net::Backtype;

# ABSTRACT: client for the backtype API

use Net::HTTP::API;

our $VERSION = '0.03';

net_api_declare backtype => (
    base_url    => 'http://api.backtype.com',
    format      => 'json',
    format_mode => 'append',
);

net_api_method comments_search => (
    description => 'Search all the comments on BackType for a given string.',
    path        => '/comments/search',
    method      => 'GET',
    params      => [qw/key q start end/],
    required    => [qw/key q/],
    expected    => [qw/200/],
);

net_api_method comments_connect => (
    description => 'Retrieve all conversations related to a given URL.',
    path        => '/comments/connects',
    method      => 'GET',
    params      => [qw/key url sources sort/],
    required    => [qw/url key/],
    expected    => [qw/200/],
);

net_api_method comments_connect_stats => (
    description =>
      'Retrieve statistics on the conversations related to a given URL.',
    path     => '/comments/connect/stats/',
    method   => 'GET',
    params   => [qw/key url/],
    required => [qw/url key/],
    expected => [qw/200/],
);

net_api_method comments_author => (
    description => 'Retrieve comments written by a particular author.',
    path        => '/url/:url/comments',
    method      => 'GET',
    params      => [qw/key url/],
    required    => [qw/key url/],
    expected    => [qw/200/],
);

net_api_method comments_page => (
    description =>
      'Retrieve excerpts of comments published on a particular page.',
    path     => '/post/comments',
    method   => 'GET',
    params   => [qw/url key/],
    required => [qw/key url/],
    expected => [qw/200/],
);

net_api_method comments_page_stats => (
    description =>
      'Retrieve statistics for the comments published on a particular page.',
    path     => '/post/stats',
    method   => 'GET',
    params   => [qw/url key/],
    required => [qw/key url/],
    expected => [qw/200/],
);

1;

=head1 SYNOPSIS

  use Net::Backtype;
  my $client = Net::Backtype->new();
  my $res = $client->comments_page(url => 'http://...', key => $mykey);

=head1 DESCRIPTION

Net::Backtype is a client for the backtype API

=head2 METHODS

=over 4

=item B<comments_search>

Search all the comments on BackType for a given string.

    my $res = $client->comments_page(key => 's3kr3t', q => 'lumberjaph' );

=over 2

=item B<q> query (required)

=item B<key> API key (required)

=item B<start> date start (optional)

=item B<end> date end (optional)

=back

See L<http://www.backtype.com/developers/comments-search>.

=item B<comments_connect>

Retrieve all conversations related to a given URL.

    my $res = $client->comments_connect(key => 's3kr3t', url => 'lumberjaph');

=over 2

=item B<url> url (required)

=item B<key> API key (required)

=item B<sources> (optional)

=item B<sort> (optional)

=back

See L<http://www.backtype.com/developers/comments-connect>.

=item B<comments_connect_stats>

Retrieve statistics on the conversations related to a given URL.

    my $res = $client->comments_connect_stats(url => 'lumberjaph', key => 's3kr3t');

=over 2

=item B<url> url (required)

=item B<key> API key (required)

=back

See L<http://www.backtype.com/developers/comments-connect-stats>.

=item B<comments_author>

Retrieve comments written by a particular author.

    my $res = $client->comments_author(url => 'lumberjaph', key => 's3kr3t');

=over 2

=item B<url> url (required)

=item B<key> API key (required)

=back

See L<http://www.backtype.com/developers/url-comments>.

=item B<comments_page>

Retrieve excerpts of comments published on a particular page.

    my $res = $client->comments_page_stats(url => 'lumberjaph', key => 's3kr3t');

=over 2

=item B<url> url (required)

=item B<key> API key (required)

=back

See L<http://www.backtype.com/developers/page-comments>.

=item B<comments_page_stats>

Retrieve statistics for the comments published on a particular page.

See L<http://www.backtype.com/developers/page-comments-stats>

=back