File: UploadMedia.pm

package info (click to toggle)
libnet-twitter-perl 4.01043-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 840 kB
  • sloc: perl: 6,703; makefile: 13
file content (64 lines) | stat: -rw-r--r-- 1,628 bytes parent folder | download | duplicates (2)
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
package Net::Twitter::Role::API::UploadMedia;
$Net::Twitter::Role::API::UploadMedia::VERSION = '4.01043';
use Moose::Role;
use Net::Twitter::API;
use DateTime::Format::Strptime;
use URI;

has upload_url => isa => 'Str', is => 'ro', default => 'http://upload.twitter.com/1.1';

after BUILD => sub {
    my $self = shift;

    $self->{upload_url} =~ s/^http:/https:/ if $self->ssl;
};

base_url     'upload_url';
authenticate 1;

twitter_api_method upload => (
    path        => 'media/upload',
    method      => 'POST',
    params      => [qw/media/],
    required    => [qw/media/],
    booleans    => [qw/possibly_sensitive display_coordinates/],
    returns     => 'HashRef',
    description => <<'',
Uploads an image to twitter without immediately posting it to the
authenticating user's timeline. Its return-value hashref notably contains a
C<media_id> value that's useful as a parameter value in various other
endpoint calls, such as C<update> and C<create_media_metadata>.

);

twitter_api_method upload_status => (
    path        => 'media/upload',
    method      => 'GET',
    params      => [qw/media_id command/],
    required    => [qw/media_id command/],
    booleans    => [qw//],
    returns     => 'status',
    description => 'Check the status for async video uploads.'
);

1;

__END__

=head1 NAME

Net::Twitter::Role::API::UploadImage - A definition of the Twitter Upload API as a Moose role

=head1 VERSION

version 4.01043

=head1 SYNOPSIS

  package My::Twitter;
  use Moose;
  with 'Net::Twitter::API::UploadImage';

=head1 DESCRIPTION

This module provides definitions the Twitter Upload API methods.