Skip to content

Commit eaf322b

Browse files
committed
rolling in pause dist
1 parent e3d4277 commit eaf322b

File tree

5 files changed

+46
-3
lines changed

5 files changed

+46
-3
lines changed

Changes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,5 @@
3636
1.011
3737
-- Removed old vendor doc links
3838
-- Added missing meetings api and pod
39+
1.012
40+
-- Added uploadFile interface

META.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,6 @@
6363
}
6464
},
6565
"release_status" : "stable",
66-
"version" : "1.011",
66+
"version" : "1.012",
6767
"x_serialization_backend" : "JSON::PP version 4.04"
6868
}

META.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,5 @@ requires:
4545
UUID::Tiny: '1.04'
4646
namespace::clean: '0.27'
4747
overload: '1.28'
48-
version: '1.011'
48+
version: '1.012'
4949
x_serialization_backend: 'CPAN::Meta::YAML version 0.018'

lib/AnyEvent/HTTP/Spark.pm

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1385,6 +1385,47 @@ Example Callback
13851385
13861386
=back
13871387
1388+
=head1 Attaching files to messages
1389+
1390+
Posting files to channel steps outside of the traditional json data format.
1391+
1392+
=over 4
1393+
1394+
=item * Blocking my $result=$self->uploadFile('/path/to/file',%args);
1395+
1396+
Returns a L<Data::Result> Object, when true it contains the data, when false it contains why it failed.
1397+
1398+
=item * Non-Blocking my $result=$self->que_uploadFile($cb,'/path/to/file',%args);
1399+
1400+
Example Callback
1401+
1402+
$cb=sub {
1403+
my ($self,$id,$result,$request,$response,$roomId,$hashRef)=@_;
1404+
# 0: $self The current AnyEvent::HTTP::Slack object
1405+
# 1: $id the id of the http request
1406+
# 2: Data::Result Object
1407+
# 3: HTTP::Request Object
1408+
# 4: HTTP::Result Object
1409+
};
1410+
1411+
=back
1412+
1413+
=cut
1414+
1415+
sub que_uploadFile {
1416+
my ($self,$cb,$file,%args)=@_;
1417+
1418+
my $post=[
1419+
%args,
1420+
files=>[$file],
1421+
];
1422+
1423+
my $url=$self->api_url.'messages';
1424+
my $request=POST($url,Content_type=>'form-data',Content=>$post);
1425+
$request->header(Authorization=>"Bearer ".$self->token);
1426+
return $self->queue_request($request,$cb);
1427+
}
1428+
13881429
=head1 Low Level Request functions
13891430
13901431
This section documents low level request functions.

lib/AnyEvent/SparkBot.pm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package AnyEvent::SparkBot;
22

3-
our $VERSION='1.011';
3+
our $VERSION='1.012';
44
use Modern::Perl;
55
use Moo;
66
use MooX::Types::MooseLike::Base qw(:all);

0 commit comments

Comments
 (0)