AnyEvent-SparkBot
view release on metacpan or search on metacpan
-- AnyEvent::SparkBot $self->run_lookup is now just a shortcut, it is no longer a wrapper, but works just fine.
-- t/AnyEvent-SparkBot.t no longer tries to get to the internet without $ENV{RUN_HTTP_TESTS} being true
1.009
-- Changed min version of Data::Dumper to 2.161
1.010
-- Changed min version of Carp to 1.38
1.011
-- Removed old vendor doc links
-- Added missing meetings api and pod
1.012
-- Added uploadFile interface
1.013
-- Fixed the readme file
1.014
-- Added retry for 404 ( these are super common )
-- fixed missing method retryTimeout, now has a default value of 1 second
1.015
-- Changed the default api url from: https://api.ciscospark.com/v1/ To: https://webexapis.com/v1/
1.016
-- added Accept http header by default
-- removed ? from get when no get arguments are included
lib/AnyEvent/HTTP/Spark.pm view on Meta::CPAN
=back
=head1 Attaching files to messages
Posting files to channel steps outside of the traditional json data format.
=over 4
=item * Blocking my $result=$self->uploadFile('/path/to/file',%args);
Returns a L<Data::Result> Object, when true it contains the data, when false it contains why it failed.
=item * Non-Blocking my $result=$self->que_uploadFile($cb,'/path/to/file',%args);
Example Callback
$cb=sub {
my ($self,$id,$result,$request,$response,$roomId,$hashRef)=@_;
# 0: $self The current AnyEvent::HTTP::Slack object
# 1: $id the id of the http request
# 2: Data::Result Object
# 3: HTTP::Request Object
# 4: HTTP::Result Object
};
=back
=cut
sub que_uploadFile {
my ($self,$cb,$file,%args)=@_;
my $post=[
%args,
files=>[$file],
];
my $url=$self->api_url.'messages';
my $request=POST($url,Content_type=>'form-data',Content=>$post);
$request->header(Authorization=>"Bearer ".$self->token);
( run in 1.262 second using v1.01-cache-2.11-cpan-b16cb0d3907 )