Backblaze-B2

 view release on metacpan or  search on metacpan

lib/Backblaze/B2/v1/AnyEvent.pm  view on Meta::CPAN

    $res->promise
}

=head2 C<< ->json_request >>

    my $res = $b2->json_request(...)->then(sub {
        my( $ok, $message, @stuff ) = @_;
    });

Helper routine that expects a JSON formatted response
and returns the decoded JSON structure.

=cut

sub json_request {
    my( $self, %options ) = @_;
    $self->request(
        %options
    )->then(sub {
        
        my( $body, $headers ) = @_;
        
        my $d = deferred;
        my @decoded = $self->decode_json_response($body, $headers);
        my $result = $d->promise;
        $d->resolve( @decoded );
        
        $result
    });
}

sub authorize_account {
    my( $self, %options ) = @_;
    $options{ accountId }
        or croak "Need an accountId";
    $options{ applicationKey }



( run in 0.567 second using v1.01-cache-2.11-cpan-a9ef4e587e4 )