JMAP-Tester

 view release on metacpan or  search on metacpan

lib/JMAP/Tester.pm  view on Meta::CPAN

  },
);

#pod =method upload
#pod
#pod   my $result = $tester->upload(\%arg);
#pod
#pod Required arguments are:
#pod
#pod   accountId - the account for which we're uploading (no default)
#pod   type      - the content-type we want to provide to the server
#pod   blob      - the data to upload. Must be a reference to a string
#pod
#pod This uploads the given blob.
#pod
#pod The return value will either be a L<failure
#pod object|JMAP::Tester::Result::Failure> or an L<upload
#pod result|JMAP::Tester::Result::Upload>.
#pod
#pod This method respects the C<should_return_futures> attributes of the
#pod JMAP::Tester object, and in futures mode will return a future that will resolve

lib/JMAP/Tester.pm  view on Meta::CPAN

}

#pod =method download
#pod
#pod   my $result = $tester->download(\%uri_arg, \%other_arg);
#pod
#pod The first hashref provides values that go into the download URI:
#pod
#pod   blobId    - the blob to download (no default)
#pod   accountId - the account for which we're downloading (no default)
#pod   type      - the content-type we want the server to provide back (no default)
#pod   name      - the name we want the server to provide back (default: "download")
#pod
#pod If the download URI template has a C<blobId>, C<accountId>, or C<type>
#pod placeholder but no argument for that is given to C<download>, an exception
#pod will be thrown.
#pod
#pod The second hashref, which is optional, provides other arguments to the method.
#pod Right now, there is only one, B<which will go away>.  The argument is only here
#pod for legacy purposes, specifically for the Cyrus IMAP project, and may be
#pod removed B<at any time>.

lib/JMAP/Tester.pm  view on Meta::CPAN

JMAP::Tester object, and in futures mode will return a future that will resolve
to the Result.

=head2 upload

  my $result = $tester->upload(\%arg);

Required arguments are:

  accountId - the account for which we're uploading (no default)
  type      - the content-type we want to provide to the server
  blob      - the data to upload. Must be a reference to a string

This uploads the given blob.

The return value will either be a L<failure
object|JMAP::Tester::Result::Failure> or an L<upload
result|JMAP::Tester::Result::Upload>.

This method respects the C<should_return_futures> attributes of the
JMAP::Tester object, and in futures mode will return a future that will resolve
to the Result.

=head2 download

  my $result = $tester->download(\%uri_arg, \%other_arg);

The first hashref provides values that go into the download URI:

  blobId    - the blob to download (no default)
  accountId - the account for which we're downloading (no default)
  type      - the content-type we want the server to provide back (no default)
  name      - the name we want the server to provide back (default: "download")

If the download URI template has a C<blobId>, C<accountId>, or C<type>
placeholder but no argument for that is given to C<download>, an exception
will be thrown.

The second hashref, which is optional, provides other arguments to the method.
Right now, there is only one, B<which will go away>.  The argument is only here
for legacy purposes, specifically for the Cyrus IMAP project, and may be
removed B<at any time>.

lib/JMAP/Tester/Manual.pm  view on Meta::CPAN

#pod
#pod Testing blobs might require that you perform JMAP upload or download requests.
#pod For these, the C<< L<JMAP::Tester/upload> >> and C<< L<JMAP::Tester/download>
#pod >> methods exist.
#pod
#pod C<upload> takes as its argument a hashref of upload properties and on success
#pod returns an L<Upload|JMAP::Tester::Result::Upload> object.  The argument hashref
#pod must contain:
#pod
#pod   accountId - the account for which we're uploading (no default)
#pod   type      - the content-type we want to provide to the server
#pod   blob      - the data to upload. Must be a reference to a string
#pod
#pod C<download> takes as its argument a hashref of download properties and on
#pod success returns a L<Download|JMAP::Tester::Result::Download> object.  The
#pod argument hashref must contain:
#pod
#pod   blobId    - the blob to download (no default)
#pod   accountId - the account for which we're downloading (no default)
#pod   type      - the content-type we want the server to provide back (no default)
#pod   name      - the name we want the server to provide back (default: "download")
#pod
#pod =head2 Other HTTP requests
#pod
#pod Sometimes, you may need to make a custom HTTP request with the same underlying
#pod user agent as your tester uses.  This might be to interact with a custom
#pod authentication mechanism, to access custom endpoints, or just to make very,
#pod very specifically crafted requests.  For this reason, C<http_request> exists.
#pod It's an async method that takes an L<HTTP::Request> object as its argument and
#pod returns an L<HTTP::Response>.  Remember when you make this call that the

lib/JMAP/Tester/Manual.pm  view on Meta::CPAN


Testing blobs might require that you perform JMAP upload or download requests.
For these, the C<< L<JMAP::Tester/upload> >> and C<< L<JMAP::Tester/download>
>> methods exist.

C<upload> takes as its argument a hashref of upload properties and on success
returns an L<Upload|JMAP::Tester::Result::Upload> object.  The argument hashref
must contain:

  accountId - the account for which we're uploading (no default)
  type      - the content-type we want to provide to the server
  blob      - the data to upload. Must be a reference to a string

C<download> takes as its argument a hashref of download properties and on
success returns a L<Download|JMAP::Tester::Result::Download> object.  The
argument hashref must contain:

  blobId    - the blob to download (no default)
  accountId - the account for which we're downloading (no default)
  type      - the content-type we want the server to provide back (no default)
  name      - the name we want the server to provide back (default: "download")

=head2 Other HTTP requests

Sometimes, you may need to make a custom HTTP request with the same underlying
user agent as your tester uses.  This might be to interact with a custom
authentication mechanism, to access custom endpoints, or just to make very,
very specifically crafted requests.  For this reason, C<http_request> exists.
It's an async method that takes an L<HTTP::Request> object as its argument and
returns an L<HTTP::Response>.  Remember when you make this call that the



( run in 3.438 seconds using v1.01-cache-2.11-cpan-800906f7e73 )